Skip to content

Commit e079374

Browse files
author
stlc-bot
committed
Build SDK
Stainless-Generated-From: 4416676
1 parent e24d49e commit e079374

27 files changed

Lines changed: 540 additions & 128 deletions

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

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private constructor(
4646
) : this(id, createdAt, enabled, name, transformation, mutableMapOf())
4747

4848
/**
49-
* Unique identifier generated by ImageKit when the named transformation was created.
49+
* Unique identifier for a named transformation.
5050
*
5151
* @throws ImageKitInvalidDataException if the JSON field has an unexpected type (e.g. if the
5252
* server responded with an unexpected value).
@@ -62,24 +62,30 @@ private constructor(
6262
fun createdAt(): Optional<OffsetDateTime> = createdAt.getOptional("createdAt")
6363

6464
/**
65-
* Whether the named transformation is currently enabled.
65+
* Whether the named transformation is currently enabled. When this is set to `false`, requests
66+
* using such disabled named transformations fail at delivery time.
6667
*
6768
* @throws ImageKitInvalidDataException if the JSON field has an unexpected type (e.g. if the
6869
* server responded with an unexpected value).
6970
*/
7071
fun enabled(): Optional<Boolean> = enabled.getOptional("enabled")
7172

7273
/**
73-
* Name of the named transformation, used as `tr:n-<name>` in image and video URLs.
74+
* Alias for the transformation string, used in URLs as `tr:n-<name>`. Must contain only
75+
* alphanumeric characters or `_` (no hyphens), and be unique for your account. Name matching is
76+
* case-sensitive.
7477
*
7578
* @throws ImageKitInvalidDataException if the JSON field has an unexpected type (e.g. if the
7679
* server responded with an unexpected value).
7780
*/
7881
fun name(): Optional<String> = name.getOptional("name")
7982

8083
/**
81-
* Transformation string this name refers to. Always includes the `tr:` prefix, even if you
82-
* omitted it in the request.
84+
* The transformation string this name refers to, for example `w-150,h-150,fo-center,cm-resize`.
85+
* The `tr:` prefix is optional; if present, it is validated. The string must be a valid
86+
* ImageKit transformation and cannot itself reference another named transformation (no
87+
* nesting). Learn more about the
88+
* [transformation syntax](https://imagekit.io/docs/transformations).
8389
*
8490
* @throws ImageKitInvalidDataException if the JSON field has an unexpected type (e.g. if the
8591
* server responded with an unexpected value).
@@ -163,7 +169,7 @@ private constructor(
163169
additionalProperties = namedTransformation.additionalProperties.toMutableMap()
164170
}
165171

166-
/** Unique identifier generated by ImageKit when the named transformation was created. */
172+
/** Unique identifier for a named transformation. */
167173
fun id(id: String) = id(JsonField.of(id))
168174

169175
/**
@@ -186,7 +192,10 @@ private constructor(
186192
*/
187193
fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply { this.createdAt = createdAt }
188194

189-
/** Whether the named transformation is currently enabled. */
195+
/**
196+
* Whether the named transformation is currently enabled. When this is set to `false`,
197+
* requests using such disabled named transformations fail at delivery time.
198+
*/
190199
fun enabled(enabled: Boolean) = enabled(JsonField.of(enabled))
191200

192201
/**
@@ -197,7 +206,11 @@ private constructor(
197206
*/
198207
fun enabled(enabled: JsonField<Boolean>) = apply { this.enabled = enabled }
199208

200-
/** Name of the named transformation, used as `tr:n-<name>` in image and video URLs. */
209+
/**
210+
* Alias for the transformation string, used in URLs as `tr:n-<name>`. Must contain only
211+
* alphanumeric characters or `_` (no hyphens), and be unique for your account. Name
212+
* matching is case-sensitive.
213+
*/
201214
fun name(name: String) = name(JsonField.of(name))
202215

203216
/**
@@ -209,8 +222,11 @@ private constructor(
209222
fun name(name: JsonField<String>) = apply { this.name = name }
210223

211224
/**
212-
* Transformation string this name refers to. Always includes the `tr:` prefix, even if you
213-
* omitted it in the request.
225+
* The transformation string this name refers to, for example
226+
* `w-150,h-150,fo-center,cm-resize`. The `tr:` prefix is optional; if present, it is
227+
* validated. The string must be a valid ImageKit transformation and cannot itself reference
228+
* another named transformation (no nesting). Learn more about the
229+
* [transformation syntax](https://imagekit.io/docs/transformations).
214230
*/
215231
fun transformation(transformation: String) = transformation(JsonField.of(transformation))
216232

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
}

0 commit comments

Comments
 (0)