diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4191c889..e0dc5001 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.0.0" + ".": "3.1.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 6d0a83a8..6b776b6f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-c7f578172392bde58bbb72be2a25b9e917529cd07550358c645ce155debf2418.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc/imagekit-362d0336e8f52ab1beb7d9602a3665dbb0277700e8dc01ef4f96fc7651699349.yml openapi_spec_hash: f0d797a17b1e8e81707517700cd44b13 -config_hash: da0c89d794fefcf600a4ddfc78553c2a +config_hash: 94f48fd13b7d41b8b6a203a3a8cee9ed diff --git a/CHANGELOG.md b/CHANGELOG.md index e128eed8..4e415c7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## 3.1.0 (2026-05-05) + +Full Changelog: [v3.0.0...v3.1.0](https://github.com/imagekit-developer/imagekit-java/compare/v3.0.0...v3.1.0) + +### Features + +* **client:** more robust error parsing ([8e42517](https://github.com/imagekit-developer/imagekit-java/commit/8e4251712d721a17b9caa4f1ad04e9c2c06822a0)) +* **client:** support proxy authentication ([60effd3](https://github.com/imagekit-developer/imagekit-java/commit/60effd33a60b70e3f44e9180927e3a63a93ee00d)) +* support setting headers via env ([c31a472](https://github.com/imagekit-developer/imagekit-java/commit/c31a472fd2674c2e339d16024cb47bf246994a38)) + + +### Performance Improvements + +* **client:** create one json mapper ([92128db](https://github.com/imagekit-developer/imagekit-java/commit/92128db5fbd82870290b9c1b5003115dd7c04469)) + + +### Chores + +* remove duplicated dokka setup ([a1a0ece](https://github.com/imagekit-developer/imagekit-java/commit/a1a0ece2a2e02b2dc10b6bee8d043170e3cd9681)) + + +### Documentation + +* clarify forwards compat behavior ([d5ec8cf](https://github.com/imagekit-developer/imagekit-java/commit/d5ec8cffa3ebac99d70f70f7b6c4fadbe042a5be)) + ## 3.0.0 (2026-04-21) Full Changelog: [v0.0.1...v3.0.0](https://github.com/imagekit-developer/imagekit-java/compare/v0.0.1...v3.0.0) diff --git a/README.md b/README.md index 69642eee..9b37af22 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/io.imagekit/image-kit-java)](https://central.sonatype.com/artifact/io.imagekit/image-kit-java/3.0.0) -[![javadoc](https://javadoc.io/badge2/io.imagekit/image-kit-java/3.0.0/javadoc.svg)](https://javadoc.io/doc/io.imagekit/image-kit-java/3.0.0) +[![Maven Central](https://img.shields.io/maven-central/v/io.imagekit/image-kit-java)](https://central.sonatype.com/artifact/io.imagekit/image-kit-java/3.1.0) +[![javadoc](https://javadoc.io/badge2/io.imagekit/image-kit-java/3.1.0/javadoc.svg)](https://javadoc.io/doc/io.imagekit/image-kit-java/3.1.0) @@ -11,7 +11,7 @@ The ImageKit Java SDK is a comprehensive library designed to simplify the integr -The REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/io.imagekit/image-kit-java/3.0.0). +The REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/io.imagekit/image-kit-java/3.1.0). @@ -46,7 +46,7 @@ The REST API documentation can be found on [imagekit.io](https://imagekit.io/doc ### Gradle ```kotlin -implementation("io.imagekit:image-kit-java:3.0.0") +implementation("io.imagekit:image-kit-java:3.1.0") ``` ### Maven @@ -55,7 +55,7 @@ implementation("io.imagekit:image-kit-java:3.0.0") io.imagekit image-kit-java - 3.0.0 + 3.1.0 ``` @@ -723,6 +723,21 @@ ImageKitClient client = ImageKitOkHttpClient.builder() .build(); ``` +If the proxy responds with `407 Proxy Authentication Required`, supply credentials by also configuring `proxyAuthenticator`: + +```java +import io.imagekit.client.ImageKitClient; +import io.imagekit.client.okhttp.ImageKitOkHttpClient; +import io.imagekit.core.http.ProxyAuthenticator; + +ImageKitClient client = ImageKitOkHttpClient.builder() + .fromEnv() + .proxy(...) + // Or a custom implementation of `ProxyAuthenticator`. + .proxyAuthenticator(ProxyAuthenticator.basic("username", "password")) + .build(); +``` + ### Connection pooling To customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods: @@ -961,7 +976,9 @@ In rare cases, the API may return a response that doesn't match the expected typ By default, the SDK will not throw an exception in this case. It will throw [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/io/imagekit/errors/ImageKitInvalidDataException.kt) only if you directly access the property. -If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`: +Validating the response is _not_ forwards compatible with new types from the API for existing fields. + +If you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`: ```java import io.imagekit.models.files.FileUploadResponse; diff --git a/build.gradle.kts b/build.gradle.kts index 411f291f..a2875ce6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "io.imagekit" - version = "3.0.0" // x-release-please-version + version = "3.1.0" // x-release-please-version } subprojects { @@ -21,7 +21,6 @@ subprojects { group = "Verification" description = "Verifies all source files are formatted." } - apply(plugin = "org.jetbrains.dokka") } subprojects { diff --git a/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/ImageKitOkHttpClient.kt b/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/ImageKitOkHttpClient.kt index 7f2325e8..0999d681 100644 --- a/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/ImageKitOkHttpClient.kt +++ b/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/ImageKitOkHttpClient.kt @@ -10,6 +10,7 @@ import io.imagekit.core.Sleeper import io.imagekit.core.Timeout import io.imagekit.core.http.Headers import io.imagekit.core.http.HttpClient +import io.imagekit.core.http.ProxyAuthenticator import io.imagekit.core.http.QueryParams import io.imagekit.core.jsonMapper import java.net.Proxy @@ -47,6 +48,7 @@ class ImageKitOkHttpClient private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var dispatcherExecutorService: ExecutorService? = null private var proxy: Proxy? = null + private var proxyAuthenticator: ProxyAuthenticator? = null private var maxIdleConnections: Int? = null private var keepAliveDuration: Duration? = null private var sslSocketFactory: SSLSocketFactory? = null @@ -77,6 +79,20 @@ class ImageKitOkHttpClient private constructor() { /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */ fun proxy(proxy: Optional) = proxy(proxy.getOrNull()) + /** + * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication + * Required`. + */ + fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply { + this.proxyAuthenticator = proxyAuthenticator + } + + /** + * Alias for calling [Builder.proxyAuthenticator] with `proxyAuthenticator.orElse(null)`. + */ + fun proxyAuthenticator(proxyAuthenticator: Optional) = + proxyAuthenticator(proxyAuthenticator.getOrNull()) + /** * The maximum number of idle connections kept by the underlying OkHttp connection pool. * @@ -217,6 +233,9 @@ class ImageKitOkHttpClient private constructor() { /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -388,6 +407,7 @@ class ImageKitOkHttpClient private constructor() { OkHttpClient.builder() .timeout(clientOptions.timeout()) .proxy(proxy) + .proxyAuthenticator(proxyAuthenticator) .maxIdleConnections(maxIdleConnections) .keepAliveDuration(keepAliveDuration) .dispatcherExecutorService(dispatcherExecutorService) diff --git a/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/ImageKitOkHttpClientAsync.kt b/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/ImageKitOkHttpClientAsync.kt index c0af9fc1..6ba70517 100644 --- a/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/ImageKitOkHttpClientAsync.kt +++ b/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/ImageKitOkHttpClientAsync.kt @@ -10,6 +10,7 @@ import io.imagekit.core.Sleeper import io.imagekit.core.Timeout import io.imagekit.core.http.Headers import io.imagekit.core.http.HttpClient +import io.imagekit.core.http.ProxyAuthenticator import io.imagekit.core.http.QueryParams import io.imagekit.core.jsonMapper import java.net.Proxy @@ -47,6 +48,7 @@ class ImageKitOkHttpClientAsync private constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() private var dispatcherExecutorService: ExecutorService? = null private var proxy: Proxy? = null + private var proxyAuthenticator: ProxyAuthenticator? = null private var maxIdleConnections: Int? = null private var keepAliveDuration: Duration? = null private var sslSocketFactory: SSLSocketFactory? = null @@ -77,6 +79,20 @@ class ImageKitOkHttpClientAsync private constructor() { /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */ fun proxy(proxy: Optional) = proxy(proxy.getOrNull()) + /** + * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication + * Required`. + */ + fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply { + this.proxyAuthenticator = proxyAuthenticator + } + + /** + * Alias for calling [Builder.proxyAuthenticator] with `proxyAuthenticator.orElse(null)`. + */ + fun proxyAuthenticator(proxyAuthenticator: Optional) = + proxyAuthenticator(proxyAuthenticator.getOrNull()) + /** * The maximum number of idle connections kept by the underlying OkHttp connection pool. * @@ -217,6 +233,9 @@ class ImageKitOkHttpClientAsync private constructor() { /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -388,6 +407,7 @@ class ImageKitOkHttpClientAsync private constructor() { OkHttpClient.builder() .timeout(clientOptions.timeout()) .proxy(proxy) + .proxyAuthenticator(proxyAuthenticator) .maxIdleConnections(maxIdleConnections) .keepAliveDuration(keepAliveDuration) .dispatcherExecutorService(dispatcherExecutorService) diff --git a/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/OkHttpClient.kt b/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/OkHttpClient.kt index 4a6fed28..fddde0f5 100644 --- a/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/OkHttpClient.kt +++ b/image-kit-java-client-okhttp/src/main/kotlin/io/imagekit/client/okhttp/OkHttpClient.kt @@ -8,9 +8,11 @@ import io.imagekit.core.http.HttpMethod import io.imagekit.core.http.HttpRequest import io.imagekit.core.http.HttpRequestBody import io.imagekit.core.http.HttpResponse +import io.imagekit.core.http.ProxyAuthenticator import io.imagekit.errors.ImageKitIoException import java.io.IOException import java.io.InputStream +import java.io.OutputStream import java.net.Proxy import java.time.Duration import java.util.concurrent.CancellationException @@ -20,10 +22,12 @@ import java.util.concurrent.TimeUnit import javax.net.ssl.HostnameVerifier import javax.net.ssl.SSLSocketFactory import javax.net.ssl.X509TrustManager +import kotlin.jvm.optionals.getOrNull import okhttp3.Call import okhttp3.Callback import okhttp3.ConnectionPool import okhttp3.Dispatcher +import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaType @@ -33,6 +37,8 @@ import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.Response import okhttp3.logging.HttpLoggingInterceptor import okio.BufferedSink +import okio.buffer +import okio.sink class OkHttpClient internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClient) : HttpClient { @@ -41,7 +47,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie val call = newCall(request, requestOptions) return try { - call.execute().toResponse() + call.execute().toHttpResponse() } catch (e: IOException) { throw ImageKitIoException("Request failed", e) } finally { @@ -59,7 +65,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie call.enqueue( object : Callback { override fun onResponse(call: Call, response: Response) { - future.complete(response.toResponse()) + future.complete(response.toHttpResponse()) } override fun onFailure(call: Call, e: IOException) { @@ -111,89 +117,6 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie return client.newCall(request.toRequest(client)) } - private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient): Request { - var body: RequestBody? = body?.toRequestBody() - if (body == null && requiresBody(method)) { - body = "".toRequestBody() - } - - val builder = Request.Builder().url(toUrl()).method(method.name, body) - headers.names().forEach { name -> - headers.values(name).forEach { builder.addHeader(name, it) } - } - - if ( - !headers.names().contains("X-Stainless-Read-Timeout") && client.readTimeoutMillis != 0 - ) { - builder.addHeader( - "X-Stainless-Read-Timeout", - Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(), - ) - } - if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) { - builder.addHeader( - "X-Stainless-Timeout", - Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(), - ) - } - - return builder.build() - } - - /** `OkHttpClient` always requires a request body for some methods. */ - private fun requiresBody(method: HttpMethod): Boolean = - when (method) { - HttpMethod.POST, - HttpMethod.PUT, - HttpMethod.PATCH -> true - else -> false - } - - private fun HttpRequest.toUrl(): String { - val builder = baseUrl.toHttpUrl().newBuilder() - pathSegments.forEach(builder::addPathSegment) - queryParams.keys().forEach { key -> - queryParams.values(key).forEach { builder.addQueryParameter(key, it) } - } - - return builder.toString() - } - - private fun HttpRequestBody.toRequestBody(): RequestBody { - val mediaType = contentType()?.toMediaType() - val length = contentLength() - - return object : RequestBody() { - override fun contentType(): MediaType? = mediaType - - override fun contentLength(): Long = length - - override fun isOneShot(): Boolean = !repeatable() - - override fun writeTo(sink: BufferedSink) = writeTo(sink.outputStream()) - } - } - - private fun Response.toResponse(): HttpResponse { - val headers = headers.toHeaders() - - return object : HttpResponse { - override fun statusCode(): Int = code - - override fun headers(): Headers = headers - - override fun body(): InputStream = body!!.byteStream() - - override fun close() = body!!.close() - } - } - - private fun okhttp3.Headers.toHeaders(): Headers { - val headersBuilder = Headers.builder() - forEach { (name, value) -> headersBuilder.put(name, value) } - return headersBuilder.build() - } - companion object { @JvmStatic fun builder() = Builder() } @@ -202,6 +125,7 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null + private var proxyAuthenticator: ProxyAuthenticator? = null private var maxIdleConnections: Int? = null private var keepAliveDuration: Duration? = null private var dispatcherExecutorService: ExecutorService? = null @@ -215,6 +139,10 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } + fun proxyAuthenticator(proxyAuthenticator: ProxyAuthenticator?) = apply { + this.proxyAuthenticator = proxyAuthenticator + } + /** * Sets the maximum number of idle connections kept by the underlying [ConnectionPool]. * @@ -264,6 +192,19 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie .callTimeout(timeout.request()) .proxy(proxy) .apply { + proxyAuthenticator?.let { auth -> + proxyAuthenticator { route, response -> + auth + .authenticate( + route?.proxy ?: Proxy.NO_PROXY, + response.request.toHttpRequest(), + response.toHttpResponse(), + ) + .getOrNull() + ?.toRequest(client = null) + } + } + dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) } val maxIdleConnections = maxIdleConnections @@ -303,3 +244,126 @@ internal constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClie ) } } + +private fun HttpRequest.toRequest(client: okhttp3.OkHttpClient?): Request { + var body: RequestBody? = body?.toRequestBody() + if (body == null && requiresBody(method)) { + body = "".toRequestBody() + } + + val builder = Request.Builder().url(toUrl()).method(method.name, body) + headers.names().forEach { name -> headers.values(name).forEach { builder.addHeader(name, it) } } + + if (client != null) { + if ( + !headers.names().contains("X-Stainless-Read-Timeout") && client.readTimeoutMillis != 0 + ) { + builder.addHeader( + "X-Stainless-Read-Timeout", + Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(), + ) + } + if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) { + builder.addHeader( + "X-Stainless-Timeout", + Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(), + ) + } + } + + return builder.build() +} + +/** `OkHttpClient` always requires a request body for some methods. */ +private fun requiresBody(method: HttpMethod): Boolean = + when (method) { + HttpMethod.POST, + HttpMethod.PUT, + HttpMethod.PATCH -> true + else -> false + } + +private fun HttpRequest.toUrl(): String { + val builder = baseUrl.toHttpUrl().newBuilder() + pathSegments.forEach(builder::addPathSegment) + queryParams.keys().forEach { key -> + queryParams.values(key).forEach { builder.addQueryParameter(key, it) } + } + + return builder.toString() +} + +private fun HttpRequestBody.toRequestBody(): RequestBody { + val mediaType = contentType()?.toMediaType() + val length = contentLength() + + return object : RequestBody() { + override fun contentType(): MediaType? = mediaType + + override fun contentLength(): Long = length + + override fun isOneShot(): Boolean = !repeatable() + + override fun writeTo(sink: BufferedSink) = writeTo(sink.outputStream()) + } +} + +private fun Request.toHttpRequest(): HttpRequest { + val builder = HttpRequest.builder().method(HttpMethod.valueOf(method)).baseUrl(url.toBaseUrl()) + url.pathSegments.forEach(builder::addPathSegment) + url.queryParameterNames.forEach { name -> + url.queryParameterValues(name).filterNotNull().forEach { builder.putQueryParam(name, it) } + } + headers.forEach { (name, value) -> builder.putHeader(name, value) } + body?.let { builder.body(it.toHttpRequestBody()) } + return builder.build() +} + +private fun HttpUrl.toBaseUrl(): String = buildString { + append(scheme).append("://").append(host) + if (port != HttpUrl.defaultPort(scheme)) { + append(":").append(port) + } +} + +private fun RequestBody.toHttpRequestBody(): HttpRequestBody { + val mediaType = contentType()?.toString() + val length = contentLength() + val isOneShot = isOneShot() + val source = this + return object : HttpRequestBody { + override fun contentType(): String? = mediaType + + override fun contentLength(): Long = length + + override fun repeatable(): Boolean = !isOneShot + + override fun writeTo(outputStream: OutputStream) { + val sink = outputStream.sink().buffer() + source.writeTo(sink) + sink.flush() + } + + override fun close() {} + } +} + +private fun Response.toHttpResponse(): HttpResponse { + val headers = headers.toHeaders() + + return object : HttpResponse { + override fun statusCode(): Int = code + + override fun headers(): Headers = headers + + override fun body(): InputStream = body!!.byteStream() + + override fun close() = body!!.close() + } +} + +private fun okhttp3.Headers.toHeaders(): Headers { + val headersBuilder = Headers.builder() + forEach { (name, value) -> headersBuilder.put(name, value) } + return headersBuilder.build() +} diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/core/ClientOptions.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/core/ClientOptions.kt index 0cee88bc..588d0593 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/core/ClientOptions.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/core/ClientOptions.kt @@ -67,6 +67,9 @@ private constructor( /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for existing + * fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -257,6 +260,9 @@ private constructor( /** * Whether to call `validate` on every response before returning it. * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * * Defaults to false, which means the shape of the response will not be validated upfront. * Instead, validation will only occur for the parts of the response that are accessed. */ @@ -436,6 +442,14 @@ private constructor( (System.getProperty("imagekit.imagekitWebhookSecret") ?: System.getenv("IMAGEKIT_WEBHOOK_SECRET")) ?.let { webhookSecret(it) } + System.getenv("IMAGE_KIT_CUSTOM_HEADERS")?.let { customHeadersEnv -> + for (line in customHeadersEnv.split("\n")) { + val colon = line.indexOf(':') + if (colon >= 0) { + putHeader(line.substring(0, colon).trim(), line.substring(colon + 1).trim()) + } + } + } } /** diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/core/ObjectMappers.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/core/ObjectMappers.kt index 8c7bf11c..fab56ddf 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/core/ObjectMappers.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/core/ObjectMappers.kt @@ -29,7 +29,9 @@ import java.time.ZoneId import java.time.format.DateTimeFormatter import java.time.temporal.ChronoField -fun jsonMapper(): JsonMapper = +fun jsonMapper(): JsonMapper = JSON_MAPPER + +private val JSON_MAPPER: JsonMapper = JsonMapper.builder() .addModule(kotlinModule()) .addModule(Jdk8Module()) diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/core/RequestOptions.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/core/RequestOptions.kt index ec271554..65c183e9 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/core/RequestOptions.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/core/RequestOptions.kt @@ -33,6 +33,15 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t private var responseValidation: Boolean? = null private var timeout: Timeout? = null + /** + * Whether to call `validate` on the response before returning it. + * + * Setting this to `true` is _not_ forwards compatible with new types from the API for + * existing fields. + * + * Defaults to false, which means the shape of the response will not be validated upfront. + * Instead, validation will only occur for the parts of the response that are accessed. + */ fun responseValidation(responseValidation: Boolean) = apply { this.responseValidation = responseValidation } diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/core/http/ProxyAuthenticator.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/core/http/ProxyAuthenticator.kt new file mode 100644 index 00000000..32c1c5c5 --- /dev/null +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/core/http/ProxyAuthenticator.kt @@ -0,0 +1,59 @@ +package io.imagekit.core.http + +import java.net.Proxy +import java.nio.charset.Charset +import java.nio.charset.StandardCharsets +import java.util.Base64 +import java.util.Optional + +/** + * Provides credentials when an HTTP proxy responds with `407 Proxy Authentication Required`. + * + * Implementations inspect the 407 [response] (typically its `Proxy-Authenticate` header) and return + * the request to retry with a `Proxy-Authorization` header set, or [Optional.empty] to abandon + * authentication and surface the 407 to the caller. + * + * Implementations must be thread-safe; they may be invoked concurrently from multiple HTTP calls. + */ +fun interface ProxyAuthenticator { + + /** + * @param proxy the proxy that produced the challenge, or [Proxy.NO_PROXY] if the route is not + * yet established + * @param request the request that produced [response] + * @param response the 407 challenge response + * @return the retry request to send (typically [request] with a `Proxy-Authorization` header + * added), or [Optional.empty] to abandon authentication + */ + fun authenticate( + proxy: Proxy, + request: HttpRequest, + response: HttpResponse, + ): Optional + + companion object { + + /** + * A [ProxyAuthenticator] that uses RFC 7617 Basic authentication with the ISO-8859-1 + * charset. + */ + @JvmStatic + fun basic(username: String, password: String): ProxyAuthenticator = + basic(username, password, StandardCharsets.ISO_8859_1) + + /** + * A [ProxyAuthenticator] that uses RFC 7617 Basic authentication with the given [charset]. + */ + @JvmStatic + fun basic(username: String, password: String, charset: Charset): ProxyAuthenticator { + val token = + Base64.getEncoder().encodeToString("$username:$password".toByteArray(charset)) + val headerValue = "Basic $token" + return ProxyAuthenticator { _, request, _ -> + Optional.of( + request.toBuilder().putHeader("Proxy-Authorization", headerValue).build() + ) + } + } + } +} diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/BadRequestException.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/BadRequestException.kt index a2d14b65..b578dab8 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/BadRequestException.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/BadRequestException.kt @@ -5,12 +5,16 @@ package io.imagekit.errors import io.imagekit.core.JsonValue import io.imagekit.core.checkRequired import io.imagekit.core.http.Headers +import io.imagekit.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class BadRequestException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - ImageKitServiceException("400: $body", cause) { + ImageKitServiceException( + "400: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 400 diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/InternalServerException.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/InternalServerException.kt index a121ff83..bc02fae2 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/InternalServerException.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/InternalServerException.kt @@ -5,6 +5,7 @@ package io.imagekit.errors import io.imagekit.core.JsonValue import io.imagekit.core.checkRequired import io.imagekit.core.http.Headers +import io.imagekit.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -14,7 +15,11 @@ private constructor( private val headers: Headers, private val body: JsonValue, cause: Throwable?, -) : ImageKitServiceException("$statusCode: $body", cause) { +) : + ImageKitServiceException( + "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = statusCode diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/NotFoundException.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/NotFoundException.kt index 41721640..5fd12fa9 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/NotFoundException.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/NotFoundException.kt @@ -5,12 +5,16 @@ package io.imagekit.errors import io.imagekit.core.JsonValue import io.imagekit.core.checkRequired import io.imagekit.core.http.Headers +import io.imagekit.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class NotFoundException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - ImageKitServiceException("404: $body", cause) { + ImageKitServiceException( + "404: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 404 diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/PermissionDeniedException.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/PermissionDeniedException.kt index 6d1e3e35..39280b60 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/PermissionDeniedException.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/PermissionDeniedException.kt @@ -5,12 +5,16 @@ package io.imagekit.errors import io.imagekit.core.JsonValue import io.imagekit.core.checkRequired import io.imagekit.core.http.Headers +import io.imagekit.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class PermissionDeniedException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - ImageKitServiceException("403: $body", cause) { + ImageKitServiceException( + "403: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 403 diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/RateLimitException.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/RateLimitException.kt index 5f369cf4..febee946 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/RateLimitException.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/RateLimitException.kt @@ -5,12 +5,16 @@ package io.imagekit.errors import io.imagekit.core.JsonValue import io.imagekit.core.checkRequired import io.imagekit.core.http.Headers +import io.imagekit.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class RateLimitException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - ImageKitServiceException("429: $body", cause) { + ImageKitServiceException( + "429: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 429 diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnauthorizedException.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnauthorizedException.kt index 13bbfbc6..08b10b6d 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnauthorizedException.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnauthorizedException.kt @@ -5,12 +5,16 @@ package io.imagekit.errors import io.imagekit.core.JsonValue import io.imagekit.core.checkRequired import io.imagekit.core.http.Headers +import io.imagekit.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class UnauthorizedException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - ImageKitServiceException("401: $body", cause) { + ImageKitServiceException( + "401: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 401 diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnexpectedStatusCodeException.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnexpectedStatusCodeException.kt index 9bc1ddf3..1efd7ae6 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnexpectedStatusCodeException.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnexpectedStatusCodeException.kt @@ -5,6 +5,7 @@ package io.imagekit.errors import io.imagekit.core.JsonValue import io.imagekit.core.checkRequired import io.imagekit.core.http.Headers +import io.imagekit.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -14,7 +15,11 @@ private constructor( private val headers: Headers, private val body: JsonValue, cause: Throwable?, -) : ImageKitServiceException("$statusCode: $body", cause) { +) : + ImageKitServiceException( + "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = statusCode diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnprocessableEntityException.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnprocessableEntityException.kt index 61554585..ee979042 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnprocessableEntityException.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/errors/UnprocessableEntityException.kt @@ -5,12 +5,16 @@ package io.imagekit.errors import io.imagekit.core.JsonValue import io.imagekit.core.checkRequired import io.imagekit.core.http.Headers +import io.imagekit.core.jsonMapper import java.util.Optional import kotlin.jvm.optionals.getOrNull class UnprocessableEntityException private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) : - ImageKitServiceException("422: $body", cause) { + ImageKitServiceException( + "422: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 422 diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/AiTag.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/AiTag.kt index 7bbe153f..aea4c5fa 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/AiTag.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/AiTag.kt @@ -179,6 +179,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiTag = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/BaseOverlay.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/BaseOverlay.kt index 6204419e..851e9de2 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/BaseOverlay.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/BaseOverlay.kt @@ -223,6 +223,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BaseOverlay = apply { if (validated) { return@apply @@ -373,6 +381,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LayerMode = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/CustomMetadata.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/CustomMetadata.kt index 69181dc1..0198066b 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/CustomMetadata.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/CustomMetadata.kt @@ -69,6 +69,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CustomMetadata = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/EmbeddedMetadata.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/EmbeddedMetadata.kt index 9ff9cf92..9257c90e 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/EmbeddedMetadata.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/EmbeddedMetadata.kt @@ -71,6 +71,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EmbeddedMetadata = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionConfig.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionConfig.kt index 98a263ac..41001c11 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionConfig.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionConfig.kt @@ -71,6 +71,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = extensionConfig.accept(new ExtensionConfig.Visitor>() { + * @Override + * public Optional visitRemoveBg(RemoveBg removeBg) { + * return Optional.of(removeBg.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { removeBg != null -> visitor.visitRemoveBg(removeBg) @@ -82,6 +111,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExtensionConfig = apply { if (validated) { return@apply @@ -395,6 +432,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RemoveBg = apply { if (validated) { return@apply @@ -669,6 +715,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Options = apply { if (validated) { return@apply @@ -935,6 +991,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AutoTaggingExtension = apply { if (validated) { return@apply @@ -1056,6 +1121,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Name = apply { if (validated) { return@apply @@ -1310,6 +1385,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiTasks = apply { if (validated) { return@apply @@ -1373,6 +1457,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = task.accept(new Task.Visitor>() { + * @Override + * public Optional visitSelectTags(SelectTags selectTags) { + * return Optional.of(selectTags.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { selectTags != null -> visitor.visitSelectTags(selectTags) @@ -1383,6 +1497,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Task = apply { if (validated) { return@apply @@ -1843,6 +1967,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): SelectTags = apply { if (validated) { return@apply @@ -2271,6 +2405,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): SelectMetadata = apply { if (validated) { return@apply @@ -2342,6 +2486,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not + * known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = vocabulary.accept(new Vocabulary.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -2352,6 +2527,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Vocabulary = apply { if (validated) { return@apply @@ -2807,6 +2992,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): YesNo = apply { if (validated) { return@apply @@ -3134,6 +3329,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): OnNo = apply { if (validated) { return@apply @@ -3355,6 +3560,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): SetMetadata = apply { if (validated) { return@apply @@ -3426,6 +3641,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants + * from the API, unless [visitor] overrides [Visitor.unknown]. To handle + * variants not known to this version of the SDK gracefully, consider + * overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = value.accept(new Value.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -3437,6 +3683,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Value = apply { if (validated) { return@apply @@ -3642,6 +3898,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = metadataValueItem.accept(new MetadataValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -3652,6 +3939,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): MetadataValueItem = apply { if (validated) { return@apply @@ -3994,6 +4291,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): UnsetMetadata = apply { if (validated) { return@apply @@ -4359,6 +4666,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): OnUnknown = apply { if (validated) { return@apply @@ -4580,6 +4897,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): SetMetadata = apply { if (validated) { return@apply @@ -4651,6 +4978,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants + * from the API, unless [visitor] overrides [Visitor.unknown]. To handle + * variants not known to this version of the SDK gracefully, consider + * overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = value.accept(new Value.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -4662,6 +5020,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Value = apply { if (validated) { return@apply @@ -4867,6 +5235,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = metadataValueItem.accept(new MetadataValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -4877,6 +5276,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): MetadataValueItem = apply { if (validated) { return@apply @@ -5219,6 +5628,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): UnsetMetadata = apply { if (validated) { return@apply @@ -5582,6 +6001,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): OnYes = apply { if (validated) { return@apply @@ -5803,6 +6232,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): SetMetadata = apply { if (validated) { return@apply @@ -5874,6 +6313,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants + * from the API, unless [visitor] overrides [Visitor.unknown]. To handle + * variants not known to this version of the SDK gracefully, consider + * overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = value.accept(new Value.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -5885,6 +6355,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Value = apply { if (validated) { return@apply @@ -6090,6 +6570,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = metadataValueItem.accept(new MetadataValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -6100,6 +6611,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): MetadataValueItem = apply { if (validated) { return@apply @@ -6442,6 +6963,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): UnsetMetadata = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionItem.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionItem.kt index 263cb754..aa138b3a 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionItem.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/ExtensionItem.kt @@ -77,6 +77,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = extensionItem.accept(new ExtensionItem.Visitor>() { + * @Override + * public Optional visitRemoveBg(RemoveBg removeBg) { + * return Optional.of(removeBg.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { removeBg != null -> visitor.visitRemoveBg(removeBg) @@ -89,6 +118,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExtensionItem = apply { if (validated) { return@apply @@ -421,6 +458,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RemoveBg = apply { if (validated) { return@apply @@ -695,6 +741,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Options = apply { if (validated) { return@apply @@ -961,6 +1017,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AutoTaggingExtension = apply { if (validated) { return@apply @@ -1082,6 +1147,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Name = apply { if (validated) { return@apply @@ -1336,6 +1411,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiTasks = apply { if (validated) { return@apply @@ -1399,6 +1483,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = task.accept(new Task.Visitor>() { + * @Override + * public Optional visitSelectTags(SelectTags selectTags) { + * return Optional.of(selectTags.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { selectTags != null -> visitor.visitSelectTags(selectTags) @@ -1409,6 +1523,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Task = apply { if (validated) { return@apply @@ -1869,6 +1993,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): SelectTags = apply { if (validated) { return@apply @@ -2297,6 +2431,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): SelectMetadata = apply { if (validated) { return@apply @@ -2368,6 +2512,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not + * known to this version of the SDK gracefully, consider overriding + * [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = vocabulary.accept(new Vocabulary.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden + * in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -2378,6 +2553,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Vocabulary = apply { if (validated) { return@apply @@ -2833,6 +3018,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): YesNo = apply { if (validated) { return@apply @@ -3160,6 +3355,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): OnNo = apply { if (validated) { return@apply @@ -3381,6 +3586,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): SetMetadata = apply { if (validated) { return@apply @@ -3452,6 +3667,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants + * from the API, unless [visitor] overrides [Visitor.unknown]. To handle + * variants not known to this version of the SDK gracefully, consider + * overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = value.accept(new Value.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -3463,6 +3709,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Value = apply { if (validated) { return@apply @@ -3668,6 +3924,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = metadataValueItem.accept(new MetadataValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -3678,6 +3965,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): MetadataValueItem = apply { if (validated) { return@apply @@ -4020,6 +4317,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): UnsetMetadata = apply { if (validated) { return@apply @@ -4385,6 +4692,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): OnUnknown = apply { if (validated) { return@apply @@ -4606,6 +4923,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): SetMetadata = apply { if (validated) { return@apply @@ -4677,6 +5004,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants + * from the API, unless [visitor] overrides [Visitor.unknown]. To handle + * variants not known to this version of the SDK gracefully, consider + * overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = value.accept(new Value.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -4688,6 +5046,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Value = apply { if (validated) { return@apply @@ -4893,6 +5261,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = metadataValueItem.accept(new MetadataValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -4903,6 +5302,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): MetadataValueItem = apply { if (validated) { return@apply @@ -5245,6 +5654,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): UnsetMetadata = apply { if (validated) { return@apply @@ -5608,6 +6027,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): OnYes = apply { if (validated) { return@apply @@ -5829,6 +6258,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): SetMetadata = apply { if (validated) { return@apply @@ -5900,6 +6339,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the + * given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants + * from the API, unless [visitor] overrides [Visitor.unknown]. To handle + * variants not known to this version of the SDK gracefully, consider + * overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = value.accept(new Value.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -5911,6 +6381,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API + * for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): Value = apply { if (validated) { return@apply @@ -6116,6 +6596,37 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using + * the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new + * variants from the API, unless [visitor] overrides + * [Visitor.unknown]. To handle variants not known to this version + * of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = metadataValueItem.accept(new MetadataValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not + * overridden in [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -6126,6 +6637,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the + * API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this + * object doesn't match its expected type. + */ fun validate(): MetadataValueItem = apply { if (validated) { return@apply @@ -6468,6 +6989,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their + * expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object + * doesn't match its expected type. + */ fun validate(): UnsetMetadata = apply { if (validated) { return@apply @@ -6731,6 +7262,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SavedExtension = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/GetImageAttributesOptions.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/GetImageAttributesOptions.kt index 713b8faa..790c058f 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/GetImageAttributesOptions.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/GetImageAttributesOptions.kt @@ -671,6 +671,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): GetImageAttributesOptions = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/ImageOverlay.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/ImageOverlay.kt index e0c858a3..a06b2211 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/ImageOverlay.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/ImageOverlay.kt @@ -423,6 +423,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ImageOverlay = apply { if (validated) { return@apply @@ -570,6 +578,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Encoding = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/Overlay.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/Overlay.kt index 4032d5e3..9b06a410 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/Overlay.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/Overlay.kt @@ -67,6 +67,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = overlay.accept(new Overlay.Visitor>() { + * @Override + * public Optional visitText(TextOverlay text) { + * return Optional.of(text.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { text != null -> visitor.visitText(text) @@ -79,6 +108,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Overlay = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/OverlayPosition.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/OverlayPosition.kt index 56e22284..9c76769d 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/OverlayPosition.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/OverlayPosition.kt @@ -361,6 +361,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OverlayPosition = apply { if (validated) { return@apply @@ -536,6 +544,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AnchorPoint = apply { if (validated) { return@apply @@ -710,6 +727,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Focus = apply { if (validated) { return@apply @@ -777,6 +803,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = x.accept(new X.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -786,6 +841,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): X = apply { if (validated) { return@apply @@ -949,6 +1013,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = xCenter.accept(new XCenter.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -958,6 +1051,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): XCenter = apply { if (validated) { return@apply @@ -1124,6 +1226,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = y.accept(new Y.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -1133,6 +1264,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Y = apply { if (validated) { return@apply @@ -1296,6 +1436,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = yCenter.accept(new YCenter.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -1305,6 +1474,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): YCenter = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/OverlayTiming.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/OverlayTiming.kt index 9ba19767..3b34d1d6 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/OverlayTiming.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/OverlayTiming.kt @@ -230,6 +230,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OverlayTiming = apply { if (validated) { return@apply @@ -289,6 +297,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = duration.accept(new Duration.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -298,6 +335,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Duration = apply { if (validated) { return@apply @@ -465,6 +511,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = end.accept(new End.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -474,6 +549,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): End = apply { if (validated) { return@apply @@ -637,6 +721,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = start.accept(new Start.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -646,6 +759,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Start = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/ResponsiveImageAttributes.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/ResponsiveImageAttributes.kt index f9420a46..90ae4917 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/ResponsiveImageAttributes.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/ResponsiveImageAttributes.kt @@ -234,6 +234,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponsiveImageAttributes = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SavedExtension.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SavedExtension.kt index 5e81cbca..f460e5dc 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SavedExtension.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SavedExtension.kt @@ -321,6 +321,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SavedExtension = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SelectedFieldsSchema.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SelectedFieldsSchema.kt index 7baa61a9..cd10e154 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SelectedFieldsSchema.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SelectedFieldsSchema.kt @@ -76,6 +76,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SelectedFieldsSchema = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SolidColorOverlay.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SolidColorOverlay.kt index 882268a7..6a498276 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SolidColorOverlay.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SolidColorOverlay.kt @@ -382,6 +382,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SolidColorOverlay = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SolidColorOverlayTransformation.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SolidColorOverlayTransformation.kt index 38657c66..d97593a0 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SolidColorOverlayTransformation.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SolidColorOverlayTransformation.kt @@ -357,6 +357,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SolidColorOverlayTransformation = apply { if (validated) { return@apply @@ -421,6 +429,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = gradient.accept(new Gradient.Visitor>() { + * @Override + * public Optional visitTrue(JsonValue true_) { + * return Optional.of(true_.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { true_ != null -> visitor.visitTrue(true_) @@ -430,6 +467,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Gradient = apply { if (validated) { return@apply @@ -604,6 +650,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = height.accept(new Height.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -613,6 +688,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Height = apply { if (validated) { return@apply @@ -786,6 +870,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = radius.accept(new Radius.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -796,6 +909,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Radius = apply { if (validated) { return@apply @@ -982,6 +1104,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = width.accept(new Width.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -991,6 +1142,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Width = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SrcOptions.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SrcOptions.kt index 08135372..afe64575 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SrcOptions.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SrcOptions.kt @@ -441,6 +441,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SrcOptions = apply { if (validated) { return@apply @@ -542,6 +550,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): QueryParameters = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/StreamingResolution.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/StreamingResolution.kt index e179c5fe..ca27cd57 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/StreamingResolution.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/StreamingResolution.kt @@ -130,6 +130,14 @@ class StreamingResolution @JsonCreator private constructor(private val value: Js private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StreamingResolution = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SubtitleOverlay.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SubtitleOverlay.kt index d6248053..cc1fb9f5 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SubtitleOverlay.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SubtitleOverlay.kt @@ -417,6 +417,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SubtitleOverlay = apply { if (validated) { return@apply @@ -564,6 +572,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Encoding = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SubtitleOverlayTransformation.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SubtitleOverlayTransformation.kt index b3969f17..fce2b9d9 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/SubtitleOverlayTransformation.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/SubtitleOverlayTransformation.kt @@ -414,6 +414,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SubtitleOverlayTransformation = apply { if (validated) { return@apply @@ -556,6 +564,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Typography = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/TextOverlay.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/TextOverlay.kt index 9fcccac3..34bad4f7 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/TextOverlay.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/TextOverlay.kt @@ -419,6 +419,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextOverlay = apply { if (validated) { return@apply @@ -565,6 +573,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Encoding = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/TextOverlayTransformation.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/TextOverlayTransformation.kt index a1c3479a..9b8f019a 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/TextOverlayTransformation.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/TextOverlayTransformation.kt @@ -652,6 +652,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TextOverlayTransformation = apply { if (validated) { return@apply @@ -807,6 +815,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Flip = apply { if (validated) { return@apply @@ -872,6 +889,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = fontSize.accept(new FontSize.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -881,6 +927,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FontSize = apply { if (validated) { return@apply @@ -1118,6 +1173,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InnerAlignment = apply { if (validated) { return@apply @@ -1183,6 +1247,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = lineHeight.accept(new LineHeight.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -1192,6 +1285,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LineHeight = apply { if (validated) { return@apply @@ -1357,6 +1459,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = padding.accept(new Padding.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -1366,6 +1497,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Padding = apply { if (validated) { return@apply @@ -1541,6 +1681,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = radius.accept(new Radius.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -1551,6 +1720,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Radius = apply { if (validated) { return@apply @@ -1736,6 +1914,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = rotation.accept(new Rotation.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -1745,6 +1952,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Rotation = apply { if (validated) { return@apply @@ -1911,6 +2127,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = width.accept(new Width.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -1920,6 +2165,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Width = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/Transformation.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/Transformation.kt index d726a08e..710c77ad 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/Transformation.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/Transformation.kt @@ -2557,6 +2557,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -2719,6 +2727,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = aiDropShadow.accept(new AiDropShadow.Visitor>() { + * @Override + * public Optional visitTrue(JsonValue true_) { + * return Optional.of(true_.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { true_ != null -> visitor.visitTrue(true_) @@ -2728,6 +2765,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiDropShadow = apply { if (validated) { return@apply @@ -2964,6 +3010,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiRemoveBackground = apply { if (validated) { return@apply @@ -3095,6 +3150,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiRemoveBackgroundExternal = apply { if (validated) { return@apply @@ -3219,6 +3283,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiRetouch = apply { if (validated) { return@apply @@ -3343,6 +3416,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiUpscale = apply { if (validated) { return@apply @@ -3470,6 +3552,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AiVariation = apply { if (validated) { return@apply @@ -3537,6 +3628,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = aspectRatio.accept(new AspectRatio.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -3546,6 +3666,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AspectRatio = apply { if (validated) { return@apply @@ -3785,6 +3914,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AudioCodec = apply { if (validated) { return@apply @@ -3911,6 +4049,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ContrastStretch = apply { if (validated) { return@apply @@ -4060,6 +4207,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Crop = apply { if (validated) { return@apply @@ -4197,6 +4353,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CropMode = apply { if (validated) { return@apply @@ -4263,6 +4428,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = duration.accept(new Duration.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -4272,6 +4466,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Duration = apply { if (validated) { return@apply @@ -4437,6 +4640,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = endOffset.accept(new EndOffset.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -4446,6 +4678,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): EndOffset = apply { if (validated) { return@apply @@ -4689,6 +4930,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Flip = apply { if (validated) { return@apply @@ -4878,6 +5128,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Format = apply { if (validated) { return@apply @@ -4944,6 +5203,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = gradient.accept(new Gradient.Visitor>() { + * @Override + * public Optional visitTrue(JsonValue true_) { + * return Optional.of(true_.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { true_ != null -> visitor.visitTrue(true_) @@ -4953,6 +5241,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Gradient = apply { if (validated) { return@apply @@ -5185,6 +5482,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Grayscale = apply { if (validated) { return@apply @@ -5253,6 +5559,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = height.accept(new Height.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -5262,6 +5597,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Height = apply { if (validated) { return@apply @@ -5426,6 +5770,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = page.accept(new Page.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -5435,6 +5808,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Page = apply { if (validated) { return@apply @@ -5607,6 +5989,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = radius.accept(new Radius.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -5617,6 +6028,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Radius = apply { if (validated) { return@apply @@ -5805,6 +6225,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = rotation.accept(new Rotation.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -5814,6 +6263,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Rotation = apply { if (validated) { return@apply @@ -5980,6 +6438,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = shadow.accept(new Shadow.Visitor>() { + * @Override + * public Optional visitTrue(JsonValue true_) { + * return Optional.of(true_.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { true_ != null -> visitor.visitTrue(true_) @@ -5989,6 +6476,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Shadow = apply { if (validated) { return@apply @@ -6161,6 +6657,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = sharpen.accept(new Sharpen.Visitor>() { + * @Override + * public Optional visitTrue(JsonValue true_) { + * return Optional.of(true_.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { true_ != null -> visitor.visitTrue(true_) @@ -6170,6 +6695,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Sharpen = apply { if (validated) { return@apply @@ -6344,6 +6878,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = startOffset.accept(new StartOffset.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -6353,6 +6916,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StartOffset = apply { if (validated) { return@apply @@ -6519,6 +7091,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = trim.accept(new Trim.Visitor>() { + * @Override + * public Optional visitTrue(JsonValue true_) { + * return Optional.of(true_.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { true_ != null -> visitor.visitTrue(true_) @@ -6528,6 +7129,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Trim = apply { if (validated) { return@apply @@ -6699,6 +7309,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = unsharpMask.accept(new UnsharpMask.Visitor>() { + * @Override + * public Optional visitTrue(JsonValue true_) { + * return Optional.of(true_.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { true_ != null -> visitor.visitTrue(true_) @@ -6708,6 +7347,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UnsharpMask = apply { if (validated) { return@apply @@ -6962,6 +7610,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoCodec = apply { if (validated) { return@apply @@ -7030,6 +7687,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = width.accept(new Width.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -7039,6 +7725,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Width = apply { if (validated) { return@apply @@ -7201,6 +7896,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = x.accept(new X.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -7210,6 +7934,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): X = apply { if (validated) { return@apply @@ -7371,6 +8104,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = xCenter.accept(new XCenter.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -7380,6 +8142,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): XCenter = apply { if (validated) { return@apply @@ -7544,6 +8315,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = y.accept(new Y.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -7553,6 +8353,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Y = apply { if (validated) { return@apply @@ -7714,6 +8523,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = yCenter.accept(new YCenter.Visitor>() { + * @Override + * public Optional visitNumber(Double number) { + * return Optional.of(number.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { number != null -> visitor.visitNumber(number) @@ -7723,6 +8561,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): YCenter = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/TransformationPosition.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/TransformationPosition.kt index 09e81abc..83704298 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/TransformationPosition.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/TransformationPosition.kt @@ -102,6 +102,14 @@ private constructor(private val value: JsonField) : Enum { private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TransformationPosition = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/VersionInfo.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/VersionInfo.kt index b2207a64..8eb83e70 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/VersionInfo.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/VersionInfo.kt @@ -143,6 +143,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VersionInfo = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/VideoOverlay.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/VideoOverlay.kt index db0a28b5..1184c502 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/VideoOverlay.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/VideoOverlay.kt @@ -419,6 +419,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoOverlay = apply { if (validated) { return@apply @@ -566,6 +574,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Encoding = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/origins/OriginRequest.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/origins/OriginRequest.kt index 3d43ec9b..a5ea2714 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/origins/OriginRequest.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/origins/OriginRequest.kt @@ -93,6 +93,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = originRequest.accept(new OriginRequest.Visitor>() { + * @Override + * public Optional visitS3(S3 s3) { + * return Optional.of(s3.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { s3 != null -> visitor.visitS3(s3) @@ -108,6 +137,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OriginRequest = apply { if (validated) { return@apply @@ -739,6 +776,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): S3 = apply { if (validated) { return@apply @@ -1275,6 +1321,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): S3Compatible = apply { if (validated) { return@apply @@ -1741,6 +1796,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CloudinaryBackup = apply { if (validated) { return@apply @@ -2134,6 +2198,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WebFolder = apply { if (validated) { return@apply @@ -2436,6 +2509,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WebProxy = apply { if (validated) { return@apply @@ -2872,6 +2954,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Gcs = apply { if (validated) { return@apply @@ -3324,6 +3415,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AzureBlob = apply { if (validated) { return@apply @@ -3828,6 +3928,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AkeneoPim = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/origins/OriginResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/origins/OriginResponse.kt index 4a70feb2..f6968751 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/origins/OriginResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/origins/OriginResponse.kt @@ -93,6 +93,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = originResponse.accept(new OriginResponse.Visitor>() { + * @Override + * public Optional visitS3(S3 s3) { + * return Optional.of(s3.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { s3 != null -> visitor.visitS3(s3) @@ -108,6 +137,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): OriginResponse = apply { if (validated) { return@apply @@ -709,6 +746,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): S3 = apply { if (validated) { return@apply @@ -1212,6 +1258,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): S3Compatible = apply { if (validated) { return@apply @@ -1643,6 +1698,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CloudinaryBackup = apply { if (validated) { return@apply @@ -2075,6 +2139,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WebFolder = apply { if (validated) { return@apply @@ -2421,6 +2494,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WebProxy = apply { if (validated) { return@apply @@ -2868,6 +2950,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Gcs = apply { if (validated) { return@apply @@ -3329,6 +3420,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AzureBlob = apply { if (validated) { return@apply @@ -3721,6 +3821,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AkeneoPim = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/urlendpoints/UrlEndpointRequest.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/urlendpoints/UrlEndpointRequest.kt index e9d2c244..6dd926dd 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/urlendpoints/UrlEndpointRequest.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/urlendpoints/UrlEndpointRequest.kt @@ -286,6 +286,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UrlEndpointRequest = apply { if (validated) { return@apply @@ -349,6 +357,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = urlRewriter.accept(new UrlRewriter.Visitor>() { + * @Override + * public Optional visitCloudinary(Cloudinary cloudinary) { + * return Optional.of(cloudinary.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { cloudinary != null -> visitor.visitCloudinary(cloudinary) @@ -359,6 +396,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UrlRewriter = apply { if (validated) { return@apply @@ -674,6 +720,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Cloudinary = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/urlendpoints/UrlEndpointResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/urlendpoints/UrlEndpointResponse.kt index b0cf304a..0750882e 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/urlendpoints/UrlEndpointResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/urlendpoints/UrlEndpointResponse.kt @@ -342,6 +342,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UrlEndpointResponse = apply { if (validated) { return@apply @@ -407,6 +415,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of + * the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = urlRewriter.accept(new UrlRewriter.Visitor>() { + * @Override + * public Optional visitCloudinary(Cloudinary cloudinary) { + * return Optional.of(cloudinary.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] + * and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { cloudinary != null -> visitor.visitCloudinary(cloudinary) @@ -417,6 +454,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UrlRewriter = apply { if (validated) { return@apply @@ -747,6 +793,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Cloudinary = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usage/UsageGetResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usage/UsageGetResponse.kt index 46b510fc..68d5d64d 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usage/UsageGetResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usage/UsageGetResponse.kt @@ -294,6 +294,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UsageGetResponse = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/assets/AssetListParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/assets/AssetListParams.kt index d8def1cd..aa2572ca 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/assets/AssetListParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/assets/AssetListParams.kt @@ -446,6 +446,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileType = apply { if (validated) { return@apply @@ -646,6 +655,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Sort = apply { if (validated) { return@apply @@ -792,6 +810,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/assets/AssetListResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/assets/AssetListResponse.kt index e98dbaeb..a6a42ace 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/assets/AssetListResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/assets/AssetListResponse.kt @@ -46,6 +46,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = assetListResponse.accept(new AssetListResponse.Visitor>() { + * @Override + * public Optional visitFile(File file) { + * return Optional.of(file.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { file != null -> visitor.visitFile(file) @@ -55,6 +84,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AssetListResponse = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/beta/v2/files/FileUploadParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/beta/v2/files/FileUploadParams.kt index 17466d52..e7746506 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/beta/v2/files/FileUploadParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/beta/v2/files/FileUploadParams.kt @@ -2194,6 +2194,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -2352,6 +2361,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CustomMetadata = apply { if (validated) { return@apply @@ -2512,6 +2530,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseField = apply { if (validated) { return@apply @@ -2732,6 +2759,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UploadTransformation = apply { if (validated) { return@apply @@ -2786,6 +2822,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = post.accept(new Post.Visitor>() { + * @Override + * public Optional visitTransformation(Transformation transformation) { + * return Optional.of(transformation.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { transformation != null -> visitor.visitTransformation(transformation) @@ -2797,6 +2863,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Post = apply { if (validated) { return@apply @@ -3065,6 +3141,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -3238,6 +3324,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): GifToVideo = apply { if (validated) { return@apply @@ -3408,6 +3504,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Thumbnail = apply { if (validated) { return@apply @@ -3639,6 +3745,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Abs = apply { if (validated) { return@apply @@ -3759,6 +3875,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Protocol = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/beta/v2/files/FileUploadResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/beta/v2/files/FileUploadResponse.kt index 8ebdc361..9a6a0d35 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/beta/v2/files/FileUploadResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/beta/v2/files/FileUploadResponse.kt @@ -1095,6 +1095,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileUploadResponse = apply { if (validated) { return@apply @@ -1432,6 +1440,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExtensionStatus = apply { if (validated) { return@apply @@ -1568,6 +1585,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AiAutoDescription = apply { if (validated) { return@apply @@ -1704,6 +1731,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AiTasks = apply { if (validated) { return@apply @@ -1842,6 +1879,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AwsAutoTagging = apply { if (validated) { return@apply @@ -1981,6 +2028,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): GoogleAutoTagging = apply { if (validated) { return@apply @@ -2117,6 +2174,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RemoveBg = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationCreateParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationCreateParams.kt index b8575a6c..b4d396eb 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationCreateParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationCreateParams.kt @@ -356,6 +356,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationCreateResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationCreateResponse.kt index 17f3b15d..4142d620 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationCreateResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationCreateResponse.kt @@ -120,6 +120,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InvalidationCreateResponse = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationGetResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationGetResponse.kt index 490d3041..6a3e4e52 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationGetResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/cache/invalidation/InvalidationGetResponse.kt @@ -115,6 +115,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): InvalidationGetResponse = apply { if (validated) { return@apply @@ -229,6 +237,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataField.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataField.kt index b8b6f6fc..cbda2b69 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataField.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataField.kt @@ -254,6 +254,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CustomMetadataField = apply { if (validated) { return@apply @@ -731,6 +739,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply @@ -892,6 +909,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -979,6 +1006,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = defaultValue.accept(new DefaultValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -990,6 +1047,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): DefaultValue = apply { if (validated) { return@apply @@ -1199,6 +1266,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = defaultValueItem.accept(new DefaultValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1209,6 +1306,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): DefaultValueItem = apply { if (validated) { return@apply @@ -1395,6 +1502,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = maxValue.accept(new MaxValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1404,6 +1541,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): MaxValue = apply { if (validated) { return@apply @@ -1570,6 +1717,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = minValue.accept(new MinValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1579,6 +1756,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): MinValue = apply { if (validated) { return@apply @@ -1747,6 +1934,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = selectOption.accept(new SelectOption.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1757,6 +1974,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): SelectOption = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldCreateParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldCreateParams.kt index ddd024f6..aa69f84a 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldCreateParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldCreateParams.kt @@ -521,6 +521,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply @@ -1038,6 +1047,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Schema = apply { if (validated) { return@apply @@ -1199,6 +1217,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1287,6 +1315,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = defaultValue.accept(new DefaultValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1298,6 +1356,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): DefaultValue = apply { if (validated) { return@apply @@ -1507,6 +1575,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = defaultValueItem.accept(new DefaultValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1517,6 +1615,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): DefaultValueItem = apply { if (validated) { return@apply @@ -1703,6 +1811,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = maxValue.accept(new MaxValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1712,6 +1850,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): MaxValue = apply { if (validated) { return@apply @@ -1878,6 +2026,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = minValue.accept(new MinValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1887,6 +2065,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): MinValue = apply { if (validated) { return@apply @@ -2055,6 +2243,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = selectOption.accept(new SelectOption.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -2065,6 +2283,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): SelectOption = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldDeleteResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldDeleteResponse.kt index dd6cdfdb..75244e5f 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldDeleteResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/custommetadatafields/CustomMetadataFieldDeleteResponse.kt @@ -80,6 +80,14 @@ private constructor(private val additionalProperties: MutableMap = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = defaultValue.accept(new DefaultValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1020,6 +1068,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): DefaultValue = apply { if (validated) { return@apply @@ -1229,6 +1287,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the + * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known + * to this version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = defaultValueItem.accept(new DefaultValueItem.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1239,6 +1327,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): DefaultValueItem = apply { if (validated) { return@apply @@ -1425,6 +1523,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = maxValue.accept(new MaxValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1434,6 +1562,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): MaxValue = apply { if (validated) { return@apply @@ -1600,6 +1738,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = minValue.accept(new MinValue.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1609,6 +1777,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): MinValue = apply { if (validated) { return@apply @@ -1777,6 +1955,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = selectOption.accept(new SelectOption.Visitor>() { + * @Override + * public Optional visitString(String string) { + * return Optional.of(string.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { string != null -> visitor.visitString(string) @@ -1787,6 +1995,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): SelectOption = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/File.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/File.kt index eec3f1a3..78ac2a34 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/File.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/File.kt @@ -1146,6 +1146,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): File = apply { if (validated) { return@apply @@ -1316,6 +1324,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileCopyParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileCopyParams.kt index 13b49c09..4adc5ca6 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileCopyParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileCopyParams.kt @@ -532,6 +532,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileCopyResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileCopyResponse.kt index 5b34a5c3..cfdf1545 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileCopyResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileCopyResponse.kt @@ -74,6 +74,14 @@ private constructor(private val additionalProperties: MutableMap = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = post.accept(new Post.Visitor>() { + * @Override + * public Optional visitTransformation(Transformation transformation) { + * return Optional.of(transformation.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { transformation != null -> visitor.visitTransformation(transformation) @@ -3063,6 +3129,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Post = apply { if (validated) { return@apply @@ -3331,6 +3407,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -3504,6 +3590,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): GifToVideo = apply { if (validated) { return@apply @@ -3674,6 +3770,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Thumbnail = apply { if (validated) { return@apply @@ -3905,6 +4011,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Abs = apply { if (validated) { return@apply @@ -4025,6 +4141,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Protocol = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileUploadResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileUploadResponse.kt index d366a454..5f16e01c 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileUploadResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/FileUploadResponse.kt @@ -1094,6 +1094,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FileUploadResponse = apply { if (validated) { return@apply @@ -1431,6 +1439,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExtensionStatus = apply { if (validated) { return@apply @@ -1567,6 +1584,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AiAutoDescription = apply { if (validated) { return@apply @@ -1703,6 +1730,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AiTasks = apply { if (validated) { return@apply @@ -1841,6 +1878,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): AwsAutoTagging = apply { if (validated) { return@apply @@ -1980,6 +2027,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): GoogleAutoTagging = apply { if (validated) { return@apply @@ -2116,6 +2173,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RemoveBg = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/Folder.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/Folder.kt index 35f4df55..e03767c1 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/Folder.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/Folder.kt @@ -339,6 +339,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Folder = apply { if (validated) { return@apply @@ -439,6 +447,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CustomMetadata = apply { if (validated) { return@apply @@ -564,6 +581,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/Metadata.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/Metadata.kt index 66885a1d..ddc2bda8 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/Metadata.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/Metadata.kt @@ -558,6 +558,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -886,6 +894,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Exif = apply { if (validated) { return@apply @@ -1960,6 +1977,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ExifDetails = apply { if (validated) { return@apply @@ -2233,6 +2260,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Gps = apply { if (validated) { return@apply @@ -2738,6 +2775,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Image = apply { if (validated) { return@apply @@ -2975,6 +3022,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Interoperability = apply { if (validated) { return@apply @@ -3086,6 +3143,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Makernote = apply { if (validated) { return@apply @@ -3428,6 +3495,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Thumbnail = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/UpdateFileRequest.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/UpdateFileRequest.kt index 9582a26c..f20cbd08 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/UpdateFileRequest.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/UpdateFileRequest.kt @@ -57,6 +57,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = updateFileRequest.accept(new UpdateFileRequest.Visitor>() { + * @Override + * public Optional visitDetails(UpdateFileDetails details) { + * return Optional.of(details.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { details != null -> visitor.visitDetails(details) @@ -67,6 +96,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UpdateFileRequest = apply { if (validated) { return@apply @@ -687,6 +724,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UpdateFileDetails = apply { if (validated) { return@apply @@ -792,6 +838,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): CustomMetadata = apply { if (validated) { return@apply @@ -865,6 +921,36 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given + * [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, + * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this + * version of the SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = removeAiTags.accept(new RemoveAiTags.Visitor>() { + * @Override + * public Optional visitStrings(List strings) { + * return Optional.of(strings.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in + * [visitor] and the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { strings != null -> visitor.visitStrings(strings) @@ -874,6 +960,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RemoveAiTags = apply { if (validated) { return@apply @@ -1158,6 +1254,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChangePublicationStatus = apply { if (validated) { return@apply @@ -1357,6 +1462,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Publish = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkAddTagsParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkAddTagsParams.kt index f0bcc033..e4b1b606 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkAddTagsParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkAddTagsParams.kt @@ -469,6 +469,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkAddTagsResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkAddTagsResponse.kt index 1124d430..b93f0bfc 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkAddTagsResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkAddTagsResponse.kt @@ -144,6 +144,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BulkAddTagsResponse = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkDeleteParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkDeleteParams.kt index fc3e0dd2..dcb40d16 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkDeleteParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkDeleteParams.kt @@ -387,6 +387,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkDeleteResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkDeleteResponse.kt index 539f9a9e..482d08bd 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkDeleteResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkDeleteResponse.kt @@ -144,6 +144,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BulkDeleteResponse = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveAiTagsParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveAiTagsParams.kt index a4977e61..94123fe6 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveAiTagsParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveAiTagsParams.kt @@ -474,6 +474,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveAiTagsResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveAiTagsResponse.kt index 5966074a..fdf89448 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveAiTagsResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveAiTagsResponse.kt @@ -144,6 +144,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BulkRemoveAiTagsResponse = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveTagsParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveTagsParams.kt index cd33eca9..e13c9b46 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveTagsParams.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveTagsParams.kt @@ -470,6 +470,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveTagsResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveTagsResponse.kt index f1b2ad24..1395119e 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveTagsResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/bulk/BulkRemoveTagsResponse.kt @@ -144,6 +144,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): BulkRemoveTagsResponse = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/versions/VersionDeleteResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/versions/VersionDeleteResponse.kt index 047daa8e..e5f28414 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/versions/VersionDeleteResponse.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/files/versions/VersionDeleteResponse.kt @@ -75,6 +75,14 @@ private constructor(private val additionalProperties: MutableMap = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = unsafeUnwrapWebhookEvent.accept(new UnsafeUnwrapWebhookEvent.Visitor>() { + * @Override + * public Optional visitVideoTransformationAccepted(VideoTransformationAcceptedEvent videoTransformationAccepted) { + * return Optional.of(videoTransformationAccepted.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { videoTransformationAccepted != null -> @@ -235,6 +264,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UnsafeUnwrapWebhookEvent = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UnwrapWebhookEvent.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UnwrapWebhookEvent.kt index 6d402456..b7d686eb 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UnwrapWebhookEvent.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UnwrapWebhookEvent.kt @@ -209,6 +209,35 @@ private constructor( fun _json(): Optional = Optional.ofNullable(_json) + /** + * Maps this instance's current variant to a value of type [T] using the given [visitor]. + * + * Note that this method is _not_ forwards compatible with new variants from the API, unless + * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the + * SDK gracefully, consider overriding [Visitor.unknown]: + * ```java + * import io.imagekit.core.JsonValue; + * import java.util.Optional; + * + * Optional result = unwrapWebhookEvent.accept(new UnwrapWebhookEvent.Visitor>() { + * @Override + * public Optional visitVideoTransformationAccepted(VideoTransformationAcceptedEvent videoTransformationAccepted) { + * return Optional.of(videoTransformationAccepted.toString()); + * } + * + * // ... + * + * @Override + * public Optional unknown(JsonValue json) { + * // Or inspect the `json`. + * return Optional.empty(); + * } + * }); + * ``` + * + * @throws ImageKitInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and + * the current variant is unknown. + */ fun accept(visitor: Visitor): T = when { videoTransformationAccepted != null -> @@ -235,6 +264,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UnwrapWebhookEvent = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPostTransformErrorEvent.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPostTransformErrorEvent.kt index 41fcb8a9..eea9cab4 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPostTransformErrorEvent.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPostTransformErrorEvent.kt @@ -273,6 +273,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UploadPostTransformErrorEvent = apply { if (validated) { return@apply @@ -564,6 +572,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -716,6 +733,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -862,6 +889,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Error = apply { if (validated) { return@apply @@ -1107,6 +1144,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Request = apply { if (validated) { return@apply @@ -1325,6 +1371,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -1461,6 +1517,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1593,6 +1659,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Protocol = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPostTransformSuccessEvent.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPostTransformSuccessEvent.kt index 1b4f1e0f..c5950733 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPostTransformSuccessEvent.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPostTransformSuccessEvent.kt @@ -276,6 +276,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UploadPostTransformSuccessEvent = apply { if (validated) { return@apply @@ -494,6 +502,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -704,6 +721,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Request = apply { if (validated) { return@apply @@ -922,6 +948,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -1058,6 +1094,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1190,6 +1236,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Protocol = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPreTransformErrorEvent.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPreTransformErrorEvent.kt index af3bac71..1a02c9ad 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPreTransformErrorEvent.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPreTransformErrorEvent.kt @@ -270,6 +270,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UploadPreTransformErrorEvent = apply { if (validated) { return@apply @@ -493,6 +501,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -641,6 +658,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -787,6 +814,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Error = apply { if (validated) { return@apply @@ -1033,6 +1070,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Request = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPreTransformSuccessEvent.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPreTransformSuccessEvent.kt index 8e01813a..6d2169f9 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPreTransformSuccessEvent.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/UploadPreTransformSuccessEvent.kt @@ -285,6 +285,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UploadPreTransformSuccessEvent = apply { if (validated) { return@apply @@ -1430,6 +1438,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -1775,6 +1792,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ExtensionStatus = apply { if (validated) { return@apply @@ -1913,6 +1940,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): AiAutoDescription = apply { if (validated) { return@apply @@ -2050,6 +2087,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): AiTasks = apply { if (validated) { return@apply @@ -2190,6 +2237,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): AwsAutoTagging = apply { if (validated) { return@apply @@ -2331,6 +2388,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): GoogleAutoTagging = apply { if (validated) { return@apply @@ -2468,6 +2535,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): RemoveBg = apply { if (validated) { return@apply @@ -2770,6 +2847,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Request = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationAcceptedEvent.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationAcceptedEvent.kt index d873e2a3..a0d0711c 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationAcceptedEvent.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationAcceptedEvent.kt @@ -281,6 +281,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoTransformationAcceptedEvent = apply { if (validated) { return@apply @@ -473,6 +481,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -620,6 +637,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Asset = apply { if (validated) { return@apply @@ -826,6 +853,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -959,6 +996,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1359,6 +1406,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Options = apply { if (validated) { return@apply @@ -1496,6 +1553,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): AudioCodec = apply { if (validated) { return@apply @@ -1649,6 +1716,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Format = apply { if (validated) { return@apply @@ -1787,6 +1864,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): StreamProtocol = apply { if (validated) { return@apply @@ -1930,6 +2017,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): VideoCodec = apply { if (validated) { return@apply @@ -2233,6 +2330,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Request = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationErrorEvent.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationErrorEvent.kt index 993182e5..f14cea7e 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationErrorEvent.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationErrorEvent.kt @@ -279,6 +279,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoTransformationErrorEvent = apply { if (validated) { return@apply @@ -468,6 +476,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -615,6 +632,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Asset = apply { if (validated) { return@apply @@ -852,6 +879,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -987,6 +1024,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1154,6 +1201,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Error = apply { if (validated) { return@apply @@ -1287,6 +1344,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Reason = apply { if (validated) { return@apply @@ -1706,6 +1773,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Options = apply { if (validated) { return@apply @@ -1843,6 +1920,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): AudioCodec = apply { if (validated) { return@apply @@ -1996,6 +2083,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Format = apply { if (validated) { return@apply @@ -2134,6 +2231,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): StreamProtocol = apply { if (validated) { return@apply @@ -2277,6 +2384,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): VideoCodec = apply { if (validated) { return@apply @@ -2583,6 +2700,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Request = apply { if (validated) { return@apply diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationReadyEvent.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationReadyEvent.kt index bf3bfcbf..c20ecd16 100644 --- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationReadyEvent.kt +++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/webhooks/VideoTransformationReadyEvent.kt @@ -310,6 +310,14 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): VideoTransformationReadyEvent = apply { if (validated) { return@apply @@ -501,6 +509,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Data = apply { if (validated) { return@apply @@ -648,6 +665,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Asset = apply { if (validated) { return@apply @@ -885,6 +912,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Transformation = apply { if (validated) { return@apply @@ -1020,6 +1057,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1420,6 +1467,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Options = apply { if (validated) { return@apply @@ -1557,6 +1614,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): AudioCodec = apply { if (validated) { return@apply @@ -1710,6 +1777,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Format = apply { if (validated) { return@apply @@ -1848,6 +1925,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): StreamProtocol = apply { if (validated) { return@apply @@ -1991,6 +2078,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): VideoCodec = apply { if (validated) { return@apply @@ -2227,6 +2324,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -2502,6 +2609,16 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): VideoMetadata = apply { if (validated) { return@apply @@ -2811,6 +2928,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Request = apply { if (validated) { return@apply @@ -3015,6 +3141,15 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ImageKitInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Timings = apply { if (validated) { return@apply