Skip to content

Commit deed9fa

Browse files
author
stlc-bot
committed
Build SDK
Stainless-Generated-From: 62dd64c
1 parent 8c753e1 commit deed9fa

10 files changed

Lines changed: 236 additions & 16 deletions

File tree

image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataField.kt

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ private constructor(
3939
private val label: JsonField<String>,
4040
private val name: JsonField<String>,
4141
private val schema: JsonField<Schema>,
42+
private val description: JsonField<String>,
4243
private val additionalProperties: MutableMap<String, JsonValue>,
4344
) {
4445

@@ -48,7 +49,10 @@ private constructor(
4849
@JsonProperty("label") @ExcludeMissing label: JsonField<String> = JsonMissing.of(),
4950
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
5051
@JsonProperty("schema") @ExcludeMissing schema: JsonField<Schema> = JsonMissing.of(),
51-
) : this(id, label, name, schema, mutableMapOf())
52+
@JsonProperty("description")
53+
@ExcludeMissing
54+
description: JsonField<String> = JsonMissing.of(),
55+
) : this(id, label, name, schema, description, mutableMapOf())
5256

5357
/**
5458
* Unique identifier for the custom metadata field. Use this to update the field.
@@ -84,6 +88,16 @@ private constructor(
8488
*/
8589
fun schema(): Schema = schema.getRequired("schema")
8690

91+
/**
92+
* Optional description of the custom metadata field. Only present when a description has been
93+
* set. Shown as a hint to the users while setting the field's value on an asset in the media
94+
* library UI.
95+
*
96+
* @throws ImageKitInvalidDataException if the JSON field has an unexpected type (e.g. if the
97+
* server responded with an unexpected value).
98+
*/
99+
fun description(): Optional<String> = description.getOptional("description")
100+
87101
/**
88102
* Returns the raw JSON value of [id].
89103
*
@@ -112,6 +126,13 @@ private constructor(
112126
*/
113127
@JsonProperty("schema") @ExcludeMissing fun _schema(): JsonField<Schema> = schema
114128

