@@ -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