Skip to content

Commit b6f5318

Browse files
feat(api): api update
1 parent 743513b commit b6f5318

File tree

59 files changed

+4426
-543
lines changed

Some content is hidden

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

59 files changed

+4426
-543
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-cbce25283cb9c3282e03e08b7ee81395436af7d0eb480ffcbab307b5bf1c92a0.yml
3-
openapi_spec_hash: c286edf46db95dee05eb6f180ac24ab0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ef726ad139fa29757029206ee08150434fc6c52005fec6d42c7d2bcd3aa7ab47.yml
3+
openapi_spec_hash: e622beb7c26f9b0dd641bd5c92735a5b
44
config_hash: dd4343ce95871032ef6e0735a4ca038c

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

Lines changed: 64 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ class AffectedBlock
2525
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2626
private constructor(
2727
private val id: JsonField<String>,
28-
private val blockFilters: JsonField<List<BlockFilter>>,
2928
private val expiryDate: JsonField<OffsetDateTime>,
29+
private val filters: JsonField<List<Filter>>,
3030
private val perUnitCostBasis: JsonField<String>,
3131
private val additionalProperties: MutableMap<String, JsonValue>,
3232
) {
3333

3434
@JsonCreator
3535
private constructor(
3636
@JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
37-
@JsonProperty("block_filters")
38-
@ExcludeMissing
39-
blockFilters: JsonField<List<BlockFilter>> = JsonMissing.of(),
4037
@JsonProperty("expiry_date")
4138
@ExcludeMissing
4239
expiryDate: JsonField<OffsetDateTime> = JsonMissing.of(),
40+
@JsonProperty("filters")
41+
@ExcludeMissing
42+
filters: JsonField<List<Filter>> = JsonMissing.of(),
4343
@JsonProperty("per_unit_cost_basis")
4444
@ExcludeMissing
4545
perUnitCostBasis: JsonField<String> = JsonMissing.of(),
46-
) : this(id, blockFilters, expiryDate, perUnitCostBasis, mutableMapOf())
46+
) : this(id, expiryDate, filters, perUnitCostBasis, mutableMapOf())
4747

4848
/**
4949
* @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly
@@ -55,13 +55,13 @@ private constructor(
5555
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
5656
* responded with an unexpected value).
5757
*/
58-
fun blockFilters(): Optional<List<BlockFilter>> = blockFilters.getOptional("block_filters")
58+
fun expiryDate(): Optional<OffsetDateTime> = expiryDate.getOptional("expiry_date")
5959

6060
/**
61-
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
62-
* responded with an unexpected value).
61+
* @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly
62+
* missing or null (e.g. if the server responded with an unexpected value).
6363
*/
64-
fun expiryDate(): Optional<OffsetDateTime> = expiryDate.getOptional("expiry_date")
64+
fun filters(): List<Filter> = filters.getRequired("filters")
6565

6666
/**
6767
* @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server
@@ -76,15 +76,6 @@ private constructor(
7676
*/
7777
@JsonProperty("id") @ExcludeMissing fun _id(): JsonField<String> = id
7878

