Skip to content

Commit bf412bc

Browse files
feat(api): api update
1 parent 6aa1d53 commit bf412bc

File tree

57 files changed

+182
-945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+182
-945
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-b6ec9a6bf40b74575d917ab145b2413bc61dcd6989bb9d1aa41624bf3437599e.yml
3-
openapi_spec_hash: 53cf9363c3bd9649e0af5f713abdcba7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-b330498c2bfb80605f4c406e8b228c0a4ece85247b21f62f93273a00abb53d35.yml
3+
openapi_spec_hash: 16a82d0eb23b68218d584e385bee43da
44
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2

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

Lines changed: 6 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,21 @@ import com.withorb.api.core.checkRequired
1414
import com.withorb.api.errors.OrbInvalidDataException
1515
import java.util.Collections
1616
import java.util.Objects
17-
import java.util.Optional
18-
import kotlin.jvm.optionals.getOrNull
1917

2018
/** Configuration for unit pricing */
2119
class UnitConfig
2220
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2321
private constructor(
2422
private val unitAmount: JsonField<String>,
25-
private val scalingFactor: JsonField<Double>,
2623
private val additionalProperties: MutableMap<String, JsonValue>,
2724
) {
2825

2926
@JsonCreator
3027
private constructor(
3128
@JsonProperty("unit_amount")
3229
@ExcludeMissing
33-
unitAmount: JsonField<String> = JsonMissing.of(),
34-
@JsonProperty("scaling_factor")
35-
@ExcludeMissing
36-
scalingFactor: JsonField<Double> = JsonMissing.of(),
37-
) : this(unitAmount, scalingFactor, mutableMapOf())
30+
unitAmount: JsonField<String> = JsonMissing.of()
31+
) : this(unitAmount, mutableMapOf())
3832

3933
/**
4034
* Rate per unit of usage
@@ -44,30 +38,13 @@ private constructor(
4438
*/
4539
fun unitAmount(): String = unitAmount.getRequired("unit_amount")
4640

47-
/**
48-
* Multiplier to scale rated quantity by
49-
*
50-
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
51-
* responded with an unexpected value).
52-
*/
53-
fun scalingFactor(): Optional<Double> = scalingFactor.getOptional("scaling_factor")
54-
5541
/**
5642
* Returns the raw JSON value of [unitAmount].
5743
*
5844
* Unlike [unitAmount], this method doesn't throw if the JSON field has an unexpected type.
5945
*/
6046
@JsonProperty("unit_amount") @ExcludeMissing fun _unitAmount(): JsonField<String> = unitAmount
6147

