Skip to content

Commit 7bbb55e

Browse files
feat(api): api update
1 parent 1ce04bd commit 7bbb55e

33 files changed

+22500
-100
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 114
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-6d2a5b5d2cfb485e1a548aa15e1e36844e1f14f42553033822e1c570c8aa0825.yml
3-
openapi_spec_hash: 0266a5aaced5e768bcf6a70924d69799
4-
config_hash: e63f2d098e5d12f63ae4cd8270aa5c3c
1+
configured_endpoints: 115
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-d513be954ba2cb57489bd048f93790cabb13849f0f04d328a5a15694c99550df.yml
3+
openapi_spec_hash: 0d42694f412abf65defc3f88646a809c
4+
config_hash: 1e2186b09e57d7d27b6ab5c8e6410b31

orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdParams.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,9 @@ private constructor(
10711071
fun memo(): Optional<String> = memo.getOptional("memo")
10721072

10731073
/**
1074-
* If true, new credit blocks created by this top-up will require that the corresponding
1075-
* invoice is paid before they can be drawn down from.
1074+
* When true, credit blocks created by this top-up will require that the corresponding
1075+
* invoice is paid before they are drawn down from. If any topup block is pending payment,
1076+
* further automatic top-ups will be paused until the invoice is paid or voided.
10761077
*
10771078
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
10781079
* server responded with an unexpected value).
@@ -1207,8 +1208,10 @@ private constructor(
12071208
fun memo(memo: JsonField<String>) = apply { this.memo = memo }
12081209

12091210
/**
1210-
* If true, new credit blocks created by this top-up will require that the corresponding
1211-
* invoice is paid before they can be drawn down from.
1211+
* When true, credit blocks created by this top-up will require that the corresponding
1212+
* invoice is paid before they are drawn down from. If any topup block is pending
1213+
* payment, further automatic top-ups will be paused until the invoice is paid or
1214+
* voided.
12121215
*/
12131216
fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) =
12141217
requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment))

orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateByExternalIdResponse.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,9 @@ private constructor(
519519
fun memo(): Optional<String> = memo.getOptional("memo")
520520

521521
/**
522-
* If true, new credit blocks created by this top-up will require that the corresponding
523-
* invoice is paid before they can be drawn down from.
522+
* When true, credit blocks created by this top-up will require that the corresponding
523+
* invoice is paid before they are drawn down from. If any topup block is pending payment,
524+
* further automatic top-ups will be paused until the invoice is paid or voided.
524525
*
525526
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
526527
* server responded with an unexpected value).
@@ -655,8 +656,10 @@ private constructor(
655656
fun memo(memo: JsonField<String>) = apply { this.memo = memo }
656657

657658
/**
658-
* If true, new credit blocks created by this top-up will require that the corresponding
659-
* invoice is paid before they can be drawn down from.
659+
* When true, credit blocks created by this top-up will require that the corresponding
660+
* invoice is paid before they are drawn down from. If any topup block is pending
661+
* payment, further automatic top-ups will be paused until the invoice is paid or
662+
* voided.
660663
*/
661664
fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) =
662665
requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment))

orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateParams.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,8 +1064,9 @@ private constructor(
10641064
fun memo(): Optional<String> = memo.getOptional("memo")
10651065

10661066
/**
1067-
* If true, new credit blocks created by this top-up will require that the corresponding
1068-
* invoice is paid before they can be drawn down from.
1067+
* When true, credit blocks created by this top-up will require that the corresponding
1068+
* invoice is paid before they are drawn down from. If any topup block is pending payment,
1069+
* further automatic top-ups will be paused until the invoice is paid or voided.
10691070
*
10701071
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
10711072
* server responded with an unexpected value).
@@ -1200,8 +1201,10 @@ private constructor(
12001201
fun memo(memo: JsonField<String>) = apply { this.memo = memo }
12011202

12021203
/**
1203-
* If true, new credit blocks created by this top-up will require that the corresponding
1204-
* invoice is paid before they can be drawn down from.
1204+
* When true, credit blocks created by this top-up will require that the corresponding
1205+
* invoice is paid before they are drawn down from. If any topup block is pending
1206+
* payment, further automatic top-ups will be paused until the invoice is paid or
1207+
* voided.
12051208
*/
12061209
fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) =
12071210
requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment))

orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpCreateResponse.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,9 @@ private constructor(
517517
fun memo(): Optional<String> = memo.getOptional("memo")
518518

519519
/**
520-
* If true, new credit blocks created by this top-up will require that the corresponding
521-
* invoice is paid before they can be drawn down from.
520+
* When true, credit blocks created by this top-up will require that the corresponding
521+
* invoice is paid before they are drawn down from. If any topup block is pending payment,
522+
* further automatic top-ups will be paused until the invoice is paid or voided.
522523
*
523524
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
524525
* server responded with an unexpected value).
@@ -653,8 +654,10 @@ private constructor(
653654
fun memo(memo: JsonField<String>) = apply { this.memo = memo }
654655

655656
/**
656-
* If true, new credit blocks created by this top-up will require that the corresponding
657-
* invoice is paid before they can be drawn down from.
657+
* When true, credit blocks created by this top-up will require that the corresponding
658+
* invoice is paid before they are drawn down from. If any topup block is pending
659+
* payment, further automatic top-ups will be paused until the invoice is paid or
660+
* voided.
658661
*/
659662
fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) =
660663
requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment))

orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListByExternalIdResponse.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,9 @@ private constructor(
518518
fun memo(): Optional<String> = memo.getOptional("memo")
519519

520520
/**
521-
* If true, new credit blocks created by this top-up will require that the corresponding
522-
* invoice is paid before they can be drawn down from.
521+
* When true, credit blocks created by this top-up will require that the corresponding
522+
* invoice is paid before they are drawn down from. If any topup block is pending payment,
523+
* further automatic top-ups will be paused until the invoice is paid or voided.
523524
*
524525
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
525526
* server responded with an unexpected value).
@@ -654,8 +655,10 @@ private constructor(
654655
fun memo(memo: JsonField<String>) = apply { this.memo = memo }
655656

656657
/**
657-
* If true, new credit blocks created by this top-up will require that the corresponding
658-
* invoice is paid before they can be drawn down from.
658+
* When true, credit blocks created by this top-up will require that the corresponding
659+
* invoice is paid before they are drawn down from. If any topup block is pending
660+
* payment, further automatic top-ups will be paused until the invoice is paid or
661+
* voided.
659662
*/
660663
fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) =
661664
requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment))

orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditTopUpListResponse.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,9 @@ private constructor(
517517
fun memo(): Optional<String> = memo.getOptional("memo")
518518

519519
/**
520-
* If true, new credit blocks created by this top-up will require that the corresponding
521-
* invoice is paid before they can be drawn down from.
520+
* When true, credit blocks created by this top-up will require that the corresponding
521+
* invoice is paid before they are drawn down from. If any topup block is pending payment,
522+
* further automatic top-ups will be paused until the invoice is paid or voided.
522523
*
523524
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
524525
* server responded with an unexpected value).
@@ -653,8 +654,10 @@ private constructor(
653654
fun memo(memo: JsonField<String>) = apply { this.memo = memo }
654655

655656
/**
656-
* If true, new credit blocks created by this top-up will require that the corresponding
657-
* invoice is paid before they can be drawn down from.
657+
* When true, credit blocks created by this top-up will require that the corresponding
658+
* invoice is paid before they are drawn down from. If any topup block is pending
659+
* payment, further automatic top-ups will be paused until the invoice is paid or
660+
* voided.
658661
*/
659662
fun requireSuccessfulPayment(requireSuccessfulPayment: Boolean) =
660663
requireSuccessfulPayment(JsonField.of(requireSuccessfulPayment))

orb-java-core/src/main/kotlin/com/withorb/api/models/EventIngestParams.kt

Lines changed: 140 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ private constructor(
658658
private constructor(
659659
private val eventName: JsonField<String>,
660660
private val idempotencyKey: JsonField<String>,
661-
private val properties: JsonValue,
661+
private val properties: JsonField<Properties>,
662662
private val timestamp: JsonField<OffsetDateTime>,
663663
private val customerId: JsonField<String>,
664664
private val externalCustomerId: JsonField<String>,
@@ -673,7 +673,9 @@ private constructor(
673673
@JsonProperty("idempotency_key")
674674
@ExcludeMissing
675675
idempotencyKey: JsonField<String> = JsonMissing.of(),
676-
@JsonProperty("properties") @ExcludeMissing properties: JsonValue = JsonMissing.of(),
676+
@JsonProperty("properties")
677+
@ExcludeMissing
678+
properties: JsonField<Properties> = JsonMissing.of(),
677679
@JsonProperty("timestamp")
678680
@ExcludeMissing
679681
timestamp: JsonField<OffsetDateTime> = JsonMissing.of(),
@@ -714,8 +716,11 @@ private constructor(
714716
/**
715717
* A dictionary of custom properties. Values in this dictionary must be numeric, boolean, or
716718
* strings. Nested dictionaries are disallowed.
719+
*
720+
* @throws OrbInvalidDataException if the JSON field has an unexpected type or is
721+
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
717722
*/
718-
@JsonProperty("properties") @ExcludeMissing fun _properties(): JsonValue = properties
723+
fun properties(): Properties = properties.getRequired("properties")
719724

720725
/**
721726
* An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the
@@ -761,6 +766,15 @@ private constructor(
761766
@ExcludeMissing
762767
fun _idempotencyKey(): JsonField<String> = idempotencyKey
763768

769+
/**
770+
* Returns the raw JSON value of [properties].
771+
*
772+
* Unlike [properties], this method doesn't throw if the JSON field has an unexpected type.
773+
*/
774+
@JsonProperty("properties")
775+
@ExcludeMissing
776+
fun _properties(): JsonField<Properties> = properties
777+
764778
/**
765779
* Returns the raw JSON value of [timestamp].
766780
*
@@ -822,7 +836,7 @@ private constructor(
822836

823837
private var eventName: JsonField<String>? = null
824838
private var idempotencyKey: JsonField<String>? = null
825-
private var properties: JsonValue? = null
839+
private var properties: JsonField<Properties>? = null
826840
private var timestamp: JsonField<OffsetDateTime>? = null
827841
private var customerId: JsonField<String> = JsonMissing.of()
828842
private var externalCustomerId: JsonField<String> = JsonMissing.of()
@@ -874,7 +888,18 @@ private constructor(
874888
* A dictionary of custom properties. Values in this dictionary must be numeric,
875889
* boolean, or strings. Nested dictionaries are disallowed.
876890
*/
877-
fun properties(properties: JsonValue) = apply { this.properties = properties }
891+
fun properties(properties: Properties) = properties(JsonField.of(properties))
892+
893+
/**
894+
* Sets [Builder.properties] to an arbitrary JSON value.
895+
*
896+
* You should usually call [Builder.properties] with a well-typed [Properties] value
897+
* instead. This method is primarily for setting the field to an undocumented or not yet
898+
* supported value.
899+
*/
900+
fun properties(properties: JsonField<Properties>) = apply {
901+
this.properties = properties
902+
}
878903

879904
/**
880905
* An ISO 8601 format date with no timezone offset (i.e. UTC). This should represent the
@@ -988,6 +1013,7 @@ private constructor(
9881013

9891014
eventName()
9901015
idempotencyKey()
1016+
properties().validate()
9911017
timestamp()
9921018
customerId()
9931019
externalCustomerId()
@@ -1012,10 +1038,119 @@ private constructor(
10121038
internal fun validity(): Int =
10131039
(if (eventName.asKnown().isPresent) 1 else 0) +
10141040
(if (idempotencyKey.asKnown().isPresent) 1 else 0) +
1041+
(properties.asKnown().getOrNull()?.validity() ?: 0) +
10151042
(if (timestamp.asKnown().isPresent) 1 else 0) +
10161043
(if (customerId.asKnown().isPresent) 1 else 0) +
10171044
(if (externalCustomerId.asKnown().isPresent) 1 else 0)
10181045

1046+
/**
1047+
* A dictionary of custom properties. Values in this dictionary must be numeric, boolean, or
1048+
* strings. Nested dictionaries are disallowed.
1049+
*/
1050+
class Properties
1051+
@JsonCreator
1052+
private constructor(
1053+
@com.fasterxml.jackson.annotation.JsonValue
1054+
private val additionalProperties: Map<String, JsonValue>
1055+
) {
1056+
1057+
@JsonAnyGetter
1058+
@ExcludeMissing
1059+
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
1060+
1061+
fun toBuilder() = Builder().from(this)
1062+
1063+
companion object {
1064+
1065+
/** Returns a mutable builder for constructing an instance of [Properties]. */
1066+
@JvmStatic fun builder() = Builder()
1067+
}
1068+
1069+
/** A builder for [Properties]. */
1070+
class Builder internal constructor() {
1071+
1072+
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
1073+
1074+
@JvmSynthetic
1075+
internal fun from(properties: Properties) = apply {
1076+
additionalProperties = properties.additionalProperties.toMutableMap()
1077+
}
1078+
1079+
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
1080+
this.additionalProperties.clear()
1081+
putAllAdditionalProperties(additionalProperties)
1082+
}
1083+
1084+
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
1085+
additionalProperties.put(key, value)
1086+
}
1087+
1088+
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
1089+
apply {
1090+
this.additionalProperties.putAll(additionalProperties)
1091+
}
1092+
1093+
fun removeAdditionalProperty(key: String) = apply {
1094+
additionalProperties.remove(key)
1095+
}
1096+
1097+
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
1098+
keys.forEach(::removeAdditionalProperty)
1099+
}
1100+
1101+
/**
1102+
* Returns an immutable instance of [Properties].
1103+
*
1104+
* Further updates to this [Builder] will not mutate the returned instance.
1105+
*/
1106+
fun build(): Properties = Properties(additionalProperties.toImmutable())
1107+
}
1108+
1109+
private var validated: Boolean = false
1110+
1111+
fun validate(): Properties = apply {
1112+
if (validated) {
1113+
return@apply
1114+
}
1115+
1116+
validated = true
1117+
}
1118+
1119+
fun isValid(): Boolean =
1120+
try {
1121+
validate()
1122+
true
1123+
} catch (e: OrbInvalidDataException) {
1124+
false
1125+
}
1126+
1127+
/**
1128+
* Returns a score indicating how many valid values are contained in this object
1129+
* recursively.
1130+
*
1131+
* Used for best match union deserialization.
1132+
*/
1133+
@JvmSynthetic
1134+
internal fun validity(): Int =
1135+
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
1136+
1137+
override fun equals(other: Any?): Boolean {
1138+
if (this === other) {
1139+
return true
1140+
}
1141+
1142+
return /* spotless:off */ other is Properties && additionalProperties == other.additionalProperties /* spotless:on */
1143+
}
1144+
1145+
/* spotless:off */
1146+
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
1147+
/* spotless:on */
1148+
1149+
override fun hashCode(): Int = hashCode
1150+
1151+
override fun toString() = "Properties{additionalProperties=$additionalProperties}"
1152+
}
1153+
10191154
override fun equals(other: Any?): Boolean {
10201155
if (this === other) {
10211156
return true

0 commit comments

Comments
 (0)