@@ -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}
0 commit comments