62-
/**
63-
* Returns the raw JSON value of [scalingFactor].
64-
*
65-
* Unlike [scalingFactor], this method doesn't throw if the JSON field has an unexpected type.
66-
*/
67-
@JsonProperty("scaling_factor")
68-
@ExcludeMissing
69-
fun _scalingFactor(): JsonField<Double> = scalingFactor
70-
7148
@JsonAnySetter
7249
private fun putAdditionalProperty(key: String, value: JsonValue) {
7350
additionalProperties.put(key, value)
@@ -97,13 +74,11 @@ private constructor(
9774
class Builder internal constructor() {
9875

9976
private var unitAmount: JsonField<String>? = null
100-
private var scalingFactor: JsonField<Double> = JsonMissing.of()
10177
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
10278

10379
@JvmSynthetic
10480
internal fun from(unitConfig: UnitConfig) = apply {
10581
unitAmount = unitConfig.unitAmount
106-
scalingFactor = unitConfig.scalingFactor
10782
additionalProperties = unitConfig.additionalProperties.toMutableMap()
10883
}
10984

@@ -119,32 +94,6 @@ private constructor(
11994
*/
12095
fun unitAmount(unitAmount: JsonField<String>) = apply { this.unitAmount = unitAmount }
12196

122-
/** Multiplier to scale rated quantity by */
123-
fun scalingFactor(scalingFactor: Double?) =
124-
scalingFactor(JsonField.ofNullable(scalingFactor))
125-
126-
/**
127-
* Alias for [Builder.scalingFactor].
128-
*
129-
* This unboxed primitive overload exists for backwards compatibility.
130-
*/
131-
fun scalingFactor(scalingFactor: Double) = scalingFactor(scalingFactor as Double?)
132-
133-
/** Alias for calling [Builder.scalingFactor] with `scalingFactor.orElse(null)`. */
134-
fun scalingFactor(scalingFactor: Optional<Double>) =
135-
scalingFactor(scalingFactor.getOrNull())
136-
137-
/**
138-
* Sets [Builder.scalingFactor] to an arbitrary JSON value.
139-
*
140-
* You should usually call [Builder.scalingFactor] with a well-typed [Double] value instead.
141-
* This method is primarily for setting the field to an undocumented or not yet supported
142-
* value.
143-
*/
144-
fun scalingFactor(scalingFactor: JsonField<Double>) = apply {
145-
this.scalingFactor = scalingFactor
146-
}
147-
14897
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
14998
this.additionalProperties.clear()
15099
putAllAdditionalProperties(additionalProperties)
@@ -177,11 +126,7 @@ private constructor(
177126
* @throws IllegalStateException if any required field is unset.
178127
*/
179128
fun build(): UnitConfig =
180-
UnitConfig(
181-
checkRequired("unitAmount", unitAmount),
182-
scalingFactor,
183-
additionalProperties.toMutableMap(),
184-
)
129+
UnitConfig(checkRequired("unitAmount", unitAmount), additionalProperties.toMutableMap())
185130
}
186131

187132
private var validated: Boolean = false
@@ -192,7 +137,6 @@ private constructor(
192137
}
193138

194139
unitAmount()
195-
scalingFactor()
196140
validated = true
197141
}
198142

@@ -209,10 +153,7 @@ private constructor(
209153
*
210154
* Used for best match union deserialization.
211155
*/
212-
@JvmSynthetic
213-
internal fun validity(): Int =
214-
(if (unitAmount.asKnown().isPresent) 1 else 0) +
215-
(if (scalingFactor.asKnown().isPresent) 1 else 0)
156+
@JvmSynthetic internal fun validity(): Int = (if (unitAmount.asKnown().isPresent) 1 else 0)
216157

217158
override fun equals(other: Any?): Boolean {
218159
if (this === other) {
@@ -221,16 +162,13 @@ private constructor(
221162

222163
return other is UnitConfig &&
223164
unitAmount == other.unitAmount &&
224-
scalingFactor == other.scalingFactor &&
225165
additionalProperties == other.additionalProperties
226166
}
227167

228-
private val hashCode: Int by lazy {
229-
Objects.hash(unitAmount, scalingFactor, additionalProperties)
230-
}
168+
private val hashCode: Int by lazy { Objects.hash(unitAmount, additionalProperties) }
231169

232170
override fun hashCode(): Int = hashCode
233171

234172
override fun toString() =
235-
"UnitConfig{unitAmount=$unitAmount, scalingFactor=$scalingFactor, additionalProperties=$additionalProperties}"
173+
"UnitConfig{unitAmount=$unitAmount, additionalProperties=$additionalProperties}"
236174
}

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,7 @@ internal class AggregatedCostTest {
118118
.planPhaseOrder(0L)
119119
.priceType(Price.Unit.PriceType.USAGE_PRICE)
120120
.replacesPriceId("replaces_price_id")
121-
.unitConfig(
122-
UnitConfig.builder()
123-
.unitAmount("unit_amount")
124-
.scalingFactor(0.0)
125-
.build()
126-
)
121+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
127122
.dimensionalPriceConfiguration(
128123
DimensionalPriceConfiguration.builder()
129124
.addDimensionValue("string")
@@ -246,12 +241,7 @@ internal class AggregatedCostTest {
246241
.planPhaseOrder(0L)
247242
.priceType(Price.Unit.PriceType.USAGE_PRICE)
248243
.replacesPriceId("replaces_price_id")
249-
.unitConfig(
250-
UnitConfig.builder()
251-
.unitAmount("unit_amount")
252-
.scalingFactor(0.0)
253-
.build()
254-
)
244+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
255245
.dimensionalPriceConfiguration(
256246
DimensionalPriceConfiguration.builder()
257247
.addDimensionValue("string")
@@ -382,12 +372,7 @@ internal class AggregatedCostTest {
382372
.planPhaseOrder(0L)
383373
.priceType(Price.Unit.PriceType.USAGE_PRICE)
384374
.replacesPriceId("replaces_price_id")
385-
.unitConfig(
386-
UnitConfig.builder()
387-
.unitAmount("unit_amount")
388-
.scalingFactor(0.0)
389-
.build()
390-
)
375+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
391376
.dimensionalPriceConfiguration(
392377
DimensionalPriceConfiguration.builder()
393378
.addDimensionValue("string")

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

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ internal class BetaCreatePlanVersionParamsTest {
6565
.itemId("item_id")
6666
.modelType(NewPlanUnitPrice.ModelType.UNIT)
6767
.name("Annual fee")
68-
.unitConfig(
69-
UnitConfig.builder()
70-
.unitAmount("unit_amount")
71-
.scalingFactor(0.0)
72-
.build()
73-
)
68+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
7469
.billableMetricId("billable_metric_id")
7570
.billedInAdvance(true)
7671
.billingCycleConfiguration(
@@ -177,12 +172,7 @@ internal class BetaCreatePlanVersionParamsTest {
177172
.itemId("item_id")
178173
.modelType(NewPlanUnitPrice.ModelType.UNIT)
179174
.name("Annual fee")
180-
.unitConfig(
181-
UnitConfig.builder()
182-
.unitAmount("unit_amount")
183-
.scalingFactor(0.0)
184-
.build()
185-
)
175+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
186176
.billableMetricId("billable_metric_id")
187177
.billedInAdvance(true)
188178
.billingCycleConfiguration(
@@ -294,12 +284,7 @@ internal class BetaCreatePlanVersionParamsTest {
294284
.itemId("item_id")
295285
.modelType(NewPlanUnitPrice.ModelType.UNIT)
296286
.name("Annual fee")
297-
.unitConfig(
298-
UnitConfig.builder()
299-
.unitAmount("unit_amount")
300-
.scalingFactor(0.0)
301-
.build()
302-
)
287+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
303288
.billableMetricId("billable_metric_id")
304289
.billedInAdvance(true)
305290
.billingCycleConfiguration(
@@ -408,12 +393,7 @@ internal class BetaCreatePlanVersionParamsTest {
408393
.itemId("item_id")
409394
.modelType(NewPlanUnitPrice.ModelType.UNIT)
410395
.name("Annual fee")
411-
.unitConfig(
412-
UnitConfig.builder()
413-
.unitAmount("unit_amount")
414-
.scalingFactor(0.0)
415-
.build()
416-
)
396+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
417397
.billableMetricId("billable_metric_id")
418398
.billedInAdvance(true)
419399
.billingCycleConfiguration(
@@ -516,12 +496,7 @@ internal class BetaCreatePlanVersionParamsTest {
516496
.itemId("item_id")
517497
.modelType(NewPlanUnitPrice.ModelType.UNIT)
518498
.name("Annual fee")
519-
.unitConfig(
520-
UnitConfig.builder()
521-
.unitAmount("unit_amount")
522-
.scalingFactor(0.0)
523-
.build()
524-
)
499+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
525500
.billableMetricId("billable_metric_id")
526501
.billedInAdvance(true)
527502
.billingCycleConfiguration(
@@ -632,12 +607,7 @@ internal class BetaCreatePlanVersionParamsTest {
632607
.itemId("item_id")
633608
.modelType(NewPlanUnitPrice.ModelType.UNIT)
634609
.name("Annual fee")
635-
.unitConfig(
636-
UnitConfig.builder()
637-
.unitAmount("unit_amount")
638-
.scalingFactor(0.0)
639-
.build()
640-
)
610+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
641611
.billableMetricId("billable_metric_id")
642612
.billedInAdvance(true)
643613
.billingCycleConfiguration(

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

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest {
6565
.itemId("item_id")
6666
.modelType(NewPlanUnitPrice.ModelType.UNIT)
6767
.name("Annual fee")
68-
.unitConfig(
69-
UnitConfig.builder()
70-
.unitAmount("unit_amount")
71-
.scalingFactor(0.0)
72-
.build()
73-
)
68+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
7469
.billableMetricId("billable_metric_id")
7570
.billedInAdvance(true)
7671
.billingCycleConfiguration(
@@ -177,12 +172,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest {
177172
.itemId("item_id")
178173
.modelType(NewPlanUnitPrice.ModelType.UNIT)
179174
.name("Annual fee")
180-
.unitConfig(
181-
UnitConfig.builder()
182-
.unitAmount("unit_amount")
183-
.scalingFactor(0.0)
184-
.build()
185-
)
175+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
186176
.billableMetricId("billable_metric_id")
187177
.billedInAdvance(true)
188178
.billingCycleConfiguration(
@@ -298,12 +288,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest {
298288
.itemId("item_id")
299289
.modelType(NewPlanUnitPrice.ModelType.UNIT)
300290
.name("Annual fee")
301-
.unitConfig(
302-
UnitConfig.builder()
303-
.unitAmount("unit_amount")
304-
.scalingFactor(0.0)
305-
.build()
306-
)
291+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
307292
.billableMetricId("billable_metric_id")
308293
.billedInAdvance(true)
309294
.billingCycleConfiguration(
@@ -412,12 +397,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest {
412397
.itemId("item_id")
413398
.modelType(NewPlanUnitPrice.ModelType.UNIT)
414399
.name("Annual fee")
415-
.unitConfig(
416-
UnitConfig.builder()
417-
.unitAmount("unit_amount")
418-
.scalingFactor(0.0)
419-
.build()
420-
)
400+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
421401
.billableMetricId("billable_metric_id")
422402
.billedInAdvance(true)
423403
.billingCycleConfiguration(
@@ -520,12 +500,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest {
520500
.itemId("item_id")
521501
.modelType(NewPlanUnitPrice.ModelType.UNIT)
522502
.name("Annual fee")
523-
.unitConfig(
524-
UnitConfig.builder()
525-
.unitAmount("unit_amount")
526-
.scalingFactor(0.0)
527-
.build()
528-
)
503+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
529504
.billableMetricId("billable_metric_id")
530505
.billedInAdvance(true)
531506
.billingCycleConfiguration(
@@ -636,12 +611,7 @@ internal class BetaExternalPlanIdCreatePlanVersionParamsTest {
636611
.itemId("item_id")
637612
.modelType(NewPlanUnitPrice.ModelType.UNIT)
638613
.name("Annual fee")
639-
.unitConfig(
640-
UnitConfig.builder()
641-
.unitAmount("unit_amount")
642-
.scalingFactor(0.0)
643-
.build()
644-
)
614+
.unitConfig(UnitConfig.builder().unitAmount("unit_amount").build())
645615
.billableMetricId("billable_metric_id")
646616
.billedInAdvance(true)
647617
.billingCycleConfiguration(

0 commit comments

Comments
 (0)