diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ac370d2b..a9e92226 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.46" + ".": "0.1.0-alpha.47" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index f2253470..1e64c91b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 103 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-95a3d7780935a38e0cf076d4ad2d68bd1a5641bced8398d972db2e92751d364a.yml openapi_spec_hash: 9ebe818c4ad4f2d9c4e473b5192d7544 -config_hash: 3dc5bc1df028fc7301fb2ada9846f038 +config_hash: 54edf41f0377bc235f622fdaa7405f22 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bd9a7c2..f29652f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## 0.1.0-alpha.47 (2025-04-07) + +Full Changelog: [v0.1.0-alpha.46...v0.1.0-alpha.47](https://github.com/orbcorp/orb-kotlin/compare/v0.1.0-alpha.46...v0.1.0-alpha.47) + +### Features + +* **client:** expose request body setter and getter ([#346](https://github.com/orbcorp/orb-kotlin/issues/346)) ([0e0965d](https://github.com/orbcorp/orb-kotlin/commit/0e0965d8c2195326d430cdb8c11804d972995663)) + + +### Bug Fixes + +* **api:** naming for sync_payment_methods methods ([#351](https://github.com/orbcorp/orb-kotlin/issues/351)) ([00120a1](https://github.com/orbcorp/orb-kotlin/commit/00120a145d3e4cc29e56c2da60bb4ec2330ee131)) + + +### Chores + +* **internal:** codegen related update ([#348](https://github.com/orbcorp/orb-kotlin/issues/348)) ([7900ed7](https://github.com/orbcorp/orb-kotlin/commit/7900ed75a3763aae4bcce5875835068cc5c39f5e)) + + +### Documentation + +* add comments to `JsonField` classes ([#349](https://github.com/orbcorp/orb-kotlin/issues/349)) ([7e440ba](https://github.com/orbcorp/orb-kotlin/commit/7e440ba16b1455d2a3c6e35eb0ac1d259fd9d391)) +* document how to forcibly omit required field ([51cb762](https://github.com/orbcorp/orb-kotlin/commit/51cb76259150387df200996952cc29c4bce048a6)) +* swap examples used in readme ([#350](https://github.com/orbcorp/orb-kotlin/issues/350)) ([51cb762](https://github.com/orbcorp/orb-kotlin/commit/51cb76259150387df200996952cc29c4bce048a6)) + ## 0.1.0-alpha.46 (2025-04-02) Full Changelog: [v0.1.0-alpha.45...v0.1.0-alpha.46](https://github.com/orbcorp/orb-kotlin/compare/v0.1.0-alpha.45...v0.1.0-alpha.46) diff --git a/README.md b/README.md index 30e89138..26475228 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-kotlin)](https://central.sonatype.com/artifact/com.withorb.api/orb-kotlin/0.1.0-alpha.46) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-kotlin)](https://central.sonatype.com/artifact/com.withorb.api/orb-kotlin/0.1.0-alpha.47) @@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho ### Gradle ```kotlin -implementation("com.withorb.api:orb-kotlin:0.1.0-alpha.46") +implementation("com.withorb.api:orb-kotlin:0.1.0-alpha.47") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-kotlin:0.1.0-alpha.46") com.withorb.api orb-kotlin - 0.1.0-alpha.46 + 0.1.0-alpha.47 ``` @@ -442,6 +442,20 @@ val complexValue: JsonValue = JsonValue.from(mapOf( )) ``` +Normally a `Builder` class's `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset. + +To forcibly omit a required parameter or property, pass [`JsonMissing`](orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Values.kt): + +```kotlin +import com.withorb.api.core.JsonMissing +import com.withorb.api.models.CustomerCreateParams + +val params: CustomerCreateParams = CustomerCreateParams.builder() + .name("x") + .email(JsonMissing.of()) + .build() +``` + ### Response properties To access undocumented response properties, call the `_additionalProperties()` method: diff --git a/build.gradle.kts b/build.gradle.kts index 557b6844..85789979 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "0.1.0-alpha.46" // x-release-please-version + version = "0.1.0-alpha.47" // x-release-please-version } diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Values.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Values.kt index 0474da3c..196c0ffa 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Values.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/Values.kt @@ -27,32 +27,48 @@ import com.fasterxml.jackson.databind.ser.std.NullSerializer import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.withorb.api.errors.OrbInvalidDataException import java.io.InputStream -import java.util.Objects +import java.util.* import kotlin.reflect.KClass +/** + * A class representing a serializable JSON field. + * + * It can either be a [KnownValue] value of type [T], matching the type the SDK expects, or an + * arbitrary JSON value that bypasses the type system (via [JsonValue]). + */ @JsonDeserialize(using = JsonField.Deserializer::class) sealed class JsonField { + /** + * Returns whether this field is missing, which means it will be omitted from the serialized + * JSON entirely. + */ fun isMissing(): Boolean = this is JsonMissing + /** Whether this field is explicitly set to `null`. */ fun isNull(): Boolean = this is JsonNull - fun asKnown(): T? = - when (this) { - is KnownValue -> value - else -> null - } + /** + * Returns this field's "known" value, meaning it matches the type the SDK expects, or null if + * this field contains an arbitrary [JsonValue]. + * + * This is the opposite of [asUnknown]. + */ + fun asKnown(): T? = (this as? KnownValue)?.value /** - * If the "known" value (i.e. matching the type that the SDK expects) is returned by the API - * then this method will return `null`, otherwise a `JsonValue` is returned. + * Returns this field's arbitrary [JsonValue], meaning it mismatches the type the SDK expects, + * or null if this field contains a "known" value. + * + * This is the opposite of [asKnown]. */ - fun asUnknown(): JsonValue? = - when (this) { - is JsonValue -> this - else -> null - } + fun asUnknown(): JsonValue? = this as? JsonValue + /** + * Returns this field's boolean value, or null if it doesn't contain a boolean. + * + * This method checks for both a [KnownValue] containing a boolean and for [JsonBoolean]. + */ fun asBoolean(): Boolean? = when (this) { is JsonBoolean -> value @@ -60,6 +76,11 @@ sealed class JsonField { else -> null } + /** + * Returns this field's numerical value, or null if it doesn't contain a number. + * + * This method checks for both a [KnownValue] containing a number and for [JsonNumber]. + */ fun asNumber(): Number? = when (this) { is JsonNumber -> value @@ -67,6 +88,11 @@ sealed class JsonField { else -> null } + /** + * Returns this field's string value, or null if it doesn't contain a string. + * + * This method checks for both a [KnownValue] containing a string and for [JsonString]. + */ fun asString(): String? = when (this) { is JsonString -> value @@ -77,6 +103,11 @@ sealed class JsonField { fun asStringOrThrow(): String = asString() ?: throw OrbInvalidDataException("Value is not a string") + /** + * Returns this field's list value, or null if it doesn't contain a list. + * + * This method checks for both a [KnownValue] containing a list and for [JsonArray]. + */ fun asArray(): List? = when (this) { is JsonArray -> values @@ -93,6 +124,11 @@ sealed class JsonField { else -> null } + /** + * Returns this field's map value, or null if it doesn't contain a map. + * + * This method checks for both a [KnownValue] containing a map and for [JsonObject]. + */ fun asObject(): Map? = when (this) { is JsonObject -> values @@ -144,19 +180,31 @@ sealed class JsonField { asKnown()?.let(consume) } + /** Returns the result of calling the [visitor] method corresponding to this field's state. */ fun accept(visitor: Visitor): R = when (this) { is KnownValue -> visitor.visitKnown(value) is JsonValue -> accept(visitor as JsonValue.Visitor) } + /** + * An interface that defines how to map each possible state of a `JsonField` to a value of + * type [R]. + */ interface Visitor : JsonValue.Visitor { + fun visitKnown(value: T): R = visitDefault() } companion object { + + /** Returns a [JsonField] containing the given "known" [value]. */ fun of(value: T): JsonField = KnownValue.of(value) + /** + * Returns a [JsonField] containing the given "known" [value], or [JsonNull] if [value] is + * null. + */ fun ofNullable(value: T?): JsonField = when (value) { null -> JsonNull.of() @@ -170,6 +218,7 @@ sealed class JsonField { * annotation. */ class IsMissing { + override fun equals(other: Any?): Boolean = other is JsonMissing override fun hashCode(): Int = Objects.hash() @@ -191,6 +240,12 @@ sealed class JsonField { } } +/** + * A class representing an arbitrary JSON value. + * + * It is immutable and assignable to any [JsonField], regardless of its expected type (i.e. its + * generic type argument). + */ @JsonDeserialize(using = JsonValue.Deserializer::class) sealed class JsonValue : JsonField() { @@ -200,6 +255,7 @@ sealed class JsonValue : JsonField() { fun convert(type: KClass): R? = JSON_MAPPER.convertValue(this, type.java) + /** Returns the result of calling the [visitor] method corresponding to this value's variant. */ fun accept(visitor: Visitor): R = when (this) { is JsonMissing -> visitor.visitMissing() @@ -211,7 +267,12 @@ sealed class JsonValue : JsonField() { is JsonObject -> visitor.visitObject(values) } + /** + * An interface that defines how to map each variant state of a [JsonValue] to a value of type + * [R]. + */ interface Visitor { + fun visitNull(): R = visitDefault() fun visitMissing(): R = visitDefault() @@ -226,15 +287,52 @@ sealed class JsonValue : JsonField() { fun visitObject(values: Map): R = visitDefault() - fun visitDefault(): R { - throw RuntimeException("Unexpected value") - } + /** + * The default implementation for unimplemented visitor methods. + * + * @throws IllegalArgumentException in the default implementation. + */ + fun visitDefault(): R = throw IllegalArgumentException("Unexpected value") } companion object { private val JSON_MAPPER = jsonMapper() + /** + * Converts the given [value] to a [JsonValue]. + * + * This method works best on primitive types, [List] values, [Map] values, and nested + * combinations of these. For example: + * ```kotlin + * // Create primitive JSON values + * val nullValue: JsonValue = JsonValue.from(null) + * val booleanValue: JsonValue = JsonValue.from(true) + * val numberValue: JsonValue = JsonValue.from(42) + * val stringValue: JsonValue = JsonValue.from("Hello World!") + * + * // Create a JSON array value equivalent to `["Hello", "World"]` + * val arrayValue: JsonValue = JsonValue.from(listOf("Hello", "World")) + * + * // Create a JSON object value equivalent to `{ "a": 1, "b": 2 }` + * val objectValue: JsonValue = JsonValue.from(mapOf( + * "a" to 1, + * "b" to 2, + * )) + * + * // Create an arbitrarily nested JSON equivalent to: + * // { + * // "a": [1, 2], + * // "b": [3, 4] + * // } + * val complexValue: JsonValue = JsonValue.from(mapOf( + * "a" to listOf(1, 2), + * "b" to listOf(3, 4), + * )) + * ``` + * + * @throws IllegalArgumentException if [value] is not JSON serializable. + */ fun from(value: Any?): JsonValue = when (value) { null -> JsonNull.of() @@ -242,6 +340,11 @@ sealed class JsonValue : JsonField() { else -> JSON_MAPPER.convertValue(value, JsonValue::class.java) } + /** + * Returns a [JsonValue] converted from the given Jackson [JsonNode]. + * + * @throws IllegalStateException for unsupported node types. + */ fun fromJsonNode(node: JsonNode): JsonValue = when (node.nodeType) { MISSING -> JsonMissing.of() @@ -262,12 +365,19 @@ sealed class JsonValue : JsonField() { } class Deserializer : BaseDeserializer(JsonValue::class) { + override fun ObjectCodec.deserialize(node: JsonNode): JsonValue = fromJsonNode(node) override fun getNullValue(context: DeserializationContext?): JsonValue = JsonNull.of() } } +/** + * A class representing a "known" JSON serializable value of type [T], matching the type the SDK + * expects. + * + * It is assignable to `JsonField`. + */ class KnownValue private constructor( @com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: T @@ -286,44 +396,59 @@ private constructor( override fun toString() = value.contentToString() companion object { + + /** Returns a [KnownValue] containing the given [value]. */ @JsonCreator fun of(value: T) = KnownValue(value) } } +/** + * A [JsonValue] representing an omitted JSON field. + * + * An instance of this class will cause a JSON field to be omitted from the serialized JSON + * entirely. + */ @JsonSerialize(using = JsonMissing.Serializer::class) class JsonMissing : JsonValue() { override fun toString() = "" companion object { + private val INSTANCE: JsonMissing = JsonMissing() + /** Returns the singleton instance of [JsonMissing]. */ fun of() = INSTANCE } class Serializer : BaseSerializer(JsonMissing::class) { + override fun serialize( value: JsonMissing, generator: JsonGenerator, provider: SerializerProvider, ) { - throw RuntimeException("JsonMissing cannot be serialized") + throw IllegalStateException("JsonMissing cannot be serialized") } } } +/** A [JsonValue] representing a JSON `null` value. */ @JsonSerialize(using = NullSerializer::class) class JsonNull : JsonValue() { override fun toString() = "null" companion object { + private val INSTANCE: JsonNull = JsonNull() + /** Returns the singleton instance of [JsonMissing]. */ @JsonCreator fun of() = INSTANCE } } +/** A [JsonValue] representing a JSON boolean value. */ class JsonBoolean private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: Boolean @@ -342,14 +467,18 @@ private constructor( override fun toString() = value.toString() companion object { + + /** Returns a [JsonBoolean] containing the given [value]. */ @JsonCreator fun of(value: Boolean) = JsonBoolean(value) } } +/** A [JsonValue] representing a JSON number value. */ class JsonNumber private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: Number ) : JsonValue() { + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -363,10 +492,13 @@ private constructor( override fun toString() = value.toString() companion object { + + /** Returns a [JsonNumber] containing the given [value]. */ @JsonCreator fun of(value: Number) = JsonNumber(value) } } +/** A [JsonValue] representing a JSON string value. */ class JsonString private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @get:JvmName("value") val value: String @@ -385,10 +517,13 @@ private constructor( override fun toString() = value companion object { + + /** Returns a [JsonString] containing the given [value]. */ @JsonCreator fun of(value: String) = JsonString(value) } } +/** A [JsonValue] representing a JSON array value. */ class JsonArray private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @@ -409,10 +544,13 @@ private constructor( override fun toString() = values.toString() companion object { + + /** Returns a [JsonArray] containing the given [values]. */ @JsonCreator fun of(values: List) = JsonArray(values.toImmutable()) } } +/** A [JsonValue] representing a JSON object value. */ class JsonObject private constructor( @get:com.fasterxml.jackson.annotation.JsonValue @@ -433,27 +571,57 @@ private constructor( override fun toString() = values.toString() companion object { + + /** Returns a [JsonObject] containing the given [values]. */ @JsonCreator fun of(values: Map) = JsonObject(values.toImmutable()) } } +/** A Jackson annotation for excluding fields set to [JsonMissing] from the serialized JSON. */ @JacksonAnnotationsInside @JsonInclude(JsonInclude.Include.CUSTOM, valueFilter = JsonField.IsMissing::class) annotation class ExcludeMissing +/** A class representing a field in a `multipart/form-data` request. */ class MultipartField private constructor( + /** A [JsonField] value, which will be serialized to zero or more parts. */ @get:com.fasterxml.jackson.annotation.JsonValue val value: JsonField, + /** A content type for the serialized parts. */ val contentType: String, + /** Returns the filename directive that will be included in the serialized field. */ val filename: String?, ) { companion object { + /** + * Returns a [MultipartField] containing the given [value] as a [KnownValue]. + * + * [contentType] will be set to `application/octet-stream` if [value] is binary data, or + * `text/plain; charset=utf-8` otherwise. + */ fun of(value: T?) = builder().value(value).build() + /** + * Returns a [MultipartField] containing the given [value]. + * + * [contentType] will be set to `application/octet-stream` if [value] is binary data, or + * `text/plain; charset=utf-8` otherwise. + */ fun of(value: JsonField) = builder().value(value).build() + /** + * Returns a mutable builder for constructing an instance of [MultipartField]. + * + * The following fields are required: + * ```kotlin + * .value() + * ``` + * + * If [contentType] is unset, then it will be set to `application/octet-stream` if [value] + * is binary data, or `text/plain; charset=utf-8` otherwise. + */ fun builder() = Builder() } @@ -475,6 +643,21 @@ private constructor( fun filename(filename: String?) = apply { this.filename = filename } + /** + * Returns an immutable instance of [MultipartField]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```kotlin + * .value() + * ``` + * + * If [contentType] is unset, then it will be set to `application/octet-stream` if [value] + * is binary data, or `text/plain; charset=utf-8` otherwise. + * + * @throws IllegalStateException if any required field is unset. + */ fun build(): MultipartField { val value = checkRequired("value", value) return MultipartField( diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/HttpResponseFor.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/HttpResponseFor.kt index 63b9e96d..e114b822 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/HttpResponseFor.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/core/http/HttpResponseFor.kt @@ -10,7 +10,9 @@ interface HttpResponseFor : HttpResponse { internal fun HttpResponse.parseable(parse: () -> T): HttpResponseFor = object : HttpResponseFor { - override fun parse(): T = parse() + private val parsed: T by lazy { parse() } + + override fun parse(): T = parsed override fun statusCode(): Int = this@parseable.statusCode() diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt index 50bb6ce2..ecb6f9b2 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt @@ -124,6 +124,17 @@ private constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [currency] + * - [type] + * - [thresholds] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The case sensitive currency or custom pricing unit to use for this alert. */ fun currency(currency: String) = apply { body.currency(currency) } @@ -307,7 +318,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt index 9ae92907..458e3ec4 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt @@ -130,6 +130,17 @@ private constructor( this.externalCustomerId = externalCustomerId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [currency] + * - [type] + * - [thresholds] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The case sensitive currency or custom pricing unit to use for this alert. */ fun currency(currency: String) = apply { body.currency(currency) } @@ -313,7 +324,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt index ef9e640f..b60306e7 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt @@ -131,6 +131,17 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [thresholds] + * - [type] + * - [metricId] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The thresholds that define the values at which the alert will be triggered. */ fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) } @@ -314,7 +325,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt index 148f8cba..09e3e5d3 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertDisableParams.kt @@ -216,7 +216,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt index 8633bdd5..a675c75f 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertEnableParams.kt @@ -216,7 +216,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt index f1761166..a047fdbc 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/AlertUpdateParams.kt @@ -87,6 +87,15 @@ private constructor( this.alertConfigurationId = alertConfigurationId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [thresholds] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The thresholds that define the values at which the alert will be triggered. */ fun thresholds(thresholds: List) = apply { body.thresholds(thresholds) } @@ -247,7 +256,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt index e037f50b..9ce539c7 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CouponArchiveParams.kt @@ -204,7 +204,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt index b0336f02..31bab46e 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CouponCreateParams.kt @@ -136,6 +136,18 @@ private constructor( additionalQueryParams = couponCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [discount] + * - [redemptionCode] + * - [durationInMonths] + * - [maxRedemptions] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun discount(discount: Discount) = apply { body.discount(discount) } /** @@ -387,7 +399,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt index f159e7c4..e641d031 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt @@ -106,6 +106,17 @@ private constructor( additionalQueryParams = creditNoteCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [lineItems] + * - [memo] + * - [reason] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun lineItems(lineItems: List) = apply { body.lineItems(lineItems) } /** @@ -283,7 +294,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt index fd1f5a0c..0b5eb611 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerBalanceTransactionCreateParams.kt @@ -118,6 +118,17 @@ private constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [amount] + * - [type] + * - [description] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun amount(amount: String) = apply { body.amount(amount) } /** @@ -290,7 +301,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt index 4935da36..8175d87b 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreateParams.kt @@ -468,6 +468,20 @@ private constructor( additionalQueryParams = customerCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [email] + * - [name] + * - [accountingSyncConfiguration] + * - [additionalEmails] + * - [autoCollection] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * A valid customer email, to be used for notifications. When Orb triggers payment through a * payment gateway, this email will be used for any automatically issued receipts. @@ -1050,7 +1064,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt index f5eabd8d..a6ed44d7 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryByExternalIdParams.kt @@ -425,7 +425,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt index 5c0f1b09..03fb6ef7 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerCreateEntryParams.kt @@ -420,7 +420,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt index 06c49b7a..e01432fb 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt @@ -213,6 +213,20 @@ private constructor( this.externalCustomerId = externalCustomerId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [amount] + * - [currency] + * - [invoiceSettings] + * - [perUnitCostBasis] + * - [threshold] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The amount to increment when the threshold is reached. */ fun amount(amount: String) = apply { body.amount(amount) } @@ -483,7 +497,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt index 9ecedded..978d6b9c 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt @@ -209,6 +209,20 @@ private constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [amount] + * - [currency] + * - [invoiceSettings] + * - [perUnitCostBasis] + * - [threshold] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The amount to increment when the threshold is reached. */ fun amount(amount: String) = apply { body.amount(amount) } @@ -479,7 +493,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt index c6361ad5..61ef5efc 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteByExternalIdParams.kt @@ -221,7 +221,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt index 061d7205..1a94b110 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpDeleteParams.kt @@ -217,7 +217,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt index 9b0ba746..70fc2853 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerDeleteParams.kt @@ -214,7 +214,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.kt index 0c2466b2..8fe6dfa8 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.kt @@ -20,13 +20,13 @@ import java.util.Objects */ class CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams private constructor( - private val customerId: String, + private val externalCustomerId: String, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun customerId(): String = customerId + fun externalCustomerId(): String = externalCustomerId fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -44,7 +44,7 @@ private constructor( * * The following fields are required: * ```kotlin - * .customerId() + * .externalCustomerId() * ``` */ fun builder() = Builder() @@ -53,7 +53,7 @@ private constructor( /** A builder for [CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams]. */ class Builder internal constructor() { - private var customerId: String? = null + private var externalCustomerId: String? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() private var additionalBodyProperties: MutableMap = mutableMapOf() @@ -62,7 +62,8 @@ private constructor( customerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams ) = apply { - customerId = customerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.customerId + externalCustomerId = + customerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.externalCustomerId additionalHeaders = customerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.additionalHeaders .toBuilder() @@ -76,7 +77,9 @@ private constructor( .toMutableMap() } - fun customerId(customerId: String) = apply { this.customerId = customerId } + fun externalCustomerId(externalCustomerId: String) = apply { + this.externalCustomerId = externalCustomerId + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -206,25 +209,25 @@ private constructor( * * The following fields are required: * ```kotlin - * .customerId() + * .externalCustomerId() * ``` * * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams = CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams( - checkRequired("customerId", customerId), + checkRequired("externalCustomerId", externalCustomerId), additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { - 0 -> customerId + 0 -> externalCustomerId else -> "" } @@ -237,11 +240,11 @@ private constructor( return true } - return /* spotless:off */ other is CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams && customerId == other.customerId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams && externalCustomerId == other.externalCustomerId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalCustomerId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ override fun toString() = - "CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams{customerId=$customerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams{externalCustomerId=$externalCustomerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" } diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParams.kt index 45cb9606..bf0de0d9 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParams.kt @@ -20,13 +20,13 @@ import java.util.Objects */ class CustomerSyncPaymentMethodsFromGatewayParams private constructor( - private val externalCustomerId: String, + private val customerId: String, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, private val additionalBodyProperties: Map, ) : Params { - fun externalCustomerId(): String = externalCustomerId + fun customerId(): String = customerId fun _additionalBodyProperties(): Map = additionalBodyProperties @@ -44,7 +44,7 @@ private constructor( * * The following fields are required: * ```kotlin - * .externalCustomerId() + * .customerId() * ``` */ fun builder() = Builder() @@ -53,7 +53,7 @@ private constructor( /** A builder for [CustomerSyncPaymentMethodsFromGatewayParams]. */ class Builder internal constructor() { - private var externalCustomerId: String? = null + private var customerId: String? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() private var additionalBodyProperties: MutableMap = mutableMapOf() @@ -61,7 +61,7 @@ private constructor( internal fun from( customerSyncPaymentMethodsFromGatewayParams: CustomerSyncPaymentMethodsFromGatewayParams ) = apply { - externalCustomerId = customerSyncPaymentMethodsFromGatewayParams.externalCustomerId + customerId = customerSyncPaymentMethodsFromGatewayParams.customerId additionalHeaders = customerSyncPaymentMethodsFromGatewayParams.additionalHeaders.toBuilder() additionalQueryParams = @@ -70,9 +70,7 @@ private constructor( customerSyncPaymentMethodsFromGatewayParams.additionalBodyProperties.toMutableMap() } - fun externalCustomerId(externalCustomerId: String) = apply { - this.externalCustomerId = externalCustomerId - } + fun customerId(customerId: String) = apply { this.customerId = customerId } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -201,25 +199,25 @@ private constructor( * * The following fields are required: * ```kotlin - * .externalCustomerId() + * .customerId() * ``` * * @throws IllegalStateException if any required field is unset. */ fun build(): CustomerSyncPaymentMethodsFromGatewayParams = CustomerSyncPaymentMethodsFromGatewayParams( - checkRequired("externalCustomerId", externalCustomerId), + checkRequired("customerId", customerId), additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { - 0 -> externalCustomerId + 0 -> customerId else -> "" } @@ -232,11 +230,11 @@ private constructor( return true } - return /* spotless:off */ other is CustomerSyncPaymentMethodsFromGatewayParams && externalCustomerId == other.externalCustomerId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CustomerSyncPaymentMethodsFromGatewayParams && customerId == other.customerId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(externalCustomerId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(customerId, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ override fun toString() = - "CustomerSyncPaymentMethodsFromGatewayParams{externalCustomerId=$externalCustomerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CustomerSyncPaymentMethodsFromGatewayParams{customerId=$customerId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" } diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt index 1daaa34c..1fa5a66c 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateByExternalIdParams.kt @@ -454,6 +454,20 @@ private constructor( fun id(id: String) = apply { this.id = id } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [accountingSyncConfiguration] + * - [additionalEmails] + * - [autoCollection] + * - [billingAddress] + * - [currency] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration?) = apply { body.accountingSyncConfiguration(accountingSyncConfiguration) @@ -1020,7 +1034,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt index d682a7a8..79a37e27 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/CustomerUpdateParams.kt @@ -452,6 +452,20 @@ private constructor( fun customerId(customerId: String) = apply { this.customerId = customerId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [accountingSyncConfiguration] + * - [additionalEmails] + * - [autoCollection] + * - [billingAddress] + * - [currency] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun accountingSyncConfiguration(accountingSyncConfiguration: AccountingSyncConfiguration?) = apply { body.accountingSyncConfiguration(accountingSyncConfiguration) @@ -1018,7 +1032,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt index d3398ce1..b9a4a72c 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/DimensionalPriceGroupCreateParams.kt @@ -149,6 +149,20 @@ private constructor( dimensionalPriceGroupCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [billableMetricId] + * - [dimensions] + * - [name] + * - [externalDimensionalPriceGroupId] + * - [metadata] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun billableMetricId(billableMetricId: String) = apply { body.billableMetricId(billableMetricId) } @@ -364,7 +378,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt index 79af5d35..a40bbd59 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillCloseParams.kt @@ -205,7 +205,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt index 767d9c22..74b0be3f 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt @@ -209,6 +209,20 @@ private constructor( additionalQueryParams = eventBackfillCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [timeframeEnd] + * - [timeframeStart] + * - [closeTime] + * - [customerId] + * - [deprecationFilter] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * The (exclusive) end of the usage timeframe affected by this backfill. By default, Orb * allows backfills up to 10 days in duration at a time. Reach out to discuss extending this @@ -473,7 +487,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt index af5f2e1a..b277f9a6 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventBackfillRevertParams.kt @@ -208,7 +208,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt index d59f7913..679ef104 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventDeprecateParams.kt @@ -233,7 +233,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt index 0c8bee38..38ccb0bc 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt @@ -294,6 +294,15 @@ private constructor( */ fun debug(debug: Boolean) = debug(debug as Boolean?) + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [events] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun events(events: List) = apply { body.events(events) } /** @@ -451,7 +460,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt index a733feee..94a94e1f 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventSearchParams.kt @@ -125,6 +125,17 @@ private constructor( additionalQueryParams = eventSearchParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [eventIds] + * - [timeframeEnd] + * - [timeframeStart] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * This is an explicit array of IDs to filter by. Note that an event's ID is the * idempotency_key that was originally used for ingestion, and this only supports events @@ -321,7 +332,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt index c286901d..f64f5ea3 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/EventUpdateParams.kt @@ -178,6 +178,20 @@ private constructor( fun eventId(eventId: String) = apply { this.eventId = eventId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [eventName] + * - [properties] + * - [timestamp] + * - [customerId] + * - [externalCustomerId] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** A name to meaningfully identify the action or event type. */ fun eventName(eventName: String) = apply { body.eventName(eventName) } @@ -381,7 +395,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt index 29ba98dc..419494c3 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceCreateParams.kt @@ -225,6 +225,20 @@ private constructor( additionalQueryParams = invoiceCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [currency] + * - [invoiceDate] + * - [lineItems] + * - [netTerms] + * - [customerId] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * An ISO 4217 currency string. Must be the same as the customer's currency if it is set. */ @@ -543,7 +557,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt index f0f47752..bbc7438e 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceIssueParams.kt @@ -91,6 +91,15 @@ private constructor( fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [synchronous] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * If true, the invoice will be issued synchronously. If false, the invoice will be issued * asynchronously. The synchronous option is only available for invoices that have no usage @@ -246,7 +255,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt index b6d4eb38..77d9dbb6 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceLineItemCreateParams.kt @@ -160,6 +160,20 @@ private constructor( additionalQueryParams = invoiceLineItemCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [amount] + * - [endDate] + * - [invoiceId] + * - [name] + * - [quantity] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The total amount in the invoice's currency to add to the line item. */ fun amount(amount: String) = apply { body.amount(amount) } @@ -374,7 +388,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt index f6ea98df..3a301d08 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceMarkPaidParams.kt @@ -118,6 +118,17 @@ private constructor( fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [paymentReceivedDate] + * - [externalId] + * - [notes] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** A date string to specify the date of the payment. */ fun paymentReceivedDate(paymentReceivedDate: LocalDate) = apply { body.paymentReceivedDate(paymentReceivedDate) @@ -296,7 +307,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt index 8ae6208b..eb01780b 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoicePayParams.kt @@ -203,7 +203,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt index 748b220c..de805c01 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceUpdateParams.kt @@ -90,6 +90,15 @@ private constructor( fun invoiceId(invoiceId: String) = apply { this.invoiceId = invoiceId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [metadata] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * 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 @@ -244,7 +253,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidParams.kt index e2fc92da..c243707c 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidParams.kt @@ -210,7 +210,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt index cf0da3b9..d54a6c33 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/ItemCreateParams.kt @@ -75,6 +75,15 @@ private constructor( additionalQueryParams = itemCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [name] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The name of the item. */ fun name(name: String) = apply { body.name(name) } @@ -219,7 +228,7 @@ private constructor( ItemCreateParams(body.build(), additionalHeaders.build(), additionalQueryParams.build()) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt index 82929a4f..467955e8 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/ItemUpdateParams.kt @@ -97,6 +97,16 @@ private constructor( fun itemId(itemId: String) = apply { this.itemId = itemId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [externalConnections] + * - [name] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun externalConnections(externalConnections: List?) = apply { body.externalConnections(externalConnections) } @@ -269,7 +279,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt index 15b5135d..883acbf0 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/MetricCreateParams.kt @@ -145,6 +145,20 @@ private constructor( additionalQueryParams = metricCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [description] + * - [itemId] + * - [name] + * - [sql] + * - [metadata] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** A description of the metric. */ fun description(description: String?) = apply { body.description(description) } @@ -346,7 +360,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt index fd5c49aa..131a1535 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/MetricUpdateParams.kt @@ -88,6 +88,15 @@ private constructor( fun metricId(metricId: String) = apply { this.metricId = metricId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [metadata] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * 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 @@ -242,7 +251,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt index 3c2ce60c..b2614f4c 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanCreateParams.kt @@ -197,6 +197,20 @@ private constructor( additionalQueryParams = planCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [currency] + * - [name] + * - [prices] + * - [defaultInvoiceMemo] + * - [externalPlanId] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** An ISO 4217 currency string for invoices generated by subscriptions on this plan. */ fun currency(currency: String) = apply { body.currency(currency) } @@ -629,7 +643,7 @@ private constructor( PlanCreateParams(body.build(), additionalHeaders.build(), additionalQueryParams.build()) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt index 9339455a..0997d4ee 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanExternalPlanIdUpdateParams.kt @@ -108,6 +108,16 @@ private constructor( this.otherExternalPlanId = otherExternalPlanId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [externalPlanId] + * - [metadata] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * An optional user-defined ID for this plan resource, used throughout the system as an * alias for this Plan. Use this field to identify a plan by an existing identifier in your @@ -280,7 +290,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt index 8b311595..352f243a 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PlanUpdateParams.kt @@ -105,6 +105,16 @@ private constructor( fun planId(planId: String) = apply { this.planId = planId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [externalPlanId] + * - [metadata] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * An optional user-defined ID for this plan resource, used throughout the system as an * alias for this Plan. Use this field to identify a plan by an existing identifier in your @@ -277,7 +287,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt index 7821b31d..d401fbab 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceCreateParams.kt @@ -437,7 +437,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt index 3ce4c345..57e9076b 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateParams.kt @@ -183,6 +183,20 @@ private constructor( fun priceId(priceId: String) = apply { this.priceId = priceId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [timeframeEnd] + * - [timeframeStart] + * - [customerId] + * - [externalCustomerId] + * - [filter] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** The exclusive upper bound for event timestamps */ fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { body.timeframeEnd(timeframeEnd) } @@ -420,7 +434,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt index b01792bd..887c5514 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceExternalPriceIdUpdateParams.kt @@ -93,6 +93,15 @@ private constructor( this.externalPriceId = externalPriceId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [metadata] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * 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 @@ -247,7 +256,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt index 7608b6bf..03205bf4 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/PriceUpdateParams.kt @@ -88,6 +88,15 @@ private constructor( fun priceId(priceId: String) = apply { this.priceId = priceId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [metadata] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * 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 @@ -242,7 +251,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt index 10b8b8b8..5104bec5 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionCancelParams.kt @@ -170,6 +170,17 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [cancelOption] + * - [allowInvoiceCreditOrVoid] + * - [cancellationDate] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** Determines the timing of subscription cancellation */ fun cancelOption(cancelOption: CancelOption) = apply { body.cancelOption(cancelOption) } @@ -370,7 +381,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt index 36ae7acb..bb8fcc0a 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt @@ -798,6 +798,20 @@ private constructor( additionalQueryParams = subscriptionCreateParams.additionalQueryParams.toBuilder() } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [addAdjustments] + * - [addPrices] + * - [alignBillingWithSubscriptionStartDate] + * - [autoCollection] + * - [awsRegion] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * Additional adjustments to be added to the subscription. (Only available for accounts that * have migrated off of legacy subscription overrides) @@ -1574,7 +1588,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body override fun _headers(): Headers = additionalHeaders diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt index be4a9999..655efe4f 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt @@ -227,6 +227,20 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [add] + * - [addAdjustments] + * - [allowInvoiceCreditOrVoid] + * - [edit] + * - [editAdjustments] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** A list of price intervals to add to the subscription. */ fun add(add: List) = apply { body.add(add) } @@ -479,7 +493,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt index 3e72d6e8..bdb2da92 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionSchedulePlanChangeParams.kt @@ -675,6 +675,20 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [changeOption] + * - [addAdjustments] + * - [addPrices] + * - [alignBillingWithPlanChangeDate] + * - [autoCollection] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + fun changeOption(changeOption: ChangeOption) = apply { body.changeOption(changeOption) } /** @@ -1409,7 +1423,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt index 4637c0a7..1da1141f 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionTriggerPhaseParams.kt @@ -103,6 +103,16 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [allowInvoiceCreditOrVoid] + * - [effectiveDate] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * If false, this request will fail if it would void an issued invoice or create a credit * note. Consider using this as a safety mechanism if you do not expect existing invoices to @@ -286,7 +296,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt index 07c8587b..def323e9 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleCancellationParams.kt @@ -212,7 +212,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt index bd4afcb3..74945e1d 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnscheduleFixedFeeQuantityUpdatesParams.kt @@ -95,6 +95,15 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [priceId] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** Price for which the updates should be cleared. Must be a fixed fee. */ fun priceId(priceId: String) = apply { body.priceId(priceId) } @@ -245,7 +254,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt index e7839848..ecdc9294 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUnschedulePendingPlanChangesParams.kt @@ -208,7 +208,7 @@ private constructor( ) } - internal fun _body(): Map? = additionalBodyProperties.ifEmpty { null } + fun _body(): Map? = additionalBodyProperties.ifEmpty { null } fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt index 45a46897..f4124469 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateFixedFeeQuantityParams.kt @@ -169,6 +169,20 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [priceId] + * - [quantity] + * - [allowInvoiceCreditOrVoid] + * - [changeOption] + * - [effectiveDate] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** Price for which the quantity should be updated. Must be a fixed fee. */ fun priceId(priceId: String) = apply { body.priceId(priceId) } @@ -394,7 +408,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt index 5cf83144..5a50f00a 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateParams.kt @@ -156,6 +156,20 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [autoCollection] + * - [defaultInvoiceMemo] + * - [invoicingThreshold] + * - [metadata] + * - [netTerms] + * - etc. + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * Determines whether issued invoices for this subscription will automatically be charged * with the saved payment method on the due date. This property defaults to the plan's @@ -396,7 +410,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt index ae8e32a9..1fae7cd4 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/models/SubscriptionUpdateTrialParams.kt @@ -131,6 +131,16 @@ private constructor( fun subscriptionId(subscriptionId: String) = apply { this.subscriptionId = subscriptionId } + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [trialEndDate] + * - [shift] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + /** * The new date that the trial should end, or the literal string `immediate` to end the * trial immediately. @@ -313,7 +323,7 @@ private constructor( ) } - internal fun _body(): Body = body + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsync.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsync.kt index 073c9d44..652abbeb 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsync.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsync.kt @@ -238,8 +238,8 @@ interface CustomerServiceAsync { /** * Returns a raw HTTP response for `post - * /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway`, - * but is otherwise the same as [CustomerServiceAsync.syncPaymentMethodsFromGateway]. + * /customers/{customer_id}/sync_payment_methods_from_gateway`, but is otherwise the same as + * [CustomerServiceAsync.syncPaymentMethodsFromGateway]. */ @MustBeClosed suspend fun syncPaymentMethodsFromGateway( @@ -249,7 +249,8 @@ interface CustomerServiceAsync { /** * Returns a raw HTTP response for `post - * /customers/{customer_id}/sync_payment_methods_from_gateway`, but is otherwise the same as + * /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway`, + * but is otherwise the same as * [CustomerServiceAsync.syncPaymentMethodsFromGatewayByExternalCustomerId]. */ @MustBeClosed diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt index 72e07a35..512ae5e8 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt @@ -102,8 +102,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerSyncPaymentMethodsFromGatewayParams, requestOptions: RequestOptions, ) { - // post - // /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway + // post /customers/{customer_id}/sync_payment_methods_from_gateway withRawResponse().syncPaymentMethodsFromGateway(params, requestOptions) } @@ -111,7 +110,8 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams, requestOptions: RequestOptions, ) { - // post /customers/{customer_id}/sync_payment_methods_from_gateway + // post + // /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway withRawResponse().syncPaymentMethodsFromGatewayByExternalCustomerId(params, requestOptions) } @@ -316,7 +316,6 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C .method(HttpMethod.POST) .addPathSegments( "customers", - "external_customer_id", params._pathParam(0), "sync_payment_methods_from_gateway", ) @@ -342,6 +341,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C .method(HttpMethod.POST) .addPathSegments( "customers", + "external_customer_id", params._pathParam(0), "sync_payment_methods_from_gateway", ) diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerService.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerService.kt index a5a52222..27133a15 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerService.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerService.kt @@ -233,8 +233,8 @@ interface CustomerService { /** * Returns a raw HTTP response for `post - * /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway`, - * but is otherwise the same as [CustomerService.syncPaymentMethodsFromGateway]. + * /customers/{customer_id}/sync_payment_methods_from_gateway`, but is otherwise the same as + * [CustomerService.syncPaymentMethodsFromGateway]. */ @MustBeClosed fun syncPaymentMethodsFromGateway( @@ -244,7 +244,8 @@ interface CustomerService { /** * Returns a raw HTTP response for `post - * /customers/{customer_id}/sync_payment_methods_from_gateway`, but is otherwise the same as + * /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway`, + * but is otherwise the same as * [CustomerService.syncPaymentMethodsFromGatewayByExternalCustomerId]. */ @MustBeClosed diff --git a/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerServiceImpl.kt b/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerServiceImpl.kt index 87939377..9aa17200 100644 --- a/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerServiceImpl.kt +++ b/orb-kotlin-core/src/main/kotlin/com/withorb/api/services/blocking/CustomerServiceImpl.kt @@ -93,8 +93,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerSyncPaymentMethodsFromGatewayParams, requestOptions: RequestOptions, ) { - // post - // /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway + // post /customers/{customer_id}/sync_payment_methods_from_gateway withRawResponse().syncPaymentMethodsFromGateway(params, requestOptions) } @@ -102,7 +101,8 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams, requestOptions: RequestOptions, ) { - // post /customers/{customer_id}/sync_payment_methods_from_gateway + // post + // /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway withRawResponse().syncPaymentMethodsFromGatewayByExternalCustomerId(params, requestOptions) } @@ -301,7 +301,6 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client .method(HttpMethod.POST) .addPathSegments( "customers", - "external_customer_id", params._pathParam(0), "sync_payment_methods_from_gateway", ) @@ -327,6 +326,7 @@ class CustomerServiceImpl internal constructor(private val clientOptions: Client .method(HttpMethod.POST) .addPathSegments( "customers", + "external_customer_id", params._pathParam(0), "sync_payment_methods_from_gateway", ) diff --git a/orb-kotlin-core/src/test/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParamsTest.kt b/orb-kotlin-core/src/test/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParamsTest.kt index 45b0b7ec..a6d851c0 100644 --- a/orb-kotlin-core/src/test/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParamsTest.kt +++ b/orb-kotlin-core/src/test/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParamsTest.kt @@ -10,7 +10,7 @@ internal class CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParamsTe @Test fun create() { CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.builder() - .customerId("customer_id") + .externalCustomerId("external_customer_id") .build() } @@ -18,10 +18,10 @@ internal class CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParamsTe fun pathParams() { val params = CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.builder() - .customerId("customer_id") + .externalCustomerId("external_customer_id") .build() - assertThat(params._pathParam(0)).isEqualTo("customer_id") + assertThat(params._pathParam(0)).isEqualTo("external_customer_id") // out-of-bound path param assertThat(params._pathParam(1)).isEqualTo("") } diff --git a/orb-kotlin-core/src/test/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParamsTest.kt b/orb-kotlin-core/src/test/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParamsTest.kt index be13b6ef..e897467b 100644 --- a/orb-kotlin-core/src/test/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParamsTest.kt +++ b/orb-kotlin-core/src/test/kotlin/com/withorb/api/models/CustomerSyncPaymentMethodsFromGatewayParamsTest.kt @@ -9,19 +9,15 @@ internal class CustomerSyncPaymentMethodsFromGatewayParamsTest { @Test fun create() { - CustomerSyncPaymentMethodsFromGatewayParams.builder() - .externalCustomerId("external_customer_id") - .build() + CustomerSyncPaymentMethodsFromGatewayParams.builder().customerId("customer_id").build() } @Test fun pathParams() { val params = - CustomerSyncPaymentMethodsFromGatewayParams.builder() - .externalCustomerId("external_customer_id") - .build() + CustomerSyncPaymentMethodsFromGatewayParams.builder().customerId("customer_id").build() - assertThat(params._pathParam(0)).isEqualTo("external_customer_id") + assertThat(params._pathParam(0)).isEqualTo("customer_id") // out-of-bound path param assertThat(params._pathParam(1)).isEqualTo("") } diff --git a/orb-kotlin-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt b/orb-kotlin-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt index c1df2ff8..cc43fe3e 100644 --- a/orb-kotlin-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt +++ b/orb-kotlin-core/src/test/kotlin/com/withorb/api/services/async/CustomerServiceAsyncTest.kt @@ -277,9 +277,7 @@ internal class CustomerServiceAsyncTest { val customerServiceAsync = client.customers() customerServiceAsync.syncPaymentMethodsFromGateway( - CustomerSyncPaymentMethodsFromGatewayParams.builder() - .externalCustomerId("external_customer_id") - .build() + CustomerSyncPaymentMethodsFromGatewayParams.builder().customerId("customer_id").build() ) } @@ -294,7 +292,7 @@ internal class CustomerServiceAsyncTest { customerServiceAsync.syncPaymentMethodsFromGatewayByExternalCustomerId( CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.builder() - .customerId("customer_id") + .externalCustomerId("external_customer_id") .build() ) } diff --git a/orb-kotlin-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt b/orb-kotlin-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt index a4b1c341..c5744a00 100644 --- a/orb-kotlin-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt +++ b/orb-kotlin-core/src/test/kotlin/com/withorb/api/services/blocking/CustomerServiceTest.kt @@ -273,9 +273,7 @@ internal class CustomerServiceTest { val customerService = client.customers() customerService.syncPaymentMethodsFromGateway( - CustomerSyncPaymentMethodsFromGatewayParams.builder() - .externalCustomerId("external_customer_id") - .build() + CustomerSyncPaymentMethodsFromGatewayParams.builder().customerId("customer_id").build() ) } @@ -290,7 +288,7 @@ internal class CustomerServiceTest { customerService.syncPaymentMethodsFromGatewayByExternalCustomerId( CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams.builder() - .customerId("customer_id") + .externalCustomerId("external_customer_id") .build() ) }