diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index f81bf992..8305d4ab 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.31.0"
+ ".": "0.31.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3bd48c4..ba169181 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,24 @@
# Changelog
+## 0.31.1 (2025-02-17)
+
+Full Changelog: [v0.31.0...v0.31.1](https://github.com/orbcorp/orb-java/compare/v0.31.0...v0.31.1)
+
+### Bug Fixes
+
+* format webhooks ([143457b](https://github.com/orbcorp/orb-java/commit/143457bb6f9d9953def62bddc78e09ad6f42c158))
+
+
+### Chores
+
+* **internal:** make body class constructors private ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
+* **internal:** make body classes for multipart requests ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
+* **internal:** misc formatting changes ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
+* **internal:** optimize build and test perf ([be128e3](https://github.com/orbcorp/orb-java/commit/be128e35f2113a4e96a1c52171cc83cfe66bce74))
+* **internal:** rename internal body classes ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
+* **internal:** update formatter ([#247](https://github.com/orbcorp/orb-java/issues/247)) ([be128e3](https://github.com/orbcorp/orb-java/commit/be128e35f2113a4e96a1c52171cc83cfe66bce74))
+* **internal:** use better test example values ([#249](https://github.com/orbcorp/orb-java/issues/249)) ([3a15ffd](https://github.com/orbcorp/orb-java/commit/3a15ffd13a547878c837c9ef6dbf4b555c9e1255))
+
## 0.31.0 (2025-02-14)
Full Changelog: [v0.30.0...v0.31.0](https://github.com/orbcorp/orb-java/compare/v0.30.0...v0.31.0)
diff --git a/README.md b/README.md
index 46a71c55..81fbb139 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.31.0)
+[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.31.1)
@@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho
### Gradle
```kotlin
-implementation("com.withorb.api:orb-java:0.31.0")
+implementation("com.withorb.api:orb-java:0.31.1")
```
### Maven
@@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.31.0")
com.withorb.api
orb-java
- 0.31.0
+ 0.31.1
```
diff --git a/build.gradle.kts b/build.gradle.kts
index da315962..3e67483f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,4 @@
allprojects {
group = "com.withorb.api"
- version = "0.31.0" // x-release-please-version
+ version = "0.31.1" // x-release-please-version
}
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 8a1d7a10..d1ed374d 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -1,6 +1,6 @@
plugins {
`kotlin-dsl`
- kotlin("jvm") version "2.1.0"
+ kotlin("jvm") version "2.1.10"
id("com.vanniktech.maven.publish") version "0.28.0"
}
@@ -10,7 +10,7 @@ repositories {
}
dependencies {
- implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
- implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
+ implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
+ implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10")
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0")
}
diff --git a/buildSrc/src/main/kotlin/orb.java.gradle.kts b/buildSrc/src/main/kotlin/orb.java.gradle.kts
index a2c35b93..597b6e80 100644
--- a/buildSrc/src/main/kotlin/orb.java.gradle.kts
+++ b/buildSrc/src/main/kotlin/orb.java.gradle.kts
@@ -39,9 +39,13 @@ tasks.named("jar") {
}
}
-tasks.named("test") {
+tasks.withType().configureEach {
useJUnitPlatform()
+ // Run tests in parallel to some degree.
+ maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
+ forkEvery = 100
+
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
diff --git a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts
index 882c3a5c..1cf56f97 100644
--- a/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts
+++ b/buildSrc/src/main/kotlin/orb.kotlin.gradle.kts
@@ -1,4 +1,5 @@
import com.diffplug.gradle.spotless.SpotlessExtension
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
@@ -20,13 +21,19 @@ configure {
}
tasks.withType().configureEach {
- kotlinOptions {
+ compilerOptions {
freeCompilerArgs = listOf(
"-Xjvm-default=all",
"-Xjdk-release=1.8",
// Suppress deprecation warnings because we may still reference and test deprecated members.
"-Xsuppress-warning=DEPRECATION"
)
- jvmTarget = "1.8"
+ jvmTarget.set(JvmTarget.JVM_1_8)
}
}
+
+// Run tests in parallel to some degree.
+tasks.withType().configureEach {
+ maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
+ forkEvery = 100
+}
diff --git a/gradle.properties b/gradle.properties
index a3bc58f2..ec5c5092 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,6 @@
+org.gradle.configuration-cache=true
org.gradle.caching=true
-org.gradle.jvmargs=-Xmx4g
org.gradle.parallel=true
+org.gradle.daemon=false
+org.gradle.jvmargs=-Xmx4g
kotlin.daemon.jvmargs=-Xmx4g
diff --git a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
index e1b18a40..7cdd0e02 100644
--- a/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
+++ b/orb-java-client-okhttp/src/main/kotlin/com/withorb/api/client/okhttp/OkHttpClient.kt
@@ -31,10 +31,7 @@ class OkHttpClient
private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) :
HttpClient {
- override fun execute(
- request: HttpRequest,
- requestOptions: RequestOptions,
- ): HttpResponse {
+ override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
val call = newCall(request, requestOptions)
return try {
@@ -120,13 +117,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
) {
builder.header(
"X-Stainless-Read-Timeout",
- Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString()
+ Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(),
)
}
if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) {
builder.header(
"X-Stainless-Timeout",
- Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString()
+ Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(),
)
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
index 71cadda5..6f8eadd5 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientAsyncImpl.kt
@@ -33,9 +33,7 @@ import com.withorb.api.services.async.SubscriptionServiceAsyncImpl
import com.withorb.api.services.async.TopLevelServiceAsync
import com.withorb.api.services.async.TopLevelServiceAsyncImpl
-class OrbClientAsyncImpl(
- private val clientOptions: ClientOptions,
-) : OrbClientAsync {
+class OrbClientAsyncImpl(private val clientOptions: ClientOptions) : OrbClientAsync {
private val clientOptionsWithUserAgent =
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
index adf67509..46d45ebf 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/client/OrbClientImpl.kt
@@ -35,9 +35,7 @@ import com.withorb.api.services.blocking.TopLevelServiceImpl
import com.withorb.api.services.blocking.WebhookService
import com.withorb.api.services.blocking.WebhookServiceImpl
-class OrbClientImpl(
- private val clientOptions: ClientOptions,
-) : OrbClient {
+class OrbClientImpl(private val clientOptions: ClientOptions) : OrbClient {
private val clientOptionsWithUserAgent =
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt
index 6466a647..4fc63b4d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/BaseDeserializer.kt
@@ -18,7 +18,7 @@ abstract class BaseDeserializer(type: KClass) :
override fun createContextual(
context: DeserializationContext,
- property: BeanProperty?
+ property: BeanProperty?,
): JsonDeserializer {
return this
}
@@ -32,7 +32,7 @@ abstract class BaseDeserializer(type: KClass) :
protected fun ObjectCodec.tryDeserialize(
node: JsonNode,
type: TypeReference,
- validate: (T) -> Unit = {}
+ validate: (T) -> Unit = {},
): T? {
return try {
readValue(treeAsTokens(node), type).apply(validate)
@@ -46,7 +46,7 @@ abstract class BaseDeserializer(type: KClass) :
protected fun ObjectCodec.tryDeserialize(
node: JsonNode,
type: JavaType,
- validate: (T) -> Unit = {}
+ validate: (T) -> Unit = {},
): T? {
return try {
readValue(treeAsTokens(node), type).apply(validate)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/HttpRequestBodies.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/HttpRequestBodies.kt
index 2e22b229..020e8646 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/HttpRequestBodies.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/HttpRequestBodies.kt
@@ -10,10 +10,7 @@ import java.io.OutputStream
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder
@JvmSynthetic
-internal inline fun json(
- jsonMapper: JsonMapper,
- value: T,
-): HttpRequestBody {
+internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody {
return object : HttpRequestBody {
private var cachedBytes: ByteArray? = null
@@ -49,7 +46,7 @@ internal inline fun json(
@JvmSynthetic
internal fun multipartFormData(
jsonMapper: JsonMapper,
- parts: Array?>
+ parts: Array?>,
): HttpRequestBody {
val builder = MultipartEntityBuilder.create()
parts.forEach { part ->
@@ -66,14 +63,14 @@ internal fun multipartFormData(
part.name,
buffer.toByteArray(),
part.contentType,
- part.filename
+ part.filename,
)
}
is Boolean ->
builder.addTextBody(
part.name,
if (part.value) "true" else "false",
- part.contentType
+ part.contentType,
)
is Int -> builder.addTextBody(part.name, part.value.toString(), part.contentType)
is Long -> builder.addTextBody(part.name, part.value.toString(), part.contentType)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/PrepareRequest.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/PrepareRequest.kt
index 1a4592ad..e0c2972b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/PrepareRequest.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/PrepareRequest.kt
@@ -17,7 +17,7 @@ internal fun HttpRequest.prepare(clientOptions: ClientOptions, params: Params):
@JvmSynthetic
internal fun HttpRequest.prepareAsync(
clientOptions: ClientOptions,
- params: Params
+ params: Params,
): CompletableFuture =
// This async version exists to make it easier to add async specific preparation logic in the
// future.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/RequestOptions.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/RequestOptions.kt
index 5d9b4401..c1c6b76b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/RequestOptions.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/RequestOptions.kt
@@ -2,11 +2,7 @@ package com.withorb.api.core
import java.time.Duration
-class RequestOptions
-private constructor(
- val responseValidation: Boolean?,
- val timeout: Duration?,
-) {
+class RequestOptions private constructor(val responseValidation: Boolean?, val timeout: Duration?) {
fun applyDefaults(options: RequestOptions): RequestOptions {
return RequestOptions(
responseValidation = this.responseValidation ?: options.responseValidation,
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt
index 3a9629d0..0fbd67e0 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/Values.kt
@@ -287,7 +287,7 @@ class JsonMissing : JsonValue() {
override fun serialize(
value: JsonMissing,
generator: JsonGenerator,
- provider: SerializerProvider
+ provider: SerializerProvider,
) {
throw RuntimeException("JsonMissing cannot be serialized")
}
@@ -422,10 +422,7 @@ private constructor(
}
@JacksonAnnotationsInside
-@JsonInclude(
- JsonInclude.Include.CUSTOM,
- valueFilter = JsonField.IsMissing::class,
-)
+@JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class)
annotation class ExcludeMissing
@JacksonAnnotationsInside
@@ -434,7 +431,7 @@ annotation class ExcludeMissing
isGetterVisibility = Visibility.NONE,
setterVisibility = Visibility.NONE,
creatorVisibility = Visibility.NONE,
- fieldVisibility = Visibility.NONE
+ fieldVisibility = Visibility.NONE,
)
annotation class NoAutoDetect
@@ -443,7 +440,7 @@ internal constructor(
val name: String,
val value: T,
val contentType: ContentType,
- val filename: String? = null
+ val filename: String? = null,
) {
private var hashCode: Int = 0
@@ -462,7 +459,7 @@ internal constructor(
is Long -> value
is Double -> value
else -> value?.hashCode()
- }
+ },
)
}
return hashCode
@@ -496,7 +493,7 @@ internal constructor(
internal fun fromString(
name: String,
value: String,
- contentType: ContentType
+ contentType: ContentType,
): MultipartFormValue = MultipartFormValue(name, value, contentType)
internal fun fromBoolean(
@@ -520,14 +517,14 @@ internal constructor(
internal fun fromEnum(
name: String,
value: T,
- contentType: ContentType
+ contentType: ContentType,
): MultipartFormValue = MultipartFormValue(name, value, contentType)
internal fun fromByteArray(
name: String,
value: ByteArray,
contentType: ContentType,
- filename: String? = null
+ filename: String? = null,
): MultipartFormValue = MultipartFormValue(name, value, contentType, filename)
}
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/Headers.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/Headers.kt
index 8bec2dde..47369c39 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/Headers.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/Headers.kt
@@ -6,7 +6,7 @@ import java.util.TreeMap
class Headers
private constructor(
private val map: Map>,
- @get:JvmName("size") val size: Int
+ @get:JvmName("size") val size: Int,
) {
fun isEmpty(): Boolean = map.isEmpty()
@@ -74,7 +74,7 @@ private constructor(
values.toImmutable()
}
.toImmutable(),
- size
+ size,
)
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingHttpClient.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingHttpClient.kt
index ced0ee65..7e5760a9 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingHttpClient.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/PhantomReachableClosingHttpClient.kt
@@ -19,7 +19,7 @@ internal class PhantomReachableClosingHttpClient(private val httpClient: HttpCli
override fun executeAsync(
request: HttpRequest,
- requestOptions: RequestOptions
+ requestOptions: RequestOptions,
): CompletableFuture = httpClient.executeAsync(request, requestOptions)
override fun close() = httpClient.close()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/QueryParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/QueryParams.kt
index b09686de..87109b2b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/QueryParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/QueryParams.kt
@@ -5,7 +5,7 @@ import com.withorb.api.core.toImmutable
class QueryParams
private constructor(
private val map: Map>,
- @get:JvmName("size") val size: Int
+ @get:JvmName("size") val size: Int,
) {
fun isEmpty(): Boolean = map.isEmpty()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt
index ba6f4dda..93413092 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/http/RetryingHttpClient.kt
@@ -28,10 +28,7 @@ private constructor(
private val idempotencyHeader: String?,
) : HttpClient {
- override fun execute(
- request: HttpRequest,
- requestOptions: RequestOptions,
- ): HttpResponse {
+ override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
if (!isRetryable(request) || maxRetries <= 0) {
return httpClient.execute(request, requestOptions)
}
@@ -100,7 +97,7 @@ private constructor(
.handleAsync(
fun(
response: HttpResponse?,
- throwable: Throwable?
+ throwable: Throwable?,
): CompletableFuture {
if (response != null) {
if (++retries > maxRetries || !shouldRetry(response)) {
@@ -120,7 +117,7 @@ private constructor(
return sleepAsync(backoffMillis.toMillis()).thenCompose {
executeWithRetries(requestWithRetryCount, requestOptions)
}
- },
+ }
) {
// Run in the same thread.
it.run()
@@ -200,8 +197,8 @@ private constructor(
OffsetDateTime.now(clock),
OffsetDateTime.parse(
retryAfter,
- DateTimeFormatter.RFC_1123_DATE_TIME
- )
+ DateTimeFormatter.RFC_1123_DATE_TIME,
+ ),
)
} catch (e: DateTimeParseException) {
null
@@ -239,7 +236,7 @@ private constructor(
future.complete(null)
}
},
- millis
+ millis,
)
return future
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/BadRequestException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/BadRequestException.kt
index 30513518..08d6372d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/BadRequestException.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/BadRequestException.kt
@@ -2,8 +2,5 @@ package com.withorb.api.errors
import com.withorb.api.core.http.Headers
-class BadRequestException(
- headers: Headers,
- body: String,
- error: OrbError,
-) : OrbServiceException(400, headers, body, error)
+class BadRequestException(headers: Headers, body: String, error: OrbError) :
+ OrbServiceException(400, headers, body, error)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/InternalServerException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/InternalServerException.kt
index c8acf740..3913e5ec 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/InternalServerException.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/InternalServerException.kt
@@ -2,9 +2,5 @@ package com.withorb.api.errors
import com.withorb.api.core.http.Headers
-class InternalServerException(
- statusCode: Int,
- headers: Headers,
- body: String,
- error: OrbError,
-) : OrbServiceException(statusCode, headers, body, error)
+class InternalServerException(statusCode: Int, headers: Headers, body: String, error: OrbError) :
+ OrbServiceException(statusCode, headers, body, error)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/NotFoundException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/NotFoundException.kt
index 8e4f6cb4..ae91d72d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/NotFoundException.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/NotFoundException.kt
@@ -2,8 +2,5 @@ package com.withorb.api.errors
import com.withorb.api.core.http.Headers
-class NotFoundException(
- headers: Headers,
- body: String,
- error: OrbError,
-) : OrbServiceException(404, headers, body, error)
+class NotFoundException(headers: Headers, body: String, error: OrbError) :
+ OrbServiceException(404, headers, body, error)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbError.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbError.kt
index 172a304f..2479f3e0 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbError.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbError.kt
@@ -20,7 +20,7 @@ private constructor(
@ExcludeMissing
@JsonAnySetter
@get:JvmName("additionalProperties")
- val additionalProperties: Map = immutableEmptyMap(),
+ val additionalProperties: Map = immutableEmptyMap()
) {
fun toBuilder() = Builder().from(this)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbServiceException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbServiceException.kt
index 2eafb822..c386c79c 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbServiceException.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/OrbServiceException.kt
@@ -10,7 +10,7 @@ constructor(
private val body: String,
private val error: OrbError,
message: String = "$statusCode: $error",
- cause: Throwable? = null
+ cause: Throwable? = null,
) : OrbException(message, cause) {
fun statusCode(): Int = statusCode
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/PermissionDeniedException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/PermissionDeniedException.kt
index b5d97fd4..176d1734 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/PermissionDeniedException.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/PermissionDeniedException.kt
@@ -2,8 +2,5 @@ package com.withorb.api.errors
import com.withorb.api.core.http.Headers
-class PermissionDeniedException(
- headers: Headers,
- body: String,
- error: OrbError,
-) : OrbServiceException(403, headers, body, error)
+class PermissionDeniedException(headers: Headers, body: String, error: OrbError) :
+ OrbServiceException(403, headers, body, error)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/RateLimitException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/RateLimitException.kt
index cbfd0f5d..f76f50cc 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/RateLimitException.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/RateLimitException.kt
@@ -2,8 +2,5 @@ package com.withorb.api.errors
import com.withorb.api.core.http.Headers
-class RateLimitException(
- headers: Headers,
- body: String,
- error: OrbError,
-) : OrbServiceException(429, headers, body, error)
+class RateLimitException(headers: Headers, body: String, error: OrbError) :
+ OrbServiceException(429, headers, body, error)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnauthorizedException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnauthorizedException.kt
index 916c60ef..a561c505 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnauthorizedException.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnauthorizedException.kt
@@ -2,8 +2,5 @@ package com.withorb.api.errors
import com.withorb.api.core.http.Headers
-class UnauthorizedException(
- headers: Headers,
- body: String,
- error: OrbError,
-) : OrbServiceException(401, headers, body, error)
+class UnauthorizedException(headers: Headers, body: String, error: OrbError) :
+ OrbServiceException(401, headers, body, error)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnprocessableEntityException.kt b/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnprocessableEntityException.kt
index 818e9ad7..6f23fd97 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnprocessableEntityException.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/errors/UnprocessableEntityException.kt
@@ -2,8 +2,5 @@ package com.withorb.api.errors
import com.withorb.api.core.http.Headers
-class UnprocessableEntityException(
- headers: Headers,
- body: String,
- error: OrbError,
-) : OrbServiceException(422, headers, body, error)
+class UnprocessableEntityException(headers: Headers, body: String, error: OrbError) :
+ OrbServiceException(422, headers, body, error)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
index 321ab11e..34a42c19 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt
@@ -922,11 +922,7 @@ private constructor(
}
/** The type of alert. This must be a valid alert type. */
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
index 17954d4a..52e896b7 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt
@@ -33,7 +33,7 @@ import java.util.Optional
class AlertCreateForCustomerParams
private constructor(
private val customerId: String,
- private val body: AlertCreateForCustomerBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -64,7 +64,7 @@ private constructor(
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): AlertCreateForCustomerBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
@@ -78,9 +78,9 @@ private constructor(
}
@NoAutoDetect
- class AlertCreateForCustomerBody
+ class Body
@JsonCreator
- internal constructor(
+ private constructor(
@JsonProperty("currency")
@ExcludeMissing
private val currency: JsonField = JsonMissing.of(),
@@ -119,7 +119,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AlertCreateForCustomerBody = apply {
+ fun validate(): Body = apply {
if (validated) {
return@apply
}
@@ -137,7 +137,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AlertCreateForCustomerBody]. */
+ /** A builder for [Body]. */
class Builder internal constructor() {
private var currency: JsonField? = null
@@ -146,12 +146,11 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(alertCreateForCustomerBody: AlertCreateForCustomerBody) = apply {
- currency = alertCreateForCustomerBody.currency
- type = alertCreateForCustomerBody.type
- thresholds = alertCreateForCustomerBody.thresholds.map { it.toMutableList() }
- additionalProperties =
- alertCreateForCustomerBody.additionalProperties.toMutableMap()
+ internal fun from(body: Body) = apply {
+ currency = body.currency
+ type = body.type
+ thresholds = body.thresholds.map { it.toMutableList() }
+ additionalProperties = body.additionalProperties.toMutableMap()
}
/** The case sensitive currency or custom pricing unit to use for this alert. */
@@ -212,8 +211,8 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}
- fun build(): AlertCreateForCustomerBody =
- AlertCreateForCustomerBody(
+ fun build(): Body =
+ Body(
checkRequired("currency", currency),
checkRequired("type", type),
(thresholds ?: JsonMissing.of()).map { it.toImmutable() },
@@ -226,7 +225,7 @@ private constructor(
return true
}
- return /* spotless:off */ other is AlertCreateForCustomerBody && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Body && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
@@ -236,7 +235,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AlertCreateForCustomerBody{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}"
+ "Body{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}"
}
fun toBuilder() = Builder().from(this)
@@ -251,7 +250,7 @@ private constructor(
class Builder internal constructor() {
private var customerId: String? = null
- private var body: AlertCreateForCustomerBody.Builder = AlertCreateForCustomerBody.builder()
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -418,11 +417,7 @@ private constructor(
}
/** The type of alert to create. This must be a valid alert type. */
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
index a5cd29b0..99e52af4 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt
@@ -33,7 +33,7 @@ import java.util.Optional
class AlertCreateForExternalCustomerParams
private constructor(
private val externalCustomerId: String,
- private val body: AlertCreateForExternalCustomerBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -64,7 +64,7 @@ private constructor(
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): AlertCreateForExternalCustomerBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
@@ -78,9 +78,9 @@ private constructor(
}
@NoAutoDetect
- class AlertCreateForExternalCustomerBody
+ class Body
@JsonCreator
- internal constructor(
+ private constructor(
@JsonProperty("currency")
@ExcludeMissing
private val currency: JsonField = JsonMissing.of(),
@@ -119,7 +119,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AlertCreateForExternalCustomerBody = apply {
+ fun validate(): Body = apply {
if (validated) {
return@apply
}
@@ -137,7 +137,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AlertCreateForExternalCustomerBody]. */
+ /** A builder for [Body]. */
class Builder internal constructor() {
private var currency: JsonField? = null
@@ -146,15 +146,11 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(
- alertCreateForExternalCustomerBody: AlertCreateForExternalCustomerBody
- ) = apply {
- currency = alertCreateForExternalCustomerBody.currency
- type = alertCreateForExternalCustomerBody.type
- thresholds =
- alertCreateForExternalCustomerBody.thresholds.map { it.toMutableList() }
- additionalProperties =
- alertCreateForExternalCustomerBody.additionalProperties.toMutableMap()
+ internal fun from(body: Body) = apply {
+ currency = body.currency
+ type = body.type
+ thresholds = body.thresholds.map { it.toMutableList() }
+ additionalProperties = body.additionalProperties.toMutableMap()
}
/** The case sensitive currency or custom pricing unit to use for this alert. */
@@ -215,8 +211,8 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}
- fun build(): AlertCreateForExternalCustomerBody =
- AlertCreateForExternalCustomerBody(
+ fun build(): Body =
+ Body(
checkRequired("currency", currency),
checkRequired("type", type),
(thresholds ?: JsonMissing.of()).map { it.toImmutable() },
@@ -229,7 +225,7 @@ private constructor(
return true
}
- return /* spotless:off */ other is AlertCreateForExternalCustomerBody && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Body && currency == other.currency && type == other.type && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
@@ -239,7 +235,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AlertCreateForExternalCustomerBody{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}"
+ "Body{currency=$currency, type=$type, thresholds=$thresholds, additionalProperties=$additionalProperties}"
}
fun toBuilder() = Builder().from(this)
@@ -254,8 +250,7 @@ private constructor(
class Builder internal constructor() {
private var externalCustomerId: String? = null
- private var body: AlertCreateForExternalCustomerBody.Builder =
- AlertCreateForExternalCustomerBody.builder()
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -427,11 +422,7 @@ private constructor(
}
/** The type of alert to create. This must be a valid alert type. */
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
index fc8eb74d..fd02cd33 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt
@@ -37,7 +37,7 @@ import java.util.Optional
class AlertCreateForSubscriptionParams
private constructor(
private val subscriptionId: String,
- private val body: AlertCreateForSubscriptionBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -68,7 +68,7 @@ private constructor(
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): AlertCreateForSubscriptionBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
@@ -82,9 +82,9 @@ private constructor(
}
@NoAutoDetect
- class AlertCreateForSubscriptionBody
+ class Body
@JsonCreator
- internal constructor(
+ private constructor(
@JsonProperty("thresholds")
@ExcludeMissing
private val thresholds: JsonField> = JsonMissing.of(),
@@ -122,7 +122,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AlertCreateForSubscriptionBody = apply {
+ fun validate(): Body = apply {
if (validated) {
return@apply
}
@@ -140,7 +140,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AlertCreateForSubscriptionBody]. */
+ /** A builder for [Body]. */
class Builder internal constructor() {
private var thresholds: JsonField>? = null
@@ -149,15 +149,12 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(alertCreateForSubscriptionBody: AlertCreateForSubscriptionBody) =
- apply {
- thresholds =
- alertCreateForSubscriptionBody.thresholds.map { it.toMutableList() }
- type = alertCreateForSubscriptionBody.type
- metricId = alertCreateForSubscriptionBody.metricId
- additionalProperties =
- alertCreateForSubscriptionBody.additionalProperties.toMutableMap()
- }
+ internal fun from(body: Body) = apply {
+ thresholds = body.thresholds.map { it.toMutableList() }
+ type = body.type
+ metricId = body.metricId
+ additionalProperties = body.additionalProperties.toMutableMap()
+ }
/** The thresholds that define the values at which the alert will be triggered. */
fun thresholds(thresholds: List) = thresholds(JsonField.of(thresholds))
@@ -215,8 +212,8 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}
- fun build(): AlertCreateForSubscriptionBody =
- AlertCreateForSubscriptionBody(
+ fun build(): Body =
+ Body(
checkRequired("thresholds", thresholds).map { it.toImmutable() },
checkRequired("type", type),
metricId,
@@ -229,7 +226,7 @@ private constructor(
return true
}
- return /* spotless:off */ other is AlertCreateForSubscriptionBody && thresholds == other.thresholds && type == other.type && metricId == other.metricId && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Body && thresholds == other.thresholds && type == other.type && metricId == other.metricId && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
@@ -239,7 +236,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AlertCreateForSubscriptionBody{thresholds=$thresholds, type=$type, metricId=$metricId, additionalProperties=$additionalProperties}"
+ "Body{thresholds=$thresholds, type=$type, metricId=$metricId, additionalProperties=$additionalProperties}"
}
fun toBuilder() = Builder().from(this)
@@ -254,8 +251,7 @@ private constructor(
class Builder internal constructor() {
private var subscriptionId: String? = null
- private var body: AlertCreateForSubscriptionBody.Builder =
- AlertCreateForSubscriptionBody.builder()
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -539,11 +535,7 @@ private constructor(
}
/** The type of alert to create. This must be a valid alert type. */
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
index 28d4372b..8b7674a3 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPage.kt
@@ -87,11 +87,7 @@ private constructor(
@JvmStatic
fun of(alertsService: AlertService, params: AlertListParams, response: Response) =
- AlertListPage(
- alertsService,
- params,
- response,
- )
+ AlertListPage(alertsService, params, response)
}
@NoAutoDetect
@@ -181,18 +177,11 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: AlertListPage,
- ) : Iterable {
+ class AutoPager(private val firstPage: AlertListPage) : Iterable {
override fun iterator(): Iterator = iterator {
var page = firstPage
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt
index b6d17272..8d9ba767 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListPageAsync.kt
@@ -90,11 +90,7 @@ private constructor(
@JvmStatic
fun of(alertsService: AlertServiceAsync, params: AlertListParams, response: Response) =
- AlertListPageAsync(
- alertsService,
- params,
- response,
- )
+ AlertListPageAsync(alertsService, params, response)
}
@NoAutoDetect
@@ -184,23 +180,16 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: AlertListPageAsync,
- ) {
+ class AutoPager(private val firstPage: AlertListPageAsync) {
fun forEach(action: Predicate, executor: Executor): CompletableFuture {
fun CompletableFuture>.forEach(
action: (Alert) -> Boolean,
- executor: Executor
+ executor: Executor,
): CompletableFuture =
thenComposeAsync(
{ page ->
@@ -209,7 +198,7 @@ private constructor(
.map { it.getNextPage().forEach(action, executor) }
.orElseGet { CompletableFuture.completedFuture(null) }
},
- executor
+ executor,
)
return CompletableFuture.completedFuture(Optional.of(firstPage))
.forEach(action::test, executor)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt
index 3d7fbd2e..d1be2b8e 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertListParams.kt
@@ -74,25 +74,25 @@ private constructor(
this.createdAtGt?.let {
queryParams.put(
"created_at[gt]",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.createdAtGte?.let {
queryParams.put(
"created_at[gte]",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.createdAtLt?.let {
queryParams.put(
"created_at[lt]",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.createdAtLte?.let {
queryParams.put(
"created_at[lte]",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.cursor?.let { queryParams.put("cursor", listOf(it.toString())) }
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt
index 456a06c1..be397f6e 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt
@@ -23,7 +23,7 @@ import java.util.Objects
class AlertUpdateParams
private constructor(
private val alertConfigurationId: String,
- private val body: AlertUpdateBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -42,7 +42,7 @@ private constructor(
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): AlertUpdateBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
@@ -56,9 +56,9 @@ private constructor(
}
@NoAutoDetect
- class AlertUpdateBody
+ class Body
@JsonCreator
- internal constructor(
+ private constructor(
@JsonProperty("thresholds")
@ExcludeMissing
private val thresholds: JsonField> = JsonMissing.of(),
@@ -80,7 +80,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): AlertUpdateBody = apply {
+ fun validate(): Body = apply {
if (validated) {
return@apply
}
@@ -96,16 +96,16 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [AlertUpdateBody]. */
+ /** A builder for [Body]. */
class Builder internal constructor() {
private var thresholds: JsonField>? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(alertUpdateBody: AlertUpdateBody) = apply {
- thresholds = alertUpdateBody.thresholds.map { it.toMutableList() }
- additionalProperties = alertUpdateBody.additionalProperties.toMutableMap()
+ internal fun from(body: Body) = apply {
+ thresholds = body.thresholds.map { it.toMutableList() }
+ additionalProperties = body.additionalProperties.toMutableMap()
}
/** The thresholds that define the values at which the alert will be triggered. */
@@ -149,10 +149,10 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}
- fun build(): AlertUpdateBody =
- AlertUpdateBody(
+ fun build(): Body =
+ Body(
checkRequired("thresholds", thresholds).map { it.toImmutable() },
- additionalProperties.toImmutable()
+ additionalProperties.toImmutable(),
)
}
@@ -161,7 +161,7 @@ private constructor(
return true
}
- return /* spotless:off */ other is AlertUpdateBody && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Body && thresholds == other.thresholds && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
@@ -171,7 +171,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "AlertUpdateBody{thresholds=$thresholds, additionalProperties=$additionalProperties}"
+ "Body{thresholds=$thresholds, additionalProperties=$additionalProperties}"
}
fun toBuilder() = Builder().from(this)
@@ -186,7 +186,7 @@ private constructor(
class Builder internal constructor() {
private var alertConfigurationId: String? = null
- private var body: AlertUpdateBody.Builder = AlertUpdateBody.builder()
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
index 5b1d58f3..2d087502 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AmountDiscount.kt
@@ -194,11 +194,8 @@ private constructor(
)
}
- class DiscountType
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class DiscountType @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
/**
* Returns this class instance's raw value.
@@ -219,7 +216,7 @@ private constructor(
/** An enum containing [DiscountType]'s known values. */
enum class Known {
- AMOUNT,
+ AMOUNT
}
/**
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
index 6358f0da..9eb2451b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillableMetric.kt
@@ -223,7 +223,7 @@ private constructor(
@JsonCreator
private constructor(
@JsonAnySetter
- private val additionalProperties: Map = immutableEmptyMap(),
+ private val additionalProperties: Map = immutableEmptyMap()
) {
@JsonAnyGetter
@@ -296,11 +296,7 @@ private constructor(
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
- class Status
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Status @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt
index e91cdb76..d1417195 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/BillingCycleRelativeDate.kt
@@ -9,9 +9,7 @@ import com.withorb.api.errors.OrbInvalidDataException
class BillingCycleRelativeDate
@JsonCreator
-private constructor(
- private val value: JsonField,
-) : Enum {
+private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
index 76e6f1ff..fe82de01 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Coupon.kt
@@ -458,7 +458,7 @@ private constructor(
override fun serialize(
value: Discount,
generator: JsonGenerator,
- provider: SerializerProvider
+ provider: SerializerProvider,
) {
when {
value.percentage != null -> generator.writeObject(value.percentage)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
index 4d477bfa..37807bc2 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt
@@ -39,7 +39,7 @@ import kotlin.jvm.optionals.getOrNull
*/
class CouponCreateParams
private constructor(
- private val body: CouponCreateBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -84,16 +84,16 @@ private constructor(
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): CouponCreateBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
override fun _queryParams(): QueryParams = additionalQueryParams
@NoAutoDetect
- class CouponCreateBody
+ class Body
@JsonCreator
- internal constructor(
+ private constructor(
@JsonProperty("discount")
@ExcludeMissing
private val discount: JsonField = JsonMissing.of(),
@@ -158,7 +158,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CouponCreateBody = apply {
+ fun validate(): Body = apply {
if (validated) {
return@apply
}
@@ -177,7 +177,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CouponCreateBody]. */
+ /** A builder for [Body]. */
class Builder internal constructor() {
private var discount: JsonField? = null
@@ -187,12 +187,12 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(couponCreateBody: CouponCreateBody) = apply {
- discount = couponCreateBody.discount
- redemptionCode = couponCreateBody.redemptionCode
- durationInMonths = couponCreateBody.durationInMonths
- maxRedemptions = couponCreateBody.maxRedemptions
- additionalProperties = couponCreateBody.additionalProperties.toMutableMap()
+ internal fun from(body: Body) = apply {
+ discount = body.discount
+ redemptionCode = body.redemptionCode
+ durationInMonths = body.durationInMonths
+ maxRedemptions = body.maxRedemptions
+ additionalProperties = body.additionalProperties.toMutableMap()
}
fun discount(discount: Discount) = discount(JsonField.of(discount))
@@ -313,8 +313,8 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}
- fun build(): CouponCreateBody =
- CouponCreateBody(
+ fun build(): Body =
+ Body(
checkRequired("discount", discount),
checkRequired("redemptionCode", redemptionCode),
durationInMonths,
@@ -328,7 +328,7 @@ private constructor(
return true
}
- return /* spotless:off */ other is CouponCreateBody && discount == other.discount && redemptionCode == other.redemptionCode && durationInMonths == other.durationInMonths && maxRedemptions == other.maxRedemptions && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Body && discount == other.discount && redemptionCode == other.redemptionCode && durationInMonths == other.durationInMonths && maxRedemptions == other.maxRedemptions && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
@@ -338,7 +338,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CouponCreateBody{discount=$discount, redemptionCode=$redemptionCode, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, additionalProperties=$additionalProperties}"
+ "Body{discount=$discount, redemptionCode=$redemptionCode, durationInMonths=$durationInMonths, maxRedemptions=$maxRedemptions, additionalProperties=$additionalProperties}"
}
fun toBuilder() = Builder().from(this)
@@ -352,7 +352,7 @@ private constructor(
@NoAutoDetect
class Builder internal constructor() {
- private var body: CouponCreateBody.Builder = CouponCreateBody.builder()
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -720,7 +720,7 @@ private constructor(
override fun serialize(
value: Discount,
generator: JsonGenerator,
- provider: SerializerProvider
+ provider: SerializerProvider,
) {
when {
value.newCouponPercentage != null ->
@@ -843,9 +843,7 @@ private constructor(
class DiscountType
@JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -866,7 +864,7 @@ private constructor(
/** An enum containing [DiscountType]'s known values. */
enum class Known {
- PERCENTAGE,
+ PERCENTAGE
}
/**
@@ -1059,9 +1057,7 @@ private constructor(
class DiscountType
@JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -1082,7 +1078,7 @@ private constructor(
/** An enum containing [DiscountType]'s known values. */
enum class Known {
- AMOUNT,
+ AMOUNT
}
/**
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
index 1fae071e..1f96b804 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPage.kt
@@ -83,11 +83,7 @@ private constructor(
@JvmStatic
fun of(couponsService: CouponService, params: CouponListParams, response: Response) =
- CouponListPage(
- couponsService,
- params,
- response,
- )
+ CouponListPage(couponsService, params, response)
}
@NoAutoDetect
@@ -177,18 +173,11 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: CouponListPage,
- ) : Iterable {
+ class AutoPager(private val firstPage: CouponListPage) : Iterable {
override fun iterator(): Iterator = iterator {
var page = firstPage
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt
index 84aefe66..80198d16 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponListPageAsync.kt
@@ -86,11 +86,7 @@ private constructor(
@JvmStatic
fun of(couponsService: CouponServiceAsync, params: CouponListParams, response: Response) =
- CouponListPageAsync(
- couponsService,
- params,
- response,
- )
+ CouponListPageAsync(couponsService, params, response)
}
@NoAutoDetect
@@ -180,23 +176,16 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: CouponListPageAsync,
- ) {
+ class AutoPager(private val firstPage: CouponListPageAsync) {
fun forEach(action: Predicate, executor: Executor): CompletableFuture {
fun CompletableFuture>.forEach(
action: (Coupon) -> Boolean,
- executor: Executor
+ executor: Executor,
): CompletableFuture =
thenComposeAsync(
{ page ->
@@ -205,7 +194,7 @@ private constructor(
.map { it.getNextPage().forEach(action, executor) }
.orElseGet { CompletableFuture.completedFuture(null) }
},
- executor
+ executor,
)
return CompletableFuture.completedFuture(Optional.of(firstPage))
.forEach(action::test, executor)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
index 2618230a..63dee1ce 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPage.kt
@@ -84,13 +84,8 @@ private constructor(
fun of(
subscriptionsService: SubscriptionService,
params: CouponSubscriptionListParams,
- response: Response
- ) =
- CouponSubscriptionListPage(
- subscriptionsService,
- params,
- response,
- )
+ response: Response,
+ ) = CouponSubscriptionListPage(subscriptionsService, params, response)
}
@NoAutoDetect
@@ -180,18 +175,11 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: CouponSubscriptionListPage,
- ) : Iterable {
+ class AutoPager(private val firstPage: CouponSubscriptionListPage) : Iterable {
override fun iterator(): Iterator = iterator {
var page = firstPage
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt
index df82f6a3..e9fb4c04 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CouponSubscriptionListPageAsync.kt
@@ -87,13 +87,8 @@ private constructor(
fun of(
subscriptionsService: SubscriptionServiceAsync,
params: CouponSubscriptionListParams,
- response: Response
- ) =
- CouponSubscriptionListPageAsync(
- subscriptionsService,
- params,
- response,
- )
+ response: Response,
+ ) = CouponSubscriptionListPageAsync(subscriptionsService, params, response)
}
@NoAutoDetect
@@ -183,23 +178,16 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: CouponSubscriptionListPageAsync,
- ) {
+ class AutoPager(private val firstPage: CouponSubscriptionListPageAsync) {
fun forEach(action: Predicate, executor: Executor): CompletableFuture {
fun CompletableFuture>.forEach(
action: (Subscription) -> Boolean,
- executor: Executor
+ executor: Executor,
): CompletableFuture =
thenComposeAsync(
{ page ->
@@ -208,7 +196,7 @@ private constructor(
.map { it.getNextPage().forEach(action, executor) }
.orElseGet { CompletableFuture.completedFuture(null) }
},
- executor
+ executor,
)
return CompletableFuture.completedFuture(Optional.of(firstPage))
.forEach(action::test, executor)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
index 416feebb..84db23cb 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt
@@ -1192,9 +1192,7 @@ private constructor(
class DiscountType
@JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -1499,11 +1497,8 @@ private constructor(
)
}
- class DiscountType
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class DiscountType @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
/**
* Returns this class instance's raw value.
@@ -1524,7 +1519,7 @@ private constructor(
/** An enum containing [DiscountType]'s known values. */
enum class Known {
- PERCENTAGE,
+ PERCENTAGE
}
/**
@@ -1721,11 +1716,7 @@ private constructor(
"MaximumAmountAdjustment{amountApplied=$amountApplied, discountType=$discountType, percentageDiscount=$percentageDiscount, appliesToPrices=$appliesToPrices, reason=$reason, additionalProperties=$additionalProperties}"
}
- class Reason
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Reason @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -1824,11 +1815,7 @@ private constructor(
override fun toString() = value.toString()
}
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -2091,11 +2078,8 @@ private constructor(
)
}
- class DiscountType
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class DiscountType @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
/**
* Returns this class instance's raw value.
@@ -2116,7 +2100,7 @@ private constructor(
/** An enum containing [DiscountType]'s known values. */
enum class Known {
- PERCENTAGE,
+ PERCENTAGE
}
/**
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
index 8f621b09..b5e2dc2f 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt
@@ -25,7 +25,7 @@ import java.util.Optional
/** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */
class CreditNoteCreateParams
private constructor(
- private val body: CreditNoteCreateBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -52,16 +52,16 @@ private constructor(
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): CreditNoteCreateBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
override fun _queryParams(): QueryParams = additionalQueryParams
@NoAutoDetect
- class CreditNoteCreateBody
+ class Body
@JsonCreator
- internal constructor(
+ private constructor(
@JsonProperty("line_items")
@ExcludeMissing
private val lineItems: JsonField> = JsonMissing.of(),
@@ -99,7 +99,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CreditNoteCreateBody = apply {
+ fun validate(): Body = apply {
if (validated) {
return@apply
}
@@ -117,7 +117,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CreditNoteCreateBody]. */
+ /** A builder for [Body]. */
class Builder internal constructor() {
private var lineItems: JsonField>? = null
@@ -126,11 +126,11 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(creditNoteCreateBody: CreditNoteCreateBody) = apply {
- lineItems = creditNoteCreateBody.lineItems.map { it.toMutableList() }
- memo = creditNoteCreateBody.memo
- reason = creditNoteCreateBody.reason
- additionalProperties = creditNoteCreateBody.additionalProperties.toMutableMap()
+ internal fun from(body: Body) = apply {
+ lineItems = body.lineItems.map { it.toMutableList() }
+ memo = body.memo
+ reason = body.reason
+ additionalProperties = body.additionalProperties.toMutableMap()
}
fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems))
@@ -189,8 +189,8 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}
- fun build(): CreditNoteCreateBody =
- CreditNoteCreateBody(
+ fun build(): Body =
+ Body(
checkRequired("lineItems", lineItems).map { it.toImmutable() },
memo,
reason,
@@ -203,7 +203,7 @@ private constructor(
return true
}
- return /* spotless:off */ other is CreditNoteCreateBody && lineItems == other.lineItems && memo == other.memo && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Body && lineItems == other.lineItems && memo == other.memo && reason == other.reason && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
@@ -213,7 +213,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CreditNoteCreateBody{lineItems=$lineItems, memo=$memo, reason=$reason, additionalProperties=$additionalProperties}"
+ "Body{lineItems=$lineItems, memo=$memo, reason=$reason, additionalProperties=$additionalProperties}"
}
fun toBuilder() = Builder().from(this)
@@ -227,7 +227,7 @@ private constructor(
@NoAutoDetect
class Builder internal constructor() {
- private var body: CreditNoteCreateBody.Builder = CreditNoteCreateBody.builder()
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -513,11 +513,7 @@ private constructor(
}
/** An optional reason for the credit note. */
- class Reason
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Reason @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
index bb4c34f1..41714fb8 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPage.kt
@@ -83,13 +83,8 @@ private constructor(
fun of(
creditNotesService: CreditNoteService,
params: CreditNoteListParams,
- response: Response
- ) =
- CreditNoteListPage(
- creditNotesService,
- params,
- response,
- )
+ response: Response,
+ ) = CreditNoteListPage(creditNotesService, params, response)
}
@NoAutoDetect
@@ -179,18 +174,11 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: CreditNoteListPage,
- ) : Iterable {
+ class AutoPager(private val firstPage: CreditNoteListPage) : Iterable {
override fun iterator(): Iterator = iterator {
var page = firstPage
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt
index c97d1e38..412d467b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteListPageAsync.kt
@@ -86,13 +86,8 @@ private constructor(
fun of(
creditNotesService: CreditNoteServiceAsync,
params: CreditNoteListParams,
- response: Response
- ) =
- CreditNoteListPageAsync(
- creditNotesService,
- params,
- response,
- )
+ response: Response,
+ ) = CreditNoteListPageAsync(creditNotesService, params, response)
}
@NoAutoDetect
@@ -182,23 +177,16 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: CreditNoteListPageAsync,
- ) {
+ class AutoPager(private val firstPage: CreditNoteListPageAsync) {
fun forEach(action: Predicate, executor: Executor): CompletableFuture {
fun CompletableFuture>.forEach(
action: (CreditNote) -> Boolean,
- executor: Executor
+ executor: Executor,
): CompletableFuture =
thenComposeAsync(
{ page ->
@@ -207,7 +195,7 @@ private constructor(
.map { it.getNextPage().forEach(action, executor) }
.orElseGet { CompletableFuture.completedFuture(null) }
},
- executor
+ executor,
)
return CompletableFuture.completedFuture(Optional.of(firstPage))
.forEach(action::test, executor)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
index 9af3e19f..747c067b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Customer.kt
@@ -1381,7 +1381,7 @@ private constructor(
@JsonCreator
private constructor(
@JsonAnySetter
- private val additionalProperties: Map = immutableEmptyMap(),
+ private val additionalProperties: Map = immutableEmptyMap()
) {
@JsonAnyGetter
@@ -1458,11 +1458,8 @@ private constructor(
* This is used for creating charges or invoices in an external system via Orb. When not in test
* mode, the connection must first be configured in the Orb webapp.
*/
- class PaymentProvider
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class PaymentProvider @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
/**
* Returns this class instance's raw value.
@@ -1970,11 +1967,8 @@ private constructor(
)
}
- class Country
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Country @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
/**
* Returns this class instance's raw value.
@@ -2520,11 +2514,7 @@ private constructor(
override fun toString() = value.toString()
}
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -3275,9 +3265,7 @@ private constructor(
class ProviderType
@JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -3480,7 +3468,7 @@ private constructor(
fun build(): ReportingConfiguration =
ReportingConfiguration(
checkRequired("exempt", exempt),
- additionalProperties.toImmutable()
+ additionalProperties.toImmutable(),
)
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
index bb529d6e..29e63567 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt
@@ -29,7 +29,7 @@ import java.util.Optional
class CustomerBalanceTransactionCreateParams
private constructor(
private val customerId: String,
- private val body: CustomerBalanceTransactionCreateBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -56,7 +56,7 @@ private constructor(
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): CustomerBalanceTransactionCreateBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
@@ -70,9 +70,9 @@ private constructor(
}
@NoAutoDetect
- class CustomerBalanceTransactionCreateBody
+ class Body
@JsonCreator
- internal constructor(
+ private constructor(
@JsonProperty("amount")
@ExcludeMissing
private val amount: JsonField = JsonMissing.of(),
@@ -107,7 +107,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CustomerBalanceTransactionCreateBody = apply {
+ fun validate(): Body = apply {
if (validated) {
return@apply
}
@@ -125,7 +125,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CustomerBalanceTransactionCreateBody]. */
+ /** A builder for [Body]. */
class Builder internal constructor() {
private var amount: JsonField? = null
@@ -134,14 +134,11 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(
- customerBalanceTransactionCreateBody: CustomerBalanceTransactionCreateBody
- ) = apply {
- amount = customerBalanceTransactionCreateBody.amount
- type = customerBalanceTransactionCreateBody.type
- description = customerBalanceTransactionCreateBody.description
- additionalProperties =
- customerBalanceTransactionCreateBody.additionalProperties.toMutableMap()
+ internal fun from(body: Body) = apply {
+ amount = body.amount
+ type = body.type
+ description = body.description
+ additionalProperties = body.additionalProperties.toMutableMap()
}
fun amount(amount: String) = amount(JsonField.of(amount))
@@ -182,8 +179,8 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}
- fun build(): CustomerBalanceTransactionCreateBody =
- CustomerBalanceTransactionCreateBody(
+ fun build(): Body =
+ Body(
checkRequired("amount", amount),
checkRequired("type", type),
description,
@@ -196,7 +193,7 @@ private constructor(
return true
}
- return /* spotless:off */ other is CustomerBalanceTransactionCreateBody && amount == other.amount && type == other.type && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Body && amount == other.amount && type == other.type && description == other.description && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
@@ -206,7 +203,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CustomerBalanceTransactionCreateBody{amount=$amount, type=$type, description=$description, additionalProperties=$additionalProperties}"
+ "Body{amount=$amount, type=$type, description=$description, additionalProperties=$additionalProperties}"
}
fun toBuilder() = Builder().from(this)
@@ -221,8 +218,7 @@ private constructor(
class Builder internal constructor() {
private var customerId: String? = null
- private var body: CustomerBalanceTransactionCreateBody.Builder =
- CustomerBalanceTransactionCreateBody.builder()
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -382,11 +378,7 @@ private constructor(
)
}
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
index e8dc7498..3063f318 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateResponse.kt
@@ -300,11 +300,7 @@ private constructor(
)
}
- class Action
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Action @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -623,11 +619,7 @@ private constructor(
override fun toString() = "Invoice{id=$id, additionalProperties=$additionalProperties}"
}
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
index 481ae313..65125150 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPage.kt
@@ -104,13 +104,8 @@ private constructor(
fun of(
balanceTransactionsService: BalanceTransactionService,
params: CustomerBalanceTransactionListParams,
- response: Response
- ) =
- CustomerBalanceTransactionListPage(
- balanceTransactionsService,
- params,
- response,
- )
+ response: Response,
+ ) = CustomerBalanceTransactionListPage(balanceTransactionsService, params, response)
}
@NoAutoDetect
@@ -207,18 +202,12 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: CustomerBalanceTransactionListPage,
- ) : Iterable {
+ class AutoPager(private val firstPage: CustomerBalanceTransactionListPage) :
+ Iterable {
override fun iterator(): Iterator = iterator {
var page = firstPage
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt
index ffd6c712..d9de8ceb 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListPageAsync.kt
@@ -107,13 +107,8 @@ private constructor(
fun of(
balanceTransactionsService: BalanceTransactionServiceAsync,
params: CustomerBalanceTransactionListParams,
- response: Response
- ) =
- CustomerBalanceTransactionListPageAsync(
- balanceTransactionsService,
- params,
- response,
- )
+ response: Response,
+ ) = CustomerBalanceTransactionListPageAsync(balanceTransactionsService, params, response)
}
@NoAutoDetect
@@ -210,26 +205,19 @@ private constructor(
this.additionalProperties.put(key, value)
}
- fun build() =
- Response(
- data,
- paginationMetadata,
- additionalProperties.toImmutable(),
- )
+ fun build() = Response(data, paginationMetadata, additionalProperties.toImmutable())
}
}
- class AutoPager(
- private val firstPage: CustomerBalanceTransactionListPageAsync,
- ) {
+ class AutoPager(private val firstPage: CustomerBalanceTransactionListPageAsync) {
fun forEach(
action: Predicate,
- executor: Executor
+ executor: Executor,
): CompletableFuture {
fun CompletableFuture>.forEach(
action: (CustomerBalanceTransactionListResponse) -> Boolean,
- executor: Executor
+ executor: Executor,
): CompletableFuture =
thenComposeAsync(
{ page ->
@@ -238,7 +226,7 @@ private constructor(
.map { it.getNextPage().forEach(action, executor) }
.orElseGet { CompletableFuture.completedFuture(null) }
},
- executor
+ executor,
)
return CompletableFuture.completedFuture(Optional.of(firstPage))
.forEach(action::test, executor)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt
index 54fd58b2..56e7978e 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListParams.kt
@@ -83,25 +83,25 @@ private constructor(
this.operationTimeGt?.let {
queryParams.put(
"operation_time[gt]",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.operationTimeGte?.let {
queryParams.put(
"operation_time[gte]",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.operationTimeLt?.let {
queryParams.put(
"operation_time[lt]",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.operationTimeLte?.let {
queryParams.put(
"operation_time[lte]",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
queryParams.putAll(additionalQueryParams)
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
index 817ff3b2..7bafb9d0 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionListResponse.kt
@@ -300,11 +300,7 @@ private constructor(
)
}
- class Action
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Action @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -623,11 +619,7 @@ private constructor(
override fun toString() = "Invoice{id=$id, additionalProperties=$additionalProperties}"
}
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
index b9145099..22574831 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt
@@ -165,13 +165,13 @@ private constructor(
this.timeframeEnd?.let {
queryParams.put(
"timeframe_end",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.timeframeStart?.let {
queryParams.put(
"timeframe_start",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.viewMode?.let { queryParams.put("view_mode", listOf(it.toString())) }
@@ -373,11 +373,7 @@ private constructor(
* incremental day-by-day costs. If your customer has minimums or discounts, it's strongly
* recommended that you use the default cumulative behavior.
*/
- class ViewMode
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class ViewMode @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
index eaaa61a6..1f6b42bc 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdResponse.kt
@@ -110,7 +110,7 @@ private constructor(
fun build(): CustomerCostListByExternalIdResponse =
CustomerCostListByExternalIdResponse(
checkRequired("data", data).map { it.toImmutable() },
- additionalProperties.toImmutable()
+ additionalProperties.toImmutable(),
)
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt
index dcd0ee24..03dfce3b 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt
@@ -165,13 +165,13 @@ private constructor(
this.timeframeEnd?.let {
queryParams.put(
"timeframe_end",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.timeframeStart?.let {
queryParams.put(
"timeframe_start",
- listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it))
+ listOf(DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)),
)
}
this.viewMode?.let { queryParams.put("view_mode", listOf(it.toString())) }
@@ -369,11 +369,7 @@ private constructor(
* incremental day-by-day costs. If your customer has minimums or discounts, it's strongly
* recommended that you use the default cumulative behavior.
*/
- class ViewMode
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class ViewMode @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt
index c5460b96..561c33f9 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListResponse.kt
@@ -107,7 +107,7 @@ private constructor(
fun build(): CustomerCostListResponse =
CustomerCostListResponse(
checkRequired("data", data).map { it.toImmutable() },
- additionalProperties.toImmutable()
+ additionalProperties.toImmutable(),
)
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt
index 44e2b86d..4b1f7df4 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt
@@ -47,7 +47,7 @@ import kotlin.jvm.optionals.getOrNull
*/
class CustomerCreateParams
private constructor(
- private val body: CustomerCreateBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -423,16 +423,16 @@ private constructor(
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): CustomerCreateBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
override fun _queryParams(): QueryParams = additionalQueryParams
@NoAutoDetect
- class CustomerCreateBody
+ class Body
@JsonCreator
- internal constructor(
+ private constructor(
@JsonProperty("email")
@ExcludeMissing
private val email: JsonField = JsonMissing.of(),
@@ -893,7 +893,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): CustomerCreateBody = apply {
+ fun validate(): Body = apply {
if (validated) {
return@apply
}
@@ -925,7 +925,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CustomerCreateBody]. */
+ /** A builder for [Body]. */
class Builder internal constructor() {
private var email: JsonField? = null
@@ -949,25 +949,25 @@ private constructor(
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
- internal fun from(customerCreateBody: CustomerCreateBody) = apply {
- email = customerCreateBody.email
- name = customerCreateBody.name
- accountingSyncConfiguration = customerCreateBody.accountingSyncConfiguration
- additionalEmails = customerCreateBody.additionalEmails.map { it.toMutableList() }
- autoCollection = customerCreateBody.autoCollection
- billingAddress = customerCreateBody.billingAddress
- currency = customerCreateBody.currency
- emailDelivery = customerCreateBody.emailDelivery
- externalCustomerId = customerCreateBody.externalCustomerId
- metadata = customerCreateBody.metadata
- paymentProvider = customerCreateBody.paymentProvider
- paymentProviderId = customerCreateBody.paymentProviderId
- reportingConfiguration = customerCreateBody.reportingConfiguration
- shippingAddress = customerCreateBody.shippingAddress
- taxConfiguration = customerCreateBody.taxConfiguration
- taxId = customerCreateBody.taxId
- timezone = customerCreateBody.timezone
- additionalProperties = customerCreateBody.additionalProperties.toMutableMap()
+ internal fun from(body: Body) = apply {
+ email = body.email
+ name = body.name
+ accountingSyncConfiguration = body.accountingSyncConfiguration
+ additionalEmails = body.additionalEmails.map { it.toMutableList() }
+ autoCollection = body.autoCollection
+ billingAddress = body.billingAddress
+ currency = body.currency
+ emailDelivery = body.emailDelivery
+ externalCustomerId = body.externalCustomerId
+ metadata = body.metadata
+ paymentProvider = body.paymentProvider
+ paymentProviderId = body.paymentProviderId
+ reportingConfiguration = body.reportingConfiguration
+ shippingAddress = body.shippingAddress
+ taxConfiguration = body.taxConfiguration
+ taxId = body.taxId
+ timezone = body.timezone
+ additionalProperties = body.additionalProperties.toMutableMap()
}
/**
@@ -1629,8 +1629,8 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}
- fun build(): CustomerCreateBody =
- CustomerCreateBody(
+ fun build(): Body =
+ Body(
checkRequired("email", email),
checkRequired("name", name),
accountingSyncConfiguration,
@@ -1657,7 +1657,7 @@ private constructor(
return true
}
- return /* spotless:off */ other is CustomerCreateBody && email == other.email && name == other.name && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && timezone == other.timezone && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Body && email == other.email && name == other.name && accountingSyncConfiguration == other.accountingSyncConfiguration && additionalEmails == other.additionalEmails && autoCollection == other.autoCollection && billingAddress == other.billingAddress && currency == other.currency && emailDelivery == other.emailDelivery && externalCustomerId == other.externalCustomerId && metadata == other.metadata && paymentProvider == other.paymentProvider && paymentProviderId == other.paymentProviderId && reportingConfiguration == other.reportingConfiguration && shippingAddress == other.shippingAddress && taxConfiguration == other.taxConfiguration && taxId == other.taxId && timezone == other.timezone && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
@@ -1667,7 +1667,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "CustomerCreateBody{email=$email, name=$name, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, timezone=$timezone, additionalProperties=$additionalProperties}"
+ "Body{email=$email, name=$name, accountingSyncConfiguration=$accountingSyncConfiguration, additionalEmails=$additionalEmails, autoCollection=$autoCollection, billingAddress=$billingAddress, currency=$currency, emailDelivery=$emailDelivery, externalCustomerId=$externalCustomerId, metadata=$metadata, paymentProvider=$paymentProvider, paymentProviderId=$paymentProviderId, reportingConfiguration=$reportingConfiguration, shippingAddress=$shippingAddress, taxConfiguration=$taxConfiguration, taxId=$taxId, timezone=$timezone, additionalProperties=$additionalProperties}"
}
fun toBuilder() = Builder().from(this)
@@ -1681,7 +1681,7 @@ private constructor(
@NoAutoDetect
class Builder internal constructor() {
- private var body: CustomerCreateBody.Builder = CustomerCreateBody.builder()
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -2904,7 +2904,7 @@ private constructor(
@JsonCreator
private constructor(
@JsonAnySetter
- private val additionalProperties: Map = immutableEmptyMap(),
+ private val additionalProperties: Map = immutableEmptyMap()
) {
@JsonAnyGetter
@@ -2981,11 +2981,8 @@ private constructor(
* This is used for creating charges or invoices in an external system via Orb. When not in test
* mode, the connection must first be configured in the Orb webapp.
*/
- class PaymentProvider
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class PaymentProvider @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
/**
* Returns this class instance's raw value.
@@ -3168,7 +3165,7 @@ private constructor(
fun build(): ReportingConfiguration =
ReportingConfiguration(
checkRequired("exempt", exempt),
- additionalProperties.toImmutable()
+ additionalProperties.toImmutable(),
)
}
@@ -3518,7 +3515,7 @@ private constructor(
override fun serialize(
value: TaxConfiguration,
generator: JsonGenerator,
- provider: SerializerProvider
+ provider: SerializerProvider,
) {
when {
value.newAvalara != null -> generator.writeObject(value.newAvalara)
@@ -3659,9 +3656,7 @@ private constructor(
class TaxProvider
@JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -3682,7 +3677,7 @@ private constructor(
/** An enum containing [TaxProvider]'s known values. */
enum class Known {
- AVALARA,
+ AVALARA
}
/**
@@ -3870,9 +3865,7 @@ private constructor(
class TaxProvider
@JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
@@ -3893,7 +3886,7 @@ private constructor(
/** An enum containing [TaxProvider]'s known values. */
enum class Known {
- TAXJAR,
+ TAXJAR
}
/**
@@ -4189,11 +4182,8 @@ private constructor(
)
}
- class Country
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Country @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
/**
* Returns this class instance's raw value.
@@ -4739,11 +4729,7 @@ private constructor(
override fun toString() = value.toString()
}
- class Type
- @JsonCreator
- private constructor(
- private val value: JsonField,
- ) : Enum {
+ class Type @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
* Returns this class instance's raw value.
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
index e2a9d768..e205cc67 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt
@@ -140,37 +140,20 @@ import kotlin.jvm.optionals.getOrNull
class CustomerCreditLedgerCreateEntryByExternalIdParams
private constructor(
private val externalCustomerId: String,
- private val body: CustomerCreditLedgerCreateEntryByExternalIdBody,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
fun externalCustomerId(): String = externalCustomerId
- fun addIncrementCreditLedgerEntryRequestParams():
- Optional =
- body.addIncrementCreditLedgerEntryRequestParams()
-
- fun addDecrementCreditLedgerEntryRequestParams():
- Optional =
- body.addDecrementCreditLedgerEntryRequestParams()
-
- fun addExpirationChangeCreditLedgerEntryRequestParams():
- Optional =
- body.addExpirationChangeCreditLedgerEntryRequestParams()
-
- fun addVoidCreditLedgerEntryRequestParams(): Optional =
- body.addVoidCreditLedgerEntryRequestParams()
-
- fun addAmendmentCreditLedgerEntryRequestParams():
- Optional =
- body.addAmendmentCreditLedgerEntryRequestParams()
+ fun body(): Body = body
fun _additionalHeaders(): Headers = additionalHeaders
fun _additionalQueryParams(): QueryParams = additionalQueryParams
- @JvmSynthetic internal fun _body(): CustomerCreditLedgerCreateEntryByExternalIdBody = body
+ @JvmSynthetic internal fun _body(): Body = body
override fun _headers(): Headers = additionalHeaders
@@ -183,10 +166,10 @@ private constructor(
}
}
- @JsonDeserialize(using = CustomerCreditLedgerCreateEntryByExternalIdBody.Deserializer::class)
- @JsonSerialize(using = CustomerCreditLedgerCreateEntryByExternalIdBody.Serializer::class)
- class CustomerCreditLedgerCreateEntryByExternalIdBody
- internal constructor(
+ @JsonDeserialize(using = Body.Deserializer::class)
+ @JsonSerialize(using = Body.Serializer::class)
+ class Body
+ private constructor(
private val addIncrementCreditLedgerEntryRequestParams:
AddIncrementCreditLedgerEntryRequestParams? =
null,
@@ -296,12 +279,59 @@ private constructor(
}
}
+ private var validated: Boolean = false
+
+ fun validate(): Body = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitAddIncrementCreditLedgerEntryRequestParams(
+ addIncrementCreditLedgerEntryRequestParams:
+ AddIncrementCreditLedgerEntryRequestParams
+ ) {
+ addIncrementCreditLedgerEntryRequestParams.validate()
+ }
+
+ override fun visitAddDecrementCreditLedgerEntryRequestParams(
+ addDecrementCreditLedgerEntryRequestParams:
+ AddDecrementCreditLedgerEntryRequestParams
+ ) {
+ addDecrementCreditLedgerEntryRequestParams.validate()
+ }
+
+ override fun visitAddExpirationChangeCreditLedgerEntryRequestParams(
+ addExpirationChangeCreditLedgerEntryRequestParams:
+ AddExpirationChangeCreditLedgerEntryRequestParams
+ ) {
+ addExpirationChangeCreditLedgerEntryRequestParams.validate()
+ }
+
+ override fun visitAddVoidCreditLedgerEntryRequestParams(
+ addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams
+ ) {
+ addVoidCreditLedgerEntryRequestParams.validate()
+ }
+
+ override fun visitAddAmendmentCreditLedgerEntryRequestParams(
+ addAmendmentCreditLedgerEntryRequestParams:
+ AddAmendmentCreditLedgerEntryRequestParams
+ ) {
+ addAmendmentCreditLedgerEntryRequestParams.validate()
+ }
+ }
+ )
+ validated = true
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
- return /* spotless:off */ other is CustomerCreditLedgerCreateEntryByExternalIdBody && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams /* spotless:on */
+ return /* spotless:off */ other is Body && addIncrementCreditLedgerEntryRequestParams == other.addIncrementCreditLedgerEntryRequestParams && addDecrementCreditLedgerEntryRequestParams == other.addDecrementCreditLedgerEntryRequestParams && addExpirationChangeCreditLedgerEntryRequestParams == other.addExpirationChangeCreditLedgerEntryRequestParams && addVoidCreditLedgerEntryRequestParams == other.addVoidCreditLedgerEntryRequestParams && addAmendmentCreditLedgerEntryRequestParams == other.addAmendmentCreditLedgerEntryRequestParams /* spotless:on */
}
override fun hashCode(): Int = /* spotless:off */ Objects.hash(addIncrementCreditLedgerEntryRequestParams, addDecrementCreditLedgerEntryRequestParams, addExpirationChangeCreditLedgerEntryRequestParams, addVoidCreditLedgerEntryRequestParams, addAmendmentCreditLedgerEntryRequestParams) /* spotless:on */
@@ -309,20 +339,17 @@ private constructor(
override fun toString(): String =
when {
addIncrementCreditLedgerEntryRequestParams != null ->
- "CustomerCreditLedgerCreateEntryByExternalIdBody{addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams}"
+ "Body{addIncrementCreditLedgerEntryRequestParams=$addIncrementCreditLedgerEntryRequestParams}"
addDecrementCreditLedgerEntryRequestParams != null ->
- "CustomerCreditLedgerCreateEntryByExternalIdBody{addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams}"
+ "Body{addDecrementCreditLedgerEntryRequestParams=$addDecrementCreditLedgerEntryRequestParams}"
addExpirationChangeCreditLedgerEntryRequestParams != null ->
- "CustomerCreditLedgerCreateEntryByExternalIdBody{addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams}"
+ "Body{addExpirationChangeCreditLedgerEntryRequestParams=$addExpirationChangeCreditLedgerEntryRequestParams}"
addVoidCreditLedgerEntryRequestParams != null ->
- "CustomerCreditLedgerCreateEntryByExternalIdBody{addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams}"
+ "Body{addVoidCreditLedgerEntryRequestParams=$addVoidCreditLedgerEntryRequestParams}"
addAmendmentCreditLedgerEntryRequestParams != null ->
- "CustomerCreditLedgerCreateEntryByExternalIdBody{addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams}"
- _json != null -> "CustomerCreditLedgerCreateEntryByExternalIdBody{_unknown=$_json}"
- else ->
- throw IllegalStateException(
- "Invalid CustomerCreditLedgerCreateEntryByExternalIdBody"
- )
+ "Body{addAmendmentCreditLedgerEntryRequestParams=$addAmendmentCreditLedgerEntryRequestParams}"
+ _json != null -> "Body{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Body")
}
companion object {
@@ -332,7 +359,7 @@ private constructor(
addIncrementCreditLedgerEntryRequestParams:
AddIncrementCreditLedgerEntryRequestParams
) =
- CustomerCreditLedgerCreateEntryByExternalIdBody(
+ Body(
addIncrementCreditLedgerEntryRequestParams =
addIncrementCreditLedgerEntryRequestParams
)
@@ -342,7 +369,7 @@ private constructor(
addDecrementCreditLedgerEntryRequestParams:
AddDecrementCreditLedgerEntryRequestParams
) =
- CustomerCreditLedgerCreateEntryByExternalIdBody(
+ Body(
addDecrementCreditLedgerEntryRequestParams =
addDecrementCreditLedgerEntryRequestParams
)
@@ -352,7 +379,7 @@ private constructor(
addExpirationChangeCreditLedgerEntryRequestParams:
AddExpirationChangeCreditLedgerEntryRequestParams
) =
- CustomerCreditLedgerCreateEntryByExternalIdBody(
+ Body(
addExpirationChangeCreditLedgerEntryRequestParams =
addExpirationChangeCreditLedgerEntryRequestParams
)
@@ -360,26 +387,20 @@ private constructor(
@JvmStatic
fun ofAddVoidCreditLedgerEntryRequestParams(
addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams
- ) =
- CustomerCreditLedgerCreateEntryByExternalIdBody(
- addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams
- )
+ ) = Body(addVoidCreditLedgerEntryRequestParams = addVoidCreditLedgerEntryRequestParams)
@JvmStatic
fun ofAddAmendmentCreditLedgerEntryRequestParams(
addAmendmentCreditLedgerEntryRequestParams:
AddAmendmentCreditLedgerEntryRequestParams
) =
- CustomerCreditLedgerCreateEntryByExternalIdBody(
+ Body(
addAmendmentCreditLedgerEntryRequestParams =
addAmendmentCreditLedgerEntryRequestParams
)
}
- /**
- * An interface that defines how to map each variant of
- * [CustomerCreditLedgerCreateEntryByExternalIdBody] to a value of type [T].
- */
+ /** An interface that defines how to map each variant of [Body] to a value of type [T]. */
interface Visitor {
fun visitAddIncrementCreditLedgerEntryRequestParams(
@@ -407,31 +428,22 @@ private constructor(
): T
/**
- * Maps an unknown variant of [CustomerCreditLedgerCreateEntryByExternalIdBody] to a
- * value of type [T].
+ * Maps an unknown variant of [Body] to a value of type [T].
*
- * An instance of [CustomerCreditLedgerCreateEntryByExternalIdBody] can contain an
- * unknown variant if it was deserialized from data that doesn't match any known
- * variant. For example, if the SDK is on an older version than the API, then the API
- * may respond with new variants that the SDK is unaware of.
+ * An instance of [Body] can contain an unknown variant if it was deserialized from data
+ * that doesn't match any known variant. For example, if the SDK is on an older version
+ * than the API, then the API may respond with new variants that the SDK is unaware of.
*
* @throws OrbInvalidDataException in the default implementation.
*/
fun unknown(json: JsonValue?): T {
- throw OrbInvalidDataException(
- "Unknown CustomerCreditLedgerCreateEntryByExternalIdBody: $json"
- )
+ throw OrbInvalidDataException("Unknown Body: $json")
}
}
- internal class Deserializer :
- BaseDeserializer(
- CustomerCreditLedgerCreateEntryByExternalIdBody::class
- ) {
+ internal class Deserializer : BaseDeserializer(Body::class) {
- override fun ObjectCodec.deserialize(
- node: JsonNode
- ): CustomerCreditLedgerCreateEntryByExternalIdBody {
+ override fun ObjectCodec.deserialize(node: JsonNode): Body {
val json = JsonValue.fromJsonNode(node)
val entryType =
json.asObject().getOrNull()?.get("entry_type")?.asString()?.getOrNull()
@@ -440,78 +452,85 @@ private constructor(
"increment" -> {
tryDeserialize(
node,
- jacksonTypeRef()
- )
+ jacksonTypeRef(),
+ ) {
+ it.validate()
+ }
?.let {
- return CustomerCreditLedgerCreateEntryByExternalIdBody(
+ return Body(
addIncrementCreditLedgerEntryRequestParams = it,
- _json = json
+ _json = json,
)
}
}
"decrement" -> {
tryDeserialize(
node,
- jacksonTypeRef()
- )
+ jacksonTypeRef(),
+ ) {
+ it.validate()
+ }
?.let {
- return CustomerCreditLedgerCreateEntryByExternalIdBody(
+ return Body(
addDecrementCreditLedgerEntryRequestParams = it,
- _json = json
+ _json = json,
)
}
}
"expiration_change" -> {
tryDeserialize(
node,
- jacksonTypeRef()
- )
+ jacksonTypeRef(),
+ ) {
+ it.validate()
+ }
?.let {
- return CustomerCreditLedgerCreateEntryByExternalIdBody(
+ return Body(
addExpirationChangeCreditLedgerEntryRequestParams = it,
- _json = json
+ _json = json,
)
}
}
"void" -> {
tryDeserialize(
node,
- jacksonTypeRef()
- )
+ jacksonTypeRef(),
+ ) {
+ it.validate()
+ }
?.let {
- return CustomerCreditLedgerCreateEntryByExternalIdBody(
+ return Body(
addVoidCreditLedgerEntryRequestParams = it,
- _json = json
+ _json = json,
)
}
}
"amendment" -> {
tryDeserialize(
node,
- jacksonTypeRef()
- )
+ jacksonTypeRef(),
+ ) {
+ it.validate()
+ }
?.let {
- return CustomerCreditLedgerCreateEntryByExternalIdBody(
+ return Body(
addAmendmentCreditLedgerEntryRequestParams = it,
- _json = json
+ _json = json,
)
}
}
}
- return CustomerCreditLedgerCreateEntryByExternalIdBody(_json = json)
+ return Body(_json = json)
}
}
- internal class Serializer :
- BaseSerializer(
- CustomerCreditLedgerCreateEntryByExternalIdBody::class
- ) {
+ internal class Serializer : BaseSerializer(Body::class) {
override fun serialize(
- value: CustomerCreditLedgerCreateEntryByExternalIdBody,
+ value: Body,
generator: JsonGenerator,
- provider: SerializerProvider
+ provider: SerializerProvider,
) {
when {
value.addIncrementCreditLedgerEntryRequestParams != null ->
@@ -527,509 +546,514 @@ private constructor(
value.addAmendmentCreditLedgerEntryRequestParams != null ->
generator.writeObject(value.addAmendmentCreditLedgerEntryRequestParams)
value._json != null -> generator.writeObject(value._json)
- else ->
- throw IllegalStateException(
- "Invalid CustomerCreditLedgerCreateEntryByExternalIdBody"
- )
+ else -> throw IllegalStateException("Invalid Body")
}
}
}
- }
- fun toBuilder() = Builder().from(this)
+ @NoAutoDetect
+ class AddIncrementCreditLedgerEntryRequestParams
+ @JsonCreator
+ private constructor(
+ @JsonProperty("amount")
+ @ExcludeMissing
+ private val amount: JsonField = JsonMissing.of(),
+ @JsonProperty("entry_type")
+ @ExcludeMissing
+ private val entryType: JsonField = JsonMissing.of(),
+ @JsonProperty("currency")
+ @ExcludeMissing
+ private val currency: JsonField = JsonMissing.of(),
+ @JsonProperty("description")
+ @ExcludeMissing
+ private val description: JsonField = JsonMissing.of(),
+ @JsonProperty("effective_date")
+ @ExcludeMissing
+ private val effectiveDate: JsonField = JsonMissing.of(),
+ @JsonProperty("expiry_date")
+ @ExcludeMissing
+ private val expiryDate: JsonField = JsonMissing.of(),
+ @JsonProperty("invoice_settings")
+ @ExcludeMissing
+ private val invoiceSettings: JsonField = JsonMissing.of(),
+ @JsonProperty("metadata")
+ @ExcludeMissing
+ private val metadata: JsonField = JsonMissing.of(),
+ @JsonProperty("per_unit_cost_basis")
+ @ExcludeMissing
+ private val perUnitCostBasis: JsonField = JsonMissing.of(),
+ @JsonAnySetter
+ private val additionalProperties: Map = immutableEmptyMap(),
+ ) {
- companion object {
+ /**
+ * The number of credits to effect. Note that this is required for increment, decrement,
+ * void, or undo operations.
+ */
+ fun amount(): Double = amount.getRequired("amount")
- @JvmStatic fun builder() = Builder()
- }
+ fun entryType(): EntryType = entryType.getRequired("entry_type")
- /** A builder for [CustomerCreditLedgerCreateEntryByExternalIdParams]. */
- @NoAutoDetect
- class Builder internal constructor() {
+ /**
+ * The currency or custom pricing unit to use for this ledger entry. If this is a
+ * real-world currency, it must match the customer's invoicing currency.
+ */
+ fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency"))
- private var externalCustomerId: String? = null
- private var body: CustomerCreditLedgerCreateEntryByExternalIdBody? = null
- private var additionalHeaders: Headers.Builder = Headers.builder()
- private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+ /**
+ * Optional metadata that can be specified when adding ledger results via the API. For
+ * example, this can be used to note an increment refers to trial credits, or for noting
+ * corrections as a result of an incident, etc.
+ */
+ fun description(): Optional =
+ Optional.ofNullable(description.getNullable("description"))
- @JvmSynthetic
- internal fun from(
- customerCreditLedgerCreateEntryByExternalIdParams:
- CustomerCreditLedgerCreateEntryByExternalIdParams
- ) = apply {
- externalCustomerId =
- customerCreditLedgerCreateEntryByExternalIdParams.externalCustomerId
- body = customerCreditLedgerCreateEntryByExternalIdParams.body
- additionalHeaders =
- customerCreditLedgerCreateEntryByExternalIdParams.additionalHeaders.toBuilder()
- additionalQueryParams =
- customerCreditLedgerCreateEntryByExternalIdParams.additionalQueryParams.toBuilder()
- }
+ /**
+ * An ISO 8601 format date that denotes when this credit balance should become available
+ * for use.
+ */
+ fun effectiveDate(): Optional =
+ Optional.ofNullable(effectiveDate.getNullable("effective_date"))
- fun externalCustomerId(externalCustomerId: String) = apply {
- this.externalCustomerId = externalCustomerId
- }
+ /** An ISO 8601 format date that denotes when this credit balance should expire. */
+ fun expiryDate(): Optional =
+ Optional.ofNullable(expiryDate.getNullable("expiry_date"))
- fun forAddIncrementCreditLedgerEntryRequestParams(
- addIncrementCreditLedgerEntryRequestParams: AddIncrementCreditLedgerEntryRequestParams
- ) = apply {
- body =
- CustomerCreditLedgerCreateEntryByExternalIdBody
- .ofAddIncrementCreditLedgerEntryRequestParams(
- addIncrementCreditLedgerEntryRequestParams
- )
- }
+ /**
+ * Passing `invoice_settings` automatically generates an invoice for the newly added
+ * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as
+ * the calculation of the invoice total is done on that basis.
+ */
+ fun invoiceSettings(): Optional =
+ Optional.ofNullable(invoiceSettings.getNullable("invoice_settings"))
- fun forAddDecrementCreditLedgerEntryRequestParams(
- addDecrementCreditLedgerEntryRequestParams: AddDecrementCreditLedgerEntryRequestParams
- ) = apply {
- body =
- CustomerCreditLedgerCreateEntryByExternalIdBody
- .ofAddDecrementCreditLedgerEntryRequestParams(
- addDecrementCreditLedgerEntryRequestParams
- )
- }
+ /**
+ * User-specified key/value pairs for the resource. Individual keys can be removed by
+ * setting the value to `null`, and the entire metadata mapping can be cleared by
+ * setting `metadata` to `null`.
+ */
+ fun metadata(): Optional =
+ Optional.ofNullable(metadata.getNullable("metadata"))
- fun forAddExpirationChangeCreditLedgerEntryRequestParams(
- addExpirationChangeCreditLedgerEntryRequestParams:
- AddExpirationChangeCreditLedgerEntryRequestParams
- ) = apply {
- body =
- CustomerCreditLedgerCreateEntryByExternalIdBody
- .ofAddExpirationChangeCreditLedgerEntryRequestParams(
- addExpirationChangeCreditLedgerEntryRequestParams
- )
- }
+ /**
+ * Can only be specified when entry_type=increment. How much, in the customer's
+ * currency, a customer paid for a single credit in this block
+ */
+ fun perUnitCostBasis(): Optional =
+ Optional.ofNullable(perUnitCostBasis.getNullable("per_unit_cost_basis"))
- fun forAddVoidCreditLedgerEntryRequestParams(
- addVoidCreditLedgerEntryRequestParams: AddVoidCreditLedgerEntryRequestParams
- ) = apply {
- body =
- CustomerCreditLedgerCreateEntryByExternalIdBody
- .ofAddVoidCreditLedgerEntryRequestParams(addVoidCreditLedgerEntryRequestParams)
- }
+ /**
+ * The number of credits to effect. Note that this is required for increment, decrement,
+ * void, or undo operations.
+ */
+ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
- fun forAddAmendmentCreditLedgerEntryRequestParams(
- addAmendmentCreditLedgerEntryRequestParams: AddAmendmentCreditLedgerEntryRequestParams
- ) = apply {
- body =
- CustomerCreditLedgerCreateEntryByExternalIdBody
- .ofAddAmendmentCreditLedgerEntryRequestParams(
- addAmendmentCreditLedgerEntryRequestParams
- )
- }
+ @JsonProperty("entry_type")
+ @ExcludeMissing
+ fun _entryType(): JsonField = entryType
- fun additionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.clear()
- putAllAdditionalHeaders(additionalHeaders)
- }
+ /**
+ * The currency or custom pricing unit to use for this ledger entry. If this is a
+ * real-world currency, it must match the customer's invoicing currency.
+ */
+ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency
- fun additionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.clear()
- putAllAdditionalHeaders(additionalHeaders)
- }
+ /**
+ * Optional metadata that can be specified when adding ledger results via the API. For
+ * example, this can be used to note an increment refers to trial credits, or for noting
+ * corrections as a result of an incident, etc.
+ */
+ @JsonProperty("description")
+ @ExcludeMissing
+ fun _description(): JsonField = description
- fun putAdditionalHeader(name: String, value: String) = apply {
- additionalHeaders.put(name, value)
- }
+ /**
+ * An ISO 8601 format date that denotes when this credit balance should become available
+ * for use.
+ */
+ @JsonProperty("effective_date")
+ @ExcludeMissing
+ fun _effectiveDate(): JsonField = effectiveDate
- fun putAdditionalHeaders(name: String, values: Iterable) = apply {
- additionalHeaders.put(name, values)
- }
+ /** An ISO 8601 format date that denotes when this credit balance should expire. */
+ @JsonProperty("expiry_date")
+ @ExcludeMissing
+ fun _expiryDate(): JsonField = expiryDate
- fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.putAll(additionalHeaders)
- }
+ /**
+ * Passing `invoice_settings` automatically generates an invoice for the newly added
+ * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as
+ * the calculation of the invoice total is done on that basis.
+ */
+ @JsonProperty("invoice_settings")
+ @ExcludeMissing
+ fun _invoiceSettings(): JsonField = invoiceSettings
- fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.putAll(additionalHeaders)
- }
+ /**
+ * User-specified key/value pairs for the resource. Individual keys can be removed by
+ * setting the value to `null`, and the entire metadata mapping can be cleared by
+ * setting `metadata` to `null`.
+ */
+ @JsonProperty("metadata")
+ @ExcludeMissing
+ fun _metadata(): JsonField = metadata
- fun replaceAdditionalHeaders(name: String, value: String) = apply {
- additionalHeaders.replace(name, value)
- }
+ /**
+ * Can only be specified when entry_type=increment. How much, in the customer's
+ * currency, a customer paid for a single credit in this block
+ */
+ @JsonProperty("per_unit_cost_basis")
+ @ExcludeMissing
+ fun _perUnitCostBasis(): JsonField = perUnitCostBasis
- fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
- additionalHeaders.replace(name, values)
- }
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
- fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.replaceAll(additionalHeaders)
- }
+ private var validated: Boolean = false
- fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.replaceAll(additionalHeaders)
- }
+ fun validate(): AddIncrementCreditLedgerEntryRequestParams = apply {
+ if (validated) {
+ return@apply
+ }
- fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+ amount()
+ entryType()
+ currency()
+ description()
+ effectiveDate()
+ expiryDate()
+ invoiceSettings().ifPresent { it.validate() }
+ metadata().ifPresent { it.validate() }
+ perUnitCostBasis()
+ validated = true
+ }
- fun removeAllAdditionalHeaders(names: Set) = apply {
- additionalHeaders.removeAll(names)
- }
+ fun toBuilder() = Builder().from(this)
- fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.clear()
- putAllAdditionalQueryParams(additionalQueryParams)
- }
+ companion object {
- fun additionalQueryParams(additionalQueryParams: Map>) = apply {
- this.additionalQueryParams.clear()
- putAllAdditionalQueryParams(additionalQueryParams)
- }
+ @JvmStatic fun builder() = Builder()
+ }
- fun putAdditionalQueryParam(key: String, value: String) = apply {
- additionalQueryParams.put(key, value)
- }
+ /** A builder for [AddIncrementCreditLedgerEntryRequestParams]. */
+ class Builder internal constructor() {
- fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
- additionalQueryParams.put(key, values)
- }
+ private var amount: JsonField? = null
+ private var entryType: JsonField? = null
+ private var currency: JsonField = JsonMissing.of()
+ private var description: JsonField = JsonMissing.of()
+ private var effectiveDate: JsonField = JsonMissing.of()
+ private var expiryDate: JsonField = JsonMissing.of()
+ private var invoiceSettings: JsonField = JsonMissing.of()
+ private var metadata: JsonField = JsonMissing.of()
+ private var perUnitCostBasis: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
- fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.putAll(additionalQueryParams)
- }
+ @JvmSynthetic
+ internal fun from(
+ addIncrementCreditLedgerEntryRequestParams:
+ AddIncrementCreditLedgerEntryRequestParams
+ ) = apply {
+ amount = addIncrementCreditLedgerEntryRequestParams.amount
+ entryType = addIncrementCreditLedgerEntryRequestParams.entryType
+ currency = addIncrementCreditLedgerEntryRequestParams.currency
+ description = addIncrementCreditLedgerEntryRequestParams.description
+ effectiveDate = addIncrementCreditLedgerEntryRequestParams.effectiveDate
+ expiryDate = addIncrementCreditLedgerEntryRequestParams.expiryDate
+ invoiceSettings = addIncrementCreditLedgerEntryRequestParams.invoiceSettings
+ metadata = addIncrementCreditLedgerEntryRequestParams.metadata
+ perUnitCostBasis = addIncrementCreditLedgerEntryRequestParams.perUnitCostBasis
+ additionalProperties =
+ addIncrementCreditLedgerEntryRequestParams.additionalProperties
+ .toMutableMap()
+ }
- fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
- apply {
- this.additionalQueryParams.putAll(additionalQueryParams)
- }
+ /**
+ * The number of credits to effect. Note that this is required for increment,
+ * decrement, void, or undo operations.
+ */
+ fun amount(amount: Double) = amount(JsonField.of(amount))
- fun replaceAdditionalQueryParams(key: String, value: String) = apply {
- additionalQueryParams.replace(key, value)
- }
+ /**
+ * The number of credits to effect. Note that this is required for increment,
+ * decrement, void, or undo operations.
+ */
+ fun amount(amount: JsonField) = apply { this.amount = amount }
- fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
- additionalQueryParams.replace(key, values)
- }
+ fun entryType(entryType: EntryType) = entryType(JsonField.of(entryType))
- fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.replaceAll(additionalQueryParams)
- }
+ fun entryType(entryType: JsonField) = apply {
+ this.entryType = entryType
+ }
- fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
- apply {
- this.additionalQueryParams.replaceAll(additionalQueryParams)
- }
+ /**
+ * The currency or custom pricing unit to use for this ledger entry. If this is a
+ * real-world currency, it must match the customer's invoicing currency.
+ */
+ fun currency(currency: String?) = currency(JsonField.ofNullable(currency))
- fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+ /**
+ * The currency or custom pricing unit to use for this ledger entry. If this is a
+ * real-world currency, it must match the customer's invoicing currency.
+ */
+ fun currency(currency: Optional) = currency(currency.orElse(null))
- fun removeAllAdditionalQueryParams(keys: Set) = apply {
- additionalQueryParams.removeAll(keys)
- }
+ /**
+ * The currency or custom pricing unit to use for this ledger entry. If this is a
+ * real-world currency, it must match the customer's invoicing currency.
+ */
+ fun currency(currency: JsonField) = apply { this.currency = currency }
- fun build(): CustomerCreditLedgerCreateEntryByExternalIdParams =
- CustomerCreditLedgerCreateEntryByExternalIdParams(
- checkRequired("externalCustomerId", externalCustomerId),
- body ?: CustomerCreditLedgerCreateEntryByExternalIdBody(),
- additionalHeaders.build(),
- additionalQueryParams.build(),
- )
- }
+ /**
+ * Optional metadata that can be specified when adding ledger results via the API.
+ * For example, this can be used to note an increment refers to trial credits, or
+ * for noting corrections as a result of an incident, etc.
+ */
+ fun description(description: String?) =
+ description(JsonField.ofNullable(description))
- @NoAutoDetect
- class AddIncrementCreditLedgerEntryRequestParams
- @JsonCreator
- private constructor(
- @JsonProperty("amount")
- @ExcludeMissing
- private val amount: JsonField = JsonMissing.of(),
- @JsonProperty("entry_type")
- @ExcludeMissing
- private val entryType: JsonField = JsonMissing.of(),
- @JsonProperty("currency")
- @ExcludeMissing
- private val currency: JsonField = JsonMissing.of(),
- @JsonProperty("description")
- @ExcludeMissing
- private val description: JsonField = JsonMissing.of(),
- @JsonProperty("effective_date")
- @ExcludeMissing
- private val effectiveDate: JsonField = JsonMissing.of(),
- @JsonProperty("expiry_date")
- @ExcludeMissing
- private val expiryDate: JsonField = JsonMissing.of(),
- @JsonProperty("invoice_settings")
- @ExcludeMissing
- private val invoiceSettings: JsonField = JsonMissing.of(),
- @JsonProperty("metadata")
- @ExcludeMissing
- private val metadata: JsonField = JsonMissing.of(),
- @JsonProperty("per_unit_cost_basis")
- @ExcludeMissing
- private val perUnitCostBasis: JsonField = JsonMissing.of(),
- @JsonAnySetter
- private val additionalProperties: Map = immutableEmptyMap(),
- ) {
+ /**
+ * Optional metadata that can be specified when adding ledger results via the API.
+ * For example, this can be used to note an increment refers to trial credits, or
+ * for noting corrections as a result of an incident, etc.
+ */
+ fun description(description: Optional) =
+ description(description.orElse(null))
- /**
- * The number of credits to effect. Note that this is required for increment, decrement,
- * void, or undo operations.
- */
- fun amount(): Double = amount.getRequired("amount")
-
- fun entryType(): EntryType = entryType.getRequired("entry_type")
-
- /**
- * The currency or custom pricing unit to use for this ledger entry. If this is a real-world
- * currency, it must match the customer's invoicing currency.
- */
- fun currency(): Optional = Optional.ofNullable(currency.getNullable("currency"))
-
- /**
- * Optional metadata that can be specified when adding ledger results via the API. For
- * example, this can be used to note an increment refers to trial credits, or for noting
- * corrections as a result of an incident, etc.
- */
- fun description(): Optional =
- Optional.ofNullable(description.getNullable("description"))
-
- /**
- * An ISO 8601 format date that denotes when this credit balance should become available for
- * use.
- */
- fun effectiveDate(): Optional =
- Optional.ofNullable(effectiveDate.getNullable("effective_date"))
-
- /** An ISO 8601 format date that denotes when this credit balance should expire. */
- fun expiryDate(): Optional =
- Optional.ofNullable(expiryDate.getNullable("expiry_date"))
-
- /**
- * Passing `invoice_settings` automatically generates an invoice for the newly added
- * credits. If `invoice_settings` is passed, you must specify per_unit_cost_basis, as the
- * calculation of the invoice total is done on that basis.
- */
- fun invoiceSettings(): Optional =
- Optional.ofNullable(invoiceSettings.getNullable("invoice_settings"))
-
- /**
- * User-specified key/value pairs for the resource. Individual keys can be removed by
- * setting the value to `null`, and the entire metadata mapping can be cleared by setting
- * `metadata` to `null`.
- */
- fun metadata(): Optional = Optional.ofNullable(metadata.getNullable("metadata"))
-
- /**
- * Can only be specified when entry_type=increment. How much, in the customer's currency, a
- * customer paid for a single credit in this block
- */
- fun perUnitCostBasis(): Optional =
- Optional.ofNullable(perUnitCostBasis.getNullable("per_unit_cost_basis"))
-
- /**
- * The number of credits to effect. Note that this is required for increment, decrement,
- * void, or undo operations.
- */
- @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
-
- @JsonProperty("entry_type")
- @ExcludeMissing
- fun _entryType(): JsonField = entryType
-
- /**
- * The currency or custom pricing unit to use for this ledger entry. If this is a real-world
- * currency, it must match the customer's invoicing currency.
- */
- @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField