Skip to content

Commit 16c09ab

Browse files
feat(api): api update
1 parent 9928daa commit 16c09ab

18 files changed

+285
-23
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-36e32afb76082ffbe12a71342ed5b855b9ae83d8c5bcd225fe23915c308b39e7.yml
3-
openapi_spec_hash: 035e0bb6141d78b4aed031303585940c
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0ab0946487d1ee971683d894554494d9940010403874c0be724ffc3a82d696db.yml
3+
openapi_spec_hash: 66b792328a4faee3c7659185accc3f0e
44
config_hash: e6db17547fe854b1c240407cf4c6dc9e

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

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ private constructor(
2929
private val customExpiration: JsonField<CustomExpiration>,
3030
private val expiresAtEndOfCadence: JsonField<Boolean>,
3131
private val filters: JsonField<List<Filter>>,
32+
private val itemId: JsonField<String>,
33+
private val perUnitCostBasis: JsonField<String>,
3234
private val additionalProperties: MutableMap<String, JsonValue>,
3335
) {
3436

@@ -43,14 +45,22 @@ private constructor(
4345
@JsonProperty("expires_at_end_of_cadence")
4446
@ExcludeMissing
4547
expiresAtEndOfCadence: JsonField<Boolean> = JsonMissing.of(),
46-
@JsonProperty("filters") @ExcludeMissing filters: JsonField<List<Filter>> = JsonMissing.of(),
48+
@JsonProperty("filters")
49+
@ExcludeMissing
50+
filters: JsonField<List<Filter>> = JsonMissing.of(),
51+
@JsonProperty("item_id") @ExcludeMissing itemId: JsonField<String> = JsonMissing.of(),
52+
@JsonProperty("per_unit_cost_basis")
53+
@ExcludeMissing
54+
perUnitCostBasis: JsonField<String> = JsonMissing.of(),
4755
) : this(
4856
amount,
4957
cadence,
5058
currency,
5159
customExpiration,
5260
expiresAtEndOfCadence,
5361
filters,
62+
itemId,
63+
perUnitCostBasis,
5464
mutableMapOf(),
5565
)
5666

@@ -105,6 +115,25 @@ private constructor(
105115
*/
106116
fun filters(): Optional<List<Filter>> = filters.getOptional("filters")
107117

118+
/**
119+
* The item ID that line items representing charges for this allocation will be associated with.
120+
* If not provided, the default allocation item for the currency will be used (e.g. 'Included
121+
* Allocation (USD)').
122+
*
123+
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
124+
* responded with an unexpected value).
125+
*/
126+
fun itemId(): Optional<String> = itemId.getOptional("item_id")
127+
128+
/**
129+
* The (per-unit) cost basis of each created block. If non-zero, a customer will be invoiced
130+
* according to the quantity and per unit cost basis specified for the allocation each cadence.
131+
*
132+
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
133+
* responded with an unexpected value).
134+
*/
135+
fun perUnitCostBasis(): Optional<String> = perUnitCostBasis.getOptional("per_unit_cost_basis")
136+
108137
/**
109138
* Returns the raw JSON value of [amount].
110139
*
@@ -153,6 +182,23 @@ private constructor(
153182
*/
154183
@JsonProperty("filters") @ExcludeMissing fun _filters(): JsonField<List<Filter>> = filters
155184

185+
/**
186+
* Returns the raw JSON value of [itemId].
187+
*
188+
* Unlike [itemId], this method doesn't throw if the JSON field has an unexpected type.
189+
*/
190+
@JsonProperty("item_id") @ExcludeMissing fun _itemId(): JsonField<String> = itemId
191+
192+
/**
193+
* Returns the raw JSON value of [perUnitCostBasis].
194+
*
195+
* Unlike [perUnitCostBasis], this method doesn't throw if the JSON field has an unexpected
196+
* type.
197+
*/
198+
@JsonProperty("per_unit_cost_basis")
199+
@ExcludeMissing
200+
fun _perUnitCostBasis(): JsonField<String> = perUnitCostBasis
201+
156202
@JsonAnySetter
157203
private fun putAdditionalProperty(key: String, value: JsonValue) {
158204
additionalProperties.put(key, value)
@@ -189,6 +235,8 @@ private constructor(
189235
private var customExpiration: JsonField<CustomExpiration> = JsonMissing.of()
190236
private var expiresAtEndOfCadence: JsonField<Boolean> = JsonMissing.of()
191237
private var filters: JsonField<MutableList<Filter>>? = null
238+
private var itemId: JsonField<String> = JsonMissing.of()
239+
private var perUnitCostBasis: JsonField<String> = JsonMissing.of()
192240
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
193241

194242
@JvmSynthetic
@@ -199,6 +247,8 @@ private constructor(
199247
customExpiration = newAllocationPrice.customExpiration
200248
expiresAtEndOfCadence = newAllocationPrice.expiresAtEndOfCadence
201249
filters = newAllocationPrice.filters.map { it.toMutableList() }
250+
itemId = newAllocationPrice.itemId
251+
perUnitCostBasis = newAllocationPrice.perUnitCostBasis
202252
additionalProperties = newAllocationPrice.additionalProperties.toMutableMap()
203253
}
204254

@@ -319,6 +369,43 @@ private constructor(
319369
}
320370
}
321371

372+
/**
373+
* The item ID that line items representing charges for this allocation will be associated
374+
* with. If not provided, the default allocation item for the currency will be used (e.g.
375+
* 'Included Allocation (USD)').
376+
*/
377+
fun itemId(itemId: String?) = itemId(JsonField.ofNullable(itemId))
378+
379+
/** Alias for calling [Builder.itemId] with `itemId.orElse(null)`. */
380+
fun itemId(itemId: Optional<String>) = itemId(itemId.getOrNull())
381+
382+
/**
383+
* Sets [Builder.itemId] to an arbitrary JSON value.
384+
*
385+
* You should usually call [Builder.itemId] with a well-typed [String] value instead. This
386+
* method is primarily for setting the field to an undocumented or not yet supported value.
387+
*/
388+
fun itemId(itemId: JsonField<String>) = apply { this.itemId = itemId }
389+
390+
/**
391+
* The (per-unit) cost basis of each created block. If non-zero, a customer will be invoiced
392+
* according to the quantity and per unit cost basis specified for the allocation each
393+
* cadence.
394+
*/
395+
fun perUnitCostBasis(perUnitCostBasis: String) =
396+
perUnitCostBasis(JsonField.of(perUnitCostBasis))
397+
398+
/**
399+
* Sets [Builder.perUnitCostBasis] to an arbitrary JSON value.
400+
*
401+
* You should usually call [Builder.perUnitCostBasis] with a well-typed [String] value
402+
* instead. This method is primarily for setting the field to an undocumented or not yet
403+
* supported value.
404+
*/
405+
fun perUnitCostBasis(perUnitCostBasis: JsonField<String>) = apply {
406+
this.perUnitCostBasis = perUnitCostBasis
407+
}
408+
322409
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
323410
this.additionalProperties.clear()
324411
putAllAdditionalProperties(additionalProperties)
@@ -360,6 +447,8 @@ private constructor(
360447
customExpiration,
361448
expiresAtEndOfCadence,
362449
(filters ?: JsonMissing.of()).map { it.toImmutable() },
450+
itemId,
451+
perUnitCostBasis,
363452
additionalProperties.toMutableMap(),
364453
)
365454
}
@@ -377,6 +466,8 @@ private constructor(
377466
customExpiration().ifPresent { it.validate() }
378467
expiresAtEndOfCadence()
379468
filters().ifPresent { it.forEach { it.validate() } }
469+
itemId()
470+
perUnitCostBasis()
380471
validated = true
381472
}
382473

@@ -400,7 +491,9 @@ private constructor(
400491
(if (currency.asKnown().isPresent) 1 else 0) +
401492
(customExpiration.asKnown().getOrNull()?.validity() ?: 0) +
402493
(if (expiresAtEndOfCadence.asKnown().isPresent) 1 else 0) +
403-
(filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
494+
(filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
495+
(if (itemId.asKnown().isPresent) 1 else 0) +
496+
(if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
404497

405498
/** The cadence at which to allocate the amount to the customer. */
406499
class Cadence @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
@@ -1064,6 +1157,8 @@ private constructor(
10641157
customExpiration == other.customExpiration &&
10651158
expiresAtEndOfCadence == other.expiresAtEndOfCadence &&
10661159
filters == other.filters &&
1160+
itemId == other.itemId &&
1161+
perUnitCostBasis == other.perUnitCostBasis &&
10671162
additionalProperties == other.additionalProperties
10681163
}
10691164

@@ -1075,12 +1170,14 @@ private constructor(
10751170
customExpiration,
10761171
expiresAtEndOfCadence,
10771172
filters,
1173+
itemId,
1174+
perUnitCostBasis,
10781175
additionalProperties,
10791176
)
10801177
}
10811178

10821179
override fun hashCode(): Int = hashCode
10831180

10841181
override fun toString() =
1085-
"NewAllocationPrice{amount=$amount, cadence=$cadence, currency=$currency, customExpiration=$customExpiration, expiresAtEndOfCadence=$expiresAtEndOfCadence, filters=$filters, additionalProperties=$additionalProperties}"
1182+
"NewAllocationPrice{amount=$amount, cadence=$cadence, currency=$currency, customExpiration=$customExpiration, expiresAtEndOfCadence=$expiresAtEndOfCadence, filters=$filters, itemId=$itemId, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}"
10861183
}

0 commit comments

Comments
 (0)