79-
/**
80-
* Returns the raw JSON value of [blockFilters].
81-
*
82-
* Unlike [blockFilters], this method doesn't throw if the JSON field has an unexpected type.
83-
*/
84-
@JsonProperty("block_filters")
85-
@ExcludeMissing
86-
fun _blockFilters(): JsonField<List<BlockFilter>> = blockFilters
87-
8879
/**
8980
* Returns the raw JSON value of [expiryDate].
9081
*
@@ -94,6 +85,13 @@ private constructor(
9485
@ExcludeMissing
9586
fun _expiryDate(): JsonField<OffsetDateTime> = expiryDate
9687

88+
/**
89+
* Returns the raw JSON value of [filters].
90+
*
91+
* Unlike [filters], this method doesn't throw if the JSON field has an unexpected type.
92+
*/
93+
@JsonProperty("filters") @ExcludeMissing fun _filters(): JsonField<List<Filter>> = filters
94+
9795
/**
9896
* Returns the raw JSON value of [perUnitCostBasis].
9997
*
@@ -124,8 +122,8 @@ private constructor(
124122
* The following fields are required:
125123
* ```java
126124
* .id()
127-
* .blockFilters()
128125
* .expiryDate()
126+
* .filters()
129127
* .perUnitCostBasis()
130128
* ```
131129
*/
@@ -136,16 +134,16 @@ private constructor(
136134
class Builder internal constructor() {
137135

138136
private var id: JsonField<String>? = null
139-
private var blockFilters: JsonField<MutableList<BlockFilter>>? = null
140137
private var expiryDate: JsonField<OffsetDateTime>? = null
138+
private var filters: JsonField<MutableList<Filter>>? = null
141139
private var perUnitCostBasis: JsonField<String>? = null
142140
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
143141

144142
@JvmSynthetic
145143
internal fun from(affectedBlock: AffectedBlock) = apply {
146144
id = affectedBlock.id
147-
blockFilters = affectedBlock.blockFilters.map { it.toMutableList() }
148145
expiryDate = affectedBlock.expiryDate
146+
filters = affectedBlock.filters.map { it.toMutableList() }
149147
perUnitCostBasis = affectedBlock.perUnitCostBasis
150148
additionalProperties = affectedBlock.additionalProperties.toMutableMap()
151149
}
@@ -160,50 +158,45 @@ private constructor(
160158
*/
161159
fun id(id: JsonField<String>) = apply { this.id = id }
162160

163-
fun blockFilters(blockFilters: List<BlockFilter>?) =
164-
blockFilters(JsonField.ofNullable(blockFilters))
161+
fun expiryDate(expiryDate: OffsetDateTime?) = expiryDate(JsonField.ofNullable(expiryDate))
165162

166-
/** Alias for calling [Builder.blockFilters] with `blockFilters.orElse(null)`. */
167-
fun blockFilters(blockFilters: Optional<List<BlockFilter>>) =
168-
blockFilters(blockFilters.getOrNull())
163+
/** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */
164+
fun expiryDate(expiryDate: Optional<OffsetDateTime>) = expiryDate(expiryDate.getOrNull())
169165

170166
/**
171-
* Sets [Builder.blockFilters] to an arbitrary JSON value.
167+
* Sets [Builder.expiryDate] to an arbitrary JSON value.
172168
*
173-
* You should usually call [Builder.blockFilters] with a well-typed `List<BlockFilter>`
174-
* value instead. This method is primarily for setting the field to an undocumented or not
175-
* yet supported value.
169+
* You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime] value
170+
* instead. This method is primarily for setting the field to an undocumented or not yet
171+
* supported value.
176172
*/
177-
fun blockFilters(blockFilters: JsonField<List<BlockFilter>>) = apply {
178-
this.blockFilters = blockFilters.map { it.toMutableList() }
173+
fun expiryDate(expiryDate: JsonField<OffsetDateTime>) = apply {
174+
this.expiryDate = expiryDate
179175
}
180176

177+
fun filters(filters: List<Filter>) = filters(JsonField.of(filters))
178+
181179
/**
182-
* Adds a single [BlockFilter] to [blockFilters].
180+
* Sets [Builder.filters] to an arbitrary JSON value.
183181
*
184-
* @throws IllegalStateException if the field was previously set to a non-list.
182+
* You should usually call [Builder.filters] with a well-typed `List<Filter>` value instead.
183+
* This method is primarily for setting the field to an undocumented or not yet supported
184+
* value.
185185
*/
186-
fun addBlockFilter(blockFilter: BlockFilter) = apply {
187-
blockFilters =
188-
(blockFilters ?: JsonField.of(mutableListOf())).also {
189-
checkKnown("blockFilters", it).add(blockFilter)
190-
}
186+
fun filters(filters: JsonField<List<Filter>>) = apply {
187+
this.filters = filters.map { it.toMutableList() }
191188
}
192189

193-
fun expiryDate(expiryDate: OffsetDateTime?) = expiryDate(JsonField.ofNullable(expiryDate))
194-
195-
/** Alias for calling [Builder.expiryDate] with `expiryDate.orElse(null)`. */
196-
fun expiryDate(expiryDate: Optional<OffsetDateTime>) = expiryDate(expiryDate.getOrNull())
197-
198190
/**
199-
* Sets [Builder.expiryDate] to an arbitrary JSON value.
191+
* Adds a single [Filter] to [filters].
200192
*
201-
* You should usually call [Builder.expiryDate] with a well-typed [OffsetDateTime] value
202-
* instead. This method is primarily for setting the field to an undocumented or not yet
203-
* supported value.
193+
* @throws IllegalStateException if the field was previously set to a non-list.
204194
*/
205-
fun expiryDate(expiryDate: JsonField<OffsetDateTime>) = apply {
206-
this.expiryDate = expiryDate
195+
fun addFilter(filter: Filter) = apply {
196+
filters =
197+
(filters ?: JsonField.of(mutableListOf())).also {
198+
checkKnown("filters", it).add(filter)
199+
}
207200
}
208201

209202
fun perUnitCostBasis(perUnitCostBasis: String?) =
@@ -251,8 +244,8 @@ private constructor(
251244
* The following fields are required:
252245
* ```java
253246
* .id()
254-
* .blockFilters()
255247
* .expiryDate()
248+
* .filters()
256249
* .perUnitCostBasis()
257250
* ```
258251
*
@@ -261,8 +254,8 @@ private constructor(
261254
fun build(): AffectedBlock =
262255
AffectedBlock(
263256
checkRequired("id", id),
264-
checkRequired("blockFilters", blockFilters).map { it.toImmutable() },
265257
checkRequired("expiryDate", expiryDate),
258+
checkRequired("filters", filters).map { it.toImmutable() },
266259
checkRequired("perUnitCostBasis", perUnitCostBasis),
267260
additionalProperties.toMutableMap(),
268261
)
@@ -276,8 +269,8 @@ private constructor(
276269
}
277270

278271
id()
279-
blockFilters().ifPresent { it.forEach { it.validate() } }
280272
expiryDate()
273+
filters().forEach { it.validate() }
281274
perUnitCostBasis()
282275
validated = true
283276
}
@@ -298,11 +291,11 @@ private constructor(
298291
@JvmSynthetic
299292
internal fun validity(): Int =
300293
(if (id.asKnown().isPresent) 1 else 0) +
301-
(blockFilters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
302294
(if (expiryDate.asKnown().isPresent) 1 else 0) +
295+
(filters.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
303296
(if (perUnitCostBasis.asKnown().isPresent) 1 else 0)
304297

305-
class BlockFilter
298+
class Filter
306299
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
307300
private constructor(
308301
private val field: JsonField<Field>,
@@ -382,7 +375,7 @@ private constructor(
382375
companion object {
383376

384377
/**
385-
* Returns a mutable builder for constructing an instance of [BlockFilter].
378+
* Returns a mutable builder for constructing an instance of [Filter].
386379
*
387380
* The following fields are required:
388381
* ```java
@@ -394,7 +387,7 @@ private constructor(
394387
@JvmStatic fun builder() = Builder()
395388
}
396389

397-
/** A builder for [BlockFilter]. */
390+
/** A builder for [Filter]. */
398391
class Builder internal constructor() {
399392

400393
private var field: JsonField<Field>? = null
@@ -403,11 +396,11 @@ private constructor(
403396
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
404397

405398
@JvmSynthetic
406-
internal fun from(blockFilter: BlockFilter) = apply {
407-
field = blockFilter.field
408-
operator = blockFilter.operator
409-
values = blockFilter.values.map { it.toMutableList() }
410-
additionalProperties = blockFilter.additionalProperties.toMutableMap()
399+
internal fun from(filter: Filter) = apply {
400+
field = filter.field
401+
operator = filter.operator
402+
values = filter.values.map { it.toMutableList() }
403+
additionalProperties = filter.additionalProperties.toMutableMap()
411404
}
412405

413406
/** The property of the price to filter on. */
@@ -480,7 +473,7 @@ private constructor(
480473
}
481474

482475
/**
483-
* Returns an immutable instance of [BlockFilter].
476+
* Returns an immutable instance of [Filter].
484477
*
485478
* Further updates to this [Builder] will not mutate the returned instance.
486479
*
@@ -493,8 +486,8 @@ private constructor(
493486
*
494487
* @throws IllegalStateException if any required field is unset.
495488
*/
496-
fun build(): BlockFilter =
497-
BlockFilter(
489+
fun build(): Filter =
490+
Filter(
498491
checkRequired("field", field),
499492
checkRequired("operator", operator),
500493
checkRequired("values", values).map { it.toImmutable() },
@@ -504,7 +497,7 @@ private constructor(
504497

505498
private var validated: Boolean = false
506499

507-
fun validate(): BlockFilter = apply {
500+
fun validate(): Filter = apply {
508501
if (validated) {
509502
return@apply
510503
}
@@ -815,7 +808,7 @@ private constructor(
815808
return true
816809
}
817810

818-
return other is BlockFilter &&
811+
return other is Filter &&
819812
field == other.field &&
820813
operator == other.operator &&
821814
values == other.values &&
@@ -829,7 +822,7 @@ private constructor(
829822
override fun hashCode(): Int = hashCode
830823

831824
override fun toString() =
832-
"BlockFilter{field=$field, operator=$operator, values=$values, additionalProperties=$additionalProperties}"
825+
"Filter{field=$field, operator=$operator, values=$values, additionalProperties=$additionalProperties}"
833826
}
834827

835828
override fun equals(other: Any?): Boolean {
@@ -839,18 +832,18 @@ private constructor(
839832

840833
return other is AffectedBlock &&
841834
id == other.id &&
842-
blockFilters == other.blockFilters &&
843835
expiryDate == other.expiryDate &&
836+
filters == other.filters &&
844837
perUnitCostBasis == other.perUnitCostBasis &&
845838
additionalProperties == other.additionalProperties
846839
}
847840

848841
private val hashCode: Int by lazy {
849-
Objects.hash(id, blockFilters, expiryDate, perUnitCostBasis, additionalProperties)
842+
Objects.hash(id, expiryDate, filters, perUnitCostBasis, additionalProperties)
850843
}
851844

852845
override fun hashCode(): Int = hashCode
853846

854847
override fun toString() =
855-
"AffectedBlock{id=$id, blockFilters=$blockFilters, expiryDate=$expiryDate, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}"
848+
"AffectedBlock{id=$id, expiryDate=$expiryDate, filters=$filters, perUnitCostBasis=$perUnitCostBasis, additionalProperties=$additionalProperties}"
856849
}

0 commit comments

Comments
 (0)