diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d76a3e43..0837041f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,12 +7,17 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
+ pull_request:
+ branches-ignore:
+ - 'stl-preview-head/**'
+ - 'stl-preview-base/**'
jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/orb-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
@@ -35,6 +40,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/orb-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index fea34540..2601677b 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "1.0.0"
+ ".": "1.1.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 645b4c0b..090c0e18 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 116
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c2a4808c828c8288c5c8dfe2fdfa51d4d7c1bcc33cacc6b859d0cf4b35ce95cc.yml
-openapi_spec_hash: a2b5a1bfabbd03dd1b411791576eb502
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ff68c7ee2669d61716781d01b93f34186fb7a19ff4ad6fc2c0b8f9f4d9c4a588.yml
+openapi_spec_hash: 17bdc6b1ca2531dc884c6d156f404f0c
config_hash: 3c3524be9607afb24d2139ce26ce5389
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e83af691..be3cbd1c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,37 @@
# Changelog
+## 1.1.0 (2025-07-02)
+
+Full Changelog: [v1.0.0...v1.1.0](https://github.com/orbcorp/orb-java/compare/v1.0.0...v1.1.0)
+
+### Features
+
+* **api:** api update ([91c85d4](https://github.com/orbcorp/orb-java/commit/91c85d496a9d4e2f7597a52f193df49012bfe53b))
+* **api:** api update ([e58761c](https://github.com/orbcorp/orb-java/commit/e58761cd2e36bfa66ec1f17d05428acf2299653a))
+* **api:** api update ([83c2707](https://github.com/orbcorp/orb-java/commit/83c2707bc9dd85f14df2c31e2837fd6c43e3349e))
+* **api:** api update ([614dfad](https://github.com/orbcorp/orb-java/commit/614dfad8313393787778319ff46860ad2c548aa5))
+* **client:** add a `withOptions` method ([744d7a6](https://github.com/orbcorp/orb-java/commit/744d7a67931d92a891bea1ff58140de71fca9eb8))
+* **client:** implement per-endpoint base URL support ([6172f77](https://github.com/orbcorp/orb-java/commit/6172f770b4a6ccbb41f5748aee9164f8071036d7))
+
+
+### Bug Fixes
+
+* **ci:** release-doctor — report correct token name ([d631afb](https://github.com/orbcorp/orb-java/commit/d631afbee08819fa5febba75d799ebbbc688f0b9))
+* **client:** bump max requests per host to max requests (5 -> 64) ([5576ea4](https://github.com/orbcorp/orb-java/commit/5576ea4d94771c0003e8f13d503cbef46a7c8221))
+* **client:** don't close client on `withOptions` usage when original is gc'd ([002c10d](https://github.com/orbcorp/orb-java/commit/002c10dd581d1e95da9431baf6c157c878db04d8))
+
+
+### Chores
+
+* **ci:** enable for pull requests ([ecdbbd4](https://github.com/orbcorp/orb-java/commit/ecdbbd4212a2bcb27d7ec96013d3a6487751372c))
+* **ci:** only run for pushes and fork pull requests ([cbc078a](https://github.com/orbcorp/orb-java/commit/cbc078ac5bf69fbfa3c6f165441f58cb4d493c93))
+* fix formatting ([fe0ad84](https://github.com/orbcorp/orb-java/commit/fe0ad84fdeb583979218fddfc2e17d7aeab19421))
+
+
+### Refactors
+
+* **internal:** minor `ClientOptionsTest` change ([d7614c8](https://github.com/orbcorp/orb-java/commit/d7614c8bb5048cfb430094f7ae3cc877a0627aad))
+
## 1.0.0 (2025-06-09)
Full Changelog: [v0.57.0...v1.0.0](https://github.com/orbcorp/orb-java/compare/v0.57.0...v1.0.0)
diff --git a/README.md b/README.md
index b61134f3..f484e895 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/1.0.0)
+[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/1.1.0)
@@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho
### Gradle
```kotlin
-implementation("com.withorb.api:orb-java:1.0.0")
+implementation("com.withorb.api:orb-java:1.1.0")
```
### Maven
@@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:1.0.0")
com.withorb.api
orb-java
- 1.0.0
+ 1.1.0
```
@@ -104,6 +104,21 @@ See this table for the available options:
> Don't create more than one client in the same application. Each client has a connection pool and
> thread pools, which are more efficient to share between requests.
+### Modifying configuration
+
+To temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:
+
+```java
+import com.withorb.api.client.OrbClient;
+
+OrbClient clientWithOptions = client.withOptions(optionsBuilder -> {
+ optionsBuilder.baseUrl("https://example.com");
+ optionsBuilder.maxRetries(42);
+});
+```
+
+The `withOptions()` method does not affect the original client or service.
+
## Requests and responses
To send a request to the Orb API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.
diff --git a/bin/check-release-environment b/bin/check-release-environment
index ef2c1d07..3a6a7b4a 100644
--- a/bin/check-release-environment
+++ b/bin/check-release-environment
@@ -3,19 +3,19 @@
errors=()
if [ -z "${SONATYPE_USERNAME}" ]; then
- errors+=("The ORB_SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+ errors+=("The SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
if [ -z "${SONATYPE_PASSWORD}" ]; then
- errors+=("The ORB_SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+ errors+=("The SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
if [ -z "${GPG_SIGNING_KEY}" ]; then
- errors+=("The ORB_SONATYPE_GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+ errors+=("The GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
if [ -z "${GPG_SIGNING_PASSWORD}" ]; then
- errors+=("The ORB_SONATYPE_GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets")
+ errors+=("The GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
lenErrors=${#errors[@]}
diff --git a/build.gradle.kts b/build.gradle.kts
index 93c2171a..e29e10bb 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,4 @@
allprojects {
group = "com.withorb.api"
- version = "1.0.0" // x-release-please-version
+ version = "1.1.0" // x-release-please-version
}
diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
index 655da4e8..90820ecd 100644
--- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
+++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
@@ -2,7 +2,6 @@ package com.withorb.api.client.okhttp
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.Timeout
-import com.withorb.api.core.checkRequired
import com.withorb.api.core.http.Headers
import com.withorb.api.core.http.HttpClient
import com.withorb.api.core.http.HttpMethod
@@ -17,7 +16,6 @@ import java.time.Duration
import java.util.concurrent.CompletableFuture
import okhttp3.Call
import okhttp3.Callback
-import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaType
@@ -28,8 +26,7 @@ import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import okio.BufferedSink
-class OkHttpClient
-private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) :
+class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient) :
HttpClient {
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
@@ -140,11 +137,7 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
}
private fun HttpRequest.toUrl(): String {
- url?.let {
- return it
- }
-
- val builder = baseUrl.newBuilder()
+ val builder = baseUrl.toHttpUrl().newBuilder()
pathSegments.forEach(builder::addPathSegment)
queryParams.keys().forEach { key ->
queryParams.values(key).forEach { builder.addQueryParameter(key, it) }
@@ -194,12 +187,9 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
class Builder internal constructor() {
- private var baseUrl: HttpUrl? = null
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
- fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl.toHttpUrl() }
-
fun timeout(timeout: Timeout) = apply { this.timeout = timeout }
fun timeout(timeout: Duration) = timeout(Timeout.builder().request(timeout).build())
@@ -214,8 +204,12 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
.writeTimeout(timeout.write())
.callTimeout(timeout.request())
.proxy(proxy)
- .build(),
- checkRequired("baseUrl", baseUrl),
+ .build()
+ .apply {
+ // We usually make all our requests to the same host so it makes sense to
+ // raise the per-host limit to the overall limit.
+ dispatcher.maxRequestsPerHost = dispatcher.maxRequests
+ }
)
}
}
diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
index df13e8b1..f09de14d 100644
--- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
+++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
@@ -176,13 +176,7 @@ class OrbOkHttpClient private constructor() {
fun build(): OrbClient =
OrbClientImpl(
clientOptions
- .httpClient(
- OkHttpClient.builder()
- .baseUrl(clientOptions.baseUrl())
- .timeout(timeout)
- .proxy(proxy)
- .build()
- )
+ .httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
.build()
)
}
diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
index b0396fb6..eb68056e 100644
--- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
+++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
@@ -176,13 +176,7 @@ class OrbOkHttpClientAsync private constructor() {
fun build(): OrbClientAsync =
OrbClientAsyncImpl(
clientOptions
- .httpClient(
- OkHttpClient.builder()
- .baseUrl(clientOptions.baseUrl())
- .timeout(timeout)
- .proxy(proxy)
- .build()
- )
+ .httpClient(OkHttpClient.builder().timeout(timeout).proxy(proxy).build())
.build()
)
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt
index a2a23ae8..4bdf622a 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt
@@ -2,6 +2,7 @@
package com.withorb.api.client
+import com.withorb.api.core.ClientOptions
import com.withorb.api.services.blocking.AlertService
import com.withorb.api.services.blocking.BetaService
import com.withorb.api.services.blocking.CouponService
@@ -19,6 +20,7 @@ import com.withorb.api.services.blocking.SubscriptionChangeService
import com.withorb.api.services.blocking.SubscriptionService
import com.withorb.api.services.blocking.TopLevelService
import com.withorb.api.services.blocking.WebhookService
+import java.util.function.Consumer
/**
* A client for interacting with the Orb REST API synchronously. You can also switch to asynchronous
@@ -49,6 +51,13 @@ interface OrbClient {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): OrbClient
+
fun topLevel(): TopLevelService
fun beta(): BetaService
@@ -99,6 +108,13 @@ interface OrbClient {
/** A view of [OrbClient] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): OrbClient.WithRawResponse
+
fun topLevel(): TopLevelService.WithRawResponse
fun beta(): BetaService.WithRawResponse
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt
index 258fd0f2..b904eb55 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt
@@ -2,6 +2,7 @@
package com.withorb.api.client
+import com.withorb.api.core.ClientOptions
import com.withorb.api.services.async.AlertServiceAsync
import com.withorb.api.services.async.BetaServiceAsync
import com.withorb.api.services.async.CouponServiceAsync
@@ -18,6 +19,7 @@ import com.withorb.api.services.async.PriceServiceAsync
import com.withorb.api.services.async.SubscriptionChangeServiceAsync
import com.withorb.api.services.async.SubscriptionServiceAsync
import com.withorb.api.services.async.TopLevelServiceAsync
+import java.util.function.Consumer
/**
* A client for interacting with the Orb REST API asynchronously. You can also switch to synchronous
@@ -48,6 +50,13 @@ interface OrbClientAsync {
*/
fun withRawResponse(): WithRawResponse
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): OrbClientAsync
+
fun topLevel(): TopLevelServiceAsync
fun beta(): BetaServiceAsync
@@ -96,6 +105,13 @@ interface OrbClientAsync {
/** A view of [OrbClientAsync] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): OrbClientAsync.WithRawResponse
+
fun topLevel(): TopLevelServiceAsync.WithRawResponse
fun beta(): BetaServiceAsync.WithRawResponse
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
index e5e096d9..fa0e22b0 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
@@ -36,6 +36,7 @@ import com.withorb.api.services.async.SubscriptionServiceAsync
import com.withorb.api.services.async.SubscriptionServiceAsyncImpl
import com.withorb.api.services.async.TopLevelServiceAsync
import com.withorb.api.services.async.TopLevelServiceAsyncImpl
+import java.util.function.Consumer
class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAsync {
@@ -116,6 +117,9 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
override fun withRawResponse(): OrbClientAsync.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): OrbClientAsync =
+ OrbClientAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun topLevel(): TopLevelServiceAsync = topLevel
override fun beta(): BetaServiceAsync = beta
@@ -219,6 +223,13 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
SubscriptionChangeServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ override fun withOptions(
+ modifier: Consumer
+ ): OrbClientAsync.WithRawResponse =
+ OrbClientAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
override fun topLevel(): TopLevelServiceAsync.WithRawResponse = topLevel
override fun beta(): BetaServiceAsync.WithRawResponse = beta
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
index c29770c2..e3671e40 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
@@ -38,6 +38,7 @@ import com.withorb.api.services.blocking.TopLevelService
import com.withorb.api.services.blocking.TopLevelServiceImpl
import com.withorb.api.services.blocking.WebhookService
import com.withorb.api.services.blocking.WebhookServiceImpl
+import java.util.function.Consumer
class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
@@ -108,6 +109,9 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
override fun withRawResponse(): OrbClient.WithRawResponse = withRawResponse
+ override fun withOptions(modifier: Consumer): OrbClient =
+ OrbClientImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
override fun topLevel(): TopLevelService = topLevel
override fun beta(): BetaService = beta
@@ -211,6 +215,13 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
SubscriptionChangeServiceImpl.WithRawResponseImpl(clientOptions)
}
+ override fun withOptions(
+ modifier: Consumer
+ ): OrbClient.WithRawResponse =
+ OrbClientImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
override fun topLevel(): TopLevelService.WithRawResponse = topLevel
override fun beta(): BetaService.WithRawResponse = beta
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
index f1898f51..5710deff 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
@@ -24,7 +24,7 @@ private constructor(
@get:JvmName("jsonMapper") val jsonMapper: JsonMapper,
@get:JvmName("streamHandlerExecutor") val streamHandlerExecutor: Executor,
@get:JvmName("clock") val clock: Clock,
- @get:JvmName("baseUrl") val baseUrl: String,
+ private val baseUrl: String?,
@get:JvmName("headers") val headers: Headers,
@get:JvmName("queryParams") val queryParams: QueryParams,
@get:JvmName("responseValidation") val responseValidation: Boolean,
@@ -40,6 +40,8 @@ private constructor(
}
}
+ fun baseUrl(): String = baseUrl ?: PRODUCTION_URL
+
fun webhookSecret(): Optional = Optional.ofNullable(webhookSecret)
fun toBuilder() = Builder().from(this)
@@ -70,7 +72,7 @@ private constructor(
private var jsonMapper: JsonMapper = jsonMapper()
private var streamHandlerExecutor: Executor? = null
private var clock: Clock = Clock.systemUTC()
- private var baseUrl: String = PRODUCTION_URL
+ private var baseUrl: String? = null
private var headers: Headers.Builder = Headers.builder()
private var queryParams: QueryParams.Builder = QueryParams.builder()
private var responseValidation: Boolean = false
@@ -96,7 +98,9 @@ private constructor(
webhookSecret = clientOptions.webhookSecret
}
- fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
+ fun httpClient(httpClient: HttpClient) = apply {
+ this.httpClient = PhantomReachableClosingHttpClient(httpClient)
+ }
fun checkJacksonVersionCompatibility(checkJacksonVersionCompatibility: Boolean) = apply {
this.checkJacksonVersionCompatibility = checkJacksonVersionCompatibility
@@ -110,7 +114,10 @@ private constructor(
fun clock(clock: Clock) = apply { this.clock = clock }
- fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl }
+ fun baseUrl(baseUrl: String?) = apply { this.baseUrl = baseUrl }
+
+ /** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
+ fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull())
fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
@@ -208,8 +215,6 @@ private constructor(
fun removeAllQueryParams(keys: Set) = apply { queryParams.removeAll(keys) }
- fun baseUrl(): String = baseUrl
-
fun fromEnv() = apply {
System.getenv("ORB_BASE_URL")?.let { baseUrl(it) }
System.getenv("ORB_API_KEY")?.let { apiKey(it) }
@@ -252,14 +257,12 @@ private constructor(
return ClientOptions(
httpClient,
- PhantomReachableClosingHttpClient(
- RetryingHttpClient.builder()
- .httpClient(httpClient)
- .clock(clock)
- .maxRetries(maxRetries)
- .idempotencyHeader("Idempotency-Key")
- .build()
- ),
+ RetryingHttpClient.builder()
+ .httpClient(httpClient)
+ .clock(clock)
+ .maxRetries(maxRetries)
+ .idempotencyHeader("Idempotency-Key")
+ .build(),
checkJacksonVersionCompatibility,
jsonMapper,
streamHandlerExecutor
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt
index a5a3aaab..406a35d7 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/HttpRequest.kt
@@ -6,7 +6,7 @@ import com.withorb.api.core.toImmutable
class HttpRequest
private constructor(
@get:JvmName("method") val method: HttpMethod,
- @get:JvmName("url") val url: String?,
+ @get:JvmName("baseUrl") val baseUrl: String,
@get:JvmName("pathSegments") val pathSegments: List,
@get:JvmName("headers") val headers: Headers,
@get:JvmName("queryParams") val queryParams: QueryParams,
@@ -16,7 +16,7 @@ private constructor(
fun toBuilder(): Builder = Builder().from(this)
override fun toString(): String =
- "HttpRequest{method=$method, url=$url, pathSegments=$pathSegments, headers=$headers, queryParams=$queryParams, body=$body}"
+ "HttpRequest{method=$method, baseUrl=$baseUrl, pathSegments=$pathSegments, headers=$headers, queryParams=$queryParams, body=$body}"
companion object {
@JvmStatic fun builder() = Builder()
@@ -25,7 +25,7 @@ private constructor(
class Builder internal constructor() {
private var method: HttpMethod? = null
- private var url: String? = null
+ private var baseUrl: String? = null
private var pathSegments: MutableList = mutableListOf()
private var headers: Headers.Builder = Headers.builder()
private var queryParams: QueryParams.Builder = QueryParams.builder()
@@ -34,7 +34,7 @@ private constructor(
@JvmSynthetic
internal fun from(request: HttpRequest) = apply {
method = request.method
- url = request.url
+ baseUrl = request.baseUrl
pathSegments = request.pathSegments.toMutableList()
headers = request.headers.toBuilder()
queryParams = request.queryParams.toBuilder()
@@ -43,7 +43,7 @@ private constructor(
fun method(method: HttpMethod) = apply { this.method = method }
- fun url(url: String) = apply { this.url = url }
+ fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl }
fun addPathSegment(pathSegment: String) = apply { pathSegments.add(pathSegment) }
@@ -136,7 +136,7 @@ private constructor(
fun build(): HttpRequest =
HttpRequest(
checkRequired("method", method),
- url,
+ checkRequired("baseUrl", baseUrl),
pathSegments.toImmutable(),
headers.build(),
queryParams.build(),
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
index 2bf2a5ed..a5860df1 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
@@ -232,6 +232,17 @@ private constructor(
fun body(expirationChange: Body.ExpirationChange) =
body(Body.ofExpirationChange(expirationChange))
+ /**
+ * Alias for calling [body] with the following:
+ * ```java
+ * Body.ExpirationChange.builder()
+ * .targetExpiryDate(targetExpiryDate)
+ * .build()
+ * ```
+ */
+ fun expirationChangeBody(targetExpiryDate: LocalDate) =
+ body(Body.ExpirationChange.builder().targetExpiryDate(targetExpiryDate).build())
+
/** Alias for calling [body] with `Body.ofVoid(void_)`. */
fun body(void_: Body.Void) = body(Body.ofVoid(void_))
@@ -2069,12 +2080,12 @@ private constructor(
class ExpirationChange
private constructor(
private val entryType: JsonValue,
- private val expiryDate: JsonField,
private val targetExpiryDate: JsonField,
private val amount: JsonField,
private val blockId: JsonField,
private val currency: JsonField,
private val description: JsonField,
+ private val expiryDate: JsonField,
private val metadata: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -2082,9 +2093,6 @@ private constructor(
@JsonCreator
private constructor(
@JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(),
- @JsonProperty("expiry_date")
- @ExcludeMissing
- expiryDate: JsonField = JsonMissing.of(),
@JsonProperty("target_expiry_date")
@ExcludeMissing
targetExpiryDate: JsonField = JsonMissing.of(),
@@ -2100,17 +2108,20 @@ private constructor(
@JsonProperty("description")
@ExcludeMissing
description: JsonField = JsonMissing.of(),
+ @JsonProperty("expiry_date")
+ @ExcludeMissing
+ expiryDate: JsonField = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField = JsonMissing.of(),
) : this(
entryType,
- expiryDate,
targetExpiryDate,
amount,
blockId,
currency,
description,
+ expiryDate,
metadata,
mutableMapOf(),
)
@@ -2126,14 +2137,6 @@ private constructor(
*/
@JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType
- /**
- * An ISO 8601 format date that identifies the origination credit block to expire
- *
- * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun expiryDate(): Optional = expiryDate.getOptional("expiry_date")
-
/**
* A future date (specified in YYYY-MM-DD format) used for expiration change, denoting
* when credits transferred (as part of a partial block expiration) should expire.
@@ -2182,24 +2185,22 @@ private constructor(
fun description(): Optional = description.getOptional("description")
/**
- * User-specified key/value pairs for the resource. Individual keys can be removed by
- * setting the value to `null`, and the entire metadata mapping can be cleared by
- * setting `metadata` to `null`.
+ * An ISO 8601 format date that identifies the origination credit block to expire
*
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
- fun metadata(): Optional = metadata.getOptional("metadata")
+ fun expiryDate(): Optional = expiryDate.getOptional("expiry_date")
/**
- * Returns the raw JSON value of [expiryDate].
+ * User-specified key/value pairs for the resource. Individual keys can be removed by
+ * setting the value to `null`, and the entire metadata mapping can be cleared by
+ * setting `metadata` to `null`.
*
- * Unlike [expiryDate], this method doesn't throw if the JSON field has an unexpected
- * type.
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
*/
- @JsonProperty("expiry_date")
- @ExcludeMissing
- fun _expiryDate(): JsonField = expiryDate
+ fun metadata(): Optional = metadata.getOptional("metadata")
/**
* Returns the raw JSON value of [targetExpiryDate].
@@ -2243,6 +2244,16 @@ private constructor(
@ExcludeMissing
fun _description(): JsonField = description
+ /**
+ * Returns the raw JSON value of [expiryDate].
+ *
+ * Unlike [expiryDate], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("expiry_date")
+ @ExcludeMissing
+ fun _expiryDate(): JsonField = expiryDate
+
/**
* Returns the raw JSON value of [metadata].
*
@@ -2272,7 +2283,6 @@ private constructor(
*
* The following fields are required:
* ```java
- * .expiryDate()
* .targetExpiryDate()
* ```
*/
@@ -2283,24 +2293,24 @@ private constructor(
class Builder internal constructor() {
private var entryType: JsonValue = JsonValue.from("expiration_change")
- private var expiryDate: JsonField? = null
private var targetExpiryDate: JsonField? = null
private var amount: JsonField = JsonMissing.of()
private var blockId: JsonField = JsonMissing.of()
private var currency: JsonField = JsonMissing.of()
private var description: JsonField = JsonMissing.of()
+ private var expiryDate: JsonField = JsonMissing.of()
private var metadata: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(expirationChange: ExpirationChange) = apply {
entryType = expirationChange.entryType
- expiryDate = expirationChange.expiryDate
targetExpiryDate = expirationChange.targetExpiryDate
amount = expirationChange.amount
blockId = expirationChange.blockId
currency = expirationChange.currency
description = expirationChange.description
+ expiryDate = expirationChange.expiryDate
metadata = expirationChange.metadata
additionalProperties = expirationChange.additionalProperties.toMutableMap()
}
@@ -2319,27 +2329,6 @@ private constructor(
*/
fun entryType(entryType: JsonValue) = apply { this.entryType = entryType }
- /**
- * An ISO 8601 format date that identifies the origination credit block to expire
- */
- fun expiryDate(expiryDate: OffsetDateTime?) =
- expiryDate(JsonField.ofNullable(expiryDate))
-
- /** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */
- fun expiryDate(expiryDate: Optional) =
- expiryDate(expiryDate.getOrNull())
-
- /**
- * Sets [Builder.expiryDate] to an arbitrary JSON value.
- *
- * You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime]
- * value instead. This method is primarily for setting the field to an undocumented
- * or not yet supported value.
- */
- fun expiryDate(expiryDate: JsonField) = apply {
- this.expiryDate = expiryDate
- }
-
/**
* A future date (specified in YYYY-MM-DD format) used for expiration change,
* denoting when credits transferred (as part of a partial block expiration) should
@@ -2443,6 +2432,27 @@ private constructor(
this.description = description
}
+ /**
+ * An ISO 8601 format date that identifies the origination credit block to expire
+ */
+ fun expiryDate(expiryDate: OffsetDateTime?) =
+ expiryDate(JsonField.ofNullable(expiryDate))
+
+ /** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */
+ fun expiryDate(expiryDate: Optional) =
+ expiryDate(expiryDate.getOrNull())
+
+ /**
+ * Sets [Builder.expiryDate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun expiryDate(expiryDate: JsonField) = apply {
+ this.expiryDate = expiryDate
+ }
+
/**
* User-specified key/value pairs for the resource. Individual keys can be removed
* by setting the value to `null`, and the entire metadata mapping can be cleared by
@@ -2491,7 +2501,6 @@ private constructor(
*
* The following fields are required:
* ```java
- * .expiryDate()
* .targetExpiryDate()
* ```
*
@@ -2500,12 +2509,12 @@ private constructor(
fun build(): ExpirationChange =
ExpirationChange(
entryType,
- checkRequired("expiryDate", expiryDate),
checkRequired("targetExpiryDate", targetExpiryDate),
amount,
blockId,
currency,
description,
+ expiryDate,
metadata,
additionalProperties.toMutableMap(),
)
@@ -2523,12 +2532,12 @@ private constructor(
throw OrbInvalidDataException("'entryType' is invalid, received $it")
}
}
- expiryDate()
targetExpiryDate()
amount()
blockId()
currency()
description()
+ expiryDate()
metadata().ifPresent { it.validate() }
validated = true
}
@@ -2550,12 +2559,12 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } +
- (if (expiryDate.asKnown().isPresent) 1 else 0) +
(if (targetExpiryDate.asKnown().isPresent) 1 else 0) +
(if (amount.asKnown().isPresent) 1 else 0) +
(if (blockId.asKnown().isPresent) 1 else 0) +
(if (currency.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0)
/**
@@ -2674,17 +2683,17 @@ private constructor(
return true
}
- return /* spotless:off */ other is ExpirationChange && entryType == other.entryType && expiryDate == other.expiryDate && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is ExpirationChange && entryType == other.entryType && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && expiryDate == other.expiryDate && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(entryType, expiryDate, targetExpiryDate, amount, blockId, currency, description, metadata, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(entryType, targetExpiryDate, amount, blockId, currency, description, expiryDate, metadata, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "ExpirationChange{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}"
+ "ExpirationChange{entryType=$entryType, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, expiryDate=$expiryDate, metadata=$metadata, additionalProperties=$additionalProperties}"
}
class Void
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt
index 876dcb8b..8f64f8fb 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt
@@ -224,6 +224,17 @@ private constructor(
fun body(expirationChange: Body.ExpirationChange) =
body(Body.ofExpirationChange(expirationChange))
+ /**
+ * Alias for calling [body] with the following:
+ * ```java
+ * Body.ExpirationChange.builder()
+ * .targetExpiryDate(targetExpiryDate)
+ * .build()
+ * ```
+ */
+ fun expirationChangeBody(targetExpiryDate: LocalDate) =
+ body(Body.ExpirationChange.builder().targetExpiryDate(targetExpiryDate).build())
+
/** Alias for calling [body] with `Body.ofVoid(void_)`. */
fun body(void_: Body.Void) = body(Body.ofVoid(void_))
@@ -2061,12 +2072,12 @@ private constructor(
class ExpirationChange
private constructor(
private val entryType: JsonValue,
- private val expiryDate: JsonField,
private val targetExpiryDate: JsonField,
private val amount: JsonField,
private val blockId: JsonField,
private val currency: JsonField,
private val description: JsonField,
+ private val expiryDate: JsonField,
private val metadata: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -2074,9 +2085,6 @@ private constructor(
@JsonCreator
private constructor(
@JsonProperty("entry_type") @ExcludeMissing entryType: JsonValue = JsonMissing.of(),
- @JsonProperty("expiry_date")
- @ExcludeMissing
- expiryDate: JsonField = JsonMissing.of(),
@JsonProperty("target_expiry_date")
@ExcludeMissing
targetExpiryDate: JsonField = JsonMissing.of(),
@@ -2092,17 +2100,20 @@ private constructor(
@JsonProperty("description")
@ExcludeMissing
description: JsonField = JsonMissing.of(),
+ @JsonProperty("expiry_date")
+ @ExcludeMissing
+ expiryDate: JsonField = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField = JsonMissing.of(),
) : this(
entryType,
- expiryDate,
targetExpiryDate,
amount,
blockId,
currency,
description,
+ expiryDate,
metadata,
mutableMapOf(),
)
@@ -2118,14 +2129,6 @@ private constructor(
*/
@JsonProperty("entry_type") @ExcludeMissing fun _entryType(): JsonValue = entryType
- /**
- * An ISO 8601 format date that identifies the origination credit block to expire
- *
- * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun expiryDate(): Optional = expiryDate.getOptional("expiry_date")
-
/**
* A future date (specified in YYYY-MM-DD format) used for expiration change, denoting
* when credits transferred (as part of a partial block expiration) should expire.
@@ -2174,24 +2177,22 @@ private constructor(
fun description(): Optional = description.getOptional("description")
/**
- * User-specified key/value pairs for the resource. Individual keys can be removed by
- * setting the value to `null`, and the entire metadata mapping can be cleared by
- * setting `metadata` to `null`.
+ * An ISO 8601 format date that identifies the origination credit block to expire
*
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
- fun metadata(): Optional = metadata.getOptional("metadata")
+ fun expiryDate(): Optional = expiryDate.getOptional("expiry_date")
/**
- * Returns the raw JSON value of [expiryDate].
+ * User-specified key/value pairs for the resource. Individual keys can be removed by
+ * setting the value to `null`, and the entire metadata mapping can be cleared by
+ * setting `metadata` to `null`.
*
- * Unlike [expiryDate], this method doesn't throw if the JSON field has an unexpected
- * type.
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
*/
- @JsonProperty("expiry_date")
- @ExcludeMissing
- fun _expiryDate(): JsonField = expiryDate
+ fun metadata(): Optional = metadata.getOptional("metadata")
/**
* Returns the raw JSON value of [targetExpiryDate].
@@ -2235,6 +2236,16 @@ private constructor(
@ExcludeMissing
fun _description(): JsonField = description
+ /**
+ * Returns the raw JSON value of [expiryDate].
+ *
+ * Unlike [expiryDate], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("expiry_date")
+ @ExcludeMissing
+ fun _expiryDate(): JsonField = expiryDate
+
/**
* Returns the raw JSON value of [metadata].
*
@@ -2264,7 +2275,6 @@ private constructor(
*
* The following fields are required:
* ```java
- * .expiryDate()
* .targetExpiryDate()
* ```
*/
@@ -2275,24 +2285,24 @@ private constructor(
class Builder internal constructor() {
private var entryType: JsonValue = JsonValue.from("expiration_change")
- private var expiryDate: JsonField? = null
private var targetExpiryDate: JsonField? = null
private var amount: JsonField = JsonMissing.of()
private var blockId: JsonField = JsonMissing.of()
private var currency: JsonField = JsonMissing.of()
private var description: JsonField = JsonMissing.of()
+ private var expiryDate: JsonField = JsonMissing.of()
private var metadata: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(expirationChange: ExpirationChange) = apply {
entryType = expirationChange.entryType
- expiryDate = expirationChange.expiryDate
targetExpiryDate = expirationChange.targetExpiryDate
amount = expirationChange.amount
blockId = expirationChange.blockId
currency = expirationChange.currency
description = expirationChange.description
+ expiryDate = expirationChange.expiryDate
metadata = expirationChange.metadata
additionalProperties = expirationChange.additionalProperties.toMutableMap()
}
@@ -2311,27 +2321,6 @@ private constructor(
*/
fun entryType(entryType: JsonValue) = apply { this.entryType = entryType }
- /**
- * An ISO 8601 format date that identifies the origination credit block to expire
- */
- fun expiryDate(expiryDate: OffsetDateTime?) =
- expiryDate(JsonField.ofNullable(expiryDate))
-
- /** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */
- fun expiryDate(expiryDate: Optional) =
- expiryDate(expiryDate.getOrNull())
-
- /**
- * Sets [Builder.expiryDate] to an arbitrary JSON value.
- *
- * You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime]
- * value instead. This method is primarily for setting the field to an undocumented
- * or not yet supported value.
- */
- fun expiryDate(expiryDate: JsonField) = apply {
- this.expiryDate = expiryDate
- }
-
/**
* A future date (specified in YYYY-MM-DD format) used for expiration change,
* denoting when credits transferred (as part of a partial block expiration) should
@@ -2435,6 +2424,27 @@ private constructor(
this.description = description
}
+ /**
+ * An ISO 8601 format date that identifies the origination credit block to expire
+ */
+ fun expiryDate(expiryDate: OffsetDateTime?) =
+ expiryDate(JsonField.ofNullable(expiryDate))
+
+ /** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */
+ fun expiryDate(expiryDate: Optional) =
+ expiryDate(expiryDate.getOrNull())
+
+ /**
+ * Sets [Builder.expiryDate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun expiryDate(expiryDate: JsonField) = apply {
+ this.expiryDate = expiryDate
+ }
+
/**
* User-specified key/value pairs for the resource. Individual keys can be removed
* by setting the value to `null`, and the entire metadata mapping can be cleared by
@@ -2483,7 +2493,6 @@ private constructor(
*
* The following fields are required:
* ```java
- * .expiryDate()
* .targetExpiryDate()
* ```
*
@@ -2492,12 +2501,12 @@ private constructor(
fun build(): ExpirationChange =
ExpirationChange(
entryType,
- checkRequired("expiryDate", expiryDate),
checkRequired("targetExpiryDate", targetExpiryDate),
amount,
blockId,
currency,
description,
+ expiryDate,
metadata,
additionalProperties.toMutableMap(),
)
@@ -2515,12 +2524,12 @@ private constructor(
throw OrbInvalidDataException("'entryType' is invalid, received $it")
}
}
- expiryDate()
targetExpiryDate()
amount()
blockId()
currency()
description()
+ expiryDate()
metadata().ifPresent { it.validate() }
validated = true
}
@@ -2542,12 +2551,12 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
entryType.let { if (it == JsonValue.from("expiration_change")) 1 else 0 } +
- (if (expiryDate.asKnown().isPresent) 1 else 0) +
(if (targetExpiryDate.asKnown().isPresent) 1 else 0) +
(if (amount.asKnown().isPresent) 1 else 0) +
(if (blockId.asKnown().isPresent) 1 else 0) +
(if (currency.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
+ (if (expiryDate.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0)
/**
@@ -2666,17 +2675,17 @@ private constructor(
return true
}
- return /* spotless:off */ other is ExpirationChange && entryType == other.entryType && expiryDate == other.expiryDate && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is ExpirationChange && entryType == other.entryType && targetExpiryDate == other.targetExpiryDate && amount == other.amount && blockId == other.blockId && currency == other.currency && description == other.description && expiryDate == other.expiryDate && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(entryType, expiryDate, targetExpiryDate, amount, blockId, currency, description, metadata, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(entryType, targetExpiryDate, amount, blockId, currency, description, expiryDate, metadata, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "ExpirationChange{entryType=$entryType, expiryDate=$expiryDate, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, metadata=$metadata, additionalProperties=$additionalProperties}"
+ "ExpirationChange{entryType=$entryType, targetExpiryDate=$targetExpiryDate, amount=$amount, blockId=$blockId, currency=$currency, description=$description, expiryDate=$expiryDate, metadata=$metadata, additionalProperties=$additionalProperties}"
}
class Void
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt
index 34c8fbe9..7ccfc99d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Invoice.kt
@@ -4085,9 +4085,12 @@ private constructor(
fun creditsApplied(): String = creditsApplied.getRequired("credits_applied")
/**
+ * This field is deprecated in favor of `adjustments`
+ *
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
+ @Deprecated("deprecated")
fun discount(): Optional = discount.getOptional("discount")
/**
@@ -4283,7 +4286,10 @@ private constructor(
*
* Unlike [discount], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("discount") @ExcludeMissing fun _discount(): JsonField = discount
+ @Deprecated("deprecated")
+ @JsonProperty("discount")
+ @ExcludeMissing
+ fun _discount(): JsonField = discount
/**
* Returns the raw JSON value of [endDate].
@@ -4643,9 +4649,12 @@ private constructor(
this.creditsApplied = creditsApplied
}
+ /** This field is deprecated in favor of `adjustments` */
+ @Deprecated("deprecated")
fun discount(discount: Discount?) = discount(JsonField.ofNullable(discount))
/** Alias for calling [Builder.discount] with `discount.orElse(null)`. */
+ @Deprecated("deprecated")
fun discount(discount: Optional) = discount(discount.getOrNull())
/**
@@ -4655,9 +4664,11 @@ private constructor(
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
+ @Deprecated("deprecated")
fun discount(discount: JsonField) = apply { this.discount = discount }
/** Alias for calling [discount] with `Discount.ofPercentage(percentage)`. */
+ @Deprecated("deprecated")
fun discount(percentage: PercentageDiscount) =
discount(Discount.ofPercentage(percentage))
@@ -4670,6 +4681,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun percentageDiscount(percentageDiscount: Double) =
discount(
PercentageDiscount.builder()
@@ -4679,9 +4691,11 @@ private constructor(
)
/** Alias for calling [discount] with `Discount.ofTrial(trial)`. */
+ @Deprecated("deprecated")
fun discount(trial: TrialDiscount) = discount(Discount.ofTrial(trial))
/** Alias for calling [discount] with `Discount.ofUsage(usage)`. */
+ @Deprecated("deprecated")
fun discount(usage: UsageDiscount) = discount(Discount.ofUsage(usage))
/**
@@ -4693,6 +4707,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun usageDiscount(usageDiscount: Double) =
discount(
UsageDiscount.builder()
@@ -4702,6 +4717,7 @@ private constructor(
)
/** Alias for calling [discount] with `Discount.ofAmount(amount)`. */
+ @Deprecated("deprecated")
fun discount(amount: AmountDiscount) = discount(Discount.ofAmount(amount))
/**
@@ -4713,6 +4729,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun amountDiscount(amountDiscount: String) =
discount(
AmountDiscount.builder()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt
index f7214836..7c33d0ac 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceFetchUpcomingResponse.kt
@@ -4079,9 +4079,12 @@ private constructor(
fun creditsApplied(): String = creditsApplied.getRequired("credits_applied")
/**
+ * This field is deprecated in favor of `adjustments`
+ *
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
+ @Deprecated("deprecated")
fun discount(): Optional = discount.getOptional("discount")
/**
@@ -4277,7 +4280,10 @@ private constructor(
*
* Unlike [discount], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("discount") @ExcludeMissing fun _discount(): JsonField = discount
+ @Deprecated("deprecated")
+ @JsonProperty("discount")
+ @ExcludeMissing
+ fun _discount(): JsonField = discount
/**
* Returns the raw JSON value of [endDate].
@@ -4637,9 +4643,12 @@ private constructor(
this.creditsApplied = creditsApplied
}
+ /** This field is deprecated in favor of `adjustments` */
+ @Deprecated("deprecated")
fun discount(discount: Discount?) = discount(JsonField.ofNullable(discount))
/** Alias for calling [Builder.discount] with `discount.orElse(null)`. */
+ @Deprecated("deprecated")
fun discount(discount: Optional) = discount(discount.getOrNull())
/**
@@ -4649,9 +4658,11 @@ private constructor(
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
+ @Deprecated("deprecated")
fun discount(discount: JsonField) = apply { this.discount = discount }
/** Alias for calling [discount] with `Discount.ofPercentage(percentage)`. */
+ @Deprecated("deprecated")
fun discount(percentage: PercentageDiscount) =
discount(Discount.ofPercentage(percentage))
@@ -4664,6 +4675,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun percentageDiscount(percentageDiscount: Double) =
discount(
PercentageDiscount.builder()
@@ -4673,9 +4685,11 @@ private constructor(
)
/** Alias for calling [discount] with `Discount.ofTrial(trial)`. */
+ @Deprecated("deprecated")
fun discount(trial: TrialDiscount) = discount(Discount.ofTrial(trial))
/** Alias for calling [discount] with `Discount.ofUsage(usage)`. */
+ @Deprecated("deprecated")
fun discount(usage: UsageDiscount) = discount(Discount.ofUsage(usage))
/**
@@ -4687,6 +4701,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun usageDiscount(usageDiscount: Double) =
discount(
UsageDiscount.builder()
@@ -4696,6 +4711,7 @@ private constructor(
)
/** Alias for calling [discount] with `Discount.ofAmount(amount)`. */
+ @Deprecated("deprecated")
fun discount(amount: AmountDiscount) = discount(Discount.ofAmount(amount))
/**
@@ -4707,6 +4723,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun amountDiscount(amountDiscount: String) =
discount(
AmountDiscount.builder()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt
index d2dbbc9b..89e6b926 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateResponse.kt
@@ -174,10 +174,12 @@ private constructor(
fun creditsApplied(): String = creditsApplied.getRequired("credits_applied")
/**
+ * This field is deprecated in favor of `adjustments`
+ *
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
* responded with an unexpected value).
*/
- fun discount(): Optional = discount.getOptional("discount")
+ @Deprecated("deprecated") fun discount(): Optional = discount.getOptional("discount")
/**
* The end date of the range of time applied for this line item's price.
@@ -370,7 +372,10 @@ private constructor(
*
* Unlike [discount], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("discount") @ExcludeMissing fun _discount(): JsonField = discount
+ @Deprecated("deprecated")
+ @JsonProperty("discount")
+ @ExcludeMissing
+ fun _discount(): JsonField = discount
/**
* Returns the raw JSON value of [endDate].
@@ -720,9 +725,12 @@ private constructor(
this.creditsApplied = creditsApplied
}
+ /** This field is deprecated in favor of `adjustments` */
+ @Deprecated("deprecated")
fun discount(discount: Discount?) = discount(JsonField.ofNullable(discount))
/** Alias for calling [Builder.discount] with `discount.orElse(null)`. */
+ @Deprecated("deprecated")
fun discount(discount: Optional) = discount(discount.getOrNull())
/**
@@ -732,9 +740,11 @@ private constructor(
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
+ @Deprecated("deprecated")
fun discount(discount: JsonField) = apply { this.discount = discount }
/** Alias for calling [discount] with `Discount.ofPercentage(percentage)`. */
+ @Deprecated("deprecated")
fun discount(percentage: PercentageDiscount) = discount(Discount.ofPercentage(percentage))
/**
@@ -746,6 +756,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun percentageDiscount(percentageDiscount: Double) =
discount(
PercentageDiscount.builder()
@@ -755,9 +766,11 @@ private constructor(
)
/** Alias for calling [discount] with `Discount.ofTrial(trial)`. */
+ @Deprecated("deprecated")
fun discount(trial: TrialDiscount) = discount(Discount.ofTrial(trial))
/** Alias for calling [discount] with `Discount.ofUsage(usage)`. */
+ @Deprecated("deprecated")
fun discount(usage: UsageDiscount) = discount(Discount.ofUsage(usage))
/**
@@ -769,6 +782,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun usageDiscount(usageDiscount: Double) =
discount(
UsageDiscount.builder()
@@ -778,6 +792,7 @@ private constructor(
)
/** Alias for calling [discount] with `Discount.ofAmount(amount)`. */
+ @Deprecated("deprecated")
fun discount(amount: AmountDiscount) = discount(Discount.ofAmount(amount))
/**
@@ -789,6 +804,7 @@ private constructor(
* .build()
* ```
*/
+ @Deprecated("deprecated")
fun amountDiscount(amountDiscount: String) =
discount(
AmountDiscount.builder()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustment.kt
index 24516aca..7ceb9fd9 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustment.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryAmountDiscountAdjustment.kt
@@ -30,6 +30,7 @@ private constructor(
private val filters: JsonField>,
private val isInvoiceLevel: JsonField,
private val reason: JsonField,
+ private val replacesAdjustmentId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -53,6 +54,9 @@ private constructor(
@ExcludeMissing
isInvoiceLevel: JsonField = JsonMissing.of(),
@JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(),
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ replacesAdjustmentId: JsonField = JsonMissing.of(),
) : this(
id,
adjustmentType,
@@ -62,6 +66,7 @@ private constructor(
filters,
isInvoiceLevel,
reason,
+ replacesAdjustmentId,
mutableMapOf(),
)
@@ -128,6 +133,16 @@ private constructor(
*/
fun reason(): Optional = reason.getOptional("reason")
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun replacesAdjustmentId(): Optional =
+ replacesAdjustmentId.getOptional("replaces_adjustment_id")
+
/**
* Returns the raw JSON value of [id].
*
@@ -196,6 +211,16 @@ private constructor(
*/
@JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason
+ /**
+ * Returns the raw JSON value of [replacesAdjustmentId].
+ *
+ * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -224,6 +249,7 @@ private constructor(
* .filters()
* .isInvoiceLevel()
* .reason()
+ * .replacesAdjustmentId()
* ```
*/
@JvmStatic fun builder() = Builder()
@@ -240,6 +266,7 @@ private constructor(
private var filters: JsonField>? = null
private var isInvoiceLevel: JsonField? = null
private var reason: JsonField? = null
+ private var replacesAdjustmentId: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -254,6 +281,7 @@ private constructor(
filters = monetaryAmountDiscountAdjustment.filters.map { it.toMutableList() }
isInvoiceLevel = monetaryAmountDiscountAdjustment.isInvoiceLevel
reason = monetaryAmountDiscountAdjustment.reason
+ replacesAdjustmentId = monetaryAmountDiscountAdjustment.replacesAdjustmentId
additionalProperties =
monetaryAmountDiscountAdjustment.additionalProperties.toMutableMap()
}
@@ -397,6 +425,31 @@ private constructor(
*/
fun reason(reason: JsonField) = apply { this.reason = reason }
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: String?) =
+ replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId))
+
+ /**
+ * Alias for calling [Builder.replacesAdjustmentId] with
+ * `replacesAdjustmentId.orElse(null)`.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: Optional) =
+ replacesAdjustmentId(replacesAdjustmentId.getOrNull())
+
+ /**
+ * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply {
+ this.replacesAdjustmentId = replacesAdjustmentId
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -431,6 +484,7 @@ private constructor(
* .filters()
* .isInvoiceLevel()
* .reason()
+ * .replacesAdjustmentId()
* ```
*
* @throws IllegalStateException if any required field is unset.
@@ -445,6 +499,7 @@ private constructor(
checkRequired("filters", filters).map { it.toImmutable() },
checkRequired("isInvoiceLevel", isInvoiceLevel),
checkRequired("reason", reason),
+ checkRequired("replacesAdjustmentId", replacesAdjustmentId),
additionalProperties.toMutableMap(),
)
}
@@ -464,6 +519,7 @@ private constructor(
filters().forEach { it.validate() }
isInvoiceLevel()
reason()
+ replacesAdjustmentId()
validated = true
}
@@ -489,7 +545,8 @@ private constructor(
(appliesToPriceIds.asKnown().getOrNull()?.size ?: 0) +
(filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (isInvoiceLevel.asKnown().isPresent) 1 else 0) +
- (if (reason.asKnown().isPresent) 1 else 0)
+ (if (reason.asKnown().isPresent) 1 else 0) +
+ (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0)
class AdjustmentType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -618,15 +675,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is MonetaryAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is MonetaryAmountDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && amountDiscount == other.amountDiscount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, amountDiscount, appliesToPriceIds, filters, isInvoiceLevel, reason, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, amountDiscount, appliesToPriceIds, filters, isInvoiceLevel, reason, replacesAdjustmentId, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "MonetaryAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, reason=$reason, additionalProperties=$additionalProperties}"
+ "MonetaryAmountDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, amountDiscount=$amountDiscount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}"
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMaximumAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMaximumAdjustment.kt
index 2862d922..74e8ff45 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMaximumAdjustment.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMaximumAdjustment.kt
@@ -30,6 +30,7 @@ private constructor(
private val isInvoiceLevel: JsonField,
private val maximumAmount: JsonField,
private val reason: JsonField,
+ private val replacesAdjustmentId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -53,6 +54,9 @@ private constructor(
@ExcludeMissing
maximumAmount: JsonField = JsonMissing.of(),
@JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(),
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ replacesAdjustmentId: JsonField = JsonMissing.of(),
) : this(
id,
adjustmentType,
@@ -62,6 +66,7 @@ private constructor(
isInvoiceLevel,
maximumAmount,
reason,
+ replacesAdjustmentId,
mutableMapOf(),
)
@@ -128,6 +133,16 @@ private constructor(
*/
fun reason(): Optional = reason.getOptional("reason")
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun replacesAdjustmentId(): Optional =
+ replacesAdjustmentId.getOptional("replaces_adjustment_id")
+
/**
* Returns the raw JSON value of [id].
*
@@ -196,6 +211,16 @@ private constructor(
*/
@JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason
+ /**
+ * Returns the raw JSON value of [replacesAdjustmentId].
+ *
+ * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -223,6 +248,7 @@ private constructor(
* .isInvoiceLevel()
* .maximumAmount()
* .reason()
+ * .replacesAdjustmentId()
* ```
*/
@JvmStatic fun builder() = Builder()
@@ -239,6 +265,7 @@ private constructor(
private var isInvoiceLevel: JsonField? = null
private var maximumAmount: JsonField? = null
private var reason: JsonField? = null
+ private var replacesAdjustmentId: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -252,6 +279,7 @@ private constructor(
isInvoiceLevel = monetaryMaximumAdjustment.isInvoiceLevel
maximumAmount = monetaryMaximumAdjustment.maximumAmount
reason = monetaryMaximumAdjustment.reason
+ replacesAdjustmentId = monetaryMaximumAdjustment.replacesAdjustmentId
additionalProperties = monetaryMaximumAdjustment.additionalProperties.toMutableMap()
}
@@ -394,6 +422,31 @@ private constructor(
*/
fun reason(reason: JsonField) = apply { this.reason = reason }
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: String?) =
+ replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId))
+
+ /**
+ * Alias for calling [Builder.replacesAdjustmentId] with
+ * `replacesAdjustmentId.orElse(null)`.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: Optional) =
+ replacesAdjustmentId(replacesAdjustmentId.getOrNull())
+
+ /**
+ * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply {
+ this.replacesAdjustmentId = replacesAdjustmentId
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -428,6 +481,7 @@ private constructor(
* .isInvoiceLevel()
* .maximumAmount()
* .reason()
+ * .replacesAdjustmentId()
* ```
*
* @throws IllegalStateException if any required field is unset.
@@ -442,6 +496,7 @@ private constructor(
checkRequired("isInvoiceLevel", isInvoiceLevel),
checkRequired("maximumAmount", maximumAmount),
checkRequired("reason", reason),
+ checkRequired("replacesAdjustmentId", replacesAdjustmentId),
additionalProperties.toMutableMap(),
)
}
@@ -461,6 +516,7 @@ private constructor(
isInvoiceLevel()
maximumAmount()
reason()
+ replacesAdjustmentId()
validated = true
}
@@ -486,7 +542,8 @@ private constructor(
(filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (isInvoiceLevel.asKnown().isPresent) 1 else 0) +
(if (maximumAmount.asKnown().isPresent) 1 else 0) +
- (if (reason.asKnown().isPresent) 1 else 0)
+ (if (reason.asKnown().isPresent) 1 else 0) +
+ (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0)
class AdjustmentType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -615,15 +672,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is MonetaryMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is MonetaryMaximumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && maximumAmount == other.maximumAmount && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, maximumAmount, reason, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, maximumAmount, reason, replacesAdjustmentId, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "MonetaryMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, additionalProperties=$additionalProperties}"
+ "MonetaryMaximumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, maximumAmount=$maximumAmount, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}"
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMinimumAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMinimumAdjustment.kt
index d03c30a5..5411af3b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMinimumAdjustment.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryMinimumAdjustment.kt
@@ -31,6 +31,7 @@ private constructor(
private val itemId: JsonField,
private val minimumAmount: JsonField,
private val reason: JsonField,
+ private val replacesAdjustmentId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -55,6 +56,9 @@ private constructor(
@ExcludeMissing
minimumAmount: JsonField = JsonMissing.of(),
@JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(),
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ replacesAdjustmentId: JsonField = JsonMissing.of(),
) : this(
id,
adjustmentType,
@@ -65,6 +69,7 @@ private constructor(
itemId,
minimumAmount,
reason,
+ replacesAdjustmentId,
mutableMapOf(),
)
@@ -139,6 +144,16 @@ private constructor(
*/
fun reason(): Optional = reason.getOptional("reason")
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun replacesAdjustmentId(): Optional =
+ replacesAdjustmentId.getOptional("replaces_adjustment_id")
+
/**
* Returns the raw JSON value of [id].
*
@@ -214,6 +229,16 @@ private constructor(
*/
@JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason
+ /**
+ * Returns the raw JSON value of [replacesAdjustmentId].
+ *
+ * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -242,6 +267,7 @@ private constructor(
* .itemId()
* .minimumAmount()
* .reason()
+ * .replacesAdjustmentId()
* ```
*/
@JvmStatic fun builder() = Builder()
@@ -259,6 +285,7 @@ private constructor(
private var itemId: JsonField? = null
private var minimumAmount: JsonField? = null
private var reason: JsonField? = null
+ private var replacesAdjustmentId: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -273,6 +300,7 @@ private constructor(
itemId = monetaryMinimumAdjustment.itemId
minimumAmount = monetaryMinimumAdjustment.minimumAmount
reason = monetaryMinimumAdjustment.reason
+ replacesAdjustmentId = monetaryMinimumAdjustment.replacesAdjustmentId
additionalProperties = monetaryMinimumAdjustment.additionalProperties.toMutableMap()
}
@@ -426,6 +454,31 @@ private constructor(
*/
fun reason(reason: JsonField) = apply { this.reason = reason }
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: String?) =
+ replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId))
+
+ /**
+ * Alias for calling [Builder.replacesAdjustmentId] with
+ * `replacesAdjustmentId.orElse(null)`.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: Optional) =
+ replacesAdjustmentId(replacesAdjustmentId.getOrNull())
+
+ /**
+ * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply {
+ this.replacesAdjustmentId = replacesAdjustmentId
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -461,6 +514,7 @@ private constructor(
* .itemId()
* .minimumAmount()
* .reason()
+ * .replacesAdjustmentId()
* ```
*
* @throws IllegalStateException if any required field is unset.
@@ -476,6 +530,7 @@ private constructor(
checkRequired("itemId", itemId),
checkRequired("minimumAmount", minimumAmount),
checkRequired("reason", reason),
+ checkRequired("replacesAdjustmentId", replacesAdjustmentId),
additionalProperties.toMutableMap(),
)
}
@@ -496,6 +551,7 @@ private constructor(
itemId()
minimumAmount()
reason()
+ replacesAdjustmentId()
validated = true
}
@@ -522,7 +578,8 @@ private constructor(
(if (isInvoiceLevel.asKnown().isPresent) 1 else 0) +
(if (itemId.asKnown().isPresent) 1 else 0) +
(if (minimumAmount.asKnown().isPresent) 1 else 0) +
- (if (reason.asKnown().isPresent) 1 else 0)
+ (if (reason.asKnown().isPresent) 1 else 0) +
+ (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0)
class AdjustmentType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -651,15 +708,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is MonetaryMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is MonetaryMinimumAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && itemId == other.itemId && minimumAmount == other.minimumAmount && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, itemId, minimumAmount, reason, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, itemId, minimumAmount, reason, replacesAdjustmentId, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "MonetaryMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, additionalProperties=$additionalProperties}"
+ "MonetaryMinimumAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, itemId=$itemId, minimumAmount=$minimumAmount, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}"
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustment.kt
index 41b8c741..88586711 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustment.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryPercentageDiscountAdjustment.kt
@@ -30,6 +30,7 @@ private constructor(
private val isInvoiceLevel: JsonField,
private val percentageDiscount: JsonField,
private val reason: JsonField,
+ private val replacesAdjustmentId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -53,6 +54,9 @@ private constructor(
@ExcludeMissing
percentageDiscount: JsonField = JsonMissing.of(),
@JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(),
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ replacesAdjustmentId: JsonField = JsonMissing.of(),
) : this(
id,
adjustmentType,
@@ -62,6 +66,7 @@ private constructor(
isInvoiceLevel,
percentageDiscount,
reason,
+ replacesAdjustmentId,
mutableMapOf(),
)
@@ -128,6 +133,16 @@ private constructor(
*/
fun reason(): Optional = reason.getOptional("reason")
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun replacesAdjustmentId(): Optional =
+ replacesAdjustmentId.getOptional("replaces_adjustment_id")
+
/**
* Returns the raw JSON value of [id].
*
@@ -197,6 +212,16 @@ private constructor(
*/
@JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason
+ /**
+ * Returns the raw JSON value of [replacesAdjustmentId].
+ *
+ * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -225,6 +250,7 @@ private constructor(
* .isInvoiceLevel()
* .percentageDiscount()
* .reason()
+ * .replacesAdjustmentId()
* ```
*/
@JvmStatic fun builder() = Builder()
@@ -241,6 +267,7 @@ private constructor(
private var isInvoiceLevel: JsonField? = null
private var percentageDiscount: JsonField? = null
private var reason: JsonField? = null
+ private var replacesAdjustmentId: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -256,6 +283,7 @@ private constructor(
isInvoiceLevel = monetaryPercentageDiscountAdjustment.isInvoiceLevel
percentageDiscount = monetaryPercentageDiscountAdjustment.percentageDiscount
reason = monetaryPercentageDiscountAdjustment.reason
+ replacesAdjustmentId = monetaryPercentageDiscountAdjustment.replacesAdjustmentId
additionalProperties =
monetaryPercentageDiscountAdjustment.additionalProperties.toMutableMap()
}
@@ -400,6 +428,31 @@ private constructor(
*/
fun reason(reason: JsonField) = apply { this.reason = reason }
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: String?) =
+ replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId))
+
+ /**
+ * Alias for calling [Builder.replacesAdjustmentId] with
+ * `replacesAdjustmentId.orElse(null)`.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: Optional) =
+ replacesAdjustmentId(replacesAdjustmentId.getOrNull())
+
+ /**
+ * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply {
+ this.replacesAdjustmentId = replacesAdjustmentId
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -434,6 +487,7 @@ private constructor(
* .isInvoiceLevel()
* .percentageDiscount()
* .reason()
+ * .replacesAdjustmentId()
* ```
*
* @throws IllegalStateException if any required field is unset.
@@ -448,6 +502,7 @@ private constructor(
checkRequired("isInvoiceLevel", isInvoiceLevel),
checkRequired("percentageDiscount", percentageDiscount),
checkRequired("reason", reason),
+ checkRequired("replacesAdjustmentId", replacesAdjustmentId),
additionalProperties.toMutableMap(),
)
}
@@ -467,6 +522,7 @@ private constructor(
isInvoiceLevel()
percentageDiscount()
reason()
+ replacesAdjustmentId()
validated = true
}
@@ -492,7 +548,8 @@ private constructor(
(filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (isInvoiceLevel.asKnown().isPresent) 1 else 0) +
(if (percentageDiscount.asKnown().isPresent) 1 else 0) +
- (if (reason.asKnown().isPresent) 1 else 0)
+ (if (reason.asKnown().isPresent) 1 else 0) +
+ (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0)
class AdjustmentType @JsonCreator private constructor(private val value: JsonField) :
Enum {
@@ -621,15 +678,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is MonetaryPercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is MonetaryPercentageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && percentageDiscount == other.percentageDiscount && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, percentageDiscount, reason, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, percentageDiscount, reason, replacesAdjustmentId, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "MonetaryPercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, additionalProperties=$additionalProperties}"
+ "MonetaryPercentageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, percentageDiscount=$percentageDiscount, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, additionalProperties=$additionalProperties}"
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustment.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustment.kt
index f1fc3f66..d6010e91 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustment.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MonetaryUsageDiscountAdjustment.kt
@@ -29,6 +29,7 @@ private constructor(
private val filters: JsonField>,
private val isInvoiceLevel: JsonField,
private val reason: JsonField,
+ private val replacesAdjustmentId: JsonField,
private val usageDiscount: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -50,6 +51,9 @@ private constructor(
@ExcludeMissing
isInvoiceLevel: JsonField = JsonMissing.of(),
@JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(),
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ replacesAdjustmentId: JsonField = JsonMissing.of(),
@JsonProperty("usage_discount")
@ExcludeMissing
usageDiscount: JsonField = JsonMissing.of(),
@@ -61,6 +65,7 @@ private constructor(
filters,
isInvoiceLevel,
reason,
+ replacesAdjustmentId,
usageDiscount,
mutableMapOf(),
)
@@ -119,6 +124,16 @@ private constructor(
*/
fun reason(): Optional = reason.getOptional("reason")
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun replacesAdjustmentId(): Optional =
+ replacesAdjustmentId.getOptional("replaces_adjustment_id")
+
/**
* The number of usage units by which to discount the price this adjustment applies to in a
* given billing period.
@@ -187,6 +202,16 @@ private constructor(
*/
@JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason
+ /**
+ * Returns the raw JSON value of [replacesAdjustmentId].
+ *
+ * Unlike [replacesAdjustmentId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("replaces_adjustment_id")
+ @ExcludeMissing
+ fun _replacesAdjustmentId(): JsonField = replacesAdjustmentId
+
/**
* Returns the raw JSON value of [usageDiscount].
*
@@ -223,6 +248,7 @@ private constructor(
* .filters()
* .isInvoiceLevel()
* .reason()
+ * .replacesAdjustmentId()
* .usageDiscount()
* ```
*/
@@ -239,6 +265,7 @@ private constructor(
private var filters: JsonField>? = null
private var isInvoiceLevel: JsonField? = null
private var reason: JsonField? = null
+ private var replacesAdjustmentId: JsonField? = null
private var usageDiscount: JsonField? = null
private var additionalProperties: MutableMap = mutableMapOf()
@@ -253,6 +280,7 @@ private constructor(
filters = monetaryUsageDiscountAdjustment.filters.map { it.toMutableList() }
isInvoiceLevel = monetaryUsageDiscountAdjustment.isInvoiceLevel
reason = monetaryUsageDiscountAdjustment.reason
+ replacesAdjustmentId = monetaryUsageDiscountAdjustment.replacesAdjustmentId
usageDiscount = monetaryUsageDiscountAdjustment.usageDiscount
additionalProperties =
monetaryUsageDiscountAdjustment.additionalProperties.toMutableMap()
@@ -380,6 +408,31 @@ private constructor(
*/
fun reason(reason: JsonField) = apply { this.reason = reason }
+ /**
+ * The adjustment id this adjustment replaces. This adjustment will take the place of the
+ * replaced adjustment in plan version migrations.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: String?) =
+ replacesAdjustmentId(JsonField.ofNullable(replacesAdjustmentId))
+
+ /**
+ * Alias for calling [Builder.replacesAdjustmentId] with
+ * `replacesAdjustmentId.orElse(null)`.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: Optional) =
+ replacesAdjustmentId(replacesAdjustmentId.getOrNull())
+
+ /**
+ * Sets [Builder.replacesAdjustmentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.replacesAdjustmentId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun replacesAdjustmentId(replacesAdjustmentId: JsonField) = apply {
+ this.replacesAdjustmentId = replacesAdjustmentId
+ }
+
/**
* The number of usage units by which to discount the price this adjustment applies to in a
* given billing period.
@@ -430,6 +483,7 @@ private constructor(
* .filters()
* .isInvoiceLevel()
* .reason()
+ * .replacesAdjustmentId()
* .usageDiscount()
* ```
*
@@ -444,6 +498,7 @@ private constructor(
checkRequired("filters", filters).map { it.toImmutable() },
checkRequired("isInvoiceLevel", isInvoiceLevel),
checkRequired("reason", reason),
+ checkRequired("replacesAdjustmentId", replacesAdjustmentId),
checkRequired("usageDiscount", usageDiscount),
additionalProperties.toMutableMap(),
)
@@ -463,6 +518,7 @@ private constructor(
filters().forEach { it.validate() }
isInvoiceLevel()
reason()
+ replacesAdjustmentId()
usageDiscount()
validated = true
}
@@ -489,6 +545,7 @@ private constructor(
(filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (isInvoiceLevel.asKnown().isPresent) 1 else 0) +
(if (reason.asKnown().isPresent) 1 else 0) +
+ (if (replacesAdjustmentId.asKnown().isPresent) 1 else 0) +
(if (usageDiscount.asKnown().isPresent) 1 else 0)
class AdjustmentType @JsonCreator private constructor(private val value: JsonField) :
@@ -618,15 +675,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is MonetaryUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is MonetaryUsageDiscountAdjustment && id == other.id && adjustmentType == other.adjustmentType && amount == other.amount && appliesToPriceIds == other.appliesToPriceIds && filters == other.filters && isInvoiceLevel == other.isInvoiceLevel && reason == other.reason && replacesAdjustmentId == other.replacesAdjustmentId && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, reason, usageDiscount, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, adjustmentType, amount, appliesToPriceIds, filters, isInvoiceLevel, reason, replacesAdjustmentId, usageDiscount, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "MonetaryUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, reason=$reason, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}"
+ "MonetaryUsageDiscountAdjustment{id=$id, adjustmentType=$adjustmentType, amount=$amount, appliesToPriceIds=$appliesToPriceIds, filters=$filters, isInvoiceLevel=$isInvoiceLevel, reason=$reason, replacesAdjustmentId=$replacesAdjustmentId, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}"
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBpsPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBpsPrice.kt
index ddc7d1f5..1bb29b70 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBpsPrice.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBpsPrice.kt
@@ -48,6 +48,7 @@ private constructor(
private val invoiceGroupingKey: JsonField,
private val invoicingCycleConfiguration: JsonField,
private val metadata: JsonField,
+ private val referenceId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -95,6 +96,9 @@ private constructor(
@ExcludeMissing
invoicingCycleConfiguration: JsonField = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(),
+ @JsonProperty("reference_id")
+ @ExcludeMissing
+ referenceId: JsonField = JsonMissing.of(),
) : this(
bpsConfig,
cadence,
@@ -113,6 +117,7 @@ private constructor(
invoiceGroupingKey,
invoicingCycleConfiguration,
metadata,
+ referenceId,
mutableMapOf(),
)
@@ -259,6 +264,15 @@ private constructor(
*/
fun metadata(): Optional = metadata.getOptional("metadata")
+ /**
+ * A transient ID that can be used to reference this price when adding adjustments in the same
+ * API call.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun referenceId(): Optional = referenceId.getOptional("reference_id")
+
/**
* Returns the raw JSON value of [bpsConfig].
*
@@ -408,6 +422,15 @@ private constructor(
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata
+ /**
+ * Returns the raw JSON value of [referenceId].
+ *
+ * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("reference_id")
+ @ExcludeMissing
+ fun _referenceId(): JsonField = referenceId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -460,6 +483,7 @@ private constructor(
private var invoicingCycleConfiguration: JsonField =
JsonMissing.of()
private var metadata: JsonField = JsonMissing.of()
+ private var referenceId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -481,6 +505,7 @@ private constructor(
invoiceGroupingKey = newPlanBpsPrice.invoiceGroupingKey
invoicingCycleConfiguration = newPlanBpsPrice.invoicingCycleConfiguration
metadata = newPlanBpsPrice.metadata
+ referenceId = newPlanBpsPrice.referenceId
additionalProperties = newPlanBpsPrice.additionalProperties.toMutableMap()
}
@@ -858,6 +883,24 @@ private constructor(
*/
fun metadata(metadata: JsonField) = apply { this.metadata = metadata }
+ /**
+ * A transient ID that can be used to reference this price when adding adjustments in the
+ * same API call.
+ */
+ fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId))
+
+ /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */
+ fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull())
+
+ /**
+ * Sets [Builder.referenceId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.referenceId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -912,6 +955,7 @@ private constructor(
invoiceGroupingKey,
invoicingCycleConfiguration,
metadata,
+ referenceId,
additionalProperties.toMutableMap(),
)
}
@@ -940,6 +984,7 @@ private constructor(
invoiceGroupingKey()
invoicingCycleConfiguration().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
+ referenceId()
validated = true
}
@@ -974,7 +1019,8 @@ private constructor(
(if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) +
(if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) +
(invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
- (metadata.asKnown().getOrNull()?.validity() ?: 0)
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (referenceId.asKnown().isPresent) 1 else 0)
/** The cadence to bill for this price on. */
class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum {
@@ -1534,15 +1580,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is NewPlanBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is NewPlanBpsPrice && bpsConfig == other.bpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(bpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "NewPlanBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}"
+ "NewPlanBpsPrice{bpsConfig=$bpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}"
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkBpsPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkBpsPrice.kt
index b19a14ee..5d49f502 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkBpsPrice.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkBpsPrice.kt
@@ -48,6 +48,7 @@ private constructor(
private val invoiceGroupingKey: JsonField,
private val invoicingCycleConfiguration: JsonField,
private val metadata: JsonField,
+ private val referenceId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -95,6 +96,9 @@ private constructor(
@ExcludeMissing
invoicingCycleConfiguration: JsonField = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(),
+ @JsonProperty("reference_id")
+ @ExcludeMissing
+ referenceId: JsonField = JsonMissing.of(),
) : this(
bulkBpsConfig,
cadence,
@@ -113,6 +117,7 @@ private constructor(
invoiceGroupingKey,
invoicingCycleConfiguration,
metadata,
+ referenceId,
mutableMapOf(),
)
@@ -259,6 +264,15 @@ private constructor(
*/
fun metadata(): Optional = metadata.getOptional("metadata")
+ /**
+ * A transient ID that can be used to reference this price when adding adjustments in the same
+ * API call.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun referenceId(): Optional = referenceId.getOptional("reference_id")
+
/**
* Returns the raw JSON value of [bulkBpsConfig].
*
@@ -410,6 +424,15 @@ private constructor(
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata
+ /**
+ * Returns the raw JSON value of [referenceId].
+ *
+ * Unlike [referenceId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("reference_id")
+ @ExcludeMissing
+ fun _referenceId(): JsonField = referenceId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -462,6 +485,7 @@ private constructor(
private var invoicingCycleConfiguration: JsonField =
JsonMissing.of()
private var metadata: JsonField = JsonMissing.of()
+ private var referenceId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -483,6 +507,7 @@ private constructor(
invoiceGroupingKey = newPlanBulkBpsPrice.invoiceGroupingKey
invoicingCycleConfiguration = newPlanBulkBpsPrice.invoicingCycleConfiguration
metadata = newPlanBulkBpsPrice.metadata
+ referenceId = newPlanBulkBpsPrice.referenceId
additionalProperties = newPlanBulkBpsPrice.additionalProperties.toMutableMap()
}
@@ -862,6 +887,24 @@ private constructor(
*/
fun metadata(metadata: JsonField) = apply { this.metadata = metadata }
+ /**
+ * A transient ID that can be used to reference this price when adding adjustments in the
+ * same API call.
+ */
+ fun referenceId(referenceId: String?) = referenceId(JsonField.ofNullable(referenceId))
+
+ /** Alias for calling [Builder.referenceId] with `referenceId.orElse(null)`. */
+ fun referenceId(referenceId: Optional) = referenceId(referenceId.getOrNull())
+
+ /**
+ * Sets [Builder.referenceId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.referenceId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun referenceId(referenceId: JsonField) = apply { this.referenceId = referenceId }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -916,6 +959,7 @@ private constructor(
invoiceGroupingKey,
invoicingCycleConfiguration,
metadata,
+ referenceId,
additionalProperties.toMutableMap(),
)
}
@@ -944,6 +988,7 @@ private constructor(
invoiceGroupingKey()
invoicingCycleConfiguration().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
+ referenceId()
validated = true
}
@@ -978,7 +1023,8 @@ private constructor(
(if (fixedPriceQuantity.asKnown().isPresent) 1 else 0) +
(if (invoiceGroupingKey.asKnown().isPresent) 1 else 0) +
(invoicingCycleConfiguration.asKnown().getOrNull()?.validity() ?: 0) +
- (metadata.asKnown().getOrNull()?.validity() ?: 0)
+ (metadata.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (referenceId.asKnown().isPresent) 1 else 0)
/** The cadence to bill for this price on. */
class Cadence @JsonCreator private constructor(private val value: JsonField) : Enum {
@@ -1538,15 +1584,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is NewPlanBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is NewPlanBulkBpsPrice && bulkBpsConfig == other.bulkBpsConfig && cadence == other.cadence && itemId == other.itemId && modelType == other.modelType && name == other.name && billableMetricId == other.billableMetricId && billedInAdvance == other.billedInAdvance && billingCycleConfiguration == other.billingCycleConfiguration && conversionRate == other.conversionRate && conversionRateConfig == other.conversionRateConfig && currency == other.currency && dimensionalPriceConfiguration == other.dimensionalPriceConfiguration && externalPriceId == other.externalPriceId && fixedPriceQuantity == other.fixedPriceQuantity && invoiceGroupingKey == other.invoiceGroupingKey && invoicingCycleConfiguration == other.invoicingCycleConfiguration && metadata == other.metadata && referenceId == other.referenceId && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(bulkBpsConfig, cadence, itemId, modelType, name, billableMetricId, billedInAdvance, billingCycleConfiguration, conversionRate, conversionRateConfig, currency, dimensionalPriceConfiguration, externalPriceId, fixedPriceQuantity, invoiceGroupingKey, invoicingCycleConfiguration, metadata, referenceId, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "NewPlanBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, additionalProperties=$additionalProperties}"
+ "NewPlanBulkBpsPrice{bulkBpsConfig=$bulkBpsConfig, cadence=$cadence, itemId=$itemId, modelType=$modelType, name=$name, billableMetricId=$billableMetricId, billedInAdvance=$billedInAdvance, billingCycleConfiguration=$billingCycleConfiguration, conversionRate=$conversionRate, conversionRateConfig=$conversionRateConfig, currency=$currency, dimensionalPriceConfiguration=$dimensionalPriceConfiguration, externalPriceId=$externalPriceId, fixedPriceQuantity=$fixedPriceQuantity, invoiceGroupingKey=$invoiceGroupingKey, invoicingCycleConfiguration=$invoicingCycleConfiguration, metadata=$metadata, referenceId=$referenceId, additionalProperties=$additionalProperties}"
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkPrice.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkPrice.kt
index 0ea7ac5a..bd9f78b4 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkPrice.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/NewPlanBulkPrice.kt
@@ -48,6 +48,7 @@ private constructor(
private val invoiceGroupingKey: JsonField,
private val invoicingCycleConfiguration: JsonField