129+
/**
130+
* Returns the raw JSON value of [description].
131+
*
132+
* Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
133+
*/
134+
@JsonProperty("description") @ExcludeMissing fun _description(): JsonField<String> = description
135+
115136
@JsonAnySetter
116137
private fun putAdditionalProperty(key: String, value: JsonValue) {
117138
additionalProperties.put(key, value)
@@ -147,6 +168,7 @@ private constructor(
147168
private var label: JsonField<String>? = null
148169
private var name: JsonField<String>? = null
149170
private var schema: JsonField<Schema>? = null
171+
private var description: JsonField<String> = JsonMissing.of()
150172
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
151173

152174
@JvmSynthetic
@@ -155,6 +177,7 @@ private constructor(
155177
label = customMetadataField.label
156178
name = customMetadataField.name
157179
schema = customMetadataField.schema
180+
description = customMetadataField.description
158181
additionalProperties = customMetadataField.additionalProperties.toMutableMap()
159182
}
160183

@@ -208,6 +231,22 @@ private constructor(
208231
*/
209232
fun schema(schema: JsonField<Schema>) = apply { this.schema = schema }
210233

234+
/**
235+
* Optional description of the custom metadata field. Only present when a description has
236+
* been set. Shown as a hint to the users while setting the field's value on an asset in the
237+
* media library UI.
238+
*/
239+
fun description(description: String) = description(JsonField.of(description))
240+
241+
/**
242+
* Sets [Builder.description] to an arbitrary JSON value.
243+
*
244+
* You should usually call [Builder.description] with a well-typed [String] value instead.
245+
* This method is primarily for setting the field to an undocumented or not yet supported
246+
* value.
247+
*/
248+
fun description(description: JsonField<String>) = apply { this.description = description }
249+
211250
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
212251
this.additionalProperties.clear()
213252
putAllAdditionalProperties(additionalProperties)
@@ -248,6 +287,7 @@ private constructor(
248287
checkRequired("label", label),
249288
checkRequired("name", name),
250289
checkRequired("schema", schema),
290+
description,
251291
additionalProperties.toMutableMap(),
252292
)
253293
}
@@ -271,6 +311,7 @@ private constructor(
271311
label()
272312
name()
273313
schema().validate()
314+
description()
274315
validated = true
275316
}
276317

@@ -292,7 +333,8 @@ private constructor(
292333
(if (id.asKnown().isPresent) 1 else 0) +
293334
(if (label.asKnown().isPresent) 1 else 0) +
294335
(if (name.asKnown().isPresent) 1 else 0) +
295-
(schema.asKnown().getOrNull()?.validity() ?: 0)
336+
(schema.asKnown().getOrNull()?.validity() ?: 0) +
337+
(if (description.asKnown().isPresent) 1 else 0)
296338

297339
/** An object that describes the rules for the custom metadata field value. */
298340
class Schema
@@ -2185,15 +2227,16 @@ private constructor(
21852227
label == other.label &&
21862228
name == other.name &&
21872229
schema == other.schema &&
2230+
description == other.description &&
21882231
additionalProperties == other.additionalProperties
21892232
}
21902233

21912234
private val hashCode: Int by lazy {
2192-
Objects.hash(id, label, name, schema, additionalProperties)
2235+
Objects.hash(id, label, name, schema, description, additionalProperties)
21932236
}
21942237

21952238
override fun hashCode(): Int = hashCode
21962239

21972240
override fun toString() =
2198-
"CustomMetadataField{id=$id, label=$label, name=$name, schema=$schema, additionalProperties=$additionalProperties}"
2241+
"CustomMetadataField{id=$id, label=$label, name=$name, schema=$schema, description=$description, additionalProperties=$additionalProperties}"
21992242
}

image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldCreateParams.kt

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ private constructor(
7272
*/
7373
fun schema(): Schema = body.schema()
7474

75+
/**
76+
* Optional description for the custom metadata field. Can be up to 500 characters. This is
77+
* shown as a hint to the users while setting the field's value on an asset in the media library
78+
* UI.
79+
*
80+
* @throws ImageKitInvalidDataException if the JSON field has an unexpected type (e.g. if the
81+
* server responded with an unexpected value).
82+
*/
83+
fun description(): Optional<String> = body.description()
84+
7585
/**
7686
* Returns the raw JSON value of [label].
7787
*
@@ -93,6 +103,13 @@ private constructor(
93103
*/
94104
fun _schema(): JsonField<Schema> = body._schema()
95105

106+
/**
107+
* Returns the raw JSON value of [description].
108+
*
109+
* Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
110+
*/
111+
fun _description(): JsonField<String> = body._description()
112+
96113
fun _additionalBodyProperties(): Map<String, JsonValue> = body._additionalProperties()
97114

98115
/** Additional headers to send with the request. */
@@ -143,6 +160,7 @@ private constructor(
143160
* - [label]
144161
* - [name]
145162
* - [schema]
163+
* - [description]
146164
*/
147165
fun body(body: Body) = apply { this.body = body.toBuilder() }
148166

@@ -185,6 +203,22 @@ private constructor(
185203
*/
186204
fun schema(schema: JsonField<Schema>) = apply { body.schema(schema) }
187205

206+
/**
207+
* Optional description for the custom metadata field. Can be up to 500 characters. This is
208+
* shown as a hint to the users while setting the field's value on an asset in the media
209+
* library UI.
210+
*/
211+
fun description(description: String) = apply { body.description(description) }
212+
213+
/**
214+
* Sets [Builder.description] to an arbitrary JSON value.
215+
*
216+
* You should usually call [Builder.description] with a well-typed [String] value instead.
217+
* This method is primarily for setting the field to an undocumented or not yet supported
218+
* value.
219+
*/
220+
fun description(description: JsonField<String>) = apply { body.description(description) }
221+
188222
fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
189223
body.additionalProperties(additionalBodyProperties)
190224
}
@@ -336,6 +370,7 @@ private constructor(
336370
private val label: JsonField<String>,
337371
private val name: JsonField<String>,
338372
private val schema: JsonField<Schema>,
373+
private val description: JsonField<String>,
339374
private val additionalProperties: MutableMap<String, JsonValue>,
340375
) {
341376

@@ -344,7 +379,10 @@ private constructor(
344379
@JsonProperty("label") @ExcludeMissing label: JsonField<String> = JsonMissing.of(),
345380
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
346381
@JsonProperty("schema") @ExcludeMissing schema: JsonField<Schema> = JsonMissing.of(),
347-
) : this(label, name, schema, mutableMapOf())
382+
@JsonProperty("description")
383+
@ExcludeMissing
384+
description: JsonField<String> = JsonMissing.of(),
385+
) : this(label, name, schema, description, mutableMapOf())
348386

349387
/**
350388
* Human readable name of the custom metadata field. This should be unique across all non
@@ -371,6 +409,16 @@ private constructor(
371409
*/
372410
fun schema(): Schema = schema.getRequired("schema")
373411

412+
/**
413+
* Optional description for the custom metadata field. Can be up to 500 characters. This is
414+
* shown as a hint to the users while setting the field's value on an asset in the media
415+
* library UI.
416+
*
417+
* @throws ImageKitInvalidDataException if the JSON field has an unexpected type (e.g. if
418+
* the server responded with an unexpected value).
419+
*/
420+
fun description(): Optional<String> = description.getOptional("description")
421+
374422
/**
375423
* Returns the raw JSON value of [label].
376424
*
@@ -392,6 +440,15 @@ private constructor(
392440
*/
393441
@JsonProperty("schema") @ExcludeMissing fun _schema(): JsonField<Schema> = schema
394442

443+
/**
444+
* Returns the raw JSON value of [description].
445+
*
446+
* Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
447+
*/
448+
@JsonProperty("description")
449+
@ExcludeMissing
450+
fun _description(): JsonField<String> = description
451+
395452
@JsonAnySetter
396453
private fun putAdditionalProperty(key: String, value: JsonValue) {
397454
additionalProperties.put(key, value)
@@ -425,13 +482,15 @@ private constructor(
425482
private var label: JsonField<String>? = null
426483
private var name: JsonField<String>? = null
427484
private var schema: JsonField<Schema>? = null
485+
private var description: JsonField<String> = JsonMissing.of()
428486
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
429487

430488
@JvmSynthetic
431489
internal fun from(body: Body) = apply {
432490
label = body.label
433491
name = body.name
434492
schema = body.schema
493+
description = body.description
435494
additionalProperties = body.additionalProperties.toMutableMap()
436495
}
437496

@@ -477,6 +536,24 @@ private constructor(
477536
*/
478537
fun schema(schema: JsonField<Schema>) = apply { this.schema = schema }
479538

539+
/**
540+
* Optional description for the custom metadata field. Can be up to 500 characters. This
541+
* is shown as a hint to the users while setting the field's value on an asset in the
542+
* media library UI.
543+
*/
544+
fun description(description: String) = description(JsonField.of(description))
545+
546+
/**
547+
* Sets [Builder.description] to an arbitrary JSON value.
548+
*
549+
* You should usually call [Builder.description] with a well-typed [String] value
550+
* instead. This method is primarily for setting the field to an undocumented or not yet
551+
* supported value.
552+
*/
553+
fun description(description: JsonField<String>) = apply {
554+
this.description = description
555+
}
556+
480557
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
481558
this.additionalProperties.clear()
482559
putAllAdditionalProperties(additionalProperties)
@@ -515,6 +592,7 @@ private constructor(
515592
checkRequired("label", label),
516593
checkRequired("name", name),
517594
checkRequired("schema", schema),
595+
description,
518596
additionalProperties.toMutableMap(),
519597
)
520598
}
@@ -538,6 +616,7 @@ private constructor(
538616
label()
539617
name()
540618
schema().validate()
619+
description()
541620
validated = true
542621
}
543622

@@ -559,7 +638,8 @@ private constructor(
559638
internal fun validity(): Int =
560639
(if (label.asKnown().isPresent) 1 else 0) +
561640
(if (name.asKnown().isPresent) 1 else 0) +
562-
(schema.asKnown().getOrNull()?.validity() ?: 0)
641+
(schema.asKnown().getOrNull()?.validity() ?: 0) +
642+
(if (description.asKnown().isPresent) 1 else 0)
563643

564644
override fun equals(other: Any?): Boolean {
565645
if (this === other) {
@@ -570,17 +650,18 @@ private constructor(
570650
label == other.label &&
571651
name == other.name &&
572652
schema == other.schema &&
653+
description == other.description &&
573654
additionalProperties == other.additionalProperties
574655
}
575656

576657
private val hashCode: Int by lazy {
577-
Objects.hash(label, name, schema, additionalProperties)
658+
Objects.hash(label, name, schema, description, additionalProperties)
578659
}
579660

580661
override fun hashCode(): Int = hashCode
581662

582663
override fun toString() =
583-
"Body{label=$label, name=$name, schema=$schema, additionalProperties=$additionalProperties}"
664+
"Body{label=$label, name=$name, schema=$schema, description=$description, additionalProperties=$additionalProperties}"
584665
}
585666

586667
class Schema

0 commit comments

Comments
 (0)