diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ba47facd6..18e4c314e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,12 +1,14 @@
name: CI
on:
push:
- branches-ignore:
- - 'generated'
- - 'codegen/**'
- - 'integrated/**'
- - 'stl-preview-head/**'
- - 'stl-preview-base/**'
+ branches:
+ - '**'
+ - '!integrated/**'
+ - '!stl-preview-head/**'
+ - '!stl-preview-base/**'
+ - '!generated'
+ - '!codegen/**'
+ - 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
@@ -17,7 +19,7 @@ jobs:
timeout-minutes: 15
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/orb-kotlin' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+ if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
@@ -41,7 +43,7 @@ jobs:
timeout-minutes: 15
name: build
runs-on: ${{ github.repository == 'stainless-sdks/orb-kotlin' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+ if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
diff --git a/.gitignore b/.gitignore
index b1346e6d1..90b85e944 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.prism.log
+.stdy.log
.gradle
.idea
.kotlin
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index de0960aba..f94eeca26 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "1.12.0"
+ ".": "1.13.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index e572dc254..9eac7077a 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 126
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-9f1a41612765cb08d100b2c9e85080e93306e8d0942d535f16052c3eb18d9b8b.yml
-openapi_spec_hash: 6dd28f36adc7e7d6a9245585eaf9b9c1
-config_hash: bcf82bddb691f6be773ac6cae8c03b9a
+configured_endpoints: 139
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-91a51960dab258d5435cc2a7f47760fd81e4b711b891a1fde3d98757e85e8add.yml
+openapi_spec_hash: 192e4e94264db429260169f0b2e731ce
+config_hash: c01c1191b1cd696c7ca855ff6d28a8df
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d0690ca0..75f4ea29f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,72 @@
# Changelog
+## 1.13.0 (2026-04-13)
+
+Full Changelog: [v1.12.0...v1.13.0](https://github.com/orbcorp/orb-kotlin/compare/v1.12.0...v1.13.0)
+
+### Features
+
+* **api:** api update ([f108cca](https://github.com/orbcorp/orb-kotlin/commit/f108cca9594df29f98fee72963ce55534cee1b50))
+* **api:** api update ([ffa5b92](https://github.com/orbcorp/orb-kotlin/commit/ffa5b92f2d89afa95c12a8d4fd6c608c983b3eac))
+* **api:** api update ([2f25f86](https://github.com/orbcorp/orb-kotlin/commit/2f25f860175c24c187e7f8ffd2d283f0017b8722))
+* **api:** api update ([a0f53b0](https://github.com/orbcorp/orb-kotlin/commit/a0f53b00b27077118e8da9afc249843109aad174))
+* **api:** api update ([86ce6f3](https://github.com/orbcorp/orb-kotlin/commit/86ce6f3f76500235d4ebba8c96e2a4c84d4343db))
+* **api:** api update ([7091a72](https://github.com/orbcorp/orb-kotlin/commit/7091a7208d02be59e8e72fcec879ca805cf00813))
+* **api:** api update ([0e05662](https://github.com/orbcorp/orb-kotlin/commit/0e05662b947ceb6d28995075cc59fad024d6161f))
+* **api:** api update ([e397453](https://github.com/orbcorp/orb-kotlin/commit/e3974536b461231fef00e23c9e02fe6b274b6bd1))
+* **api:** api update ([723f156](https://github.com/orbcorp/orb-kotlin/commit/723f156299560f9a997cdb75603fc96dcbbe6906))
+* **api:** api update ([fe15a1e](https://github.com/orbcorp/orb-kotlin/commit/fe15a1ef1f9ecba723e359bcba1f36a629d3d960))
+* **api:** api update ([a018be0](https://github.com/orbcorp/orb-kotlin/commit/a018be0afe3879a198d667714f0de75f2c5cdbf9))
+* **api:** api update ([63f49a7](https://github.com/orbcorp/orb-kotlin/commit/63f49a7d9be8e33bbdc0489310fe5ef7f5f1df44))
+* **api:** api update ([6de031f](https://github.com/orbcorp/orb-kotlin/commit/6de031f604efd812fc895269568e4debf2b36566))
+* **api:** api update ([9c54a99](https://github.com/orbcorp/orb-kotlin/commit/9c54a99fc2abd5d78d679967ddf8c48c960eeb03))
+* **api:** api update ([808e072](https://github.com/orbcorp/orb-kotlin/commit/808e0728d3848bdcbd4e3ace9e4cf7e3e7fe9852))
+* **api:** api update ([a4e55fc](https://github.com/orbcorp/orb-kotlin/commit/a4e55fcd736a0e61da05512f1015c542b77b2e01))
+* **api:** api update ([7df6475](https://github.com/orbcorp/orb-kotlin/commit/7df6475b8742a8d3755c77f2168bfafdc0bf660a))
+* **api:** manual updates ([d93464c](https://github.com/orbcorp/orb-kotlin/commit/d93464c286e31f707862d8a961c5f454351022e5))
+* **client:** add connection pooling option ([ce4d8a2](https://github.com/orbcorp/orb-kotlin/commit/ce4d8a2e387790b9a1faf40b8f04374a74c9110e))
+* **client:** add more convenience service method overloads ([c449333](https://github.com/orbcorp/orb-kotlin/commit/c449333d09d0b112178f42325b09fd7ff48811df))
+
+
+### Bug Fixes
+
+* **client:** allow updating header/query affecting fields in `toBuilder()` ([562fcc3](https://github.com/orbcorp/orb-kotlin/commit/562fcc3e28663dc802d801a6c359cbc5c04c681a))
+* **client:** incorrect `Retry-After` parsing ([3c13033](https://github.com/orbcorp/orb-kotlin/commit/3c13033d0e362da84b28e1b5e26ba32d69188bac))
+* fix request delays for retrying to be more respectful of high requested delays ([860ce4a](https://github.com/orbcorp/orb-kotlin/commit/860ce4a58b2d43cad76f218d23db8baccab57534))
+
+
+### Chores
+
+* **ci:** skip lint on metadata-only changes ([847e839](https://github.com/orbcorp/orb-kotlin/commit/847e8399ce5cd8c10fcf1abeeaba3184a0695b9f))
+* **docs:** add missing descriptions ([c57175f](https://github.com/orbcorp/orb-kotlin/commit/c57175fc1dc641c6d28ad1dc72cec513bc5982c2))
+* drop apache dependency ([2fb8c9e](https://github.com/orbcorp/orb-kotlin/commit/2fb8c9eb2ca0dbbf34cf0ec88e2053dae3af1df6))
+* **internal:** allow passing args to `./scripts/test` ([8b61c22](https://github.com/orbcorp/orb-kotlin/commit/8b61c22ee33f728ae31d37c535280c2ca0c6a364))
+* **internal:** bump ktfmt ([24a716a](https://github.com/orbcorp/orb-kotlin/commit/24a716abbe941baed09fedde8e5ef860e65e01ba))
+* **internal:** bump palantir-java-format ([8195969](https://github.com/orbcorp/orb-kotlin/commit/8195969d6833b6dbf576fe9a74e511ce8d1b4a00))
+* **internal:** codegen related update ([4e9e830](https://github.com/orbcorp/orb-kotlin/commit/4e9e830d982ed89d6e3f3a08e8dd952dedf44676))
+* **internal:** expand imports ([4e1cecf](https://github.com/orbcorp/orb-kotlin/commit/4e1cecf9966e60a856333a3fd94f08ffb5abe1d2))
+* **internal:** make `OkHttp` constructor internal ([2435e96](https://github.com/orbcorp/orb-kotlin/commit/2435e963adf84c275057b6a2e9ede78989e59cd0))
+* **internal:** tweak CI branches ([5fceea6](https://github.com/orbcorp/orb-kotlin/commit/5fceea66f7cc3148c01a0a33c81000cf1fbfd1a1))
+* **internal:** update `TestServerExtension` comment ([7eb1e48](https://github.com/orbcorp/orb-kotlin/commit/7eb1e48401da793d82b5b8465fef638088411e55))
+* **internal:** update gitignore ([fa67c12](https://github.com/orbcorp/orb-kotlin/commit/fa67c1226f96926bce3720704e5fff5a29871679))
+* **internal:** update multipart form array serialization ([f8ee810](https://github.com/orbcorp/orb-kotlin/commit/f8ee81005fb308a952e6fd946680c8e7d3f04190))
+* **internal:** update retry delay tests ([b77931f](https://github.com/orbcorp/orb-kotlin/commit/b77931f2d6025e820c84c9a01626321c73a65240))
+* **internal:** upgrade AssertJ ([8ea3731](https://github.com/orbcorp/orb-kotlin/commit/8ea373173f2b39a788ecd61aa1f4e83b9a27b8e4))
+* make `Properties` more resilient to `null` ([7104ce5](https://github.com/orbcorp/orb-kotlin/commit/7104ce5655136a86694abe6438bb8d7df7093ff9))
+* **test:** do not count install time for mock server timeout ([e2497db](https://github.com/orbcorp/orb-kotlin/commit/e2497db0a8bb5068d55a5ed257ebbad1e766bf2c))
+* **tests:** bump steady to v0.19.4 ([849d3de](https://github.com/orbcorp/orb-kotlin/commit/849d3de8b4ea87f9d0468a7375f0fdcb643e5cbc))
+* **tests:** bump steady to v0.19.5 ([a10b512](https://github.com/orbcorp/orb-kotlin/commit/a10b51221a51c8316be0ea100d22aa621e1672ad))
+* **tests:** bump steady to v0.19.6 ([db03fe4](https://github.com/orbcorp/orb-kotlin/commit/db03fe4c53ad646d5de1f7bd7a58bb1d9554c768))
+* **tests:** bump steady to v0.19.7 ([7f90cdf](https://github.com/orbcorp/orb-kotlin/commit/7f90cdf8a4b13e32a35eb69e48643dc3bbf7388e))
+* **tests:** bump steady to v0.20.1 ([60af3d0](https://github.com/orbcorp/orb-kotlin/commit/60af3d0eafd87bccc861e9c586f384869042f50d))
+* **tests:** bump steady to v0.20.2 ([196c645](https://github.com/orbcorp/orb-kotlin/commit/196c645c4bf289fb6ecfa7165e8b417679c52f0e))
+* **tests:** update mock server to steady ([67887bf](https://github.com/orbcorp/orb-kotlin/commit/67887bfd41f3744589a59299b8b4b69c136dfc1e))
+
+
+### Documentation
+
+* improve examples ([f1ab4b8](https://github.com/orbcorp/orb-kotlin/commit/f1ab4b89f00819f7dc49af9c2163d5372a416327))
+
## 1.12.0 (2026-01-28)
Full Changelog: [v1.11.0...v1.12.0](https://github.com/orbcorp/orb-kotlin/compare/v1.11.0...v1.12.0)
diff --git a/README.md b/README.md
index 4afffc4f2..fde07cfeb 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[](https://central.sonatype.com/artifact/com.withorb.api/orb-kotlin/1.12.0)
+[](https://central.sonatype.com/artifact/com.withorb.api/orb-kotlin/1.13.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-kotlin:1.12.0")
+implementation("com.withorb.api:orb-kotlin:1.13.0")
```
### Maven
@@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-kotlin:1.12.0")
com.withorb.api
orb-kotlin
- 1.12.0
+ 1.13.0
```
@@ -408,6 +408,25 @@ val client: OrbClient = OrbOkHttpClient.builder()
.build()
```
+### Connection pooling
+
+To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:
+
+```kotlin
+import com.withorb.api.client.OrbClient
+import com.withorb.api.client.okhttp.OrbOkHttpClient
+import java.time.Duration
+
+val client: OrbClient = OrbOkHttpClient.builder()
+ .fromEnv()
+ // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.
+ .maxIdleConnections(10)
+ .keepAliveDuration(Duration.ofMinutes(2))
+ .build()
+```
+
+If both options are unset, OkHttp's default connection pool settings are used.
+
### HTTPS
> [!NOTE]
diff --git a/build.gradle.kts b/build.gradle.kts
index 4fd74a10b..c78651cf6 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,6 +1,6 @@
allprojects {
group = "com.withorb.api"
- version = "1.12.0" // x-release-please-version
+ version = "1.13.0" // x-release-please-version
}
subprojects {
diff --git a/buildSrc/src/main/kotlin/orb.java.gradle.kts b/buildSrc/src/main/kotlin/orb.java.gradle.kts
index 70fc33f41..8f4f902a6 100644
--- a/buildSrc/src/main/kotlin/orb.java.gradle.kts
+++ b/buildSrc/src/main/kotlin/orb.java.gradle.kts
@@ -45,7 +45,7 @@ tasks.withType().configureEach {
val palantir by configurations.creating
dependencies {
- palantir("com.palantir.javaformat:palantir-java-format:2.73.0")
+ palantir("com.palantir.javaformat:palantir-java-format:2.89.0")
}
fun registerPalantir(
diff --git a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts
index 78bb0bbc3..9f10a4f06 100644
--- a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts
+++ b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts
@@ -40,7 +40,7 @@ tasks.withType().configureEach {
val ktfmt by configurations.creating
dependencies {
- ktfmt("com.facebook:ktfmt:0.56")
+ ktfmt("com.facebook:ktfmt:0.61")
}
fun registerKtfmt(
diff --git a/orb-kotlin-client-okhttp/build.gradle.kts b/orb-kotlin-client-okhttp/build.gradle.kts
index a20491dc6..4085749ad 100644
--- a/orb-kotlin-client-okhttp/build.gradle.kts
+++ b/orb-kotlin-client-okhttp/build.gradle.kts
@@ -11,5 +11,5 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
testImplementation(kotlin("test"))
- testImplementation("org.assertj:assertj-core:3.25.3")
+ testImplementation("org.assertj:assertj-core:3.27.7")
}
diff --git a/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt b/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
index fe2cb08bf..f1a2bba05 100644
--- a/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
+++ b/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
@@ -14,12 +14,14 @@ import java.io.InputStream
import java.net.Proxy
import java.time.Duration
import java.util.concurrent.ExecutorService
+import java.util.concurrent.TimeUnit
import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
import kotlinx.coroutines.suspendCancellableCoroutine
import okhttp3.Call
import okhttp3.Callback
+import okhttp3.ConnectionPool
import okhttp3.Dispatcher
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.MediaType
@@ -31,7 +33,7 @@ import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import okio.BufferedSink
-class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpClient) :
+class OkHttpClient internal constructor(private val okHttpClient: okhttp3.OkHttpClient) :
HttpClient {
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
@@ -202,6 +204,8 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpC
private var timeout: Timeout = Timeout.default()
private var proxy: Proxy? = null
+ private var maxIdleConnections: Int? = null
+ private var keepAliveDuration: Duration? = null
private var dispatcherExecutorService: ExecutorService? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
@@ -213,6 +217,28 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpC
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
+ /**
+ * Sets the maximum number of idle connections kept by the underlying [ConnectionPool].
+ *
+ * If this is set, then [keepAliveDuration] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int?) = apply {
+ this.maxIdleConnections = maxIdleConnections
+ }
+
+ /**
+ * Sets the keep-alive duration for idle connections in the underlying [ConnectionPool].
+ *
+ * If this is set, then [maxIdleConnections] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
+ this.keepAliveDuration = keepAliveDuration
+ }
+
fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply {
this.dispatcherExecutorService = dispatcherExecutorService
}
@@ -242,6 +268,22 @@ class OkHttpClient private constructor(private val okHttpClient: okhttp3.OkHttpC
.apply {
dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) }
+ val maxIdleConnections = maxIdleConnections
+ val keepAliveDuration = keepAliveDuration
+ if (maxIdleConnections != null && keepAliveDuration != null) {
+ connectionPool(
+ ConnectionPool(
+ maxIdleConnections,
+ keepAliveDuration.toNanos(),
+ TimeUnit.NANOSECONDS,
+ )
+ )
+ } else {
+ check((maxIdleConnections != null) == (keepAliveDuration != null)) {
+ "Both or none of `maxIdleConnections` and `keepAliveDuration` must be set, but only one was set"
+ }
+ }
+
val sslSocketFactory = sslSocketFactory
val trustManager = trustManager
if (sslSocketFactory != null && trustManager != null) {
diff --git a/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt b/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
index e2dfb2ce5..4798f0c14 100644
--- a/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
+++ b/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClient.kt
@@ -45,6 +45,8 @@ class OrbOkHttpClient private constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var dispatcherExecutorService: ExecutorService? = null
private var proxy: Proxy? = null
+ private var maxIdleConnections: Int? = null
+ private var keepAliveDuration: Duration? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
private var hostnameVerifier: HostnameVerifier? = null
@@ -63,6 +65,36 @@ class OrbOkHttpClient private constructor() {
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
+ /**
+ * The maximum number of idle connections kept by the underlying OkHttp connection pool.
+ *
+ * If this is set, then [keepAliveDuration] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int?) = apply {
+ this.maxIdleConnections = maxIdleConnections
+ }
+
+ /**
+ * Alias for [Builder.maxIdleConnections].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int) =
+ maxIdleConnections(maxIdleConnections as Int?)
+
+ /**
+ * The keep-alive duration for idle connections in the underlying OkHttp connection pool.
+ *
+ * If this is set, then [maxIdleConnections] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
+ this.keepAliveDuration = keepAliveDuration
+ }
+
/**
* The socket factory used to secure HTTPS connections.
*
@@ -294,6 +326,8 @@ class OrbOkHttpClient private constructor() {
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
+ .maxIdleConnections(maxIdleConnections)
+ .keepAliveDuration(keepAliveDuration)
.dispatcherExecutorService(dispatcherExecutorService)
.sslSocketFactory(sslSocketFactory)
.trustManager(trustManager)
diff --git a/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt b/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
index 7790ccdd1..abef19f57 100644
--- a/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
+++ b/orb-kotlin-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OrbOkHttpClientAsync.kt
@@ -45,6 +45,8 @@ class OrbOkHttpClientAsync private constructor() {
private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var dispatcherExecutorService: ExecutorService? = null
private var proxy: Proxy? = null
+ private var maxIdleConnections: Int? = null
+ private var keepAliveDuration: Duration? = null
private var sslSocketFactory: SSLSocketFactory? = null
private var trustManager: X509TrustManager? = null
private var hostnameVerifier: HostnameVerifier? = null
@@ -63,6 +65,36 @@ class OrbOkHttpClientAsync private constructor() {
fun proxy(proxy: Proxy?) = apply { this.proxy = proxy }
+ /**
+ * The maximum number of idle connections kept by the underlying OkHttp connection pool.
+ *
+ * If this is set, then [keepAliveDuration] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int?) = apply {
+ this.maxIdleConnections = maxIdleConnections
+ }
+
+ /**
+ * Alias for [Builder.maxIdleConnections].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun maxIdleConnections(maxIdleConnections: Int) =
+ maxIdleConnections(maxIdleConnections as Int?)
+
+ /**
+ * The keep-alive duration for idle connections in the underlying OkHttp connection pool.
+ *
+ * If this is set, then [maxIdleConnections] must also be set.
+ *
+ * If unset, then OkHttp's default is used.
+ */
+ fun keepAliveDuration(keepAliveDuration: Duration?) = apply {
+ this.keepAliveDuration = keepAliveDuration
+ }
+
/**
* The socket factory used to secure HTTPS connections.
*
@@ -294,6 +326,8 @@ class OrbOkHttpClientAsync private constructor() {
OkHttpClient.builder()
.timeout(clientOptions.timeout())
.proxy(proxy)
+ .maxIdleConnections(maxIdleConnections)
+ .keepAliveDuration(keepAliveDuration)
.dispatcherExecutorService(dispatcherExecutorService)
.sslSocketFactory(sslSocketFactory)
.trustManager(trustManager)
diff --git a/orb-kotlin-core/build.gradle.kts b/orb-kotlin-core/build.gradle.kts
index 8e0f7a9b3..36806e67d 100644
--- a/orb-kotlin-core/build.gradle.kts
+++ b/orb-kotlin-core/build.gradle.kts
@@ -27,14 +27,12 @@ dependencies {
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2")
- implementation("org.apache.httpcomponents.core5:httpcore5:5.2.4")
- implementation("org.apache.httpcomponents.client5:httpclient5:5.3.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
testImplementation(kotlin("test"))
testImplementation(project(":orb-kotlin-client-okhttp"))
testImplementation("com.github.tomakehurst:wiremock-jre8:2.35.2")
- testImplementation("org.assertj:assertj-core:3.25.3")
+ testImplementation("org.assertj:assertj-core:3.27.7")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.3")
testImplementation("org.junit-pioneer:junit-pioneer:1.9.1")
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt
index 710e3b486..0b8733add 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClient.kt
@@ -14,6 +14,8 @@ import com.withorb.api.services.blocking.EventService
import com.withorb.api.services.blocking.InvoiceLineItemService
import com.withorb.api.services.blocking.InvoiceService
import com.withorb.api.services.blocking.ItemService
+import com.withorb.api.services.blocking.LicenseService
+import com.withorb.api.services.blocking.LicenseTypeService
import com.withorb.api.services.blocking.MetricService
import com.withorb.api.services.blocking.PlanService
import com.withorb.api.services.blocking.PriceService
@@ -60,30 +62,115 @@ interface OrbClient {
fun topLevel(): TopLevelService
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed
+ * to by a customer. Plans define the billing behavior of the subscription. You can see more
+ * about how to configure prices in the [Price resource](/reference/price).
+ */
fun beta(): BetaService
+ /**
+ * A coupon represents a reusable discount configuration that can be applied either as a fixed
+ * or percentage amount to an invoice or subscription. Coupons are activated using a redemption
+ * code, which applies the discount to a subscription or invoice. The duration of a coupon
+ * determines how long it remains available for use by end users.
+ */
fun coupons(): CouponService
+ /**
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been applied
+ * to a particular invoice.
+ */
fun creditNotes(): CreditNoteService
+ /**
+ * A customer is a buyer of your products, and the other party to the billing relationship.
+ *
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often
+ * desirable to have these match existing identifiers in your system. To avoid having to
+ * denormalize Orb ID information, you can pass in an `external_customer_id` with your own
+ * identifier. See [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
+ * information about how these aliases work in Orb.
+ *
+ * In addition to having an identifier in your system, a customer may exist in a payment
+ * provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider` enum
+ * field to express this mapping.
+ *
+ * A customer also has a timezone (from the standard
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your account's
+ * timezone. See [Timezone localization](/essentials/timezones) for information on what this
+ * timezone parameter influences within Orb.
+ */
fun customers(): CustomerService
+ /**
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created for
+ * a customer. Events are the core of Orb's usage-based billing model, and are used to calculate
+ * the usage charges for a given billing period.
+ */
fun events(): EventService
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of an
+ * action, such as a cancellation.
+ */
fun invoiceLineItems(): InvoiceLineItemService
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of an
+ * action, such as a cancellation.
+ */
fun invoices(): InvoiceService
+ /**
+ * The Item resource represents a sellable product or good. Items are associated with all line
+ * items, billable metrics, and prices and are used for defining external sync behavior for
+ * invoices and tax calculation purposes.
+ */
fun items(): ItemService
+ /**
+ * The Metric resource represents a calculation of a quantity based on events. Metrics are
+ * defined by the query that transforms raw usage events into meaningful values for your
+ * customers.
+ */
fun metrics(): MetricService
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed
+ * to by a customer. Plans define the billing behavior of the subscription. You can see more
+ * about how to configure prices in the [Price resource](/reference/price).
+ */
fun plans(): PlanService
+ /**
+ * The Price resource represents a price that can be billed on a subscription, resulting in a
+ * charge on an invoice in the form of an invoice line item. Prices take a quantity and
+ * determine an amount to bill.
+ *
+ * Orb supports a few different pricing models out of the box. Each of these models is
+ * serialized differently in a given Price object. The model_type field determines the key for
+ * the configuration object that is present.
+ *
+ * For more on the types of prices, see
+ * [the core concepts documentation](/core-concepts#plan-and-price)
+ */
fun prices(): PriceService
fun subscriptions(): SubscriptionService
+ /**
+ * [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or credit
+ * balance and trigger webhooks when a threshold is exceeded.
+ *
+ * Alerts created through the API can be scoped to either customers or subscriptions.
+ */
fun alerts(): AlertService
fun dimensionalPriceGroups(): DimensionalPriceGroupService
@@ -92,8 +179,20 @@ interface OrbClient {
fun webhooks(): WebhookService
+ /**
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits
+ * within Orb.
+ */
fun creditBlocks(): CreditBlockService
+ /**
+ * The LicenseType resource represents a type of license that can be assigned to users. License
+ * types are used during billing by grouping metrics on the configured grouping key.
+ */
+ fun licenseTypes(): LicenseTypeService
+
+ fun licenses(): LicenseService
+
/**
* Closes this client, relinquishing any underlying resources.
*
@@ -119,36 +218,133 @@ interface OrbClient {
fun topLevel(): TopLevelService.WithRawResponse
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
+ * subscribed to by a customer. Plans define the billing behavior of the subscription. You
+ * can see more about how to configure prices in the [Price resource](/reference/price).
+ */
fun beta(): BetaService.WithRawResponse
+ /**
+ * A coupon represents a reusable discount configuration that can be applied either as a
+ * fixed or percentage amount to an invoice or subscription. Coupons are activated using a
+ * redemption code, which applies the discount to a subscription or invoice. The duration of
+ * a coupon determines how long it remains available for use by end users.
+ */
fun coupons(): CouponService.WithRawResponse
+ /**
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been
+ * applied to a particular invoice.
+ */
fun creditNotes(): CreditNoteService.WithRawResponse
+ /**
+ * A customer is a buyer of your products, and the other party to the billing relationship.
+ *
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often
+ * desirable to have these match existing identifiers in your system. To avoid having to
+ * denormalize Orb ID information, you can pass in an `external_customer_id` with your own
+ * identifier. See [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
+ * information about how these aliases work in Orb.
+ *
+ * In addition to having an identifier in your system, a customer may exist in a payment
+ * provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider`
+ * enum field to express this mapping.
+ *
+ * A customer also has a timezone (from the standard
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your
+ * account's timezone. See [Timezone localization](/essentials/timezones) for information on
+ * what this timezone parameter influences within Orb.
+ */
fun customers(): CustomerService.WithRawResponse
+ /**
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created
+ * for a customer. Events are the core of Orb's usage-based billing model, and are used to
+ * calculate the usage charges for a given billing period.
+ */
fun events(): EventService.WithRawResponse
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of
+ * an action, such as a cancellation.
+ */
fun invoiceLineItems(): InvoiceLineItemService.WithRawResponse
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of
+ * an action, such as a cancellation.
+ */
fun invoices(): InvoiceService.WithRawResponse
+ /**
+ * The Item resource represents a sellable product or good. Items are associated with all
+ * line items, billable metrics, and prices and are used for defining external sync behavior
+ * for invoices and tax calculation purposes.
+ */
fun items(): ItemService.WithRawResponse
+ /**
+ * The Metric resource represents a calculation of a quantity based on events. Metrics are
+ * defined by the query that transforms raw usage events into meaningful values for your
+ * customers.
+ */
fun metrics(): MetricService.WithRawResponse
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
+ * subscribed to by a customer. Plans define the billing behavior of the subscription. You
+ * can see more about how to configure prices in the [Price resource](/reference/price).
+ */
fun plans(): PlanService.WithRawResponse
+ /**
+ * The Price resource represents a price that can be billed on a subscription, resulting in
+ * a charge on an invoice in the form of an invoice line item. Prices take a quantity and
+ * determine an amount to bill.
+ *
+ * Orb supports a few different pricing models out of the box. Each of these models is
+ * serialized differently in a given Price object. The model_type field determines the key
+ * for the configuration object that is present.
+ *
+ * For more on the types of prices, see
+ * [the core concepts documentation](/core-concepts#plan-and-price)
+ */
fun prices(): PriceService.WithRawResponse
fun subscriptions(): SubscriptionService.WithRawResponse
+ /**
+ * [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or
+ * credit balance and trigger webhooks when a threshold is exceeded.
+ *
+ * Alerts created through the API can be scoped to either customers or subscriptions.
+ */
fun alerts(): AlertService.WithRawResponse
fun dimensionalPriceGroups(): DimensionalPriceGroupService.WithRawResponse
fun subscriptionChanges(): SubscriptionChangeService.WithRawResponse
+ /**
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits
+ * within Orb.
+ */
fun creditBlocks(): CreditBlockService.WithRawResponse
+
+ /**
+ * The LicenseType resource represents a type of license that can be assigned to users.
+ * License types are used during billing by grouping metrics on the configured grouping key.
+ */
+ fun licenseTypes(): LicenseTypeService.WithRawResponse
+
+ fun licenses(): LicenseService.WithRawResponse
}
}
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt
index f46caadca..a2bfabd1c 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientAsync.kt
@@ -14,6 +14,8 @@ import com.withorb.api.services.async.EventServiceAsync
import com.withorb.api.services.async.InvoiceLineItemServiceAsync
import com.withorb.api.services.async.InvoiceServiceAsync
import com.withorb.api.services.async.ItemServiceAsync
+import com.withorb.api.services.async.LicenseServiceAsync
+import com.withorb.api.services.async.LicenseTypeServiceAsync
import com.withorb.api.services.async.MetricServiceAsync
import com.withorb.api.services.async.PlanServiceAsync
import com.withorb.api.services.async.PriceServiceAsync
@@ -59,38 +61,135 @@ interface OrbClientAsync {
fun topLevel(): TopLevelServiceAsync
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed
+ * to by a customer. Plans define the billing behavior of the subscription. You can see more
+ * about how to configure prices in the [Price resource](/reference/price).
+ */
fun beta(): BetaServiceAsync
+ /**
+ * A coupon represents a reusable discount configuration that can be applied either as a fixed
+ * or percentage amount to an invoice or subscription. Coupons are activated using a redemption
+ * code, which applies the discount to a subscription or invoice. The duration of a coupon
+ * determines how long it remains available for use by end users.
+ */
fun coupons(): CouponServiceAsync
+ /**
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been applied
+ * to a particular invoice.
+ */
fun creditNotes(): CreditNoteServiceAsync
+ /**
+ * A customer is a buyer of your products, and the other party to the billing relationship.
+ *
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often
+ * desirable to have these match existing identifiers in your system. To avoid having to
+ * denormalize Orb ID information, you can pass in an `external_customer_id` with your own
+ * identifier. See [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
+ * information about how these aliases work in Orb.
+ *
+ * In addition to having an identifier in your system, a customer may exist in a payment
+ * provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider` enum
+ * field to express this mapping.
+ *
+ * A customer also has a timezone (from the standard
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your account's
+ * timezone. See [Timezone localization](/essentials/timezones) for information on what this
+ * timezone parameter influences within Orb.
+ */
fun customers(): CustomerServiceAsync
+ /**
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created for
+ * a customer. Events are the core of Orb's usage-based billing model, and are used to calculate
+ * the usage charges for a given billing period.
+ */
fun events(): EventServiceAsync
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of an
+ * action, such as a cancellation.
+ */
fun invoiceLineItems(): InvoiceLineItemServiceAsync
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of an
+ * action, such as a cancellation.
+ */
fun invoices(): InvoiceServiceAsync
+ /**
+ * The Item resource represents a sellable product or good. Items are associated with all line
+ * items, billable metrics, and prices and are used for defining external sync behavior for
+ * invoices and tax calculation purposes.
+ */
fun items(): ItemServiceAsync
+ /**
+ * The Metric resource represents a calculation of a quantity based on events. Metrics are
+ * defined by the query that transforms raw usage events into meaningful values for your
+ * customers.
+ */
fun metrics(): MetricServiceAsync
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed
+ * to by a customer. Plans define the billing behavior of the subscription. You can see more
+ * about how to configure prices in the [Price resource](/reference/price).
+ */
fun plans(): PlanServiceAsync
+ /**
+ * The Price resource represents a price that can be billed on a subscription, resulting in a
+ * charge on an invoice in the form of an invoice line item. Prices take a quantity and
+ * determine an amount to bill.
+ *
+ * Orb supports a few different pricing models out of the box. Each of these models is
+ * serialized differently in a given Price object. The model_type field determines the key for
+ * the configuration object that is present.
+ *
+ * For more on the types of prices, see
+ * [the core concepts documentation](/core-concepts#plan-and-price)
+ */
fun prices(): PriceServiceAsync
fun subscriptions(): SubscriptionServiceAsync
+ /**
+ * [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or credit
+ * balance and trigger webhooks when a threshold is exceeded.
+ *
+ * Alerts created through the API can be scoped to either customers or subscriptions.
+ */
fun alerts(): AlertServiceAsync
fun dimensionalPriceGroups(): DimensionalPriceGroupServiceAsync
fun subscriptionChanges(): SubscriptionChangeServiceAsync
+ /**
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits
+ * within Orb.
+ */
fun creditBlocks(): CreditBlockServiceAsync
+ /**
+ * The LicenseType resource represents a type of license that can be assigned to users. License
+ * types are used during billing by grouping metrics on the configured grouping key.
+ */
+ fun licenseTypes(): LicenseTypeServiceAsync
+
+ fun licenses(): LicenseServiceAsync
+
/**
* Closes this client, relinquishing any underlying resources.
*
@@ -116,36 +215,133 @@ interface OrbClientAsync {
fun topLevel(): TopLevelServiceAsync.WithRawResponse
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
+ * subscribed to by a customer. Plans define the billing behavior of the subscription. You
+ * can see more about how to configure prices in the [Price resource](/reference/price).
+ */
fun beta(): BetaServiceAsync.WithRawResponse
+ /**
+ * A coupon represents a reusable discount configuration that can be applied either as a
+ * fixed or percentage amount to an invoice or subscription. Coupons are activated using a
+ * redemption code, which applies the discount to a subscription or invoice. The duration of
+ * a coupon determines how long it remains available for use by end users.
+ */
fun coupons(): CouponServiceAsync.WithRawResponse
+ /**
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been
+ * applied to a particular invoice.
+ */
fun creditNotes(): CreditNoteServiceAsync.WithRawResponse
+ /**
+ * A customer is a buyer of your products, and the other party to the billing relationship.
+ *
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often
+ * desirable to have these match existing identifiers in your system. To avoid having to
+ * denormalize Orb ID information, you can pass in an `external_customer_id` with your own
+ * identifier. See [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
+ * information about how these aliases work in Orb.
+ *
+ * In addition to having an identifier in your system, a customer may exist in a payment
+ * provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider`
+ * enum field to express this mapping.
+ *
+ * A customer also has a timezone (from the standard
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your
+ * account's timezone. See [Timezone localization](/essentials/timezones) for information on
+ * what this timezone parameter influences within Orb.
+ */
fun customers(): CustomerServiceAsync.WithRawResponse
+ /**
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created
+ * for a customer. Events are the core of Orb's usage-based billing model, and are used to
+ * calculate the usage charges for a given billing period.
+ */
fun events(): EventServiceAsync.WithRawResponse
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of
+ * an action, such as a cancellation.
+ */
fun invoiceLineItems(): InvoiceLineItemServiceAsync.WithRawResponse
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of
+ * an action, such as a cancellation.
+ */
fun invoices(): InvoiceServiceAsync.WithRawResponse
+ /**
+ * The Item resource represents a sellable product or good. Items are associated with all
+ * line items, billable metrics, and prices and are used for defining external sync behavior
+ * for invoices and tax calculation purposes.
+ */
fun items(): ItemServiceAsync.WithRawResponse
+ /**
+ * The Metric resource represents a calculation of a quantity based on events. Metrics are
+ * defined by the query that transforms raw usage events into meaningful values for your
+ * customers.
+ */
fun metrics(): MetricServiceAsync.WithRawResponse
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
+ * subscribed to by a customer. Plans define the billing behavior of the subscription. You
+ * can see more about how to configure prices in the [Price resource](/reference/price).
+ */
fun plans(): PlanServiceAsync.WithRawResponse
+ /**
+ * The Price resource represents a price that can be billed on a subscription, resulting in
+ * a charge on an invoice in the form of an invoice line item. Prices take a quantity and
+ * determine an amount to bill.
+ *
+ * Orb supports a few different pricing models out of the box. Each of these models is
+ * serialized differently in a given Price object. The model_type field determines the key
+ * for the configuration object that is present.
+ *
+ * For more on the types of prices, see
+ * [the core concepts documentation](/core-concepts#plan-and-price)
+ */
fun prices(): PriceServiceAsync.WithRawResponse
fun subscriptions(): SubscriptionServiceAsync.WithRawResponse
+ /**
+ * [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or
+ * credit balance and trigger webhooks when a threshold is exceeded.
+ *
+ * Alerts created through the API can be scoped to either customers or subscriptions.
+ */
fun alerts(): AlertServiceAsync.WithRawResponse
fun dimensionalPriceGroups(): DimensionalPriceGroupServiceAsync.WithRawResponse
fun subscriptionChanges(): SubscriptionChangeServiceAsync.WithRawResponse
+ /**
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits
+ * within Orb.
+ */
fun creditBlocks(): CreditBlockServiceAsync.WithRawResponse
+
+ /**
+ * The LicenseType resource represents a type of license that can be assigned to users.
+ * License types are used during billing by grouping metrics on the configured grouping key.
+ */
+ fun licenseTypes(): LicenseTypeServiceAsync.WithRawResponse
+
+ fun licenses(): LicenseServiceAsync.WithRawResponse
}
}
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
index 5ff626dd4..2104260c1 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
@@ -26,6 +26,10 @@ import com.withorb.api.services.async.InvoiceServiceAsync
import com.withorb.api.services.async.InvoiceServiceAsyncImpl
import com.withorb.api.services.async.ItemServiceAsync
import com.withorb.api.services.async.ItemServiceAsyncImpl
+import com.withorb.api.services.async.LicenseServiceAsync
+import com.withorb.api.services.async.LicenseServiceAsyncImpl
+import com.withorb.api.services.async.LicenseTypeServiceAsync
+import com.withorb.api.services.async.LicenseTypeServiceAsyncImpl
import com.withorb.api.services.async.MetricServiceAsync
import com.withorb.api.services.async.MetricServiceAsyncImpl
import com.withorb.api.services.async.PlanServiceAsync
@@ -118,6 +122,14 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
CreditBlockServiceAsyncImpl(clientOptionsWithUserAgent)
}
+ private val licenseTypes: LicenseTypeServiceAsync by lazy {
+ LicenseTypeServiceAsyncImpl(clientOptionsWithUserAgent)
+ }
+
+ private val licenses: LicenseServiceAsync by lazy {
+ LicenseServiceAsyncImpl(clientOptionsWithUserAgent)
+ }
+
override fun sync(): OrbClient = sync
override fun withRawResponse(): OrbClientAsync.WithRawResponse = withRawResponse
@@ -127,30 +139,115 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
override fun topLevel(): TopLevelServiceAsync = topLevel
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed
+ * to by a customer. Plans define the billing behavior of the subscription. You can see more
+ * about how to configure prices in the [Price resource](/reference/price).
+ */
override fun beta(): BetaServiceAsync = beta
+ /**
+ * A coupon represents a reusable discount configuration that can be applied either as a fixed
+ * or percentage amount to an invoice or subscription. Coupons are activated using a redemption
+ * code, which applies the discount to a subscription or invoice. The duration of a coupon
+ * determines how long it remains available for use by end users.
+ */
override fun coupons(): CouponServiceAsync = coupons
+ /**
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been applied
+ * to a particular invoice.
+ */
override fun creditNotes(): CreditNoteServiceAsync = creditNotes
+ /**
+ * A customer is a buyer of your products, and the other party to the billing relationship.
+ *
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often
+ * desirable to have these match existing identifiers in your system. To avoid having to
+ * denormalize Orb ID information, you can pass in an `external_customer_id` with your own
+ * identifier. See [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
+ * information about how these aliases work in Orb.
+ *
+ * In addition to having an identifier in your system, a customer may exist in a payment
+ * provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider` enum
+ * field to express this mapping.
+ *
+ * A customer also has a timezone (from the standard
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your account's
+ * timezone. See [Timezone localization](/essentials/timezones) for information on what this
+ * timezone parameter influences within Orb.
+ */
override fun customers(): CustomerServiceAsync = customers
+ /**
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created for
+ * a customer. Events are the core of Orb's usage-based billing model, and are used to calculate
+ * the usage charges for a given billing period.
+ */
override fun events(): EventServiceAsync = events
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of an
+ * action, such as a cancellation.
+ */
override fun invoiceLineItems(): InvoiceLineItemServiceAsync = invoiceLineItems
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of an
+ * action, such as a cancellation.
+ */
override fun invoices(): InvoiceServiceAsync = invoices
+ /**
+ * The Item resource represents a sellable product or good. Items are associated with all line
+ * items, billable metrics, and prices and are used for defining external sync behavior for
+ * invoices and tax calculation purposes.
+ */
override fun items(): ItemServiceAsync = items
+ /**
+ * The Metric resource represents a calculation of a quantity based on events. Metrics are
+ * defined by the query that transforms raw usage events into meaningful values for your
+ * customers.
+ */
override fun metrics(): MetricServiceAsync = metrics
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed
+ * to by a customer. Plans define the billing behavior of the subscription. You can see more
+ * about how to configure prices in the [Price resource](/reference/price).
+ */
override fun plans(): PlanServiceAsync = plans
+ /**
+ * The Price resource represents a price that can be billed on a subscription, resulting in a
+ * charge on an invoice in the form of an invoice line item. Prices take a quantity and
+ * determine an amount to bill.
+ *
+ * Orb supports a few different pricing models out of the box. Each of these models is
+ * serialized differently in a given Price object. The model_type field determines the key for
+ * the configuration object that is present.
+ *
+ * For more on the types of prices, see
+ * [the core concepts documentation](/core-concepts#plan-and-price)
+ */
override fun prices(): PriceServiceAsync = prices
override fun subscriptions(): SubscriptionServiceAsync = subscriptions
+ /**
+ * [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or credit
+ * balance and trigger webhooks when a threshold is exceeded.
+ *
+ * Alerts created through the API can be scoped to either customers or subscriptions.
+ */
override fun alerts(): AlertServiceAsync = alerts
override fun dimensionalPriceGroups(): DimensionalPriceGroupServiceAsync =
@@ -158,8 +255,20 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
override fun subscriptionChanges(): SubscriptionChangeServiceAsync = subscriptionChanges
+ /**
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits
+ * within Orb.
+ */
override fun creditBlocks(): CreditBlockServiceAsync = creditBlocks
+ /**
+ * The LicenseType resource represents a type of license that can be assigned to users. License
+ * types are used during billing by grouping metrics on the configured grouping key.
+ */
+ override fun licenseTypes(): LicenseTypeServiceAsync = licenseTypes
+
+ override fun licenses(): LicenseServiceAsync = licenses
+
override fun close() = clientOptions.close()
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
@@ -234,6 +343,14 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
CreditBlockServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ private val licenseTypes: LicenseTypeServiceAsync.WithRawResponse by lazy {
+ LicenseTypeServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
+ private val licenses: LicenseServiceAsync.WithRawResponse by lazy {
+ LicenseServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
override fun withOptions(
modifier: (ClientOptions.Builder) -> Unit
): OrbClientAsync.WithRawResponse =
@@ -243,31 +360,116 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
override fun topLevel(): TopLevelServiceAsync.WithRawResponse = topLevel
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
+ * subscribed to by a customer. Plans define the billing behavior of the subscription. You
+ * can see more about how to configure prices in the [Price resource](/reference/price).
+ */
override fun beta(): BetaServiceAsync.WithRawResponse = beta
+ /**
+ * A coupon represents a reusable discount configuration that can be applied either as a
+ * fixed or percentage amount to an invoice or subscription. Coupons are activated using a
+ * redemption code, which applies the discount to a subscription or invoice. The duration of
+ * a coupon determines how long it remains available for use by end users.
+ */
override fun coupons(): CouponServiceAsync.WithRawResponse = coupons
+ /**
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been
+ * applied to a particular invoice.
+ */
override fun creditNotes(): CreditNoteServiceAsync.WithRawResponse = creditNotes
+ /**
+ * A customer is a buyer of your products, and the other party to the billing relationship.
+ *
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often
+ * desirable to have these match existing identifiers in your system. To avoid having to
+ * denormalize Orb ID information, you can pass in an `external_customer_id` with your own
+ * identifier. See [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
+ * information about how these aliases work in Orb.
+ *
+ * In addition to having an identifier in your system, a customer may exist in a payment
+ * provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider`
+ * enum field to express this mapping.
+ *
+ * A customer also has a timezone (from the standard
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your
+ * account's timezone. See [Timezone localization](/essentials/timezones) for information on
+ * what this timezone parameter influences within Orb.
+ */
override fun customers(): CustomerServiceAsync.WithRawResponse = customers
+ /**
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created
+ * for a customer. Events are the core of Orb's usage-based billing model, and are used to
+ * calculate the usage charges for a given billing period.
+ */
override fun events(): EventServiceAsync.WithRawResponse = events
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of
+ * an action, such as a cancellation.
+ */
override fun invoiceLineItems(): InvoiceLineItemServiceAsync.WithRawResponse =
invoiceLineItems
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of
+ * an action, such as a cancellation.
+ */
override fun invoices(): InvoiceServiceAsync.WithRawResponse = invoices
+ /**
+ * The Item resource represents a sellable product or good. Items are associated with all
+ * line items, billable metrics, and prices and are used for defining external sync behavior
+ * for invoices and tax calculation purposes.
+ */
override fun items(): ItemServiceAsync.WithRawResponse = items
+ /**
+ * The Metric resource represents a calculation of a quantity based on events. Metrics are
+ * defined by the query that transforms raw usage events into meaningful values for your
+ * customers.
+ */
override fun metrics(): MetricServiceAsync.WithRawResponse = metrics
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
+ * subscribed to by a customer. Plans define the billing behavior of the subscription. You
+ * can see more about how to configure prices in the [Price resource](/reference/price).
+ */
override fun plans(): PlanServiceAsync.WithRawResponse = plans
+ /**
+ * The Price resource represents a price that can be billed on a subscription, resulting in
+ * a charge on an invoice in the form of an invoice line item. Prices take a quantity and
+ * determine an amount to bill.
+ *
+ * Orb supports a few different pricing models out of the box. Each of these models is
+ * serialized differently in a given Price object. The model_type field determines the key
+ * for the configuration object that is present.
+ *
+ * For more on the types of prices, see
+ * [the core concepts documentation](/core-concepts#plan-and-price)
+ */
override fun prices(): PriceServiceAsync.WithRawResponse = prices
override fun subscriptions(): SubscriptionServiceAsync.WithRawResponse = subscriptions
+ /**
+ * [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or
+ * credit balance and trigger webhooks when a threshold is exceeded.
+ *
+ * Alerts created through the API can be scoped to either customers or subscriptions.
+ */
override fun alerts(): AlertServiceAsync.WithRawResponse = alerts
override fun dimensionalPriceGroups(): DimensionalPriceGroupServiceAsync.WithRawResponse =
@@ -276,6 +478,18 @@ class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAs
override fun subscriptionChanges(): SubscriptionChangeServiceAsync.WithRawResponse =
subscriptionChanges
+ /**
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits
+ * within Orb.
+ */
override fun creditBlocks(): CreditBlockServiceAsync.WithRawResponse = creditBlocks
+
+ /**
+ * The LicenseType resource represents a type of license that can be assigned to users.
+ * License types are used during billing by grouping metrics on the configured grouping key.
+ */
+ override fun licenseTypes(): LicenseTypeServiceAsync.WithRawResponse = licenseTypes
+
+ override fun licenses(): LicenseServiceAsync.WithRawResponse = licenses
}
}
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
index 21420041e..77f21264d 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
@@ -26,6 +26,10 @@ import com.withorb.api.services.blocking.InvoiceService
import com.withorb.api.services.blocking.InvoiceServiceImpl
import com.withorb.api.services.blocking.ItemService
import com.withorb.api.services.blocking.ItemServiceImpl
+import com.withorb.api.services.blocking.LicenseService
+import com.withorb.api.services.blocking.LicenseServiceImpl
+import com.withorb.api.services.blocking.LicenseTypeService
+import com.withorb.api.services.blocking.LicenseTypeServiceImpl
import com.withorb.api.services.blocking.MetricService
import com.withorb.api.services.blocking.MetricServiceImpl
import com.withorb.api.services.blocking.PlanService
@@ -110,6 +114,12 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
CreditBlockServiceImpl(clientOptionsWithUserAgent)
}
+ private val licenseTypes: LicenseTypeService by lazy {
+ LicenseTypeServiceImpl(clientOptionsWithUserAgent)
+ }
+
+ private val licenses: LicenseService by lazy { LicenseServiceImpl(clientOptionsWithUserAgent) }
+
override fun async(): OrbClientAsync = async
override fun withRawResponse(): OrbClient.WithRawResponse = withRawResponse
@@ -119,30 +129,115 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
override fun topLevel(): TopLevelService = topLevel
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed
+ * to by a customer. Plans define the billing behavior of the subscription. You can see more
+ * about how to configure prices in the [Price resource](/reference/price).
+ */
override fun beta(): BetaService = beta
+ /**
+ * A coupon represents a reusable discount configuration that can be applied either as a fixed
+ * or percentage amount to an invoice or subscription. Coupons are activated using a redemption
+ * code, which applies the discount to a subscription or invoice. The duration of a coupon
+ * determines how long it remains available for use by end users.
+ */
override fun coupons(): CouponService = coupons
+ /**
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been applied
+ * to a particular invoice.
+ */
override fun creditNotes(): CreditNoteService = creditNotes
+ /**
+ * A customer is a buyer of your products, and the other party to the billing relationship.
+ *
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often
+ * desirable to have these match existing identifiers in your system. To avoid having to
+ * denormalize Orb ID information, you can pass in an `external_customer_id` with your own
+ * identifier. See [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
+ * information about how these aliases work in Orb.
+ *
+ * In addition to having an identifier in your system, a customer may exist in a payment
+ * provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider` enum
+ * field to express this mapping.
+ *
+ * A customer also has a timezone (from the standard
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your account's
+ * timezone. See [Timezone localization](/essentials/timezones) for information on what this
+ * timezone parameter influences within Orb.
+ */
override fun customers(): CustomerService = customers
+ /**
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created for
+ * a customer. Events are the core of Orb's usage-based billing model, and are used to calculate
+ * the usage charges for a given billing period.
+ */
override fun events(): EventService = events
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of an
+ * action, such as a cancellation.
+ */
override fun invoiceLineItems(): InvoiceLineItemService = invoiceLineItems
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of an
+ * action, such as a cancellation.
+ */
override fun invoices(): InvoiceService = invoices
+ /**
+ * The Item resource represents a sellable product or good. Items are associated with all line
+ * items, billable metrics, and prices and are used for defining external sync behavior for
+ * invoices and tax calculation purposes.
+ */
override fun items(): ItemService = items
+ /**
+ * The Metric resource represents a calculation of a quantity based on events. Metrics are
+ * defined by the query that transforms raw usage events into meaningful values for your
+ * customers.
+ */
override fun metrics(): MetricService = metrics
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be subscribed
+ * to by a customer. Plans define the billing behavior of the subscription. You can see more
+ * about how to configure prices in the [Price resource](/reference/price).
+ */
override fun plans(): PlanService = plans
+ /**
+ * The Price resource represents a price that can be billed on a subscription, resulting in a
+ * charge on an invoice in the form of an invoice line item. Prices take a quantity and
+ * determine an amount to bill.
+ *
+ * Orb supports a few different pricing models out of the box. Each of these models is
+ * serialized differently in a given Price object. The model_type field determines the key for
+ * the configuration object that is present.
+ *
+ * For more on the types of prices, see
+ * [the core concepts documentation](/core-concepts#plan-and-price)
+ */
override fun prices(): PriceService = prices
override fun subscriptions(): SubscriptionService = subscriptions
+ /**
+ * [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or credit
+ * balance and trigger webhooks when a threshold is exceeded.
+ *
+ * Alerts created through the API can be scoped to either customers or subscriptions.
+ */
override fun alerts(): AlertService = alerts
override fun dimensionalPriceGroups(): DimensionalPriceGroupService = dimensionalPriceGroups
@@ -151,8 +246,20 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
override fun subscriptionChanges(): SubscriptionChangeService = subscriptionChanges
+ /**
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits
+ * within Orb.
+ */
override fun creditBlocks(): CreditBlockService = creditBlocks
+ /**
+ * The LicenseType resource represents a type of license that can be assigned to users. License
+ * types are used during billing by grouping metrics on the configured grouping key.
+ */
+ override fun licenseTypes(): LicenseTypeService = licenseTypes
+
+ override fun licenses(): LicenseService = licenses
+
override fun close() = clientOptions.close()
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
@@ -226,6 +333,14 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
CreditBlockServiceImpl.WithRawResponseImpl(clientOptions)
}
+ private val licenseTypes: LicenseTypeService.WithRawResponse by lazy {
+ LicenseTypeServiceImpl.WithRawResponseImpl(clientOptions)
+ }
+
+ private val licenses: LicenseService.WithRawResponse by lazy {
+ LicenseServiceImpl.WithRawResponseImpl(clientOptions)
+ }
+
override fun withOptions(
modifier: (ClientOptions.Builder) -> Unit
): OrbClient.WithRawResponse =
@@ -233,30 +348,115 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
override fun topLevel(): TopLevelService.WithRawResponse = topLevel
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
+ * subscribed to by a customer. Plans define the billing behavior of the subscription. You
+ * can see more about how to configure prices in the [Price resource](/reference/price).
+ */
override fun beta(): BetaService.WithRawResponse = beta
+ /**
+ * A coupon represents a reusable discount configuration that can be applied either as a
+ * fixed or percentage amount to an invoice or subscription. Coupons are activated using a
+ * redemption code, which applies the discount to a subscription or invoice. The duration of
+ * a coupon determines how long it remains available for use by end users.
+ */
override fun coupons(): CouponService.WithRawResponse = coupons
+ /**
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been
+ * applied to a particular invoice.
+ */
override fun creditNotes(): CreditNoteService.WithRawResponse = creditNotes
+ /**
+ * A customer is a buyer of your products, and the other party to the billing relationship.
+ *
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often
+ * desirable to have these match existing identifiers in your system. To avoid having to
+ * denormalize Orb ID information, you can pass in an `external_customer_id` with your own
+ * identifier. See [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
+ * information about how these aliases work in Orb.
+ *
+ * In addition to having an identifier in your system, a customer may exist in a payment
+ * provider solution like Stripe. Use the `payment_provider_id` and the `payment_provider`
+ * enum field to express this mapping.
+ *
+ * A customer also has a timezone (from the standard
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to your
+ * account's timezone. See [Timezone localization](/essentials/timezones) for information on
+ * what this timezone parameter influences within Orb.
+ */
override fun customers(): CustomerService.WithRawResponse = customers
+ /**
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created
+ * for a customer. Events are the core of Orb's usage-based billing model, and are used to
+ * calculate the usage charges for a given billing period.
+ */
override fun events(): EventService.WithRawResponse = events
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of
+ * an action, such as a cancellation.
+ */
override fun invoiceLineItems(): InvoiceLineItemService.WithRawResponse = invoiceLineItems
+ /**
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the
+ * request for payment for a single subscription. This includes a set of line items, which
+ * correspond to prices in the subscription's plan and can represent fixed recurring fees or
+ * usage-based fees. They are generated at the end of a billing period, or as the result of
+ * an action, such as a cancellation.
+ */
override fun invoices(): InvoiceService.WithRawResponse = invoices
+ /**
+ * The Item resource represents a sellable product or good. Items are associated with all
+ * line items, billable metrics, and prices and are used for defining external sync behavior
+ * for invoices and tax calculation purposes.
+ */
override fun items(): ItemService.WithRawResponse = items
+ /**
+ * The Metric resource represents a calculation of a quantity based on events. Metrics are
+ * defined by the query that transforms raw usage events into meaningful values for your
+ * customers.
+ */
override fun metrics(): MetricService.WithRawResponse = metrics
+ /**
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
+ * subscribed to by a customer. Plans define the billing behavior of the subscription. You
+ * can see more about how to configure prices in the [Price resource](/reference/price).
+ */
override fun plans(): PlanService.WithRawResponse = plans
+ /**
+ * The Price resource represents a price that can be billed on a subscription, resulting in
+ * a charge on an invoice in the form of an invoice line item. Prices take a quantity and
+ * determine an amount to bill.
+ *
+ * Orb supports a few different pricing models out of the box. Each of these models is
+ * serialized differently in a given Price object. The model_type field determines the key
+ * for the configuration object that is present.
+ *
+ * For more on the types of prices, see
+ * [the core concepts documentation](/core-concepts#plan-and-price)
+ */
override fun prices(): PriceService.WithRawResponse = prices
override fun subscriptions(): SubscriptionService.WithRawResponse = subscriptions
+ /**
+ * [Alerts within Orb](/product-catalog/configuring-alerts) monitor spending, usage, or
+ * credit balance and trigger webhooks when a threshold is exceeded.
+ *
+ * Alerts created through the API can be scoped to either customers or subscriptions.
+ */
override fun alerts(): AlertService.WithRawResponse = alerts
override fun dimensionalPriceGroups(): DimensionalPriceGroupService.WithRawResponse =
@@ -265,6 +465,18 @@ class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
override fun subscriptionChanges(): SubscriptionChangeService.WithRawResponse =
subscriptionChanges
+ /**
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits
+ * within Orb.
+ */
override fun creditBlocks(): CreditBlockService.WithRawResponse = creditBlocks
+
+ /**
+ * The LicenseType resource represents a type of license that can be assigned to users.
+ * License types are used during billing by grouping metrics on the configured grouping key.
+ */
+ override fun licenseTypes(): LicenseTypeService.WithRawResponse = licenseTypes
+
+ override fun licenses(): LicenseService.WithRawResponse = licenses
}
}
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
index d069c2855..9b106eedc 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/ClientOptions.kt
@@ -404,13 +404,14 @@ private constructor(
headers.put("X-Stainless-Runtime", "JRE")
headers.put("X-Stainless-Runtime-Version", getJavaVersion())
headers.put("X-Stainless-Kotlin-Version", KotlinVersion.CURRENT.toString())
+ // We replace after all the default headers to allow end-users to overwrite them.
+ headers.replaceAll(this.headers.build())
+ queryParams.replaceAll(this.queryParams.build())
apiKey.let {
if (!it.isEmpty()) {
- headers.put("Authorization", "Bearer $it")
+ headers.replace("Authorization", "Bearer $it")
}
}
- headers.replaceAll(this.headers.build())
- queryParams.replaceAll(this.queryParams.build())
return ClientOptions(
httpClient,
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Properties.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Properties.kt
index f0f63ba44..e21bb1e93 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Properties.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Properties.kt
@@ -34,8 +34,9 @@ fun getOsName(): String {
}
}
-fun getOsVersion(): String = System.getProperty("os.version", "unknown")
+fun getOsVersion(): String = System.getProperty("os.version", "unknown") ?: "unknown"
-fun getPackageVersion(): String = OrbClient::class.java.`package`.implementationVersion ?: "unknown"
+fun getPackageVersion(): String =
+ OrbClient::class.java.`package`?.implementationVersion ?: "unknown"
-fun getJavaVersion(): String = System.getProperty("java.version", "unknown")
+fun getJavaVersion(): String = System.getProperty("java.version", "unknown") ?: "unknown"
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/HttpRequestBodies.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/HttpRequestBodies.kt
index 67ec3af78..b9610d3ee 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/HttpRequestBodies.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/HttpRequestBodies.kt
@@ -6,12 +6,12 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.databind.node.JsonNodeType
import com.withorb.api.core.MultipartField
+import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
+import java.io.ByteArrayInputStream
import java.io.InputStream
import java.io.OutputStream
-import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder
-import org.apache.hc.core5.http.ContentType
-import org.apache.hc.core5.http.HttpEntity
+import java.util.UUID
internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody =
object : HttpRequestBody {
@@ -32,69 +32,202 @@ internal fun multipartFormData(
jsonMapper: JsonMapper,
fields: Map>,
): HttpRequestBody =
- object : HttpRequestBody {
- private val entity: HttpEntity by lazy {
- MultipartEntityBuilder.create()
- .apply {
- fields.forEach { (name, field) ->
- val knownValue = field.value.asKnown()
- val parts =
- if (knownValue is InputStream) {
- // Read directly from the `InputStream` instead of reading it all
- // into memory due to the `jsonMapper` serialization below.
- sequenceOf(name to knownValue)
- } else {
- val node = jsonMapper.valueToTree(field.value)
- serializePart(name, node)
+ MultipartBody.Builder()
+ .apply {
+ fields.forEach { (name, field) ->
+ val knownValue = field.value.asKnown()
+ val parts =
+ if (knownValue is InputStream) {
+ // Read directly from the `InputStream` instead of reading it all
+ // into memory due to the `jsonMapper` serialization below.
+ sequenceOf(name to knownValue)
+ } else {
+ val node = jsonMapper.valueToTree(field.value)
+ serializePart(name, node)
+ }
+
+ parts.forEach { (name, bytes) ->
+ val partBody =
+ if (bytes is ByteArrayInputStream) {
+ val byteArray = bytes.readBytes()
+
+ object : HttpRequestBody {
+
+ override fun writeTo(outputStream: OutputStream) {
+ outputStream.write(byteArray)
+ }
+
+ override fun contentType(): String = field.contentType
+
+ override fun contentLength(): Long = byteArray.size.toLong()
+
+ override fun repeatable(): Boolean = true
+
+ override fun close() {}
}
+ } else {
+ object : HttpRequestBody {
+
+ override fun writeTo(outputStream: OutputStream) {
+ bytes.copyTo(outputStream)
+ }
+
+ override fun contentType(): String = field.contentType
- parts.forEach { (name, bytes) ->
- addBinaryBody(
- name,
- bytes,
- ContentType.parseLenient(field.contentType),
- field.filename,
- )
+ override fun contentLength(): Long = -1L
+
+ override fun repeatable(): Boolean = false
+
+ override fun close() = bytes.close()
+ }
}
- }
+
+ addPart(
+ MultipartBody.Part.create(name, field.filename, field.contentType, partBody)
+ )
}
- .build()
+ }
}
+ .build()
+
+private fun serializePart(name: String, node: JsonNode): Sequence> =
+ when (node.nodeType) {
+ JsonNodeType.MISSING,
+ JsonNodeType.NULL -> emptySequence()
+ JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue().inputStream())
+ JsonNodeType.STRING -> sequenceOf(name to node.textValue().byteInputStream())
+ JsonNodeType.BOOLEAN -> sequenceOf(name to node.booleanValue().toString().byteInputStream())
+ JsonNodeType.NUMBER -> sequenceOf(name to node.numberValue().toString().byteInputStream())
+ JsonNodeType.ARRAY ->
+ node.elements().asSequence().flatMap { element -> serializePart("$name[]", element) }
+ JsonNodeType.OBJECT ->
+ node.fields().asSequence().flatMap { (key, value) ->
+ serializePart("$name[$key]", value)
+ }
+ JsonNodeType.POJO,
+ null -> throw OrbInvalidDataException("Unexpected JsonNode type: ${node.nodeType}")
+ }
- private fun serializePart(
- name: String,
- node: JsonNode,
- ): Sequence> =
- when (node.nodeType) {
- JsonNodeType.MISSING,
- JsonNodeType.NULL -> emptySequence()
- JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue().inputStream())
- JsonNodeType.STRING -> sequenceOf(name to node.textValue().inputStream())
- JsonNodeType.BOOLEAN ->
- sequenceOf(name to node.booleanValue().toString().inputStream())
- JsonNodeType.NUMBER ->
- sequenceOf(name to node.numberValue().toString().inputStream())
- JsonNodeType.ARRAY ->
- node.elements().asSequence().flatMap { element ->
- serializePart("$name[]", element)
- }
- JsonNodeType.OBJECT ->
- node.fields().asSequence().flatMap { (key, value) ->
- serializePart("$name[$key]", value)
- }
- JsonNodeType.POJO,
- null -> throw OrbInvalidDataException("Unexpected JsonNode type: ${node.nodeType}")
+private class MultipartBody
+private constructor(private val boundary: String, private val parts: List) : HttpRequestBody {
+ private val boundaryBytes: ByteArray = boundary.toByteArray()
+ private val contentType = "multipart/form-data; boundary=$boundary"
+
+ // This must remain in sync with `contentLength`.
+ override fun writeTo(outputStream: OutputStream) {
+ parts.forEach { part ->
+ outputStream.write(DASHDASH)
+ outputStream.write(boundaryBytes)
+ outputStream.write(CRLF)
+
+ outputStream.write(CONTENT_DISPOSITION)
+ outputStream.write(part.contentDisposition.toByteArray())
+ outputStream.write(CRLF)
+
+ outputStream.write(CONTENT_TYPE)
+ outputStream.write(part.contentType.toByteArray())
+ outputStream.write(CRLF)
+
+ outputStream.write(CRLF)
+ part.body.writeTo(outputStream)
+ outputStream.write(CRLF)
+ }
+
+ outputStream.write(DASHDASH)
+ outputStream.write(boundaryBytes)
+ outputStream.write(DASHDASH)
+ outputStream.write(CRLF)
+ }
+
+ override fun contentType(): String = contentType
+
+ // This must remain in sync with `writeTo`.
+ override fun contentLength(): Long {
+ var byteCount = 0L
+
+ parts.forEach { part ->
+ val contentLength = part.body.contentLength()
+ if (contentLength == -1L) {
+ return -1L
}
- private fun String.inputStream(): InputStream = toByteArray().inputStream()
+ byteCount +=
+ DASHDASH.size +
+ boundaryBytes.size +
+ CRLF.size +
+ CONTENT_DISPOSITION.size +
+ part.contentDisposition.toByteArray().size +
+ CRLF.size +
+ CONTENT_TYPE.size +
+ part.contentType.toByteArray().size +
+ CRLF.size +
+ CRLF.size +
+ contentLength +
+ CRLF.size
+ }
- override fun writeTo(outputStream: OutputStream) = entity.writeTo(outputStream)
+ byteCount += DASHDASH.size + boundaryBytes.size + DASHDASH.size + CRLF.size
+ return byteCount
+ }
- override fun contentType(): String = entity.contentType
+ override fun repeatable(): Boolean = parts.all { it.body.repeatable() }
- override fun contentLength(): Long = entity.contentLength
+ override fun close() {
+ parts.forEach { it.body.close() }
+ }
- override fun repeatable(): Boolean = entity.isRepeatable
+ class Builder {
+ private val boundary = UUID.randomUUID().toString()
+ private val parts: MutableList = mutableListOf()
- override fun close() = entity.close()
+ fun addPart(part: Part) = apply { parts.add(part) }
+
+ fun build() = MultipartBody(boundary, parts.toImmutable())
+ }
+
+ class Part
+ private constructor(
+ val contentDisposition: String,
+ val contentType: String,
+ val body: HttpRequestBody,
+ ) {
+ companion object {
+ fun create(
+ name: String,
+ filename: String?,
+ contentType: String,
+ body: HttpRequestBody,
+ ): Part {
+ val disposition = buildString {
+ append("form-data; name=")
+ appendQuotedString(name)
+ if (filename != null) {
+ append("; filename=")
+ appendQuotedString(filename)
+ }
+ }
+ return Part(disposition, contentType, body)
+ }
+ }
+ }
+
+ companion object {
+ private val CRLF = byteArrayOf('\r'.code.toByte(), '\n'.code.toByte())
+ private val DASHDASH = byteArrayOf('-'.code.toByte(), '-'.code.toByte())
+ private val CONTENT_DISPOSITION = "Content-Disposition: ".toByteArray()
+ private val CONTENT_TYPE = "Content-Type: ".toByteArray()
+
+ private fun StringBuilder.appendQuotedString(key: String) {
+ append('"')
+ for (ch in key) {
+ when (ch) {
+ '\n' -> append("%0A")
+ '\r' -> append("%0D")
+ '"' -> append("%22")
+ else -> append(ch)
+ }
+ }
+ append('"')
+ }
}
+}
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt
index 0c35d198d..460994105 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt
@@ -1,3 +1,5 @@
+// File generated from our OpenAPI spec by Stainless.
+
package com.withorb.api.core.http
import com.withorb.api.core.DefaultSleeper
@@ -182,7 +184,7 @@ private constructor(
?: headers.values("Retry-After").getOrNull(0)?.let { retryAfter ->
retryAfter.toFloatOrNull()?.times(TimeUnit.SECONDS.toNanos(1))
?: try {
- ChronoUnit.MILLIS.between(
+ ChronoUnit.NANOS.between(
OffsetDateTime.now(clock),
OffsetDateTime.parse(
retryAfter,
@@ -195,13 +197,8 @@ private constructor(
}
}
?.let { retryAfterNanos ->
- // If the API asks us to wait a certain amount of time (and it's a reasonable
- // amount), just
- // do what it says.
- val retryAfter = Duration.ofNanos(retryAfterNanos.toLong())
- if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) {
- return retryAfter
- }
+ // If the API asks us to wait a certain amount of time, do what it says.
+ return Duration.ofNanos(retryAfterNanos.toLong())
}
// Apply exponential backoff, but not more than the max.
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/Alert.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/Alert.kt
index 5f3c0a922..9f491ff07 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/Alert.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/Alert.kt
@@ -39,6 +39,8 @@ private constructor(
private val thresholds: JsonField>,
private val type: JsonField,
private val balanceAlertStatus: JsonField>,
+ private val groupingKeys: JsonField>,
+ private val licenseType: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -65,6 +67,12 @@ private constructor(
@JsonProperty("balance_alert_status")
@ExcludeMissing
balanceAlertStatus: JsonField> = JsonMissing.of(),
+ @JsonProperty("grouping_keys")
+ @ExcludeMissing
+ groupingKeys: JsonField> = JsonMissing.of(),
+ @JsonProperty("license_type")
+ @ExcludeMissing
+ licenseType: JsonField = JsonMissing.of(),
) : this(
id,
createdAt,
@@ -77,6 +85,8 @@ private constructor(
thresholds,
type,
balanceAlertStatus,
+ groupingKeys,
+ licenseType,
mutableMapOf(),
)
@@ -169,6 +179,23 @@ private constructor(
fun balanceAlertStatus(): List? =
balanceAlertStatus.getNullable("balance_alert_status")
+ /**
+ * The property keys to group cost alerts by. Only present for cost alerts with grouping
+ * enabled.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun groupingKeys(): List? = groupingKeys.getNullable("grouping_keys")
+
+ /**
+ * Minified license type for alert serialization.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun licenseType(): LicenseType? = licenseType.getNullable("license_type")
+
/**
* Returns the raw JSON value of [id].
*
@@ -257,6 +284,24 @@ private constructor(
@ExcludeMissing
fun _balanceAlertStatus(): JsonField> = balanceAlertStatus
+ /**
+ * Returns the raw JSON value of [groupingKeys].
+ *
+ * Unlike [groupingKeys], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("grouping_keys")
+ @ExcludeMissing
+ fun _groupingKeys(): JsonField> = groupingKeys
+
+ /**
+ * Returns the raw JSON value of [licenseType].
+ *
+ * Unlike [licenseType], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("license_type")
+ @ExcludeMissing
+ fun _licenseType(): JsonField = licenseType
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -305,6 +350,8 @@ private constructor(
private var thresholds: JsonField>? = null
private var type: JsonField? = null
private var balanceAlertStatus: JsonField>? = null
+ private var groupingKeys: JsonField>? = null
+ private var licenseType: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(alert: Alert) = apply {
@@ -319,6 +366,8 @@ private constructor(
thresholds = alert.thresholds.map { it.toMutableList() }
type = alert.type
balanceAlertStatus = alert.balanceAlertStatus.map { it.toMutableList() }
+ groupingKeys = alert.groupingKeys.map { it.toMutableList() }
+ licenseType = alert.licenseType
additionalProperties = alert.additionalProperties.toMutableMap()
}
@@ -482,6 +531,50 @@ private constructor(
}
}
+ /**
+ * The property keys to group cost alerts by. Only present for cost alerts with grouping
+ * enabled.
+ */
+ fun groupingKeys(groupingKeys: List?) =
+ groupingKeys(JsonField.ofNullable(groupingKeys))
+
+ /**
+ * Sets [Builder.groupingKeys] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.groupingKeys] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun groupingKeys(groupingKeys: JsonField>) = apply {
+ this.groupingKeys = groupingKeys.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [groupingKeys].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addGroupingKey(groupingKey: String) = apply {
+ groupingKeys =
+ (groupingKeys ?: JsonField.of(mutableListOf())).also {
+ checkKnown("groupingKeys", it).add(groupingKey)
+ }
+ }
+
+ /** Minified license type for alert serialization. */
+ fun licenseType(licenseType: LicenseType?) = licenseType(JsonField.ofNullable(licenseType))
+
+ /**
+ * Sets [Builder.licenseType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.licenseType] with a well-typed [LicenseType] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun licenseType(licenseType: JsonField) = apply {
+ this.licenseType = licenseType
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -535,6 +628,8 @@ private constructor(
checkRequired("thresholds", thresholds).map { it.toImmutable() },
checkRequired("type", type),
(balanceAlertStatus ?: JsonMissing.of()).map { it.toImmutable() },
+ (groupingKeys ?: JsonMissing.of()).map { it.toImmutable() },
+ licenseType,
additionalProperties.toMutableMap(),
)
}
@@ -557,6 +652,8 @@ private constructor(
thresholds()?.forEach { it.validate() }
type().validate()
balanceAlertStatus()?.forEach { it.validate() }
+ groupingKeys()
+ licenseType()?.validate()
validated = true
}
@@ -584,7 +681,9 @@ private constructor(
(subscription.asKnown()?.validity() ?: 0) +
(thresholds.asKnown()?.sumOf { it.validity().toInt() } ?: 0) +
(type.asKnown()?.validity() ?: 0) +
- (balanceAlertStatus.asKnown()?.sumOf { it.validity().toInt() } ?: 0)
+ (balanceAlertStatus.asKnown()?.sumOf { it.validity().toInt() } ?: 0) +
+ (groupingKeys.asKnown()?.size ?: 0) +
+ (licenseType.asKnown()?.validity() ?: 0)
/** The metric the alert applies to. */
class Metric
@@ -1047,6 +1146,8 @@ private constructor(
val COST_EXCEEDED = of("cost_exceeded")
+ val LICENSE_BALANCE_THRESHOLD_REACHED = of("license_balance_threshold_reached")
+
fun of(value: String) = Type(JsonField.of(value))
}
@@ -1057,6 +1158,7 @@ private constructor(
CREDIT_BALANCE_RECOVERED,
USAGE_EXCEEDED,
COST_EXCEEDED,
+ LICENSE_BALANCE_THRESHOLD_REACHED,
}
/**
@@ -1074,6 +1176,7 @@ private constructor(
CREDIT_BALANCE_RECOVERED,
USAGE_EXCEEDED,
COST_EXCEEDED,
+ LICENSE_BALANCE_THRESHOLD_REACHED,
/** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
}
@@ -1092,6 +1195,7 @@ private constructor(
CREDIT_BALANCE_RECOVERED -> Value.CREDIT_BALANCE_RECOVERED
USAGE_EXCEEDED -> Value.USAGE_EXCEEDED
COST_EXCEEDED -> Value.COST_EXCEEDED
+ LICENSE_BALANCE_THRESHOLD_REACHED -> Value.LICENSE_BALANCE_THRESHOLD_REACHED
else -> Value._UNKNOWN
}
@@ -1110,6 +1214,7 @@ private constructor(
CREDIT_BALANCE_RECOVERED -> Known.CREDIT_BALANCE_RECOVERED
USAGE_EXCEEDED -> Known.USAGE_EXCEEDED
COST_EXCEEDED -> Known.COST_EXCEEDED
+ LICENSE_BALANCE_THRESHOLD_REACHED -> Known.LICENSE_BALANCE_THRESHOLD_REACHED
else -> throw OrbInvalidDataException("Unknown Type: $value")
}
@@ -1374,6 +1479,158 @@ private constructor(
"BalanceAlertStatus{inAlert=$inAlert, thresholdValue=$thresholdValue, additionalProperties=$additionalProperties}"
}
+ /** Minified license type for alert serialization. */
+ class LicenseType
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val id: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of()
+ ) : this(id, mutableMapOf())
+
+ /**
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * Returns the raw JSON value of [id].
+ *
+ * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [LicenseType].
+ *
+ * The following fields are required:
+ * ```kotlin
+ * .id()
+ * ```
+ */
+ fun builder() = Builder()
+ }
+
+ /** A builder for [LicenseType]. */
+ class Builder internal constructor() {
+
+ private var id: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ internal fun from(licenseType: LicenseType) = apply {
+ id = licenseType.id
+ additionalProperties = licenseType.additionalProperties.toMutableMap()
+ }
+
+ fun id(id: String) = id(JsonField.of(id))
+
+ /**
+ * Sets [Builder.id] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.id] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun id(id: JsonField) = apply { this.id = id }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [LicenseType].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```kotlin
+ * .id()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): LicenseType =
+ LicenseType(checkRequired("id", id), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): LicenseType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ internal fun validity(): Int = (if (id.asKnown() == null) 0 else 1)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is LicenseType &&
+ id == other.id &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "LicenseType{id=$id, additionalProperties=$additionalProperties}"
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1391,6 +1648,8 @@ private constructor(
thresholds == other.thresholds &&
type == other.type &&
balanceAlertStatus == other.balanceAlertStatus &&
+ groupingKeys == other.groupingKeys &&
+ licenseType == other.licenseType &&
additionalProperties == other.additionalProperties
}
@@ -1407,6 +1666,8 @@ private constructor(
thresholds,
type,
balanceAlertStatus,
+ groupingKeys,
+ licenseType,
additionalProperties,
)
}
@@ -1414,5 +1675,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Alert{id=$id, createdAt=$createdAt, currency=$currency, customer=$customer, enabled=$enabled, metric=$metric, plan=$plan, subscription=$subscription, thresholds=$thresholds, type=$type, balanceAlertStatus=$balanceAlertStatus, additionalProperties=$additionalProperties}"
+ "Alert{id=$id, createdAt=$createdAt, currency=$currency, customer=$customer, enabled=$enabled, metric=$metric, plan=$plan, subscription=$subscription, thresholds=$thresholds, type=$type, balanceAlertStatus=$balanceAlertStatus, groupingKeys=$groupingKeys, licenseType=$licenseType, additionalProperties=$additionalProperties}"
}
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
index d0130f701..3b606a191 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
@@ -59,6 +59,14 @@ private constructor(
*/
fun type(): Type = body.type()
+ /**
+ * The property keys to group cost alerts by. Only applicable for cost_exceeded alerts.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun groupingKeys(): List? = body.groupingKeys()
+
/**
* The metric to track usage for.
*
@@ -67,6 +75,14 @@ private constructor(
*/
fun metricId(): String? = body.metricId()
+ /**
+ * The pricing unit to use for grouped cost alerts. Required when grouping_keys is set.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun pricingUnitId(): String? = body.pricingUnitId()
+
/**
* Returns the raw JSON value of [thresholds].
*
@@ -81,6 +97,13 @@ private constructor(
*/
fun _type(): JsonField = body._type()
+ /**
+ * Returns the raw JSON value of [groupingKeys].
+ *
+ * Unlike [groupingKeys], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _groupingKeys(): JsonField> = body._groupingKeys()
+
/**
* Returns the raw JSON value of [metricId].
*
@@ -88,6 +111,13 @@ private constructor(
*/
fun _metricId(): JsonField = body._metricId()
+ /**
+ * Returns the raw JSON value of [pricingUnitId].
+ *
+ * Unlike [pricingUnitId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _pricingUnitId(): JsonField = body._pricingUnitId()
+
fun _additionalBodyProperties(): Map = body._additionalProperties()
/** Additional headers to send with the request. */
@@ -139,7 +169,10 @@ private constructor(
* Otherwise, it's more convenient to use the top-level setters instead:
* - [thresholds]
* - [type]
+ * - [groupingKeys]
* - [metricId]
+ * - [pricingUnitId]
+ * - etc.
*/
fun body(body: Body) = apply { this.body = body.toBuilder() }
@@ -175,6 +208,27 @@ private constructor(
*/
fun type(type: JsonField) = apply { body.type(type) }
+ /** The property keys to group cost alerts by. Only applicable for cost_exceeded alerts. */
+ fun groupingKeys(groupingKeys: List?) = apply { body.groupingKeys(groupingKeys) }
+
+ /**
+ * Sets [Builder.groupingKeys] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.groupingKeys] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun groupingKeys(groupingKeys: JsonField>) = apply {
+ body.groupingKeys(groupingKeys)
+ }
+
+ /**
+ * Adds a single [String] to [groupingKeys].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addGroupingKey(groupingKey: String) = apply { body.addGroupingKey(groupingKey) }
+
/** The metric to track usage for. */
fun metricId(metricId: String?) = apply { body.metricId(metricId) }
@@ -186,6 +240,20 @@ private constructor(
*/
fun metricId(metricId: JsonField) = apply { body.metricId(metricId) }
+ /** The pricing unit to use for grouped cost alerts. Required when grouping_keys is set. */
+ fun pricingUnitId(pricingUnitId: String?) = apply { body.pricingUnitId(pricingUnitId) }
+
+ /**
+ * Sets [Builder.pricingUnitId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pricingUnitId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun pricingUnitId(pricingUnitId: JsonField) = apply {
+ body.pricingUnitId(pricingUnitId)
+ }
+
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
body.additionalProperties(additionalBodyProperties)
}
@@ -342,7 +410,9 @@ private constructor(
private constructor(
private val thresholds: JsonField>,
private val type: JsonField,
+ private val groupingKeys: JsonField>,
private val metricId: JsonField,
+ private val pricingUnitId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -352,10 +422,16 @@ private constructor(
@ExcludeMissing
thresholds: JsonField> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
+ @JsonProperty("grouping_keys")
+ @ExcludeMissing
+ groupingKeys: JsonField> = JsonMissing.of(),
@JsonProperty("metric_id")
@ExcludeMissing
metricId: JsonField = JsonMissing.of(),
- ) : this(thresholds, type, metricId, mutableMapOf())
+ @JsonProperty("pricing_unit_id")
+ @ExcludeMissing
+ pricingUnitId: JsonField = JsonMissing.of(),
+ ) : this(thresholds, type, groupingKeys, metricId, pricingUnitId, mutableMapOf())
/**
* The thresholds that define the values at which the alert will be triggered.
@@ -373,6 +449,14 @@ private constructor(
*/
fun type(): Type = type.getRequired("type")
+ /**
+ * The property keys to group cost alerts by. Only applicable for cost_exceeded alerts.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun groupingKeys(): List? = groupingKeys.getNullable("grouping_keys")
+
/**
* The metric to track usage for.
*
@@ -381,6 +465,14 @@ private constructor(
*/
fun metricId(): String? = metricId.getNullable("metric_id")
+ /**
+ * The pricing unit to use for grouped cost alerts. Required when grouping_keys is set.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun pricingUnitId(): String? = pricingUnitId.getNullable("pricing_unit_id")
+
/**
* Returns the raw JSON value of [thresholds].
*
@@ -397,6 +489,16 @@ private constructor(
*/
@JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type
+ /**
+ * Returns the raw JSON value of [groupingKeys].
+ *
+ * Unlike [groupingKeys], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("grouping_keys")
+ @ExcludeMissing
+ fun _groupingKeys(): JsonField> = groupingKeys
+
/**
* Returns the raw JSON value of [metricId].
*
@@ -404,6 +506,16 @@ private constructor(
*/
@JsonProperty("metric_id") @ExcludeMissing fun _metricId(): JsonField = metricId
+ /**
+ * Returns the raw JSON value of [pricingUnitId].
+ *
+ * Unlike [pricingUnitId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("pricing_unit_id")
+ @ExcludeMissing
+ fun _pricingUnitId(): JsonField = pricingUnitId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -435,13 +547,17 @@ private constructor(
private var thresholds: JsonField>? = null
private var type: JsonField? = null
+ private var groupingKeys: JsonField>? = null
private var metricId: JsonField = JsonMissing.of()
+ private var pricingUnitId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(body: Body) = apply {
thresholds = body.thresholds.map { it.toMutableList() }
type = body.type
+ groupingKeys = body.groupingKeys.map { it.toMutableList() }
metricId = body.metricId
+ pricingUnitId = body.pricingUnitId
additionalProperties = body.additionalProperties.toMutableMap()
}
@@ -483,6 +599,35 @@ private constructor(
*/
fun type(type: JsonField) = apply { this.type = type }
+ /**
+ * The property keys to group cost alerts by. Only applicable for cost_exceeded alerts.
+ */
+ fun groupingKeys(groupingKeys: List?) =
+ groupingKeys(JsonField.ofNullable(groupingKeys))
+
+ /**
+ * Sets [Builder.groupingKeys] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.groupingKeys] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun groupingKeys(groupingKeys: JsonField>) = apply {
+ this.groupingKeys = groupingKeys.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [groupingKeys].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addGroupingKey(groupingKey: String) = apply {
+ groupingKeys =
+ (groupingKeys ?: JsonField.of(mutableListOf())).also {
+ checkKnown("groupingKeys", it).add(groupingKey)
+ }
+ }
+
/** The metric to track usage for. */
fun metricId(metricId: String?) = metricId(JsonField.ofNullable(metricId))
@@ -495,6 +640,23 @@ private constructor(
*/
fun metricId(metricId: JsonField) = apply { this.metricId = metricId }
+ /**
+ * The pricing unit to use for grouped cost alerts. Required when grouping_keys is set.
+ */
+ fun pricingUnitId(pricingUnitId: String?) =
+ pricingUnitId(JsonField.ofNullable(pricingUnitId))
+
+ /**
+ * Sets [Builder.pricingUnitId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pricingUnitId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun pricingUnitId(pricingUnitId: JsonField) = apply {
+ this.pricingUnitId = pricingUnitId
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -531,7 +693,9 @@ private constructor(
Body(
checkRequired("thresholds", thresholds).map { it.toImmutable() },
checkRequired("type", type),
+ (groupingKeys ?: JsonMissing.of()).map { it.toImmutable() },
metricId,
+ pricingUnitId,
additionalProperties.toMutableMap(),
)
}
@@ -545,7 +709,9 @@ private constructor(
thresholds().forEach { it.validate() }
type().validate()
+ groupingKeys()
metricId()
+ pricingUnitId()
validated = true
}
@@ -566,7 +732,9 @@ private constructor(
internal fun validity(): Int =
(thresholds.asKnown()?.sumOf { it.validity().toInt() } ?: 0) +
(type.asKnown()?.validity() ?: 0) +
- (if (metricId.asKnown() == null) 0 else 1)
+ (groupingKeys.asKnown()?.size ?: 0) +
+ (if (metricId.asKnown() == null) 0 else 1) +
+ (if (pricingUnitId.asKnown() == null) 0 else 1)
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -576,18 +744,27 @@ private constructor(
return other is Body &&
thresholds == other.thresholds &&
type == other.type &&
+ groupingKeys == other.groupingKeys &&
metricId == other.metricId &&
+ pricingUnitId == other.pricingUnitId &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
- Objects.hash(thresholds, type, metricId, additionalProperties)
+ Objects.hash(
+ thresholds,
+ type,
+ groupingKeys,
+ metricId,
+ pricingUnitId,
+ additionalProperties,
+ )
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "Body{thresholds=$thresholds, type=$type, metricId=$metricId, additionalProperties=$additionalProperties}"
+ "Body{thresholds=$thresholds, type=$type, groupingKeys=$groupingKeys, metricId=$metricId, pricingUnitId=$pricingUnitId, additionalProperties=$additionalProperties}"
}
/** The type of alert to create. This must be a valid alert type. */
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/Allocation.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/Allocation.kt
index ae54b8ec3..1b59838a5 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/Allocation.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/Allocation.kt
@@ -25,6 +25,7 @@ private constructor(
private val currency: JsonField,
private val customExpiration: JsonField,
private val filters: JsonField>,
+ private val licenseTypeId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -37,8 +38,13 @@ private constructor(
@JsonProperty("custom_expiration")
@ExcludeMissing
customExpiration: JsonField = JsonMissing.of(),
- @JsonProperty("filters") @ExcludeMissing filters: JsonField> = JsonMissing.of(),
- ) : this(allowsRollover, currency, customExpiration, filters, mutableMapOf())
+ @JsonProperty("filters")
+ @ExcludeMissing
+ filters: JsonField> = JsonMissing.of(),
+ @JsonProperty("license_type_id")
+ @ExcludeMissing
+ licenseTypeId: JsonField = JsonMissing.of(),
+ ) : this(allowsRollover, currency, customExpiration, filters, licenseTypeId, mutableMapOf())
/**
* @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly
@@ -64,6 +70,12 @@ private constructor(
*/
fun filters(): List? = filters.getNullable("filters")
+ /**
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
+ * responded with an unexpected value).
+ */
+ fun licenseTypeId(): String? = licenseTypeId.getNullable("license_type_id")
+
/**
* Returns the raw JSON value of [allowsRollover].
*
@@ -97,6 +109,15 @@ private constructor(
*/
@JsonProperty("filters") @ExcludeMissing fun _filters(): JsonField> = filters
+ /**
+ * Returns the raw JSON value of [licenseTypeId].
+ *
+ * Unlike [licenseTypeId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("license_type_id")
+ @ExcludeMissing
+ fun _licenseTypeId(): JsonField = licenseTypeId
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -131,6 +152,7 @@ private constructor(
private var currency: JsonField? = null
private var customExpiration: JsonField? = null
private var filters: JsonField>? = null
+ private var licenseTypeId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(allocation: Allocation) = apply {
@@ -138,6 +160,7 @@ private constructor(
currency = allocation.currency
customExpiration = allocation.customExpiration
filters = allocation.filters.map { it.toMutableList() }
+ licenseTypeId = allocation.licenseTypeId
additionalProperties = allocation.additionalProperties.toMutableMap()
}
@@ -203,6 +226,20 @@ private constructor(
}
}
+ fun licenseTypeId(licenseTypeId: String?) =
+ licenseTypeId(JsonField.ofNullable(licenseTypeId))
+
+ /**
+ * Sets [Builder.licenseTypeId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.licenseTypeId] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun licenseTypeId(licenseTypeId: JsonField) = apply {
+ this.licenseTypeId = licenseTypeId
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -242,6 +279,7 @@ private constructor(
checkRequired("currency", currency),
checkRequired("customExpiration", customExpiration),
(filters ?: JsonMissing.of()).map { it.toImmutable() },
+ licenseTypeId,
additionalProperties.toMutableMap(),
)
}
@@ -257,6 +295,7 @@ private constructor(
currency()
customExpiration()?.validate()
filters()?.forEach { it.validate() }
+ licenseTypeId()
validated = true
}
@@ -277,7 +316,8 @@ private constructor(
(if (allowsRollover.asKnown() == null) 0 else 1) +
(if (currency.asKnown() == null) 0 else 1) +
(customExpiration.asKnown()?.validity() ?: 0) +
- (filters.asKnown()?.sumOf { it.validity().toInt() } ?: 0)
+ (filters.asKnown()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (licenseTypeId.asKnown() == null) 0 else 1)
class Filter
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
@@ -817,15 +857,23 @@ private constructor(
currency == other.currency &&
customExpiration == other.customExpiration &&
filters == other.filters &&
+ licenseTypeId == other.licenseTypeId &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
- Objects.hash(allowsRollover, currency, customExpiration, filters, additionalProperties)
+ Objects.hash(
+ allowsRollover,
+ currency,
+ customExpiration,
+ filters,
+ licenseTypeId,
+ additionalProperties,
+ )
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "Allocation{allowsRollover=$allowsRollover, currency=$currency, customExpiration=$customExpiration, filters=$filters, additionalProperties=$additionalProperties}"
+ "Allocation{allowsRollover=$allowsRollover, currency=$currency, customExpiration=$customExpiration, filters=$filters, licenseTypeId=$licenseTypeId, additionalProperties=$additionalProperties}"
}
diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/BetaCreatePlanVersionParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/BetaCreatePlanVersionParams.kt
index 3ee9a727a..af8a77e99 100644
--- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/BetaCreatePlanVersionParams.kt
+++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/BetaCreatePlanVersionParams.kt
@@ -1676,6 +1676,7 @@ private constructor(
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val allocationPrice: JsonField,
+ private val licenseAllocationPrice: JsonField,
private val planPhaseOrder: JsonField,
private val price: JsonField,
private val additionalProperties: MutableMap,
@@ -1686,11 +1687,14 @@ private constructor(
@JsonProperty("allocation_price")
@ExcludeMissing
allocationPrice: JsonField = JsonMissing.of(),
+ @JsonProperty("license_allocation_price")
+ @ExcludeMissing
+ licenseAllocationPrice: JsonField = JsonMissing.of(),
@JsonProperty("plan_phase_order")
@ExcludeMissing
planPhaseOrder: JsonField = JsonMissing.of(),
@JsonProperty("price") @ExcludeMissing price: JsonField = JsonMissing.of(),
- ) : this(allocationPrice, planPhaseOrder, price, mutableMapOf())
+ ) : this(allocationPrice, licenseAllocationPrice, planPhaseOrder, price, mutableMapOf())
/**
* The allocation price to add to the plan.
@@ -1700,6 +1704,15 @@ private constructor(
*/
fun allocationPrice(): NewAllocationPrice? = allocationPrice.getNullable("allocation_price")
+ /**
+ * The license allocation price to add to the plan.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun licenseAllocationPrice(): LicenseAllocationPrice? =
+ licenseAllocationPrice.getNullable("license_allocation_price")
+
/**
* The phase to add this price to.
*
@@ -1726,6 +1739,16 @@ private constructor(
@ExcludeMissing
fun _allocationPrice(): JsonField = allocationPrice
+ /**
+ * Returns the raw JSON value of [licenseAllocationPrice].
+ *
+ * Unlike [licenseAllocationPrice], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("license_allocation_price")
+ @ExcludeMissing
+ fun _licenseAllocationPrice(): JsonField = licenseAllocationPrice
+
/**
* Returns the raw JSON value of [planPhaseOrder].
*
@@ -1765,12 +1788,14 @@ private constructor(
class Builder internal constructor() {
private var allocationPrice: JsonField = JsonMissing.of()
+ private var licenseAllocationPrice: JsonField = JsonMissing.of()
private var planPhaseOrder: JsonField = JsonMissing.of()
private var price: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(addPrice: AddPrice) = apply {
allocationPrice = addPrice.allocationPrice
+ licenseAllocationPrice = addPrice.licenseAllocationPrice
planPhaseOrder = addPrice.planPhaseOrder
price = addPrice.price
additionalProperties = addPrice.additionalProperties.toMutableMap()
@@ -1791,6 +1816,324 @@ private constructor(
this.allocationPrice = allocationPrice
}
+ /** The license allocation price to add to the plan. */
+ fun licenseAllocationPrice(licenseAllocationPrice: LicenseAllocationPrice?) =
+ licenseAllocationPrice(JsonField.ofNullable(licenseAllocationPrice))
+
+ /**
+ * Sets [Builder.licenseAllocationPrice] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.licenseAllocationPrice] with a well-typed
+ * [LicenseAllocationPrice] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun licenseAllocationPrice(licenseAllocationPrice: JsonField) =
+ apply {
+ this.licenseAllocationPrice = licenseAllocationPrice
+ }
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofUnit(unit)`.
+ */
+ fun licenseAllocationPrice(unit: LicenseAllocationPrice.Unit) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofUnit(unit))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofTiered(tiered)`.
+ */
+ fun licenseAllocationPrice(tiered: LicenseAllocationPrice.Tiered) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofTiered(tiered))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofBulk(bulk)`.
+ */
+ fun licenseAllocationPrice(bulk: LicenseAllocationPrice.Bulk) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofBulk(bulk))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofBulkWithFilters(bulkWithFilters)`.
+ */
+ fun licenseAllocationPrice(bulkWithFilters: LicenseAllocationPrice.BulkWithFilters) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofBulkWithFilters(bulkWithFilters))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofPackage(package_)`.
+ */
+ fun licenseAllocationPrice(package_: LicenseAllocationPrice.Package) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofPackage(package_))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofMatrix(matrix)`.
+ */
+ fun licenseAllocationPrice(matrix: LicenseAllocationPrice.Matrix) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofMatrix(matrix))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofThresholdTotalAmount(thresholdTotalAmount)`.
+ */
+ fun licenseAllocationPrice(
+ thresholdTotalAmount: LicenseAllocationPrice.ThresholdTotalAmount
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofThresholdTotalAmount(thresholdTotalAmount)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofTieredPackage(tieredPackage)`.
+ */
+ fun licenseAllocationPrice(tieredPackage: LicenseAllocationPrice.TieredPackage) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofTieredPackage(tieredPackage))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofTieredWithMinimum(tieredWithMinimum)`.
+ */
+ fun licenseAllocationPrice(
+ tieredWithMinimum: LicenseAllocationPrice.TieredWithMinimum
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofTieredWithMinimum(tieredWithMinimum)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofGroupedTiered(groupedTiered)`.
+ */
+ fun licenseAllocationPrice(groupedTiered: LicenseAllocationPrice.GroupedTiered) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofGroupedTiered(groupedTiered))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofTieredPackageWithMinimum(tieredPackageWithMinimum)`.
+ */
+ fun licenseAllocationPrice(
+ tieredPackageWithMinimum: LicenseAllocationPrice.TieredPackageWithMinimum
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofTieredPackageWithMinimum(tieredPackageWithMinimum)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofPackageWithAllocation(packageWithAllocation)`.
+ */
+ fun licenseAllocationPrice(
+ packageWithAllocation: LicenseAllocationPrice.PackageWithAllocation
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofPackageWithAllocation(packageWithAllocation)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofUnitWithPercent(unitWithPercent)`.
+ */
+ fun licenseAllocationPrice(unitWithPercent: LicenseAllocationPrice.UnitWithPercent) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofUnitWithPercent(unitWithPercent))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofMatrixWithAllocation(matrixWithAllocation)`.
+ */
+ fun licenseAllocationPrice(
+ matrixWithAllocation: LicenseAllocationPrice.MatrixWithAllocation
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofMatrixWithAllocation(matrixWithAllocation)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofTieredWithProration(tieredWithProration)`.
+ */
+ fun licenseAllocationPrice(
+ tieredWithProration: LicenseAllocationPrice.TieredWithProration
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofTieredWithProration(tieredWithProration)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofUnitWithProration(unitWithProration)`.
+ */
+ fun licenseAllocationPrice(
+ unitWithProration: LicenseAllocationPrice.UnitWithProration
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofUnitWithProration(unitWithProration)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofGroupedAllocation(groupedAllocation)`.
+ */
+ fun licenseAllocationPrice(
+ groupedAllocation: LicenseAllocationPrice.GroupedAllocation
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofGroupedAllocation(groupedAllocation)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofBulkWithProration(bulkWithProration)`.
+ */
+ fun licenseAllocationPrice(
+ bulkWithProration: LicenseAllocationPrice.BulkWithProration
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofBulkWithProration(bulkWithProration)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)`.
+ */
+ fun licenseAllocationPrice(
+ groupedWithProratedMinimum: LicenseAllocationPrice.GroupedWithProratedMinimum
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofGroupedWithProratedMinimum(groupedWithProratedMinimum)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)`.
+ */
+ fun licenseAllocationPrice(
+ groupedWithMeteredMinimum: LicenseAllocationPrice.GroupedWithMeteredMinimum
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofGroupedWithMeteredMinimum(groupedWithMeteredMinimum)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofGroupedWithMinMaxThresholds(groupedWithMinMaxThresholds)`.
+ */
+ fun licenseAllocationPrice(
+ groupedWithMinMaxThresholds: LicenseAllocationPrice.GroupedWithMinMaxThresholds
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofGroupedWithMinMaxThresholds(
+ groupedWithMinMaxThresholds
+ )
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofMatrixWithDisplayName(matrixWithDisplayName)`.
+ */
+ fun licenseAllocationPrice(
+ matrixWithDisplayName: LicenseAllocationPrice.MatrixWithDisplayName
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofMatrixWithDisplayName(matrixWithDisplayName)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofGroupedTieredPackage(groupedTieredPackage)`.
+ */
+ fun licenseAllocationPrice(
+ groupedTieredPackage: LicenseAllocationPrice.GroupedTieredPackage
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofGroupedTieredPackage(groupedTieredPackage)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofMaxGroupTieredPackage(maxGroupTieredPackage)`.
+ */
+ fun licenseAllocationPrice(
+ maxGroupTieredPackage: LicenseAllocationPrice.MaxGroupTieredPackage
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofMaxGroupTieredPackage(maxGroupTieredPackage)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofScalableMatrixWithUnitPricing(scalableMatrixWithUnitPricing)`.
+ */
+ fun licenseAllocationPrice(
+ scalableMatrixWithUnitPricing: LicenseAllocationPrice.ScalableMatrixWithUnitPricing
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofScalableMatrixWithUnitPricing(
+ scalableMatrixWithUnitPricing
+ )
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofScalableMatrixWithTieredPricing(scalableMatrixWithTieredPricing)`.
+ */
+ fun licenseAllocationPrice(
+ scalableMatrixWithTieredPricing:
+ LicenseAllocationPrice.ScalableMatrixWithTieredPricing
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofScalableMatrixWithTieredPricing(
+ scalableMatrixWithTieredPricing
+ )
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofCumulativeGroupedBulk(cumulativeGroupedBulk)`.
+ */
+ fun licenseAllocationPrice(
+ cumulativeGroupedBulk: LicenseAllocationPrice.CumulativeGroupedBulk
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofCumulativeGroupedBulk(cumulativeGroupedBulk)
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofCumulativeGroupedAllocation(cumulativeGroupedAllocation)`.
+ */
+ fun licenseAllocationPrice(
+ cumulativeGroupedAllocation: LicenseAllocationPrice.CumulativeGroupedAllocation
+ ) =
+ licenseAllocationPrice(
+ LicenseAllocationPrice.ofCumulativeGroupedAllocation(
+ cumulativeGroupedAllocation
+ )
+ )
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofMinimumComposite(minimumComposite)`.
+ */
+ fun licenseAllocationPrice(minimumComposite: LicenseAllocationPrice.MinimumComposite) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofMinimumComposite(minimumComposite))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofPercent(percent)`.
+ */
+ fun licenseAllocationPrice(percent: LicenseAllocationPrice.Percent) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofPercent(percent))
+
+ /**
+ * Alias for calling [licenseAllocationPrice] with
+ * `LicenseAllocationPrice.ofEventOutput(eventOutput)`.
+ */
+ fun licenseAllocationPrice(eventOutput: LicenseAllocationPrice.EventOutput) =
+ licenseAllocationPrice(LicenseAllocationPrice.ofEventOutput(eventOutput))
+
/** The phase to add this price to. */
fun planPhaseOrder(planPhaseOrder: Long?) =
planPhaseOrder(JsonField.ofNullable(planPhaseOrder))
@@ -2011,6 +2354,7 @@ private constructor(
fun build(): AddPrice =
AddPrice(
allocationPrice,
+ licenseAllocationPrice,
planPhaseOrder,
price,
additionalProperties.toMutableMap(),
@@ -2025,6 +2369,7 @@ private constructor(
}
allocationPrice()?.validate()
+ licenseAllocationPrice()?.validate()
planPhaseOrder()
price()?.validate()
validated = true
@@ -2046,115 +2391,111 @@ private constructor(
*/
internal fun validity(): Int =
(allocationPrice.asKnown()?.validity() ?: 0) +
+ (licenseAllocationPrice.asKnown()?.validity() ?: 0) +
(if (planPhaseOrder.asKnown() == null) 0 else 1) +
(price.asKnown()?.validity() ?: 0)
- /** New plan price request body params. */
- @JsonDeserialize(using = Price.Deserializer::class)
- @JsonSerialize(using = Price.Serializer::class)
- class Price
+ /** The license allocation price to add to the plan. */
+ @JsonDeserialize(using = LicenseAllocationPrice.Deserializer::class)
+ @JsonSerialize(using = LicenseAllocationPrice.Serializer::class)
+ class LicenseAllocationPrice
private constructor(
- private val unit: NewPlanUnitPrice? = null,
- private val tiered: NewPlanTieredPrice? = null,
- private val bulk: NewPlanBulkPrice? = null,
+ private val unit: Unit? = null,
+ private val tiered: Tiered? = null,
+ private val bulk: Bulk? = null,
private val bulkWithFilters: BulkWithFilters? = null,
- private val package_: NewPlanPackagePrice? = null,
- private val matrix: NewPlanMatrixPrice? = null,
- private val thresholdTotalAmount: NewPlanThresholdTotalAmountPrice? = null,
- private val tieredPackage: NewPlanTieredPackagePrice? = null,
- private val tieredWithMinimum: NewPlanTieredWithMinimumPrice? = null,
- private val groupedTiered: NewPlanGroupedTieredPrice? = null,
- private val tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice? = null,
- private val packageWithAllocation: NewPlanPackageWithAllocationPrice? = null,
- private val unitWithPercent: NewPlanUnitWithPercentPrice? = null,
- private val matrixWithAllocation: NewPlanMatrixWithAllocationPrice? = null,
+ private val package_: Package? = null,
+ private val matrix: Matrix? = null,
+ private val thresholdTotalAmount: ThresholdTotalAmount? = null,
+ private val tieredPackage: TieredPackage? = null,
+ private val tieredWithMinimum: TieredWithMinimum? = null,
+ private val groupedTiered: GroupedTiered? = null,
+ private val tieredPackageWithMinimum: TieredPackageWithMinimum? = null,
+ private val packageWithAllocation: PackageWithAllocation? = null,
+ private val unitWithPercent: UnitWithPercent? = null,
+ private val matrixWithAllocation: MatrixWithAllocation? = null,
private val tieredWithProration: TieredWithProration? = null,
- private val unitWithProration: NewPlanUnitWithProrationPrice? = null,
- private val groupedAllocation: NewPlanGroupedAllocationPrice? = null,
- private val bulkWithProration: NewPlanBulkWithProrationPrice? = null,
- private val groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice? = null,
- private val groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice? = null,
+ private val unitWithProration: UnitWithProration? = null,
+ private val groupedAllocation: GroupedAllocation? = null,
+ private val bulkWithProration: BulkWithProration? = null,
+ private val groupedWithProratedMinimum: GroupedWithProratedMinimum? = null,
+ private val groupedWithMeteredMinimum: GroupedWithMeteredMinimum? = null,
private val groupedWithMinMaxThresholds: GroupedWithMinMaxThresholds? = null,
- private val matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice? = null,
- private val groupedTieredPackage: NewPlanGroupedTieredPackagePrice? = null,
- private val maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice? = null,
- private val scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice? =
- null,
- private val scalableMatrixWithTieredPricing:
- NewPlanScalableMatrixWithTieredPricingPrice? =
- null,
- private val cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice? = null,
+ private val matrixWithDisplayName: MatrixWithDisplayName? = null,
+ private val groupedTieredPackage: GroupedTieredPackage? = null,
+ private val maxGroupTieredPackage: MaxGroupTieredPackage? = null,
+ private val scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing? = null,
+ private val scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing? = null,
+ private val cumulativeGroupedBulk: CumulativeGroupedBulk? = null,
private val cumulativeGroupedAllocation: CumulativeGroupedAllocation? = null,
- private val minimumComposite: NewPlanMinimumCompositePrice? = null,
+ private val minimumComposite: MinimumComposite? = null,
private val percent: Percent? = null,
private val eventOutput: EventOutput? = null,
private val _json: JsonValue? = null,
) {
- fun unit(): NewPlanUnitPrice? = unit
+ fun unit(): Unit? = unit
- fun tiered(): NewPlanTieredPrice? = tiered
+ fun tiered(): Tiered? = tiered
- fun bulk(): NewPlanBulkPrice? = bulk
+ fun bulk(): Bulk? = bulk
fun bulkWithFilters(): BulkWithFilters? = bulkWithFilters
- fun package_(): NewPlanPackagePrice? = package_
+ fun package_(): Package? = package_
- fun matrix(): NewPlanMatrixPrice? = matrix
+ fun matrix(): Matrix? = matrix
- fun thresholdTotalAmount(): NewPlanThresholdTotalAmountPrice? = thresholdTotalAmount
+ fun thresholdTotalAmount(): ThresholdTotalAmount? = thresholdTotalAmount
- fun tieredPackage(): NewPlanTieredPackagePrice? = tieredPackage
+ fun tieredPackage(): TieredPackage? = tieredPackage
- fun tieredWithMinimum(): NewPlanTieredWithMinimumPrice? = tieredWithMinimum
+ fun tieredWithMinimum(): TieredWithMinimum? = tieredWithMinimum
- fun groupedTiered(): NewPlanGroupedTieredPrice? = groupedTiered
+ fun groupedTiered(): GroupedTiered? = groupedTiered
- fun tieredPackageWithMinimum(): NewPlanTieredPackageWithMinimumPrice? =
- tieredPackageWithMinimum
+ fun tieredPackageWithMinimum(): TieredPackageWithMinimum? = tieredPackageWithMinimum
- fun packageWithAllocation(): NewPlanPackageWithAllocationPrice? = packageWithAllocation
+ fun packageWithAllocation(): PackageWithAllocation? = packageWithAllocation
- fun unitWithPercent(): NewPlanUnitWithPercentPrice? = unitWithPercent
+ fun unitWithPercent(): UnitWithPercent? = unitWithPercent
- fun matrixWithAllocation(): NewPlanMatrixWithAllocationPrice? = matrixWithAllocation
+ fun matrixWithAllocation(): MatrixWithAllocation? = matrixWithAllocation
fun tieredWithProration(): TieredWithProration? = tieredWithProration
- fun unitWithProration(): NewPlanUnitWithProrationPrice? = unitWithProration
+ fun unitWithProration(): UnitWithProration? = unitWithProration
- fun groupedAllocation(): NewPlanGroupedAllocationPrice? = groupedAllocation
+ fun groupedAllocation(): GroupedAllocation? = groupedAllocation
- fun bulkWithProration(): NewPlanBulkWithProrationPrice? = bulkWithProration
+ fun bulkWithProration(): BulkWithProration? = bulkWithProration
- fun groupedWithProratedMinimum(): NewPlanGroupedWithProratedMinimumPrice? =
+ fun groupedWithProratedMinimum(): GroupedWithProratedMinimum? =
groupedWithProratedMinimum
- fun groupedWithMeteredMinimum(): NewPlanGroupedWithMeteredMinimumPrice? =
- groupedWithMeteredMinimum
+ fun groupedWithMeteredMinimum(): GroupedWithMeteredMinimum? = groupedWithMeteredMinimum
fun groupedWithMinMaxThresholds(): GroupedWithMinMaxThresholds? =
groupedWithMinMaxThresholds
- fun matrixWithDisplayName(): NewPlanMatrixWithDisplayNamePrice? = matrixWithDisplayName
+ fun matrixWithDisplayName(): MatrixWithDisplayName? = matrixWithDisplayName
- fun groupedTieredPackage(): NewPlanGroupedTieredPackagePrice? = groupedTieredPackage
+ fun groupedTieredPackage(): GroupedTieredPackage? = groupedTieredPackage
- fun maxGroupTieredPackage(): NewPlanMaxGroupTieredPackagePrice? = maxGroupTieredPackage
+ fun maxGroupTieredPackage(): MaxGroupTieredPackage? = maxGroupTieredPackage
- fun scalableMatrixWithUnitPricing(): NewPlanScalableMatrixWithUnitPricingPrice? =
+ fun scalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing? =
scalableMatrixWithUnitPricing
- fun scalableMatrixWithTieredPricing(): NewPlanScalableMatrixWithTieredPricingPrice? =
+ fun scalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing? =
scalableMatrixWithTieredPricing
- fun cumulativeGroupedBulk(): NewPlanCumulativeGroupedBulkPrice? = cumulativeGroupedBulk
+ fun cumulativeGroupedBulk(): CumulativeGroupedBulk? = cumulativeGroupedBulk
fun cumulativeGroupedAllocation(): CumulativeGroupedAllocation? =
cumulativeGroupedAllocation
- fun minimumComposite(): NewPlanMinimumCompositePrice? = minimumComposite
+ fun minimumComposite(): MinimumComposite? = minimumComposite
fun percent(): Percent? = percent
@@ -2223,85 +2564,82 @@ private constructor(
fun isEventOutput(): Boolean = eventOutput != null
- fun asUnit(): NewPlanUnitPrice = unit.getOrThrow("unit")
+ fun asUnit(): Unit = unit.getOrThrow("unit")
- fun asTiered(): NewPlanTieredPrice = tiered.getOrThrow("tiered")
+ fun asTiered(): Tiered = tiered.getOrThrow("tiered")
- fun asBulk(): NewPlanBulkPrice = bulk.getOrThrow("bulk")
+ fun asBulk(): Bulk = bulk.getOrThrow("bulk")
fun asBulkWithFilters(): BulkWithFilters = bulkWithFilters.getOrThrow("bulkWithFilters")
- fun asPackage(): NewPlanPackagePrice = package_.getOrThrow("package_")
+ fun asPackage(): Package = package_.getOrThrow("package_")
- fun asMatrix(): NewPlanMatrixPrice = matrix.getOrThrow("matrix")
+ fun asMatrix(): Matrix = matrix.getOrThrow("matrix")
- fun asThresholdTotalAmount(): NewPlanThresholdTotalAmountPrice =
+ fun asThresholdTotalAmount(): ThresholdTotalAmount =
thresholdTotalAmount.getOrThrow("thresholdTotalAmount")
- fun asTieredPackage(): NewPlanTieredPackagePrice =
- tieredPackage.getOrThrow("tieredPackage")
+ fun asTieredPackage(): TieredPackage = tieredPackage.getOrThrow("tieredPackage")
- fun asTieredWithMinimum(): NewPlanTieredWithMinimumPrice =
+ fun asTieredWithMinimum(): TieredWithMinimum =
tieredWithMinimum.getOrThrow("tieredWithMinimum")
- fun asGroupedTiered(): NewPlanGroupedTieredPrice =
- groupedTiered.getOrThrow("groupedTiered")
+ fun asGroupedTiered(): GroupedTiered = groupedTiered.getOrThrow("groupedTiered")
- fun asTieredPackageWithMinimum(): NewPlanTieredPackageWithMinimumPrice =
+ fun asTieredPackageWithMinimum(): TieredPackageWithMinimum =
tieredPackageWithMinimum.getOrThrow("tieredPackageWithMinimum")
- fun asPackageWithAllocation(): NewPlanPackageWithAllocationPrice =
+ fun asPackageWithAllocation(): PackageWithAllocation =
packageWithAllocation.getOrThrow("packageWithAllocation")
- fun asUnitWithPercent(): NewPlanUnitWithPercentPrice =
- unitWithPercent.getOrThrow("unitWithPercent")
+ fun asUnitWithPercent(): UnitWithPercent = unitWithPercent.getOrThrow("unitWithPercent")
- fun asMatrixWithAllocation(): NewPlanMatrixWithAllocationPrice =
+ fun asMatrixWithAllocation(): MatrixWithAllocation =
matrixWithAllocation.getOrThrow("matrixWithAllocation")
fun asTieredWithProration(): TieredWithProration =
tieredWithProration.getOrThrow("tieredWithProration")
- fun asUnitWithProration(): NewPlanUnitWithProrationPrice =
+ fun asUnitWithProration(): UnitWithProration =
unitWithProration.getOrThrow("unitWithProration")
- fun asGroupedAllocation(): NewPlanGroupedAllocationPrice =
+ fun asGroupedAllocation(): GroupedAllocation =
groupedAllocation.getOrThrow("groupedAllocation")
- fun asBulkWithProration(): NewPlanBulkWithProrationPrice =
+ fun asBulkWithProration(): BulkWithProration =
bulkWithProration.getOrThrow("bulkWithProration")
- fun asGroupedWithProratedMinimum(): NewPlanGroupedWithProratedMinimumPrice =
+ fun asGroupedWithProratedMinimum(): GroupedWithProratedMinimum =
groupedWithProratedMinimum.getOrThrow("groupedWithProratedMinimum")
- fun asGroupedWithMeteredMinimum(): NewPlanGroupedWithMeteredMinimumPrice =
+ fun asGroupedWithMeteredMinimum(): GroupedWithMeteredMinimum =
groupedWithMeteredMinimum.getOrThrow("groupedWithMeteredMinimum")
fun asGroupedWithMinMaxThresholds(): GroupedWithMinMaxThresholds =
groupedWithMinMaxThresholds.getOrThrow("groupedWithMinMaxThresholds")
- fun asMatrixWithDisplayName(): NewPlanMatrixWithDisplayNamePrice =
+ fun asMatrixWithDisplayName(): MatrixWithDisplayName =
matrixWithDisplayName.getOrThrow("matrixWithDisplayName")
- fun asGroupedTieredPackage(): NewPlanGroupedTieredPackagePrice =
+ fun asGroupedTieredPackage(): GroupedTieredPackage =
groupedTieredPackage.getOrThrow("groupedTieredPackage")
- fun asMaxGroupTieredPackage(): NewPlanMaxGroupTieredPackagePrice =
+ fun asMaxGroupTieredPackage(): MaxGroupTieredPackage =
maxGroupTieredPackage.getOrThrow("maxGroupTieredPackage")
- fun asScalableMatrixWithUnitPricing(): NewPlanScalableMatrixWithUnitPricingPrice =
+ fun asScalableMatrixWithUnitPricing(): ScalableMatrixWithUnitPricing =
scalableMatrixWithUnitPricing.getOrThrow("scalableMatrixWithUnitPricing")
- fun asScalableMatrixWithTieredPricing(): NewPlanScalableMatrixWithTieredPricingPrice =
+ fun asScalableMatrixWithTieredPricing(): ScalableMatrixWithTieredPricing =
scalableMatrixWithTieredPricing.getOrThrow("scalableMatrixWithTieredPricing")
- fun asCumulativeGroupedBulk(): NewPlanCumulativeGroupedBulkPrice =
+ fun asCumulativeGroupedBulk(): CumulativeGroupedBulk =
cumulativeGroupedBulk.getOrThrow("cumulativeGroupedBulk")
fun asCumulativeGroupedAllocation(): CumulativeGroupedAllocation =
cumulativeGroupedAllocation.getOrThrow("cumulativeGroupedAllocation")
- fun asMinimumComposite(): NewPlanMinimumCompositePrice =
+ fun asMinimumComposite(): MinimumComposite =
minimumComposite.getOrThrow("minimumComposite")
fun asPercent(): Percent = percent.getOrThrow("percent")
@@ -2365,22 +2703,22 @@ private constructor(
private var validated: Boolean = false
- fun validate(): Price = apply {
+ fun validate(): LicenseAllocationPrice = apply {
if (validated) {
return@apply
}
accept(
object : Visitor {
- override fun visitUnit(unit: NewPlanUnitPrice) {
+ override fun visitUnit(unit: Unit) {
unit.validate()
}
- override fun visitTiered(tiered: NewPlanTieredPrice) {
+ override fun visitTiered(tiered: Tiered) {
tiered.validate()
}
- override fun visitBulk(bulk: NewPlanBulkPrice) {
+ override fun visitBulk(bulk: Bulk) {
bulk.validate()
}
@@ -2388,54 +2726,50 @@ private constructor(
bulkWithFilters.validate()
}
- override fun visitPackage(package_: NewPlanPackagePrice) {
+ override fun visitPackage(package_: Package) {
package_.validate()
}
- override fun visitMatrix(matrix: NewPlanMatrixPrice) {
+ override fun visitMatrix(matrix: Matrix) {
matrix.validate()
}
override fun visitThresholdTotalAmount(
- thresholdTotalAmount: NewPlanThresholdTotalAmountPrice
+ thresholdTotalAmount: ThresholdTotalAmount
) {
thresholdTotalAmount.validate()
}
- override fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice) {
+ override fun visitTieredPackage(tieredPackage: TieredPackage) {
tieredPackage.validate()
}
- override fun visitTieredWithMinimum(
- tieredWithMinimum: NewPlanTieredWithMinimumPrice
- ) {
+ override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) {
tieredWithMinimum.validate()
}
- override fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) {
+ override fun visitGroupedTiered(groupedTiered: GroupedTiered) {
groupedTiered.validate()
}
override fun visitTieredPackageWithMinimum(
- tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice
+ tieredPackageWithMinimum: TieredPackageWithMinimum
) {
tieredPackageWithMinimum.validate()
}
override fun visitPackageWithAllocation(
- packageWithAllocation: NewPlanPackageWithAllocationPrice
+ packageWithAllocation: PackageWithAllocation
) {
packageWithAllocation.validate()
}
- override fun visitUnitWithPercent(
- unitWithPercent: NewPlanUnitWithPercentPrice
- ) {
+ override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) {
unitWithPercent.validate()
}
override fun visitMatrixWithAllocation(
- matrixWithAllocation: NewPlanMatrixWithAllocationPrice
+ matrixWithAllocation: MatrixWithAllocation
) {
matrixWithAllocation.validate()
}
@@ -2446,32 +2780,26 @@ private constructor(
tieredWithProration.validate()
}
- override fun visitUnitWithProration(
- unitWithProration: NewPlanUnitWithProrationPrice
- ) {
+ override fun visitUnitWithProration(unitWithProration: UnitWithProration) {
unitWithProration.validate()
}
- override fun visitGroupedAllocation(
- groupedAllocation: NewPlanGroupedAllocationPrice
- ) {
+ override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) {
groupedAllocation.validate()
}
- override fun visitBulkWithProration(
- bulkWithProration: NewPlanBulkWithProrationPrice
- ) {
+ override fun visitBulkWithProration(bulkWithProration: BulkWithProration) {
bulkWithProration.validate()
}
override fun visitGroupedWithProratedMinimum(
- groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice
+ groupedWithProratedMinimum: GroupedWithProratedMinimum
) {
groupedWithProratedMinimum.validate()
}
override fun visitGroupedWithMeteredMinimum(
- groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice
+ groupedWithMeteredMinimum: GroupedWithMeteredMinimum
) {
groupedWithMeteredMinimum.validate()
}
@@ -2483,38 +2811,37 @@ private constructor(
}
override fun visitMatrixWithDisplayName(
- matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice
+ matrixWithDisplayName: MatrixWithDisplayName
) {
matrixWithDisplayName.validate()
}
override fun visitGroupedTieredPackage(
- groupedTieredPackage: NewPlanGroupedTieredPackagePrice
+ groupedTieredPackage: GroupedTieredPackage
) {
groupedTieredPackage.validate()
}
override fun visitMaxGroupTieredPackage(
- maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice
+ maxGroupTieredPackage: MaxGroupTieredPackage
) {
maxGroupTieredPackage.validate()
}
override fun visitScalableMatrixWithUnitPricing(
- scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice
+ scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing
) {
scalableMatrixWithUnitPricing.validate()
}
override fun visitScalableMatrixWithTieredPricing(
- scalableMatrixWithTieredPricing:
- NewPlanScalableMatrixWithTieredPricingPrice
+ scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing
) {
scalableMatrixWithTieredPricing.validate()
}
override fun visitCumulativeGroupedBulk(
- cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice
+ cumulativeGroupedBulk: CumulativeGroupedBulk
) {
cumulativeGroupedBulk.validate()
}
@@ -2525,9 +2852,7 @@ private constructor(
cumulativeGroupedAllocation.validate()
}
- override fun visitMinimumComposite(
- minimumComposite: NewPlanMinimumCompositePrice
- ) {
+ override fun visitMinimumComposite(minimumComposite: MinimumComposite) {
minimumComposite.validate()
}
@@ -2560,72 +2885,66 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor {
- override fun visitUnit(unit: NewPlanUnitPrice) = unit.validity()
+ override fun visitUnit(unit: Unit) = unit.validity()
- override fun visitTiered(tiered: NewPlanTieredPrice) = tiered.validity()
+ override fun visitTiered(tiered: Tiered) = tiered.validity()
- override fun visitBulk(bulk: NewPlanBulkPrice) = bulk.validity()
+ override fun visitBulk(bulk: Bulk) = bulk.validity()
override fun visitBulkWithFilters(bulkWithFilters: BulkWithFilters) =
bulkWithFilters.validity()
- override fun visitPackage(package_: NewPlanPackagePrice) =
- package_.validity()
+ override fun visitPackage(package_: Package) = package_.validity()
- override fun visitMatrix(matrix: NewPlanMatrixPrice) = matrix.validity()
+ override fun visitMatrix(matrix: Matrix) = matrix.validity()
override fun visitThresholdTotalAmount(
- thresholdTotalAmount: NewPlanThresholdTotalAmountPrice
+ thresholdTotalAmount: ThresholdTotalAmount
) = thresholdTotalAmount.validity()
- override fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice) =
+ override fun visitTieredPackage(tieredPackage: TieredPackage) =
tieredPackage.validity()
- override fun visitTieredWithMinimum(
- tieredWithMinimum: NewPlanTieredWithMinimumPrice
- ) = tieredWithMinimum.validity()
+ override fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) =
+ tieredWithMinimum.validity()
- override fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) =
+ override fun visitGroupedTiered(groupedTiered: GroupedTiered) =
groupedTiered.validity()
override fun visitTieredPackageWithMinimum(
- tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice
+ tieredPackageWithMinimum: TieredPackageWithMinimum
) = tieredPackageWithMinimum.validity()
override fun visitPackageWithAllocation(
- packageWithAllocation: NewPlanPackageWithAllocationPrice
+ packageWithAllocation: PackageWithAllocation
) = packageWithAllocation.validity()
- override fun visitUnitWithPercent(
- unitWithPercent: NewPlanUnitWithPercentPrice
- ) = unitWithPercent.validity()
+ override fun visitUnitWithPercent(unitWithPercent: UnitWithPercent) =
+ unitWithPercent.validity()
override fun visitMatrixWithAllocation(
- matrixWithAllocation: NewPlanMatrixWithAllocationPrice
+ matrixWithAllocation: MatrixWithAllocation
) = matrixWithAllocation.validity()
override fun visitTieredWithProration(
tieredWithProration: TieredWithProration
) = tieredWithProration.validity()
- override fun visitUnitWithProration(
- unitWithProration: NewPlanUnitWithProrationPrice
- ) = unitWithProration.validity()
+ override fun visitUnitWithProration(unitWithProration: UnitWithProration) =
+ unitWithProration.validity()
- override fun visitGroupedAllocation(
- groupedAllocation: NewPlanGroupedAllocationPrice
- ) = groupedAllocation.validity()
+ override fun visitGroupedAllocation(groupedAllocation: GroupedAllocation) =
+ groupedAllocation.validity()
- override fun visitBulkWithProration(
- bulkWithProration: NewPlanBulkWithProrationPrice
- ) = bulkWithProration.validity()
+ override fun visitBulkWithProration(bulkWithProration: BulkWithProration) =
+ bulkWithProration.validity()
override fun visitGroupedWithProratedMinimum(
- groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice
+ groupedWithProratedMinimum: GroupedWithProratedMinimum
) = groupedWithProratedMinimum.validity()
override fun visitGroupedWithMeteredMinimum(
- groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice
+ groupedWithMeteredMinimum: GroupedWithMeteredMinimum
) = groupedWithMeteredMinimum.validity()
override fun visitGroupedWithMinMaxThresholds(
@@ -2633,37 +2952,35 @@ private constructor(
) = groupedWithMinMaxThresholds.validity()
override fun visitMatrixWithDisplayName(
- matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice
+ matrixWithDisplayName: MatrixWithDisplayName
) = matrixWithDisplayName.validity()
override fun visitGroupedTieredPackage(
- groupedTieredPackage: NewPlanGroupedTieredPackagePrice
+ groupedTieredPackage: GroupedTieredPackage
) = groupedTieredPackage.validity()
override fun visitMaxGroupTieredPackage(
- maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice
+ maxGroupTieredPackage: MaxGroupTieredPackage
) = maxGroupTieredPackage.validity()
override fun visitScalableMatrixWithUnitPricing(
- scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice
+ scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing
) = scalableMatrixWithUnitPricing.validity()
override fun visitScalableMatrixWithTieredPricing(
- scalableMatrixWithTieredPricing:
- NewPlanScalableMatrixWithTieredPricingPrice
+ scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing
) = scalableMatrixWithTieredPricing.validity()
override fun visitCumulativeGroupedBulk(
- cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice
+ cumulativeGroupedBulk: CumulativeGroupedBulk
) = cumulativeGroupedBulk.validity()
override fun visitCumulativeGroupedAllocation(
cumulativeGroupedAllocation: CumulativeGroupedAllocation
) = cumulativeGroupedAllocation.validity()
- override fun visitMinimumComposite(
- minimumComposite: NewPlanMinimumCompositePrice
- ) = minimumComposite.validity()
+ override fun visitMinimumComposite(minimumComposite: MinimumComposite) =
+ minimumComposite.validity()
override fun visitPercent(percent: Percent) = percent.validity()
@@ -2679,7 +2996,7 @@ private constructor(
return true
}
- return other is Price &&
+ return other is LicenseAllocationPrice &&
unit == other.unit &&
tiered == other.tiered &&
bulk == other.bulk &&
@@ -2750,496 +3067,493 @@ private constructor(
override fun toString(): String =
when {
- unit != null -> "Price{unit=$unit}"
- tiered != null -> "Price{tiered=$tiered}"
- bulk != null -> "Price{bulk=$bulk}"
- bulkWithFilters != null -> "Price{bulkWithFilters=$bulkWithFilters}"
- package_ != null -> "Price{package_=$package_}"
- matrix != null -> "Price{matrix=$matrix}"
+ unit != null -> "LicenseAllocationPrice{unit=$unit}"
+ tiered != null -> "LicenseAllocationPrice{tiered=$tiered}"
+ bulk != null -> "LicenseAllocationPrice{bulk=$bulk}"
+ bulkWithFilters != null ->
+ "LicenseAllocationPrice{bulkWithFilters=$bulkWithFilters}"
+ package_ != null -> "LicenseAllocationPrice{package_=$package_}"
+ matrix != null -> "LicenseAllocationPrice{matrix=$matrix}"
thresholdTotalAmount != null ->
- "Price{thresholdTotalAmount=$thresholdTotalAmount}"
- tieredPackage != null -> "Price{tieredPackage=$tieredPackage}"
- tieredWithMinimum != null -> "Price{tieredWithMinimum=$tieredWithMinimum}"
- groupedTiered != null -> "Price{groupedTiered=$groupedTiered}"
+ "LicenseAllocationPrice{thresholdTotalAmount=$thresholdTotalAmount}"
+ tieredPackage != null -> "LicenseAllocationPrice{tieredPackage=$tieredPackage}"
+ tieredWithMinimum != null ->
+ "LicenseAllocationPrice{tieredWithMinimum=$tieredWithMinimum}"
+ groupedTiered != null -> "LicenseAllocationPrice{groupedTiered=$groupedTiered}"
tieredPackageWithMinimum != null ->
- "Price{tieredPackageWithMinimum=$tieredPackageWithMinimum}"
+ "LicenseAllocationPrice{tieredPackageWithMinimum=$tieredPackageWithMinimum}"
packageWithAllocation != null ->
- "Price{packageWithAllocation=$packageWithAllocation}"
- unitWithPercent != null -> "Price{unitWithPercent=$unitWithPercent}"
+ "LicenseAllocationPrice{packageWithAllocation=$packageWithAllocation}"
+ unitWithPercent != null ->
+ "LicenseAllocationPrice{unitWithPercent=$unitWithPercent}"
matrixWithAllocation != null ->
- "Price{matrixWithAllocation=$matrixWithAllocation}"
- tieredWithProration != null -> "Price{tieredWithProration=$tieredWithProration}"
- unitWithProration != null -> "Price{unitWithProration=$unitWithProration}"
- groupedAllocation != null -> "Price{groupedAllocation=$groupedAllocation}"
- bulkWithProration != null -> "Price{bulkWithProration=$bulkWithProration}"
+ "LicenseAllocationPrice{matrixWithAllocation=$matrixWithAllocation}"
+ tieredWithProration != null ->
+ "LicenseAllocationPrice{tieredWithProration=$tieredWithProration}"
+ unitWithProration != null ->
+ "LicenseAllocationPrice{unitWithProration=$unitWithProration}"
+ groupedAllocation != null ->
+ "LicenseAllocationPrice{groupedAllocation=$groupedAllocation}"
+ bulkWithProration != null ->
+ "LicenseAllocationPrice{bulkWithProration=$bulkWithProration}"
groupedWithProratedMinimum != null ->
- "Price{groupedWithProratedMinimum=$groupedWithProratedMinimum}"
+ "LicenseAllocationPrice{groupedWithProratedMinimum=$groupedWithProratedMinimum}"
groupedWithMeteredMinimum != null ->
- "Price{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}"
+ "LicenseAllocationPrice{groupedWithMeteredMinimum=$groupedWithMeteredMinimum}"
groupedWithMinMaxThresholds != null ->
- "Price{groupedWithMinMaxThresholds=$groupedWithMinMaxThresholds}"
+ "LicenseAllocationPrice{groupedWithMinMaxThresholds=$groupedWithMinMaxThresholds}"
matrixWithDisplayName != null ->
- "Price{matrixWithDisplayName=$matrixWithDisplayName}"
+ "LicenseAllocationPrice{matrixWithDisplayName=$matrixWithDisplayName}"
groupedTieredPackage != null ->
- "Price{groupedTieredPackage=$groupedTieredPackage}"
+ "LicenseAllocationPrice{groupedTieredPackage=$groupedTieredPackage}"
maxGroupTieredPackage != null ->
- "Price{maxGroupTieredPackage=$maxGroupTieredPackage}"
+ "LicenseAllocationPrice{maxGroupTieredPackage=$maxGroupTieredPackage}"
scalableMatrixWithUnitPricing != null ->
- "Price{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}"
+ "LicenseAllocationPrice{scalableMatrixWithUnitPricing=$scalableMatrixWithUnitPricing}"
scalableMatrixWithTieredPricing != null ->
- "Price{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}"
+ "LicenseAllocationPrice{scalableMatrixWithTieredPricing=$scalableMatrixWithTieredPricing}"
cumulativeGroupedBulk != null ->
- "Price{cumulativeGroupedBulk=$cumulativeGroupedBulk}"
+ "LicenseAllocationPrice{cumulativeGroupedBulk=$cumulativeGroupedBulk}"
cumulativeGroupedAllocation != null ->
- "Price{cumulativeGroupedAllocation=$cumulativeGroupedAllocation}"
- minimumComposite != null -> "Price{minimumComposite=$minimumComposite}"
- percent != null -> "Price{percent=$percent}"
- eventOutput != null -> "Price{eventOutput=$eventOutput}"
- _json != null -> "Price{_unknown=$_json}"
- else -> throw IllegalStateException("Invalid Price")
+ "LicenseAllocationPrice{cumulativeGroupedAllocation=$cumulativeGroupedAllocation}"
+ minimumComposite != null ->
+ "LicenseAllocationPrice{minimumComposite=$minimumComposite}"
+ percent != null -> "LicenseAllocationPrice{percent=$percent}"
+ eventOutput != null -> "LicenseAllocationPrice{eventOutput=$eventOutput}"
+ _json != null -> "LicenseAllocationPrice{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid LicenseAllocationPrice")
}
companion object {
- fun ofUnit(unit: NewPlanUnitPrice) = Price(unit = unit)
+ fun ofUnit(unit: Unit) = LicenseAllocationPrice(unit = unit)
- fun ofTiered(tiered: NewPlanTieredPrice) = Price(tiered = tiered)
+ fun ofTiered(tiered: Tiered) = LicenseAllocationPrice(tiered = tiered)
- fun ofBulk(bulk: NewPlanBulkPrice) = Price(bulk = bulk)
+ fun ofBulk(bulk: Bulk) = LicenseAllocationPrice(bulk = bulk)
fun ofBulkWithFilters(bulkWithFilters: BulkWithFilters) =
- Price(bulkWithFilters = bulkWithFilters)
+ LicenseAllocationPrice(bulkWithFilters = bulkWithFilters)
- fun ofPackage(package_: NewPlanPackagePrice) = Price(package_ = package_)
+ fun ofPackage(package_: Package) = LicenseAllocationPrice(package_ = package_)
- fun ofMatrix(matrix: NewPlanMatrixPrice) = Price(matrix = matrix)
+ fun ofMatrix(matrix: Matrix) = LicenseAllocationPrice(matrix = matrix)
- fun ofThresholdTotalAmount(thresholdTotalAmount: NewPlanThresholdTotalAmountPrice) =
- Price(thresholdTotalAmount = thresholdTotalAmount)
+ fun ofThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount) =
+ LicenseAllocationPrice(thresholdTotalAmount = thresholdTotalAmount)
- fun ofTieredPackage(tieredPackage: NewPlanTieredPackagePrice) =
- Price(tieredPackage = tieredPackage)
+ fun ofTieredPackage(tieredPackage: TieredPackage) =
+ LicenseAllocationPrice(tieredPackage = tieredPackage)
- fun ofTieredWithMinimum(tieredWithMinimum: NewPlanTieredWithMinimumPrice) =
- Price(tieredWithMinimum = tieredWithMinimum)
+ fun ofTieredWithMinimum(tieredWithMinimum: TieredWithMinimum) =
+ LicenseAllocationPrice(tieredWithMinimum = tieredWithMinimum)
- fun ofGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice) =
- Price(groupedTiered = groupedTiered)
+ fun ofGroupedTiered(groupedTiered: GroupedTiered) =
+ LicenseAllocationPrice(groupedTiered = groupedTiered)
- fun ofTieredPackageWithMinimum(
- tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice
- ) = Price(tieredPackageWithMinimum = tieredPackageWithMinimum)
+ fun ofTieredPackageWithMinimum(tieredPackageWithMinimum: TieredPackageWithMinimum) =
+ LicenseAllocationPrice(tieredPackageWithMinimum = tieredPackageWithMinimum)
- fun ofPackageWithAllocation(
- packageWithAllocation: NewPlanPackageWithAllocationPrice
- ) = Price(packageWithAllocation = packageWithAllocation)
+ fun ofPackageWithAllocation(packageWithAllocation: PackageWithAllocation) =
+ LicenseAllocationPrice(packageWithAllocation = packageWithAllocation)
- fun ofUnitWithPercent(unitWithPercent: NewPlanUnitWithPercentPrice) =
- Price(unitWithPercent = unitWithPercent)
+ fun ofUnitWithPercent(unitWithPercent: UnitWithPercent) =
+ LicenseAllocationPrice(unitWithPercent = unitWithPercent)
- fun ofMatrixWithAllocation(matrixWithAllocation: NewPlanMatrixWithAllocationPrice) =
- Price(matrixWithAllocation = matrixWithAllocation)
+ fun ofMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation) =
+ LicenseAllocationPrice(matrixWithAllocation = matrixWithAllocation)
fun ofTieredWithProration(tieredWithProration: TieredWithProration) =
- Price(tieredWithProration = tieredWithProration)
+ LicenseAllocationPrice(tieredWithProration = tieredWithProration)
- fun ofUnitWithProration(unitWithProration: NewPlanUnitWithProrationPrice) =
- Price(unitWithProration = unitWithProration)
+ fun ofUnitWithProration(unitWithProration: UnitWithProration) =
+ LicenseAllocationPrice(unitWithProration = unitWithProration)
- fun ofGroupedAllocation(groupedAllocation: NewPlanGroupedAllocationPrice) =
- Price(groupedAllocation = groupedAllocation)
+ fun ofGroupedAllocation(groupedAllocation: GroupedAllocation) =
+ LicenseAllocationPrice(groupedAllocation = groupedAllocation)
- fun ofBulkWithProration(bulkWithProration: NewPlanBulkWithProrationPrice) =
- Price(bulkWithProration = bulkWithProration)
+ fun ofBulkWithProration(bulkWithProration: BulkWithProration) =
+ LicenseAllocationPrice(bulkWithProration = bulkWithProration)
fun ofGroupedWithProratedMinimum(
- groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice
- ) = Price(groupedWithProratedMinimum = groupedWithProratedMinimum)
+ groupedWithProratedMinimum: GroupedWithProratedMinimum
+ ) = LicenseAllocationPrice(groupedWithProratedMinimum = groupedWithProratedMinimum)
fun ofGroupedWithMeteredMinimum(
- groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice
- ) = Price(groupedWithMeteredMinimum = groupedWithMeteredMinimum)
+ groupedWithMeteredMinimum: GroupedWithMeteredMinimum
+ ) = LicenseAllocationPrice(groupedWithMeteredMinimum = groupedWithMeteredMinimum)
fun ofGroupedWithMinMaxThresholds(
groupedWithMinMaxThresholds: GroupedWithMinMaxThresholds
- ) = Price(groupedWithMinMaxThresholds = groupedWithMinMaxThresholds)
+ ) =
+ LicenseAllocationPrice(
+ groupedWithMinMaxThresholds = groupedWithMinMaxThresholds
+ )
- fun ofMatrixWithDisplayName(
- matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice
- ) = Price(matrixWithDisplayName = matrixWithDisplayName)
+ fun ofMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName) =
+ LicenseAllocationPrice(matrixWithDisplayName = matrixWithDisplayName)
- fun ofGroupedTieredPackage(groupedTieredPackage: NewPlanGroupedTieredPackagePrice) =
- Price(groupedTieredPackage = groupedTieredPackage)
+ fun ofGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage) =
+ LicenseAllocationPrice(groupedTieredPackage = groupedTieredPackage)
- fun ofMaxGroupTieredPackage(
- maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice
- ) = Price(maxGroupTieredPackage = maxGroupTieredPackage)
+ fun ofMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage) =
+ LicenseAllocationPrice(maxGroupTieredPackage = maxGroupTieredPackage)
fun ofScalableMatrixWithUnitPricing(
- scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice
- ) = Price(scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing)
+ scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing
+ ) =
+ LicenseAllocationPrice(
+ scalableMatrixWithUnitPricing = scalableMatrixWithUnitPricing
+ )
fun ofScalableMatrixWithTieredPricing(
- scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice
- ) = Price(scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing)
+ scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing
+ ) =
+ LicenseAllocationPrice(
+ scalableMatrixWithTieredPricing = scalableMatrixWithTieredPricing
+ )
- fun ofCumulativeGroupedBulk(
- cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice
- ) = Price(cumulativeGroupedBulk = cumulativeGroupedBulk)
+ fun ofCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk) =
+ LicenseAllocationPrice(cumulativeGroupedBulk = cumulativeGroupedBulk)
fun ofCumulativeGroupedAllocation(
cumulativeGroupedAllocation: CumulativeGroupedAllocation
- ) = Price(cumulativeGroupedAllocation = cumulativeGroupedAllocation)
+ ) =
+ LicenseAllocationPrice(
+ cumulativeGroupedAllocation = cumulativeGroupedAllocation
+ )
- fun ofMinimumComposite(minimumComposite: NewPlanMinimumCompositePrice) =
- Price(minimumComposite = minimumComposite)
+ fun ofMinimumComposite(minimumComposite: MinimumComposite) =
+ LicenseAllocationPrice(minimumComposite = minimumComposite)
- fun ofPercent(percent: Percent) = Price(percent = percent)
+ fun ofPercent(percent: Percent) = LicenseAllocationPrice(percent = percent)
- fun ofEventOutput(eventOutput: EventOutput) = Price(eventOutput = eventOutput)
+ fun ofEventOutput(eventOutput: EventOutput) =
+ LicenseAllocationPrice(eventOutput = eventOutput)
}
/**
- * An interface that defines how to map each variant of [Price] to a value of type [T].
+ * An interface that defines how to map each variant of [LicenseAllocationPrice] to a
+ * value of type [T].
*/
interface Visitor {
- fun visitUnit(unit: NewPlanUnitPrice): T
+ fun visitUnit(unit: Unit): T
- fun visitTiered(tiered: NewPlanTieredPrice): T
+ fun visitTiered(tiered: Tiered): T
- fun visitBulk(bulk: NewPlanBulkPrice): T
+ fun visitBulk(bulk: Bulk): T
fun visitBulkWithFilters(bulkWithFilters: BulkWithFilters): T
- fun visitPackage(package_: NewPlanPackagePrice): T
+ fun visitPackage(package_: Package): T
- fun visitMatrix(matrix: NewPlanMatrixPrice): T
+ fun visitMatrix(matrix: Matrix): T
- fun visitThresholdTotalAmount(
- thresholdTotalAmount: NewPlanThresholdTotalAmountPrice
- ): T
+ fun visitThresholdTotalAmount(thresholdTotalAmount: ThresholdTotalAmount): T
- fun visitTieredPackage(tieredPackage: NewPlanTieredPackagePrice): T
+ fun visitTieredPackage(tieredPackage: TieredPackage): T
- fun visitTieredWithMinimum(tieredWithMinimum: NewPlanTieredWithMinimumPrice): T
+ fun visitTieredWithMinimum(tieredWithMinimum: TieredWithMinimum): T
- fun visitGroupedTiered(groupedTiered: NewPlanGroupedTieredPrice): T
+ fun visitGroupedTiered(groupedTiered: GroupedTiered): T
fun visitTieredPackageWithMinimum(
- tieredPackageWithMinimum: NewPlanTieredPackageWithMinimumPrice
+ tieredPackageWithMinimum: TieredPackageWithMinimum
): T
- fun visitPackageWithAllocation(
- packageWithAllocation: NewPlanPackageWithAllocationPrice
- ): T
+ fun visitPackageWithAllocation(packageWithAllocation: PackageWithAllocation): T
- fun visitUnitWithPercent(unitWithPercent: NewPlanUnitWithPercentPrice): T
+ fun visitUnitWithPercent(unitWithPercent: UnitWithPercent): T
- fun visitMatrixWithAllocation(
- matrixWithAllocation: NewPlanMatrixWithAllocationPrice
- ): T
+ fun visitMatrixWithAllocation(matrixWithAllocation: MatrixWithAllocation): T
fun visitTieredWithProration(tieredWithProration: TieredWithProration): T
- fun visitUnitWithProration(unitWithProration: NewPlanUnitWithProrationPrice): T
+ fun visitUnitWithProration(unitWithProration: UnitWithProration): T
- fun visitGroupedAllocation(groupedAllocation: NewPlanGroupedAllocationPrice): T
+ fun visitGroupedAllocation(groupedAllocation: GroupedAllocation): T
- fun visitBulkWithProration(bulkWithProration: NewPlanBulkWithProrationPrice): T
+ fun visitBulkWithProration(bulkWithProration: BulkWithProration): T
fun visitGroupedWithProratedMinimum(
- groupedWithProratedMinimum: NewPlanGroupedWithProratedMinimumPrice
+ groupedWithProratedMinimum: GroupedWithProratedMinimum
): T
fun visitGroupedWithMeteredMinimum(
- groupedWithMeteredMinimum: NewPlanGroupedWithMeteredMinimumPrice
+ groupedWithMeteredMinimum: GroupedWithMeteredMinimum
): T
fun visitGroupedWithMinMaxThresholds(
groupedWithMinMaxThresholds: GroupedWithMinMaxThresholds
): T
- fun visitMatrixWithDisplayName(
- matrixWithDisplayName: NewPlanMatrixWithDisplayNamePrice
- ): T
+ fun visitMatrixWithDisplayName(matrixWithDisplayName: MatrixWithDisplayName): T
- fun visitGroupedTieredPackage(
- groupedTieredPackage: NewPlanGroupedTieredPackagePrice
- ): T
+ fun visitGroupedTieredPackage(groupedTieredPackage: GroupedTieredPackage): T
- fun visitMaxGroupTieredPackage(
- maxGroupTieredPackage: NewPlanMaxGroupTieredPackagePrice
- ): T
+ fun visitMaxGroupTieredPackage(maxGroupTieredPackage: MaxGroupTieredPackage): T
fun visitScalableMatrixWithUnitPricing(
- scalableMatrixWithUnitPricing: NewPlanScalableMatrixWithUnitPricingPrice
+ scalableMatrixWithUnitPricing: ScalableMatrixWithUnitPricing
): T
fun visitScalableMatrixWithTieredPricing(
- scalableMatrixWithTieredPricing: NewPlanScalableMatrixWithTieredPricingPrice
+ scalableMatrixWithTieredPricing: ScalableMatrixWithTieredPricing
): T
- fun visitCumulativeGroupedBulk(
- cumulativeGroupedBulk: NewPlanCumulativeGroupedBulkPrice
- ): T
+ fun visitCumulativeGroupedBulk(cumulativeGroupedBulk: CumulativeGroupedBulk): T
fun visitCumulativeGroupedAllocation(
cumulativeGroupedAllocation: CumulativeGroupedAllocation
): T
- fun visitMinimumComposite(minimumComposite: NewPlanMinimumCompositePrice): T
+ fun visitMinimumComposite(minimumComposite: MinimumComposite): T
fun visitPercent(percent: Percent): T
fun visitEventOutput(eventOutput: EventOutput): T
/**
- * Maps an unknown variant of [Price] to a value of type [T].
+ * Maps an unknown variant of [LicenseAllocationPrice] to a value of type [T].
*
- * An instance of [Price] can contain an unknown variant if it was deserialized from
- * data that doesn't match any known variant. For example, if the SDK is on an older
- * version than the API, then the API may respond with new variants that the SDK is
- * unaware of.
+ * An instance of [LicenseAllocationPrice] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new
+ * variants that the SDK is unaware of.
*
* @throws OrbInvalidDataException in the default implementation.
*/
fun unknown(json: JsonValue?): T {
- throw OrbInvalidDataException("Unknown Price: $json")
+ throw OrbInvalidDataException("Unknown LicenseAllocationPrice: $json")
}
}
- internal class Deserializer : BaseDeserializer(Price::class) {
+ internal class Deserializer :
+ BaseDeserializer(LicenseAllocationPrice::class) {
- override fun ObjectCodec.deserialize(node: JsonNode): Price {
+ override fun ObjectCodec.deserialize(node: JsonNode): LicenseAllocationPrice {
val json = JsonValue.fromJsonNode(node)
val modelType = json.asObject()?.get("model_type")?.asString()
when (modelType) {
"unit" -> {
- return tryDeserialize(node, jacksonTypeRef())?.let {
- Price(unit = it, _json = json)
- } ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(unit = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"tiered" -> {
- return tryDeserialize(node, jacksonTypeRef())?.let {
- Price(tiered = it, _json = json)
- } ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(tiered = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"bulk" -> {
- return tryDeserialize(node, jacksonTypeRef())?.let {
- Price(bulk = it, _json = json)
- } ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(bulk = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"bulk_with_filters" -> {
return tryDeserialize(node, jacksonTypeRef())?.let {
- Price(bulkWithFilters = it, _json = json)
- } ?: Price(_json = json)
+ LicenseAllocationPrice(bulkWithFilters = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"package" -> {
- return tryDeserialize(node, jacksonTypeRef())
- ?.let { Price(package_ = it, _json = json) } ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(package_ = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"matrix" -> {
- return tryDeserialize(node, jacksonTypeRef())?.let {
- Price(matrix = it, _json = json)
- } ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(matrix = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"threshold_total_amount" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(thresholdTotalAmount = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(thresholdTotalAmount = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"tiered_package" -> {
- return tryDeserialize(node, jacksonTypeRef())
- ?.let { Price(tieredPackage = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(tieredPackage = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"tiered_with_minimum" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(tieredWithMinimum = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(tieredWithMinimum = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"grouped_tiered" -> {
- return tryDeserialize(node, jacksonTypeRef())
- ?.let { Price(groupedTiered = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(groupedTiered = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"tiered_package_with_minimum" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(tieredPackageWithMinimum = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(
+ tieredPackageWithMinimum = it,
+ _json = json,
+ )
+ } ?: LicenseAllocationPrice(_json = json)
}
"package_with_allocation" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(packageWithAllocation = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(packageWithAllocation = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"unit_with_percent" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(unitWithPercent = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(unitWithPercent = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"matrix_with_allocation" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(matrixWithAllocation = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(matrixWithAllocation = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"tiered_with_proration" -> {
return tryDeserialize(node, jacksonTypeRef())
- ?.let { Price(tieredWithProration = it, _json = json) }
- ?: Price(_json = json)
+ ?.let {
+ LicenseAllocationPrice(tieredWithProration = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"unit_with_proration" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(unitWithProration = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(unitWithProration = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"grouped_allocation" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(groupedAllocation = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(groupedAllocation = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"bulk_with_proration" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(bulkWithProration = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(bulkWithProration = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"grouped_with_prorated_minimum" -> {
return tryDeserialize(
node,
- jacksonTypeRef(),
+ jacksonTypeRef(),
)
- ?.let { Price(groupedWithProratedMinimum = it, _json = json) }
- ?: Price(_json = json)
+ ?.let {
+ LicenseAllocationPrice(
+ groupedWithProratedMinimum = it,
+ _json = json,
+ )
+ } ?: LicenseAllocationPrice(_json = json)
}
"grouped_with_metered_minimum" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(groupedWithMeteredMinimum = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(
+ groupedWithMeteredMinimum = it,
+ _json = json,
+ )
+ } ?: LicenseAllocationPrice(_json = json)
}
"grouped_with_min_max_thresholds" -> {
return tryDeserialize(
node,
jacksonTypeRef(),
)
- ?.let { Price(groupedWithMinMaxThresholds = it, _json = json) }
- ?: Price(_json = json)
+ ?.let {
+ LicenseAllocationPrice(
+ groupedWithMinMaxThresholds = it,
+ _json = json,
+ )
+ } ?: LicenseAllocationPrice(_json = json)
}
"matrix_with_display_name" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(matrixWithDisplayName = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(matrixWithDisplayName = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"grouped_tiered_package" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(groupedTieredPackage = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(groupedTieredPackage = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"max_group_tiered_package" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(maxGroupTieredPackage = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(maxGroupTieredPackage = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"scalable_matrix_with_unit_pricing" -> {
return tryDeserialize(
node,
- jacksonTypeRef(),
+ jacksonTypeRef(),
)
- ?.let { Price(scalableMatrixWithUnitPricing = it, _json = json) }
- ?: Price(_json = json)
+ ?.let {
+ LicenseAllocationPrice(
+ scalableMatrixWithUnitPricing = it,
+ _json = json,
+ )
+ } ?: LicenseAllocationPrice(_json = json)
}
"scalable_matrix_with_tiered_pricing" -> {
return tryDeserialize(
node,
- jacksonTypeRef(),
+ jacksonTypeRef(),
)
- ?.let { Price(scalableMatrixWithTieredPricing = it, _json = json) }
- ?: Price(_json = json)
+ ?.let {
+ LicenseAllocationPrice(
+ scalableMatrixWithTieredPricing = it,
+ _json = json,
+ )
+ } ?: LicenseAllocationPrice(_json = json)
}
"cumulative_grouped_bulk" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(cumulativeGroupedBulk = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let {
+ LicenseAllocationPrice(cumulativeGroupedBulk = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"cumulative_grouped_allocation" -> {
return tryDeserialize(
node,
jacksonTypeRef(),
)
- ?.let { Price(cumulativeGroupedAllocation = it, _json = json) }
- ?: Price(_json = json)
+ ?.let {
+ LicenseAllocationPrice(
+ cumulativeGroupedAllocation = it,
+ _json = json,
+ )
+ } ?: LicenseAllocationPrice(_json = json)
}
"minimum_composite" -> {
- return tryDeserialize(
- node,
- jacksonTypeRef(),
- )
- ?.let { Price(minimumComposite = it, _json = json) }
- ?: Price(_json = json)
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ LicenseAllocationPrice(minimumComposite = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"percent" -> {
return tryDeserialize(node, jacksonTypeRef())?.let {
- Price(percent = it, _json = json)
- } ?: Price(_json = json)
+ LicenseAllocationPrice(percent = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
"event_output" -> {
return tryDeserialize(node, jacksonTypeRef())?.let {
- Price(eventOutput = it, _json = json)
- } ?: Price(_json = json)
+ LicenseAllocationPrice(eventOutput = it, _json = json)
+ } ?: LicenseAllocationPrice(_json = json)
}
}
- return Price(_json = json)
+ return LicenseAllocationPrice(_json = json)
}
}
- internal class Serializer : BaseSerializer(Price::class) {
+ internal class Serializer :
+ BaseSerializer(LicenseAllocationPrice::class) {
override fun serialize(
- value: Price,
+ value: LicenseAllocationPrice,
generator: JsonGenerator,
provider: SerializerProvider,
) {
@@ -3298,19 +3612,20 @@ private constructor(
value.percent != null -> generator.writeObject(value.percent)
value.eventOutput != null -> generator.writeObject(value.eventOutput)
value._json != null -> generator.writeObject(value._json)
- else -> throw IllegalStateException("Invalid Price")
+ else -> throw IllegalStateException("Invalid LicenseAllocationPrice")
}
}
}
- class BulkWithFilters
+ class Unit
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
- private val bulkWithFiltersConfig: JsonField,
private val cadence: JsonField,
private val itemId: JsonField,
+ private val licenseAllocations: JsonField>,
private val modelType: JsonValue,
private val name: JsonField,
+ private val unitConfig: JsonField,
private val billableMetricId: JsonField,
private val billedInAdvance: JsonField,
private val billingCycleConfiguration: JsonField,
@@ -3323,6 +3638,7 @@ private constructor(
private val fixedPriceQuantity: JsonField,
private val invoiceGroupingKey: JsonField,
private val invoicingCycleConfiguration: JsonField,
+ private val licenseTypeId: JsonField,
private val metadata: JsonField,
private val referenceId: JsonField,
private val additionalProperties: MutableMap,
@@ -3330,21 +3646,24 @@ private constructor(
@JsonCreator
private constructor(
- @JsonProperty("bulk_with_filters_config")
- @ExcludeMissing
- bulkWithFiltersConfig: JsonField = JsonMissing.of(),
@JsonProperty("cadence")
@ExcludeMissing
cadence: JsonField = JsonMissing.of(),
@JsonProperty("item_id")
@ExcludeMissing
itemId: JsonField = JsonMissing.of(),
+ @JsonProperty("license_allocations")
+ @ExcludeMissing
+ licenseAllocations: JsonField> = JsonMissing.of(),
@JsonProperty("model_type")
@ExcludeMissing
modelType: JsonValue = JsonMissing.of(),
@JsonProperty("name")
@ExcludeMissing
name: JsonField = JsonMissing.of(),
+ @JsonProperty("unit_config")
+ @ExcludeMissing
+ unitConfig: JsonField = JsonMissing.of(),
@JsonProperty("billable_metric_id")
@ExcludeMissing
billableMetricId: JsonField = JsonMissing.of(),
@@ -3381,6 +3700,9 @@ private constructor(
@ExcludeMissing
invoicingCycleConfiguration: JsonField =
JsonMissing.of(),
+ @JsonProperty("license_type_id")
+ @ExcludeMissing
+ licenseTypeId: JsonField = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField = JsonMissing.of(),
@@ -3388,11 +3710,12 @@ private constructor(
@ExcludeMissing
referenceId: JsonField = JsonMissing.of(),
) : this(
- bulkWithFiltersConfig,
cadence,
itemId,
+ licenseAllocations,
modelType,
name,
+ unitConfig,
billableMetricId,
billedInAdvance,
billingCycleConfiguration,
@@ -3404,45 +3727,48 @@ private constructor(
fixedPriceQuantity,
invoiceGroupingKey,
invoicingCycleConfiguration,
+ licenseTypeId,
metadata,
referenceId,
mutableMapOf(),
)
/**
- * Configuration for bulk_with_filters pricing
+ * The cadence to bill for this price on.
*
* @throws OrbInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected
* value).
*/
- fun bulkWithFiltersConfig(): BulkWithFiltersConfig =
- bulkWithFiltersConfig.getRequired("bulk_with_filters_config")
+ fun cadence(): Cadence = cadence.getRequired("cadence")
/**
- * The cadence to bill for this price on.
+ * The id of the item the price will be associated with.
*
* @throws OrbInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected
* value).
*/
- fun cadence(): Cadence = cadence.getRequired("cadence")
+ fun itemId(): String = itemId.getRequired("item_id")
/**
- * The id of the item the price will be associated with.
+ * License allocations to associate with this price. Each entry defines a
+ * per-license credit pool granted each cadence. Requires license_type_id or
+ * license_type_configuration to be set.
*
* @throws OrbInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected
* value).
*/
- fun itemId(): String = itemId.getRequired("item_id")
+ fun licenseAllocations(): List =
+ licenseAllocations.getRequired("license_allocations")
/**
* The pricing model type
*
* Expected to always return the following:
* ```kotlin
- * JsonValue.from("bulk_with_filters")
+ * JsonValue.from("unit")
* ```
*
* However, this method can be useful for debugging and logging (e.g. if the server
@@ -3459,6 +3785,15 @@ private constructor(
*/
fun name(): String = name.getRequired("name")
+ /**
+ * Configuration for unit pricing
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun unitConfig(): UnitConfig = unitConfig.getRequired("unit_config")
+
/**
* The id of the billable metric for the price. Only needed if the price is
* usage-based.
@@ -3559,6 +3894,14 @@ private constructor(
fun invoicingCycleConfiguration(): NewBillingCycleConfiguration? =
invoicingCycleConfiguration.getNullable("invoicing_cycle_configuration")
+ /**
+ * The ID of the license type to associate with this price.
+ *
+ * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun licenseTypeId(): String? = licenseTypeId.getNullable("license_type_id")
+
/**
* User-specified key/value pairs for the resource. Individual keys can be removed
* by setting the value to `null`, and the entire metadata mapping can be cleared by
@@ -3578,17 +3921,6 @@ private constructor(
*/
fun referenceId(): String? = referenceId.getNullable("reference_id")
- /**
- * Returns the raw JSON value of [bulkWithFiltersConfig].
- *
- * Unlike [bulkWithFiltersConfig], this method doesn't throw if the JSON field has
- * an unexpected type.
- */
- @JsonProperty("bulk_with_filters_config")
- @ExcludeMissing
- fun _bulkWithFiltersConfig(): JsonField =
- bulkWithFiltersConfig
-
/**
* Returns the raw JSON value of [cadence].
*
@@ -3607,6 +3939,16 @@ private constructor(
*/
@JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField = itemId
+ /**
+ * Returns the raw JSON value of [licenseAllocations].
+ *
+ * Unlike [licenseAllocations], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("license_allocations")
+ @ExcludeMissing
+ fun _licenseAllocations(): JsonField> = licenseAllocations
+
/**
* Returns the raw JSON value of [name].
*
@@ -3615,6 +3957,16 @@ private constructor(
*/
@JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+ /**
+ * Returns the raw JSON value of [unitConfig].
+ *
+ * Unlike [unitConfig], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("unit_config")
+ @ExcludeMissing
+ fun _unitConfig(): JsonField = unitConfig
+
/**
* Returns the raw JSON value of [billableMetricId].
*
@@ -3728,6 +4080,16 @@ private constructor(
fun _invoicingCycleConfiguration(): JsonField =
invoicingCycleConfiguration
+ /**
+ * Returns the raw JSON value of [licenseTypeId].
+ *
+ * Unlike [licenseTypeId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("license_type_id")
+ @ExcludeMissing
+ fun _licenseTypeId(): JsonField = licenseTypeId
+
/**
* Returns the raw JSON value of [metadata].
*
@@ -3763,27 +4125,30 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of [BulkWithFilters].
+ * Returns a mutable builder for constructing an instance of [Unit].
*
* The following fields are required:
* ```kotlin
- * .bulkWithFiltersConfig()
* .cadence()
* .itemId()
+ * .licenseAllocations()
* .name()
+ * .unitConfig()
* ```
*/
fun builder() = Builder()
}
- /** A builder for [BulkWithFilters]. */
+ /** A builder for [Unit]. */
class Builder internal constructor() {
- private var bulkWithFiltersConfig: JsonField? = null
private var cadence: JsonField? = null
private var itemId: JsonField? = null
- private var modelType: JsonValue = JsonValue.from("bulk_with_filters")
+ private var licenseAllocations: JsonField>? =
+ null
+ private var modelType: JsonValue = JsonValue.from("unit")
private var name: JsonField? = null
+ private var unitConfig: JsonField? = null
private var billableMetricId: JsonField = JsonMissing.of()
private var billedInAdvance: JsonField = JsonMissing.of()
private var billingCycleConfiguration: JsonField =
@@ -3801,48 +4166,35 @@ private constructor(
private var invoicingCycleConfiguration:
JsonField =
JsonMissing.of()
+ private var licenseTypeId: JsonField = JsonMissing.of()
private var metadata: JsonField = JsonMissing.of()
private var referenceId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
- internal fun from(bulkWithFilters: BulkWithFilters) = apply {
- bulkWithFiltersConfig = bulkWithFilters.bulkWithFiltersConfig
- cadence = bulkWithFilters.cadence
- itemId = bulkWithFilters.itemId
- modelType = bulkWithFilters.modelType
- name = bulkWithFilters.name
- billableMetricId = bulkWithFilters.billableMetricId
- billedInAdvance = bulkWithFilters.billedInAdvance
- billingCycleConfiguration = bulkWithFilters.billingCycleConfiguration
- conversionRate = bulkWithFilters.conversionRate
- conversionRateConfig = bulkWithFilters.conversionRateConfig
- currency = bulkWithFilters.currency
- dimensionalPriceConfiguration =
- bulkWithFilters.dimensionalPriceConfiguration
- externalPriceId = bulkWithFilters.externalPriceId
- fixedPriceQuantity = bulkWithFilters.fixedPriceQuantity
- invoiceGroupingKey = bulkWithFilters.invoiceGroupingKey
- invoicingCycleConfiguration = bulkWithFilters.invoicingCycleConfiguration
- metadata = bulkWithFilters.metadata
- referenceId = bulkWithFilters.referenceId
- additionalProperties = bulkWithFilters.additionalProperties.toMutableMap()
+ internal fun from(unit: Unit) = apply {
+ cadence = unit.cadence
+ itemId = unit.itemId
+ licenseAllocations = unit.licenseAllocations.map { it.toMutableList() }
+ modelType = unit.modelType
+ name = unit.name
+ unitConfig = unit.unitConfig
+ billableMetricId = unit.billableMetricId
+ billedInAdvance = unit.billedInAdvance
+ billingCycleConfiguration = unit.billingCycleConfiguration
+ conversionRate = unit.conversionRate
+ conversionRateConfig = unit.conversionRateConfig
+ currency = unit.currency
+ dimensionalPriceConfiguration = unit.dimensionalPriceConfiguration
+ externalPriceId = unit.externalPriceId
+ fixedPriceQuantity = unit.fixedPriceQuantity
+ invoiceGroupingKey = unit.invoiceGroupingKey
+ invoicingCycleConfiguration = unit.invoicingCycleConfiguration
+ licenseTypeId = unit.licenseTypeId
+ metadata = unit.metadata
+ referenceId = unit.referenceId
+ additionalProperties = unit.additionalProperties.toMutableMap()
}
- /** Configuration for bulk_with_filters pricing */
- fun bulkWithFiltersConfig(bulkWithFiltersConfig: BulkWithFiltersConfig) =
- bulkWithFiltersConfig(JsonField.of(bulkWithFiltersConfig))
-
- /**
- * Sets [Builder.bulkWithFiltersConfig] to an arbitrary JSON value.
- *
- * You should usually call [Builder.bulkWithFiltersConfig] with a well-typed
- * [BulkWithFiltersConfig] value instead. This method is primarily for setting
- * the field to an undocumented or not yet supported value.
- */
- fun bulkWithFiltersConfig(
- bulkWithFiltersConfig: JsonField
- ) = apply { this.bulkWithFiltersConfig = bulkWithFiltersConfig }
-
/** The cadence to bill for this price on. */
fun cadence(cadence: Cadence) = cadence(JsonField.of(cadence))
@@ -3867,13 +4219,45 @@ private constructor(
*/
fun itemId(itemId: JsonField) = apply { this.itemId = itemId }
+ /**
+ * License allocations to associate with this price. Each entry defines a
+ * per-license credit pool granted each cadence. Requires license_type_id or
+ * license_type_configuration to be set.
+ */
+ fun licenseAllocations(licenseAllocations: List) =
+ licenseAllocations(JsonField.of(licenseAllocations))
+
+ /**
+ * Sets [Builder.licenseAllocations] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.licenseAllocations] with a well-typed
+ * `List` value instead. This method is primarily for setting
+ * the field to an undocumented or not yet supported value.
+ */
+ fun licenseAllocations(licenseAllocations: JsonField>) =
+ apply {
+ this.licenseAllocations = licenseAllocations.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [LicenseAllocation] to [licenseAllocations].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addLicenseAllocation(licenseAllocation: LicenseAllocation) = apply {
+ licenseAllocations =
+ (licenseAllocations ?: JsonField.of(mutableListOf())).also {
+ checkKnown("licenseAllocations", it).add(licenseAllocation)
+ }
+ }
+
/**
* Sets the field to an arbitrary JSON value.
*
* It is usually unnecessary to call this method because the field defaults to
* the following:
* ```kotlin
- * JsonValue.from("bulk_with_filters")
+ * JsonValue.from("unit")
* ```
*
* This method is primarily for setting the field to an undocumented or not yet
@@ -3893,6 +4277,20 @@ private constructor(
*/
fun name(name: JsonField) = apply { this.name = name }
+ /** Configuration for unit pricing */
+ fun unitConfig(unitConfig: UnitConfig) = unitConfig(JsonField.of(unitConfig))
+
+ /**
+ * Sets [Builder.unitConfig] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.unitConfig] with a well-typed [UnitConfig]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun unitConfig(unitConfig: JsonField) = apply {
+ this.unitConfig = unitConfig
+ }
+
/**
* The id of the billable metric for the price. Only needed if the price is
* usage-based.
@@ -4165,6 +4563,21 @@ private constructor(
invoicingCycleConfiguration: JsonField
) = apply { this.invoicingCycleConfiguration = invoicingCycleConfiguration }
+ /** The ID of the license type to associate with this price. */
+ fun licenseTypeId(licenseTypeId: String?) =
+ licenseTypeId(JsonField.ofNullable(licenseTypeId))
+
+ /**
+ * Sets [Builder.licenseTypeId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.licenseTypeId] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun licenseTypeId(licenseTypeId: JsonField) = apply {
+ this.licenseTypeId = licenseTypeId
+ }
+
/**
* User-specified key/value pairs for the resource. Individual keys can be
* removed by setting the value to `null`, and the entire metadata mapping can
@@ -4222,27 +4635,31 @@ private constructor(
}
/**
- * Returns an immutable instance of [BulkWithFilters].
+ * Returns an immutable instance of [Unit].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```kotlin
- * .bulkWithFiltersConfig()
* .cadence()
* .itemId()
+ * .licenseAllocations()
* .name()
+ * .unitConfig()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): BulkWithFilters =
- BulkWithFilters(
- checkRequired("bulkWithFiltersConfig", bulkWithFiltersConfig),
+ fun build(): Unit =
+ Unit(
checkRequired("cadence", cadence),
checkRequired("itemId", itemId),
+ checkRequired("licenseAllocations", licenseAllocations).map {
+ it.toImmutable()
+ },
modelType,
checkRequired("name", name),
+ checkRequired("unitConfig", unitConfig),
billableMetricId,
billedInAdvance,
billingCycleConfiguration,
@@ -4254,6 +4671,7 @@ private constructor(
fixedPriceQuantity,
invoiceGroupingKey,
invoicingCycleConfiguration,
+ licenseTypeId,
metadata,
referenceId,
additionalProperties.toMutableMap(),
@@ -4262,20 +4680,21 @@ private constructor(
private var validated: Boolean = false
- fun validate(): BulkWithFilters = apply {
+ fun validate(): Unit = apply {
if (validated) {
return@apply
}
- bulkWithFiltersConfig().validate()
cadence().validate()
itemId()
+ licenseAllocations().forEach { it.validate() }
_modelType().let {
- if (it != JsonValue.from("bulk_with_filters")) {
+ if (it != JsonValue.from("unit")) {
throw OrbInvalidDataException("'modelType' is invalid, received $it")
}
}
name()
+ unitConfig().validate()
billableMetricId()
billedInAdvance()
billingCycleConfiguration()?.validate()
@@ -4287,6 +4706,7 @@ private constructor(
fixedPriceQuantity()
invoiceGroupingKey()
invoicingCycleConfiguration()?.validate()
+ licenseTypeId()
metadata()?.validate()
referenceId()
validated = true
@@ -4307,11 +4727,12 @@ private constructor(
* Used for best match union deserialization.
*/
internal fun validity(): Int =
- (bulkWithFiltersConfig.asKnown()?.validity() ?: 0) +
- (cadence.asKnown()?.validity() ?: 0) +
+ (cadence.asKnown()?.validity() ?: 0) +
(if (itemId.asKnown() == null) 0 else 1) +
- modelType.let { if (it == JsonValue.from("bulk_with_filters")) 1 else 0 } +
+ (licenseAllocations.asKnown()?.sumOf { it.validity().toInt() } ?: 0) +
+ modelType.let { if (it == JsonValue.from("unit")) 1 else 0 } +
(if (name.asKnown() == null) 0 else 1) +
+ (unitConfig.asKnown()?.validity() ?: 0) +
(if (billableMetricId.asKnown() == null) 0 else 1) +
(if (billedInAdvance.asKnown() == null) 0 else 1) +
(billingCycleConfiguration.asKnown()?.validity() ?: 0) +
@@ -4323,65 +4744,245 @@ private constructor(
(if (fixedPriceQuantity.asKnown() == null) 0 else 1) +
(if (invoiceGroupingKey.asKnown() == null) 0 else 1) +
(invoicingCycleConfiguration.asKnown()?.validity() ?: 0) +
+ (if (licenseTypeId.asKnown() == null) 0 else 1) +
(metadata.asKnown()?.validity() ?: 0) +
(if (referenceId.asKnown() == null) 0 else 1)
- /** Configuration for bulk_with_filters pricing */
- class BulkWithFiltersConfig
+ /** The cadence to bill for this price on. */
+ class Cadence
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue
+ fun _value(): JsonField = value
+
+ companion object {
+
+ val ANNUAL = of("annual")
+
+ val SEMI_ANNUAL = of("semi_annual")
+
+ val MONTHLY = of("monthly")
+
+ val QUARTERLY = of("quarterly")
+
+ val ONE_TIME = of("one_time")
+
+ val CUSTOM = of("custom")
+
+ fun of(value: String) = Cadence(JsonField.of(value))
+ }
+
+ /** An enum containing [Cadence]'s known values. */
+ enum class Known {
+ ANNUAL,
+ SEMI_ANNUAL,
+ MONTHLY,
+ QUARTERLY,
+ ONE_TIME,
+ CUSTOM,
+ }
+
+ /**
+ * An enum containing [Cadence]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Cadence] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For
+ * example, if the SDK is on an older version than the API, then the API may
+ * respond with new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ ANNUAL,
+ SEMI_ANNUAL,
+ MONTHLY,
+ QUARTERLY,
+ ONE_TIME,
+ CUSTOM,
+ /**
+ * An enum member indicating that [Cadence] was instantiated with an unknown
+ * value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or
+ * if you want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ ANNUAL -> Value.ANNUAL
+ SEMI_ANNUAL -> Value.SEMI_ANNUAL
+ MONTHLY -> Value.MONTHLY
+ QUARTERLY -> Value.QUARTERLY
+ ONE_TIME -> Value.ONE_TIME
+ CUSTOM -> Value.CUSTOM
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known
+ * and don't want to throw for the unknown case.
+ *
+ * @throws OrbInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ ANNUAL -> Known.ANNUAL
+ SEMI_ANNUAL -> Known.SEMI_ANNUAL
+ MONTHLY -> Known.MONTHLY
+ QUARTERLY -> Known.QUARTERLY
+ ONE_TIME -> Known.ONE_TIME
+ CUSTOM -> Known.CUSTOM
+ else -> throw OrbInvalidDataException("Unknown Cadence: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws OrbInvalidDataException if this class instance's value does not have
+ * the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString()
+ ?: throw OrbInvalidDataException("Value is not a String")
+
+ private var validated: Boolean = false
+
+ fun validate(): Cadence = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: OrbInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Cadence && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class LicenseAllocation
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
- private val filters: JsonField>,
- private val tiers: JsonField>,
+ private val amount: JsonField,
+ private val currency: JsonField,
+ private val writeOffOverage: JsonField,
private val additionalProperties: MutableMap,
) {
@JsonCreator
private constructor(
- @JsonProperty("filters")
+ @JsonProperty("amount")
@ExcludeMissing
- filters: JsonField> = JsonMissing.of(),
- @JsonProperty("tiers")
+ amount: JsonField