Skip to content

Commit 321aa41

Browse files
feat(api): api update
1 parent 1764089 commit 321aa41

File tree

5 files changed

+122
-10
lines changed

5 files changed

+122
-10
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-42aa43f3893eef31a351e066bf0cf8c56da8c857ccbb45eb7dd58739ad43bd86.yml
3-
openapi_spec_hash: e6b8c1e707036539d88a7b79af864a49
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c075f748a7de8ecdccf11a8f2374682b0efd84f1318147274a838bf2fdd73b58.yml
3+
openapi_spec_hash: ae918b8f348f1b7d3252a59dac36c453
44
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2

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

Lines changed: 115 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,17 @@ private constructor(
4343
fun description(): Optional<String> = body.description()
4444

4545
/**
46-
* Amount already collected to apply to the customer's balance.
46+
* Mark all pending invoices that are payable as paid. If amount is also provided, mark as paid
47+
* and credit the difference to the customer's balance.
48+
*
49+
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
50+
* responded with an unexpected value).
51+
*/
52+
fun markAsPaid(): Optional<Boolean> = body.markAsPaid()
53+
54+
/**
55+
* Amount already collected to apply to the customer's balance. If mark_as_paid is also
56+
* provided, credit the difference to the customer's balance.
4757
*
4858
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
4959
* responded with an unexpected value).
@@ -57,6 +67,13 @@ private constructor(
5767
*/
5868
fun _description(): JsonField<String> = body._description()
5969

70+
/**
71+
* Returns the raw JSON value of [markAsPaid].
72+
*
73+
* Unlike [markAsPaid], this method doesn't throw if the JSON field has an unexpected type.
74+
*/
75+
fun _markAsPaid(): JsonField<Boolean> = body._markAsPaid()
76+
6077
/**
6178
* Returns the raw JSON value of [previouslyCollectedAmount].
6279
*
@@ -119,6 +136,7 @@ private constructor(
119136
* This is generally only useful if you are already constructing the body separately.
120137
* Otherwise, it's more convenient to use the top-level setters instead:
121138
* - [description]
139+
* - [markAsPaid]
122140
* - [previouslyCollectedAmount]
123141
*/
124142
fun body(body: Body) = apply { this.body = body.toBuilder() }
@@ -138,7 +156,35 @@ private constructor(
138156
*/
139157
fun description(description: JsonField<String>) = apply { body.description(description) }
140158

141-
/** Amount already collected to apply to the customer's balance. */
159+
/**
160+
* Mark all pending invoices that are payable as paid. If amount is also provided, mark as
161+
* paid and credit the difference to the customer's balance.
162+
*/
163+
fun markAsPaid(markAsPaid: Boolean?) = apply { body.markAsPaid(markAsPaid) }
164+
165+
/**
166+
* Alias for [Builder.markAsPaid].
167+
*
168+
* This unboxed primitive overload exists for backwards compatibility.
169+
*/
170+
fun markAsPaid(markAsPaid: Boolean) = markAsPaid(markAsPaid as Boolean?)
171+
172+
/** Alias for calling [Builder.markAsPaid] with `markAsPaid.orElse(null)`. */
173+
fun markAsPaid(markAsPaid: Optional<Boolean>) = markAsPaid(markAsPaid.getOrNull())
174+
175+
/**
176+
* Sets [Builder.markAsPaid] to an arbitrary JSON value.
177+
*
178+
* You should usually call [Builder.markAsPaid] with a well-typed [Boolean] value instead.
179+
* This method is primarily for setting the field to an undocumented or not yet supported
180+
* value.
181+
*/
182+
fun markAsPaid(markAsPaid: JsonField<Boolean>) = apply { body.markAsPaid(markAsPaid) }
183+
184+
/**
185+
* Amount already collected to apply to the customer's balance. If mark_as_paid is also
186+
* provided, credit the difference to the customer's balance.
187+
*/
142188
fun previouslyCollectedAmount(previouslyCollectedAmount: String?) = apply {
143189
body.previouslyCollectedAmount(previouslyCollectedAmount)
144190
}
@@ -308,6 +354,7 @@ private constructor(
308354
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
309355
private constructor(
310356
private val description: JsonField<String>,
357+
private val markAsPaid: JsonField<Boolean>,
311358
private val previouslyCollectedAmount: JsonField<String>,
312359
private val additionalProperties: MutableMap<String, JsonValue>,
313360
) {
@@ -317,10 +364,13 @@ private constructor(
317364
@JsonProperty("description")
318365
@ExcludeMissing
319366
description: JsonField<String> = JsonMissing.of(),
367+
@JsonProperty("mark_as_paid")
368+
@ExcludeMissing
369+
markAsPaid: JsonField<Boolean> = JsonMissing.of(),
320370
@JsonProperty("previously_collected_amount")
321371
@ExcludeMissing
322372
previouslyCollectedAmount: JsonField<String> = JsonMissing.of(),
323-
) : this(description, previouslyCollectedAmount, mutableMapOf())
373+
) : this(description, markAsPaid, previouslyCollectedAmount, mutableMapOf())
324374

325375
/**
326376
* Description to apply to the balance transaction representing this credit.
@@ -331,7 +381,17 @@ private constructor(
331381
fun description(): Optional<String> = description.getOptional("description")
332382

333383
/**
334-
* Amount already collected to apply to the customer's balance.
384+
* Mark all pending invoices that are payable as paid. If amount is also provided, mark as
385+
* paid and credit the difference to the customer's balance.
386+
*
387+
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
388+
* server responded with an unexpected value).
389+
*/
390+
fun markAsPaid(): Optional<Boolean> = markAsPaid.getOptional("mark_as_paid")
391+
392+
/**
393+
* Amount already collected to apply to the customer's balance. If mark_as_paid is also
394+
* provided, credit the difference to the customer's balance.
335395
*
336396
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the
337397
* server responded with an unexpected value).
@@ -348,6 +408,15 @@ private constructor(
348408
@ExcludeMissing
349409
fun _description(): JsonField<String> = description
350410

411+
/**
412+
* Returns the raw JSON value of [markAsPaid].
413+
*
414+
* Unlike [markAsPaid], this method doesn't throw if the JSON field has an unexpected type.
415+
*/
416+
@JsonProperty("mark_as_paid")
417+
@ExcludeMissing
418+
fun _markAsPaid(): JsonField<Boolean> = markAsPaid
419+
351420
/**
352421
* Returns the raw JSON value of [previouslyCollectedAmount].
353422
*
@@ -380,12 +449,14 @@ private constructor(
380449
class Builder internal constructor() {
381450

382451
private var description: JsonField<String> = JsonMissing.of()
452+
private var markAsPaid: JsonField<Boolean> = JsonMissing.of()
383453
private var previouslyCollectedAmount: JsonField<String> = JsonMissing.of()
384454
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
385455

386456
@JvmSynthetic
387457
internal fun from(body: Body) = apply {
388458
description = body.description
459+
markAsPaid = body.markAsPaid
389460
previouslyCollectedAmount = body.previouslyCollectedAmount
390461
additionalProperties = body.additionalProperties.toMutableMap()
391462
}
@@ -407,7 +478,35 @@ private constructor(
407478
this.description = description
408479
}
409480

410-
/** Amount already collected to apply to the customer's balance. */
481+
/**
482+
* Mark all pending invoices that are payable as paid. If amount is also provided, mark
483+
* as paid and credit the difference to the customer's balance.
484+
*/
485+
fun markAsPaid(markAsPaid: Boolean?) = markAsPaid(JsonField.ofNullable(markAsPaid))
486+
487+
/**
488+
* Alias for [Builder.markAsPaid].
489+
*
490+
* This unboxed primitive overload exists for backwards compatibility.
491+
*/
492+
fun markAsPaid(markAsPaid: Boolean) = markAsPaid(markAsPaid as Boolean?)
493+
494+
/** Alias for calling [Builder.markAsPaid] with `markAsPaid.orElse(null)`. */
495+
fun markAsPaid(markAsPaid: Optional<Boolean>) = markAsPaid(markAsPaid.getOrNull())
496+
497+
/**
498+
* Sets [Builder.markAsPaid] to an arbitrary JSON value.
499+
*
500+
* You should usually call [Builder.markAsPaid] with a well-typed [Boolean] value
501+
* instead. This method is primarily for setting the field to an undocumented or not yet
502+
* supported value.
503+
*/
504+
fun markAsPaid(markAsPaid: JsonField<Boolean>) = apply { this.markAsPaid = markAsPaid }
505+
506+
/**
507+
* Amount already collected to apply to the customer's balance. If mark_as_paid is also
508+
* provided, credit the difference to the customer's balance.
509+
*/
411510
fun previouslyCollectedAmount(previouslyCollectedAmount: String?) =
412511
previouslyCollectedAmount(JsonField.ofNullable(previouslyCollectedAmount))
413512

@@ -454,7 +553,12 @@ private constructor(
454553
* Further updates to this [Builder] will not mutate the returned instance.
455554
*/
456555
fun build(): Body =
457-
Body(description, previouslyCollectedAmount, additionalProperties.toMutableMap())
556+
Body(
557+
description,
558+
markAsPaid,
559+
previouslyCollectedAmount,
560+
additionalProperties.toMutableMap(),
561+
)
458562
}
459563

460564
private var validated: Boolean = false
@@ -465,6 +569,7 @@ private constructor(
465569
}
466570

467571
description()
572+
markAsPaid()
468573
previouslyCollectedAmount()
469574
validated = true
470575
}
@@ -486,6 +591,7 @@ private constructor(
486591
@JvmSynthetic
487592
internal fun validity(): Int =
488593
(if (description.asKnown().isPresent) 1 else 0) +
594+
(if (markAsPaid.asKnown().isPresent) 1 else 0) +
489595
(if (previouslyCollectedAmount.asKnown().isPresent) 1 else 0)
490596

491597
override fun equals(other: Any?): Boolean {
@@ -495,18 +601,19 @@ private constructor(
495601

496602
return other is Body &&
497603
description == other.description &&
604+
markAsPaid == other.markAsPaid &&
498605
previouslyCollectedAmount == other.previouslyCollectedAmount &&
499606
additionalProperties == other.additionalProperties
500607
}
501608

502609
private val hashCode: Int by lazy {
503-
Objects.hash(description, previouslyCollectedAmount, additionalProperties)
610+
Objects.hash(description, markAsPaid, previouslyCollectedAmount, additionalProperties)
504611
}
505612

506613
override fun hashCode(): Int = hashCode
507614

508615
override fun toString() =
509-
"Body{description=$description, previouslyCollectedAmount=$previouslyCollectedAmount, additionalProperties=$additionalProperties}"
616+
"Body{description=$description, markAsPaid=$markAsPaid, previouslyCollectedAmount=$previouslyCollectedAmount, additionalProperties=$additionalProperties}"
510617
}
511618

512619
override fun equals(other: Any?): Boolean {

orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyParamsTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ internal class SubscriptionChangeApplyParamsTest {
1212
SubscriptionChangeApplyParams.builder()
1313
.subscriptionChangeId("subscription_change_id")
1414
.description("description")
15+
.markAsPaid(true)
1516
.previouslyCollectedAmount("previously_collected_amount")
1617
.build()
1718
}
@@ -34,12 +35,14 @@ internal class SubscriptionChangeApplyParamsTest {
3435
SubscriptionChangeApplyParams.builder()
3536
.subscriptionChangeId("subscription_change_id")
3637
.description("description")
38+
.markAsPaid(true)
3739
.previouslyCollectedAmount("previously_collected_amount")
3840
.build()
3941

4042
val body = params._body()
4143

4244
assertThat(body.description()).contains("description")
45+
assertThat(body.markAsPaid()).contains(true)
4346
assertThat(body.previouslyCollectedAmount()).contains("previously_collected_amount")
4447
}
4548

orb-java-core/src/test/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ internal class SubscriptionChangeServiceAsyncTest {
4141
SubscriptionChangeApplyParams.builder()
4242
.subscriptionChangeId("subscription_change_id")
4343
.description("description")
44+
.markAsPaid(true)
4445
.previouslyCollectedAmount("previously_collected_amount")
4546
.build()
4647
)

orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/SubscriptionChangeServiceTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ internal class SubscriptionChangeServiceTest {
3939
SubscriptionChangeApplyParams.builder()
4040
.subscriptionChangeId("subscription_change_id")
4141
.description("description")
42+
.markAsPaid(true)
4243
.previouslyCollectedAmount("previously_collected_amount")
4344
.build()
4445
)

0 commit comments

Comments
 (0)