diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index ff1c7af5..2437b419 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "3.3.0"
+ ".": "3.4.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 006b15f4..58526a77 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 47
+configured_endpoints: 48
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 96892df7..c5853bbb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+## [3.4.0](https://github.com/imagekit-developer/imagekit-java/compare/v3.3.0...v3.4.0) (2026-07-14)
+
+
+### Features
+
+* **api:** add usage analytics breakdown endpoint ([7fb0d7b](https://github.com/imagekit-developer/imagekit-java/commit/7fb0d7b2ce4a7ba672e0d780f94a7d0b98a32416))
+
## [3.3.0](https://github.com/imagekit-developer/imagekit-java/compare/v3.2.0...v3.3.0) (2026-06-18)
diff --git a/README.md b/README.md
index d1e382a7..fe5318b2 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/io.imagekit/image-kit-java/3.3.0)
-[](https://javadoc.io/doc/io.imagekit/image-kit-java/3.1.1)
+[](https://central.sonatype.com/artifact/io.imagekit/image-kit-java/3.4.0)
+[](https://javadoc.io/doc/io.imagekit/image-kit-java/3.1.1)
@@ -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.3.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.4.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.3.0")
+implementation("io.imagekit:image-kit-java:3.4.0")
```
### Maven
@@ -55,7 +55,7 @@ implementation("io.imagekit:image-kit-java:3.3.0")
io.imagekit
image-kit-java
- 3.3.0
+ 3.4.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 1b6c0c52..efaca8dc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "io.imagekit"
- version = "3.3.0" // x-release-please-version
+ version = "3.4.0" // x-release-please-version
}
subprojects {
diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usage/UsageGetParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usage/UsageGetParams.kt
index a4b76c84..b945ef4a 100644
--- a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usage/UsageGetParams.kt
+++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usage/UsageGetParams.kt
@@ -13,6 +13,11 @@ import java.util.Objects
* Get the account usage information between two dates. Note that the API response includes data
* from the start date while excluding data from the end date. In other words, the data covers the
* period starting from the specified start date up to, but not including, the end date.
+ *
+ * For an agency account, the returned usage is aggregated across the agency and all of its child
+ * accounts that are billed to it.
+ *
+ * The response is cached for 6 hours per account, date range and requested metrics.
*/
class UsageGetParams
private constructor(
diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/RequestBandwidthEntry.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/RequestBandwidthEntry.kt
new file mode 100644
index 00000000..fdadc79a
--- /dev/null
+++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/RequestBandwidthEntry.kt
@@ -0,0 +1,235 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package io.imagekit.models.accounts.usageanalytics
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import io.imagekit.core.ExcludeMissing
+import io.imagekit.core.JsonField
+import io.imagekit.core.JsonMissing
+import io.imagekit.core.JsonValue
+import io.imagekit.core.checkRequired
+import io.imagekit.errors.ImageKitInvalidDataException
+import java.util.Collections
+import java.util.Objects
+
+class RequestBandwidthEntry
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val bandwidthBytes: JsonField,
+ private val requestCount: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("bandwidthBytes")
+ @ExcludeMissing
+ bandwidthBytes: JsonField = JsonMissing.of(),
+ @JsonProperty("requestCount")
+ @ExcludeMissing
+ requestCount: JsonField = JsonMissing.of(),
+ ) : this(bandwidthBytes, requestCount, mutableMapOf())
+
+ /**
+ * Total bandwidth used in bytes.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun bandwidthBytes(): Double = bandwidthBytes.getRequired("bandwidthBytes")
+
+ /**
+ * Number of requests.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun requestCount(): Double = requestCount.getRequired("requestCount")
+
+ /**
+ * Returns the raw JSON value of [bandwidthBytes].
+ *
+ * Unlike [bandwidthBytes], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("bandwidthBytes")
+ @ExcludeMissing
+ fun _bandwidthBytes(): JsonField = bandwidthBytes
+
+ /**
+ * Returns the raw JSON value of [requestCount].
+ *
+ * Unlike [requestCount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("requestCount")
+ @ExcludeMissing
+ fun _requestCount(): JsonField = requestCount
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [RequestBandwidthEntry].
+ *
+ * The following fields are required:
+ * ```java
+ * .bandwidthBytes()
+ * .requestCount()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [RequestBandwidthEntry]. */
+ class Builder internal constructor() {
+
+ private var bandwidthBytes: JsonField? = null
+ private var requestCount: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(requestBandwidthEntry: RequestBandwidthEntry) = apply {
+ bandwidthBytes = requestBandwidthEntry.bandwidthBytes
+ requestCount = requestBandwidthEntry.requestCount
+ additionalProperties = requestBandwidthEntry.additionalProperties.toMutableMap()
+ }
+
+ /** Total bandwidth used in bytes. */
+ fun bandwidthBytes(bandwidthBytes: Double) = bandwidthBytes(JsonField.of(bandwidthBytes))
+
+ /**
+ * Sets [Builder.bandwidthBytes] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.bandwidthBytes] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun bandwidthBytes(bandwidthBytes: JsonField) = apply {
+ this.bandwidthBytes = bandwidthBytes
+ }
+
+ /** Number of requests. */
+ fun requestCount(requestCount: Double) = requestCount(JsonField.of(requestCount))
+
+ /**
+ * Sets [Builder.requestCount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.requestCount] with a well-typed [Double] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun requestCount(requestCount: JsonField) = apply {
+ this.requestCount = requestCount
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [RequestBandwidthEntry].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .bandwidthBytes()
+ * .requestCount()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): RequestBandwidthEntry =
+ RequestBandwidthEntry(
+ checkRequired("bandwidthBytes", bandwidthBytes),
+ checkRequired("requestCount", requestCount),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws ImageKitInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): RequestBandwidthEntry = apply {
+ if (validated) {
+ return@apply
+ }
+
+ bandwidthBytes()
+ requestCount()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: ImageKitInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (bandwidthBytes.asKnown().isPresent) 1 else 0) +
+ (if (requestCount.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is RequestBandwidthEntry &&
+ bandwidthBytes == other.bandwidthBytes &&
+ requestCount == other.requestCount &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(bandwidthBytes, requestCount, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "RequestBandwidthEntry{bandwidthBytes=$bandwidthBytes, requestCount=$requestCount, additionalProperties=$additionalProperties}"
+}
diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/UsageAnalyticsGetParams.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/UsageAnalyticsGetParams.kt
new file mode 100644
index 00000000..e80867bc
--- /dev/null
+++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/UsageAnalyticsGetParams.kt
@@ -0,0 +1,246 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package io.imagekit.models.accounts.usageanalytics
+
+import io.imagekit.core.Params
+import io.imagekit.core.checkRequired
+import io.imagekit.core.http.Headers
+import io.imagekit.core.http.QueryParams
+import java.time.LocalDate
+import java.util.Objects
+
+/**
+ * **Note:** This API is currently in beta.
+ *
+ * Get the account analytics data between two dates. The response covers the period from the start
+ * date to the end date, both dates inclusive. Both dates are interpreted as UTC calendar days.
+ *
+ * The returned data is scoped to the requesting account only. Unlike `/v1/accounts/usage`, an
+ * agency account's analytics are not aggregated across its child accounts.
+ *
+ * The response is cached for 5 minutes per account and date range. Use `generatedAt` to check how
+ * fresh the returned data is.
+ */
+class UsageAnalyticsGetParams
+private constructor(
+ private val endDate: LocalDate,
+ private val startDate: LocalDate,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ /**
+ * Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. It should be
+ * after the `startDate`. The difference between `startDate` and `endDate` should be less than
+ * 90 days.
+ */
+ fun endDate(): LocalDate = endDate
+
+ /**
+ * Specify a `startDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. It should be
+ * before the `endDate`. The difference between `startDate` and `endDate` should be less than 90
+ * days.
+ */
+ fun startDate(): LocalDate = startDate
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [UsageAnalyticsGetParams].
+ *
+ * The following fields are required:
+ * ```java
+ * .endDate()
+ * .startDate()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [UsageAnalyticsGetParams]. */
+ class Builder internal constructor() {
+
+ private var endDate: LocalDate? = null
+ private var startDate: LocalDate? = null
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(usageAnalyticsGetParams: UsageAnalyticsGetParams) = apply {
+ endDate = usageAnalyticsGetParams.endDate
+ startDate = usageAnalyticsGetParams.startDate
+ additionalHeaders = usageAnalyticsGetParams.additionalHeaders.toBuilder()
+ additionalQueryParams = usageAnalyticsGetParams.additionalQueryParams.toBuilder()
+ }
+
+ /**
+ * Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. It should
+ * be after the `startDate`. The difference between `startDate` and `endDate` should be less
+ * than 90 days.
+ */
+ fun endDate(endDate: LocalDate) = apply { this.endDate = endDate }
+
+ /**
+ * Specify a `startDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. It
+ * should be before the `endDate`. The difference between `startDate` and `endDate` should
+ * be less than 90 days.
+ */
+ fun startDate(startDate: LocalDate) = apply { this.startDate = startDate }
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ /**
+ * Returns an immutable instance of [UsageAnalyticsGetParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .endDate()
+ * .startDate()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): UsageAnalyticsGetParams =
+ UsageAnalyticsGetParams(
+ checkRequired("endDate", endDate),
+ checkRequired("startDate", startDate),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams =
+ QueryParams.builder()
+ .apply {
+ put("endDate", endDate.toString())
+ put("startDate", startDate.toString())
+ putAll(additionalQueryParams)
+ }
+ .build()
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is UsageAnalyticsGetParams &&
+ endDate == other.endDate &&
+ startDate == other.startDate &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(endDate, startDate, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "UsageAnalyticsGetParams{endDate=$endDate, startDate=$startDate, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/UsageAnalyticsResponse.kt b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/UsageAnalyticsResponse.kt
new file mode 100644
index 00000000..3e2b2927
--- /dev/null
+++ b/image-kit-java-core/src/main/kotlin/io/imagekit/models/accounts/usageanalytics/UsageAnalyticsResponse.kt
@@ -0,0 +1,12236 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package io.imagekit.models.accounts.usageanalytics
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import io.imagekit.core.ExcludeMissing
+import io.imagekit.core.JsonField
+import io.imagekit.core.JsonMissing
+import io.imagekit.core.JsonValue
+import io.imagekit.core.checkKnown
+import io.imagekit.core.checkRequired
+import io.imagekit.core.toImmutable
+import io.imagekit.errors.ImageKitInvalidDataException
+import java.time.LocalDate
+import java.time.OffsetDateTime
+import java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+class UsageAnalyticsResponse
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val bandwidthBytes: JsonField,
+ private val browser: JsonField,
+ private val cache: JsonField,
+ private val country: JsonField,
+ private val device: JsonField,
+ private val endDate: JsonField,
+ private val errorReasons: JsonField>,
+ private val extensions: JsonField>,
+ private val format: JsonField,
+ private val generatedAt: JsonField,
+ private val requestCount: JsonField,
+ private val startDate: JsonField,
+ private val statusCodes: JsonField>,
+ private val top404Assets: JsonField>,
+ private val topImages: JsonField,
+ private val topImageTransforms: JsonField,
+ private val topOtherAssets: JsonField,
+ private val topReferrers: JsonField,
+ private val topUserAgents: JsonField,
+ private val topVideos: JsonField,
+ private val topVideoTransforms: JsonField,
+ private val urlEndpoints: JsonField,
+ private val videoProcessing: JsonField>,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("bandwidthBytes")
+ @ExcludeMissing
+ bandwidthBytes: JsonField = JsonMissing.of(),
+ @JsonProperty("browser") @ExcludeMissing browser: JsonField = JsonMissing.of(),
+ @JsonProperty("cache") @ExcludeMissing cache: JsonField = JsonMissing.of(),
+ @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(),
+ @JsonProperty("device") @ExcludeMissing device: JsonField = JsonMissing.of(),
+ @JsonProperty("endDate") @ExcludeMissing endDate: JsonField = JsonMissing.of(),
+ @JsonProperty("errorReasons")
+ @ExcludeMissing
+ errorReasons: JsonField> = JsonMissing.of(),
+ @JsonProperty("extensions")
+ @ExcludeMissing
+ extensions: JsonField> = JsonMissing.of(),
+ @JsonProperty("format") @ExcludeMissing format: JsonField = JsonMissing.of(),
+ @JsonProperty("generatedAt")
+ @ExcludeMissing
+ generatedAt: JsonField = JsonMissing.of(),
+ @JsonProperty("requestCount")
+ @ExcludeMissing
+ requestCount: JsonField = JsonMissing.of(),
+ @JsonProperty("startDate")
+ @ExcludeMissing
+ startDate: JsonField = JsonMissing.of(),
+ @JsonProperty("statusCodes")
+ @ExcludeMissing
+ statusCodes: JsonField> = JsonMissing.of(),
+ @JsonProperty("top404Assets")
+ @ExcludeMissing
+ top404Assets: JsonField> = JsonMissing.of(),
+ @JsonProperty("topImages")
+ @ExcludeMissing
+ topImages: JsonField = JsonMissing.of(),
+ @JsonProperty("topImageTransforms")
+ @ExcludeMissing
+ topImageTransforms: JsonField = JsonMissing.of(),
+ @JsonProperty("topOtherAssets")
+ @ExcludeMissing
+ topOtherAssets: JsonField = JsonMissing.of(),
+ @JsonProperty("topReferrers")
+ @ExcludeMissing
+ topReferrers: JsonField = JsonMissing.of(),
+ @JsonProperty("topUserAgents")
+ @ExcludeMissing
+ topUserAgents: JsonField = JsonMissing.of(),
+ @JsonProperty("topVideos")
+ @ExcludeMissing
+ topVideos: JsonField = JsonMissing.of(),
+ @JsonProperty("topVideoTransforms")
+ @ExcludeMissing
+ topVideoTransforms: JsonField = JsonMissing.of(),
+ @JsonProperty("urlEndpoints")
+ @ExcludeMissing
+ urlEndpoints: JsonField = JsonMissing.of(),
+ @JsonProperty("videoProcessing")
+ @ExcludeMissing
+ videoProcessing: JsonField> = JsonMissing.of(),
+ ) : this(
+ bandwidthBytes,
+ browser,
+ cache,
+ country,
+ device,
+ endDate,
+ errorReasons,
+ extensions,
+ format,
+ generatedAt,
+ requestCount,
+ startDate,
+ statusCodes,
+ top404Assets,
+ topImages,
+ topImageTransforms,
+ topOtherAssets,
+ topReferrers,
+ topUserAgents,
+ topVideos,
+ topVideoTransforms,
+ urlEndpoints,
+ videoProcessing,
+ mutableMapOf(),
+ )
+
+ /**
+ * Total bandwidth, in bytes, utilized during the specified date range.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun bandwidthBytes(): Double = bandwidthBytes.getRequired("bandwidthBytes")
+
+ /**
+ * CDN traffic grouped by browser.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun browser(): Browser = browser.getRequired("browser")
+
+ /**
+ * CDN cache hit, miss and error counts for the date range.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun cache(): Cache = cache.getRequired("cache")
+
+ /**
+ * CDN traffic grouped by country.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun country(): Country = country.getRequired("country")
+
+ /**
+ * CDN traffic grouped by device and operating system (e.g. `Desktop - Apple Mac`, `Smartphone -
+ * Apple iPhone`).
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun device(): Device = device.getRequired("device")
+
+ /**
+ * End date of the computed analytics data.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun endDate(): LocalDate = endDate.getRequired("endDate")
+
+ /**
+ * Request count grouped by origin error reason. This covers failed origin fetches, such as an
+ * asset not found at origin or an origin timeout. It is not the HTTP status code returned to
+ * the client, see `statusCodes` for that.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun errorReasons(): List = errorReasons.getRequired("errorReasons")
+
+ /**
+ * Raw per-extension operation counts for the date range. These are raw operation counts, not
+ * billable extension units. For billable usage, use the `/v1/accounts/usage` endpoint.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun extensions(): List = extensions.getRequired("extensions")
+
+ /**
+ * CDN traffic grouped by response `Content-Type`.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun format(): Format = format.getRequired("format")
+
+ /**
+ * Date and time when the analytics data was computed. Use this to gauge how fresh the returned
+ * data is. The date and time is in ISO8601 format.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun generatedAt(): OffsetDateTime = generatedAt.getRequired("generatedAt")
+
+ /**
+ * Total number of requests made during the specified date range.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun requestCount(): Double = requestCount.getRequired("requestCount")
+
+ /**
+ * Start date of the computed analytics data.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun startDate(): LocalDate = startDate.getRequired("startDate")
+
+ /**
+ * Request count grouped by HTTP status code.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun statusCodes(): List = statusCodes.getRequired("statusCodes")
+
+ /**
+ * Top URLs that returned a 404 response.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun top404Assets(): List = top404Assets.getRequired("top404Assets")
+
+ /**
+ * Top image assets by traffic.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun topImages(): TopImages = topImages.getRequired("topImages")
+
+ /**
+ * Top image transformation strings by traffic.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun topImageTransforms(): TopImageTransforms =
+ topImageTransforms.getRequired("topImageTransforms")
+
+ /**
+ * Top non-image, non-video assets by traffic.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun topOtherAssets(): TopOtherAssets = topOtherAssets.getRequired("topOtherAssets")
+
+ /**
+ * Top HTTP referrers by traffic.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun topReferrers(): TopReferrers = topReferrers.getRequired("topReferrers")
+
+ /**
+ * Top user agents by traffic.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun topUserAgents(): TopUserAgents = topUserAgents.getRequired("topUserAgents")
+
+ /**
+ * Top video assets by traffic.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun topVideos(): TopVideos = topVideos.getRequired("topVideos")
+
+ /**
+ * Top video transformation strings by traffic.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun topVideoTransforms(): TopVideoTransforms =
+ topVideoTransforms.getRequired("topVideoTransforms")
+
+ /**
+ * CDN traffic grouped by configured URL endpoint. Traffic that does not match any named URL
+ * endpoint pattern is grouped under `Default`.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun urlEndpoints(): UrlEndpoints = urlEndpoints.getRequired("urlEndpoints")
+
+ /**
+ * Raw observed video transcode output duration, in seconds, grouped by resolution and codec.
+ * These are raw seconds, not billable Video Processing Units (VPU). For billable VPU totals,
+ * use the `/v1/accounts/usage` endpoint.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun videoProcessing(): List = videoProcessing.getRequired("videoProcessing")
+
+ /**
+ * Returns the raw JSON value of [bandwidthBytes].
+ *
+ * Unlike [bandwidthBytes], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("bandwidthBytes")
+ @ExcludeMissing
+ fun _bandwidthBytes(): JsonField = bandwidthBytes
+
+ /**
+ * Returns the raw JSON value of [browser].
+ *
+ * Unlike [browser], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("browser") @ExcludeMissing fun _browser(): JsonField = browser
+
+ /**
+ * Returns the raw JSON value of [cache].
+ *
+ * Unlike [cache], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("cache") @ExcludeMissing fun _cache(): JsonField = cache
+
+ /**
+ * Returns the raw JSON value of [country].
+ *
+ * Unlike [country], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country
+
+ /**
+ * Returns the raw JSON value of [device].
+ *
+ * Unlike [device], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("device") @ExcludeMissing fun _device(): JsonField = device
+
+ /**
+ * Returns the raw JSON value of [endDate].
+ *
+ * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("endDate") @ExcludeMissing fun _endDate(): JsonField = endDate
+
+ /**
+ * Returns the raw JSON value of [errorReasons].
+ *
+ * Unlike [errorReasons], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("errorReasons")
+ @ExcludeMissing
+ fun _errorReasons(): JsonField> = errorReasons
+
+ /**
+ * Returns the raw JSON value of [extensions].
+ *
+ * Unlike [extensions], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("extensions")
+ @ExcludeMissing
+ fun _extensions(): JsonField> = extensions
+
+ /**
+ * Returns the raw JSON value of [format].
+ *
+ * Unlike [format], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("format") @ExcludeMissing fun _format(): JsonField = format
+
+ /**
+ * Returns the raw JSON value of [generatedAt].
+ *
+ * Unlike [generatedAt], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("generatedAt")
+ @ExcludeMissing
+ fun _generatedAt(): JsonField = generatedAt
+
+ /**
+ * Returns the raw JSON value of [requestCount].
+ *
+ * Unlike [requestCount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("requestCount")
+ @ExcludeMissing
+ fun _requestCount(): JsonField = requestCount
+
+ /**
+ * Returns the raw JSON value of [startDate].
+ *
+ * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("startDate") @ExcludeMissing fun _startDate(): JsonField = startDate
+
+ /**
+ * Returns the raw JSON value of [statusCodes].
+ *
+ * Unlike [statusCodes], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("statusCodes")
+ @ExcludeMissing
+ fun _statusCodes(): JsonField> = statusCodes
+
+ /**
+ * Returns the raw JSON value of [top404Assets].
+ *
+ * Unlike [top404Assets], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("top404Assets")
+ @ExcludeMissing
+ fun _top404Assets(): JsonField> = top404Assets
+
+ /**
+ * Returns the raw JSON value of [topImages].
+ *
+ * Unlike [topImages], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("topImages") @ExcludeMissing fun _topImages(): JsonField = topImages
+
+ /**
+ * Returns the raw JSON value of [topImageTransforms].
+ *
+ * Unlike [topImageTransforms], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("topImageTransforms")
+ @ExcludeMissing
+ fun _topImageTransforms(): JsonField = topImageTransforms
+
+ /**
+ * Returns the raw JSON value of [topOtherAssets].
+ *
+ * Unlike [topOtherAssets], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("topOtherAssets")
+ @ExcludeMissing
+ fun _topOtherAssets(): JsonField = topOtherAssets
+
+ /**
+ * Returns the raw JSON value of [topReferrers].
+ *
+ * Unlike [topReferrers], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("topReferrers")
+ @ExcludeMissing
+ fun _topReferrers(): JsonField = topReferrers
+
+ /**
+ * Returns the raw JSON value of [topUserAgents].
+ *
+ * Unlike [topUserAgents], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("topUserAgents")
+ @ExcludeMissing
+ fun _topUserAgents(): JsonField = topUserAgents
+
+ /**
+ * Returns the raw JSON value of [topVideos].
+ *
+ * Unlike [topVideos], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("topVideos") @ExcludeMissing fun _topVideos(): JsonField = topVideos
+
+ /**
+ * Returns the raw JSON value of [topVideoTransforms].
+ *
+ * Unlike [topVideoTransforms], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("topVideoTransforms")
+ @ExcludeMissing
+ fun _topVideoTransforms(): JsonField = topVideoTransforms
+
+ /**
+ * Returns the raw JSON value of [urlEndpoints].
+ *
+ * Unlike [urlEndpoints], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("urlEndpoints")
+ @ExcludeMissing
+ fun _urlEndpoints(): JsonField = urlEndpoints
+
+ /**
+ * Returns the raw JSON value of [videoProcessing].
+ *
+ * Unlike [videoProcessing], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("videoProcessing")
+ @ExcludeMissing
+ fun _videoProcessing(): JsonField> = videoProcessing
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [UsageAnalyticsResponse].
+ *
+ * The following fields are required:
+ * ```java
+ * .bandwidthBytes()
+ * .browser()
+ * .cache()
+ * .country()
+ * .device()
+ * .endDate()
+ * .errorReasons()
+ * .extensions()
+ * .format()
+ * .generatedAt()
+ * .requestCount()
+ * .startDate()
+ * .statusCodes()
+ * .top404Assets()
+ * .topImages()
+ * .topImageTransforms()
+ * .topOtherAssets()
+ * .topReferrers()
+ * .topUserAgents()
+ * .topVideos()
+ * .topVideoTransforms()
+ * .urlEndpoints()
+ * .videoProcessing()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [UsageAnalyticsResponse]. */
+ class Builder internal constructor() {
+
+ private var bandwidthBytes: JsonField? = null
+ private var browser: JsonField? = null
+ private var cache: JsonField? = null
+ private var country: JsonField? = null
+ private var device: JsonField? = null
+ private var endDate: JsonField? = null
+ private var errorReasons: JsonField>? = null
+ private var extensions: JsonField>? = null
+ private var format: JsonField? = null
+ private var generatedAt: JsonField? = null
+ private var requestCount: JsonField? = null
+ private var startDate: JsonField? = null
+ private var statusCodes: JsonField>? = null
+ private var top404Assets: JsonField>? = null
+ private var topImages: JsonField? = null
+ private var topImageTransforms: JsonField? = null
+ private var topOtherAssets: JsonField? = null
+ private var topReferrers: JsonField? = null
+ private var topUserAgents: JsonField? = null
+ private var topVideos: JsonField? = null
+ private var topVideoTransforms: JsonField? = null
+ private var urlEndpoints: JsonField? = null
+ private var videoProcessing: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(usageAnalyticsResponse: UsageAnalyticsResponse) = apply {
+ bandwidthBytes = usageAnalyticsResponse.bandwidthBytes
+ browser = usageAnalyticsResponse.browser
+ cache = usageAnalyticsResponse.cache
+ country = usageAnalyticsResponse.country
+ device = usageAnalyticsResponse.device
+ endDate = usageAnalyticsResponse.endDate
+ errorReasons = usageAnalyticsResponse.errorReasons.map { it.toMutableList() }
+ extensions = usageAnalyticsResponse.extensions.map { it.toMutableList() }
+ format = usageAnalyticsResponse.format
+ generatedAt = usageAnalyticsResponse.generatedAt
+ requestCount = usageAnalyticsResponse.requestCount
+ startDate = usageAnalyticsResponse.startDate
+ statusCodes = usageAnalyticsResponse.statusCodes.map { it.toMutableList() }
+ top404Assets = usageAnalyticsResponse.top404Assets.map { it.toMutableList() }
+ topImages = usageAnalyticsResponse.topImages
+ topImageTransforms = usageAnalyticsResponse.topImageTransforms
+ topOtherAssets = usageAnalyticsResponse.topOtherAssets
+ topReferrers = usageAnalyticsResponse.topReferrers
+ topUserAgents = usageAnalyticsResponse.topUserAgents
+ topVideos = usageAnalyticsResponse.topVideos
+ topVideoTransforms = usageAnalyticsResponse.topVideoTransforms
+ urlEndpoints = usageAnalyticsResponse.urlEndpoints
+ videoProcessing = usageAnalyticsResponse.videoProcessing.map { it.toMutableList() }
+ additionalProperties = usageAnalyticsResponse.additionalProperties.toMutableMap()
+ }
+
+ /** Total bandwidth, in bytes, utilized during the specified date range. */
+ fun bandwidthBytes(bandwidthBytes: Double) = bandwidthBytes(JsonField.of(bandwidthBytes))
+
+ /**
+ * Sets [Builder.bandwidthBytes] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.bandwidthBytes] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun bandwidthBytes(bandwidthBytes: JsonField) = apply {
+ this.bandwidthBytes = bandwidthBytes
+ }
+
+ /** CDN traffic grouped by browser. */
+ fun browser(browser: Browser) = browser(JsonField.of(browser))
+
+ /**
+ * Sets [Builder.browser] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.browser] with a well-typed [Browser] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun browser(browser: JsonField) = apply { this.browser = browser }
+
+ /** CDN cache hit, miss and error counts for the date range. */
+ fun cache(cache: Cache) = cache(JsonField.of(cache))
+
+ /**
+ * Sets [Builder.cache] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.cache] with a well-typed [Cache] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun cache(cache: JsonField) = apply { this.cache = cache }
+
+ /** CDN traffic grouped by country. */
+ fun country(country: Country) = country(JsonField.of(country))
+
+ /**
+ * Sets [Builder.country] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.country] with a well-typed [Country] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun country(country: JsonField) = apply { this.country = country }
+
+ /**
+ * CDN traffic grouped by device and operating system (e.g. `Desktop - Apple Mac`,
+ * `Smartphone - Apple iPhone`).
+ */
+ fun device(device: Device) = device(JsonField.of(device))
+
+ /**
+ * Sets [Builder.device] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.device] with a well-typed [Device] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun device(device: JsonField) = apply { this.device = device }
+
+ /** End date of the computed analytics data. */
+ fun endDate(endDate: LocalDate) = endDate(JsonField.of(endDate))
+
+ /**
+ * Sets [Builder.endDate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.endDate] with a well-typed [LocalDate] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun endDate(endDate: JsonField) = apply { this.endDate = endDate }
+
+ /**
+ * Request count grouped by origin error reason. This covers failed origin fetches, such as
+ * an asset not found at origin or an origin timeout. It is not the HTTP status code
+ * returned to the client, see `statusCodes` for that.
+ */
+ fun errorReasons(errorReasons: List) = errorReasons(JsonField.of(errorReasons))
+
+ /**
+ * Sets [Builder.errorReasons] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.errorReasons] with a well-typed `List`
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun errorReasons(errorReasons: JsonField>) = apply {
+ this.errorReasons = errorReasons.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [ErrorReason] to [errorReasons].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addErrorReason(errorReason: ErrorReason) = apply {
+ errorReasons =
+ (errorReasons ?: JsonField.of(mutableListOf())).also {
+ checkKnown("errorReasons", it).add(errorReason)
+ }
+ }
+
+ /**
+ * Raw per-extension operation counts for the date range. These are raw operation counts,
+ * not billable extension units. For billable usage, use the `/v1/accounts/usage` endpoint.
+ */
+ fun extensions(extensions: List) = extensions(JsonField.of(extensions))
+
+ /**
+ * Sets [Builder.extensions] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.extensions] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun extensions(extensions: JsonField>) = apply {
+ this.extensions = extensions.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Extension] to [extensions].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addExtension(extension: Extension) = apply {
+ extensions =
+ (extensions ?: JsonField.of(mutableListOf())).also {
+ checkKnown("extensions", it).add(extension)
+ }
+ }
+
+ /** CDN traffic grouped by response `Content-Type`. */
+ fun format(format: Format) = format(JsonField.of(format))
+
+ /**
+ * Sets [Builder.format] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.format] with a well-typed [Format] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun format(format: JsonField) = apply { this.format = format }
+
+ /**
+ * Date and time when the analytics data was computed. Use this to gauge how fresh the
+ * returned data is. The date and time is in ISO8601 format.
+ */
+ fun generatedAt(generatedAt: OffsetDateTime) = generatedAt(JsonField.of(generatedAt))
+
+ /**
+ * Sets [Builder.generatedAt] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.generatedAt] with a well-typed [OffsetDateTime] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun generatedAt(generatedAt: JsonField) = apply {
+ this.generatedAt = generatedAt
+ }
+
+ /** Total number of requests made during the specified date range. */
+ fun requestCount(requestCount: Double) = requestCount(JsonField.of(requestCount))
+
+ /**
+ * Sets [Builder.requestCount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.requestCount] with a well-typed [Double] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun requestCount(requestCount: JsonField) = apply {
+ this.requestCount = requestCount
+ }
+
+ /** Start date of the computed analytics data. */
+ fun startDate(startDate: LocalDate) = startDate(JsonField.of(startDate))
+
+ /**
+ * Sets [Builder.startDate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.startDate] with a well-typed [LocalDate] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun startDate(startDate: JsonField) = apply { this.startDate = startDate }
+
+ /** Request count grouped by HTTP status code. */
+ fun statusCodes(statusCodes: List) = statusCodes(JsonField.of(statusCodes))
+
+ /**
+ * Sets [Builder.statusCodes] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.statusCodes] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun statusCodes(statusCodes: JsonField>) = apply {
+ this.statusCodes = statusCodes.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [StatusCode] to [statusCodes].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addStatusCode(statusCode: StatusCode) = apply {
+ statusCodes =
+ (statusCodes ?: JsonField.of(mutableListOf())).also {
+ checkKnown("statusCodes", it).add(statusCode)
+ }
+ }
+
+ /** Top URLs that returned a 404 response. */
+ fun top404Assets(top404Assets: List) = top404Assets(JsonField.of(top404Assets))
+
+ /**
+ * Sets [Builder.top404Assets] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.top404Assets] with a well-typed `List`
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun top404Assets(top404Assets: JsonField>) = apply {
+ this.top404Assets = top404Assets.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Top404Asset] to [top404Assets].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addTop404Asset(top404Asset: Top404Asset) = apply {
+ top404Assets =
+ (top404Assets ?: JsonField.of(mutableListOf())).also {
+ checkKnown("top404Assets", it).add(top404Asset)
+ }
+ }
+
+ /** Top image assets by traffic. */
+ fun topImages(topImages: TopImages) = topImages(JsonField.of(topImages))
+
+ /**
+ * Sets [Builder.topImages] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.topImages] with a well-typed [TopImages] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun topImages(topImages: JsonField) = apply { this.topImages = topImages }
+
+ /** Top image transformation strings by traffic. */
+ fun topImageTransforms(topImageTransforms: TopImageTransforms) =
+ topImageTransforms(JsonField.of(topImageTransforms))
+
+ /**
+ * Sets [Builder.topImageTransforms] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.topImageTransforms] with a well-typed
+ * [TopImageTransforms] value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun topImageTransforms(topImageTransforms: JsonField) = apply {
+ this.topImageTransforms = topImageTransforms
+ }
+
+ /** Top non-image, non-video assets by traffic. */
+ fun topOtherAssets(topOtherAssets: TopOtherAssets) =
+ topOtherAssets(JsonField.of(topOtherAssets))
+
+ /**
+ * Sets [Builder.topOtherAssets] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.topOtherAssets] with a well-typed [TopOtherAssets] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun topOtherAssets(topOtherAssets: JsonField) = apply {
+ this.topOtherAssets = topOtherAssets
+ }
+
+ /** Top HTTP referrers by traffic. */
+ fun topReferrers(topReferrers: TopReferrers) = topReferrers(JsonField.of(topReferrers))
+
+ /**
+ * Sets [Builder.topReferrers] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.topReferrers] with a well-typed [TopReferrers] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun topReferrers(topReferrers: JsonField) = apply {
+ this.topReferrers = topReferrers
+ }
+
+ /** Top user agents by traffic. */
+ fun topUserAgents(topUserAgents: TopUserAgents) = topUserAgents(JsonField.of(topUserAgents))
+
+ /**
+ * Sets [Builder.topUserAgents] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.topUserAgents] with a well-typed [TopUserAgents] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun topUserAgents(topUserAgents: JsonField) = apply {
+ this.topUserAgents = topUserAgents
+ }
+
+ /** Top video assets by traffic. */
+ fun topVideos(topVideos: TopVideos) = topVideos(JsonField.of(topVideos))
+
+ /**
+ * Sets [Builder.topVideos] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.topVideos] with a well-typed [TopVideos] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun topVideos(topVideos: JsonField) = apply { this.topVideos = topVideos }
+
+ /** Top video transformation strings by traffic. */
+ fun topVideoTransforms(topVideoTransforms: TopVideoTransforms) =
+ topVideoTransforms(JsonField.of(topVideoTransforms))
+
+ /**
+ * Sets [Builder.topVideoTransforms] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.topVideoTransforms] with a well-typed
+ * [TopVideoTransforms] value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun topVideoTransforms(topVideoTransforms: JsonField) = apply {
+ this.topVideoTransforms = topVideoTransforms
+ }
+
+ /**
+ * CDN traffic grouped by configured URL endpoint. Traffic that does not match any named URL
+ * endpoint pattern is grouped under `Default`.
+ */
+ fun urlEndpoints(urlEndpoints: UrlEndpoints) = urlEndpoints(JsonField.of(urlEndpoints))
+
+ /**
+ * Sets [Builder.urlEndpoints] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.urlEndpoints] with a well-typed [UrlEndpoints] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun urlEndpoints(urlEndpoints: JsonField) = apply {
+ this.urlEndpoints = urlEndpoints
+ }
+
+ /**
+ * Raw observed video transcode output duration, in seconds, grouped by resolution and
+ * codec. These are raw seconds, not billable Video Processing Units (VPU). For billable VPU
+ * totals, use the `/v1/accounts/usage` endpoint.
+ */
+ fun videoProcessing(videoProcessing: List) =
+ videoProcessing(JsonField.of(videoProcessing))
+
+ /**
+ * Sets [Builder.videoProcessing] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.videoProcessing] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun videoProcessing(videoProcessing: JsonField>) = apply {
+ this.videoProcessing = videoProcessing.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [VideoProcessing] to [Builder.videoProcessing].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addVideoProcessing(videoProcessing: VideoProcessing) = apply {
+ this.videoProcessing =
+ (this.videoProcessing ?: JsonField.of(mutableListOf())).also {
+ checkKnown("videoProcessing", it).add(videoProcessing)
+ }
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [UsageAnalyticsResponse].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .bandwidthBytes()
+ * .browser()
+ * .cache()
+ * .country()
+ * .device()
+ * .endDate()
+ * .errorReasons()
+ * .extensions()
+ * .format()
+ * .generatedAt()
+ * .requestCount()
+ * .startDate()
+ * .statusCodes()
+ * .top404Assets()
+ * .topImages()
+ * .topImageTransforms()
+ * .topOtherAssets()
+ * .topReferrers()
+ * .topUserAgents()
+ * .topVideos()
+ * .topVideoTransforms()
+ * .urlEndpoints()
+ * .videoProcessing()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): UsageAnalyticsResponse =
+ UsageAnalyticsResponse(
+ checkRequired("bandwidthBytes", bandwidthBytes),
+ checkRequired("browser", browser),
+ checkRequired("cache", cache),
+ checkRequired("country", country),
+ checkRequired("device", device),
+ checkRequired("endDate", endDate),
+ checkRequired("errorReasons", errorReasons).map { it.toImmutable() },
+ checkRequired("extensions", extensions).map { it.toImmutable() },
+ checkRequired("format", format),
+ checkRequired("generatedAt", generatedAt),
+ checkRequired("requestCount", requestCount),
+ checkRequired("startDate", startDate),
+ checkRequired("statusCodes", statusCodes).map { it.toImmutable() },
+ checkRequired("top404Assets", top404Assets).map { it.toImmutable() },
+ checkRequired("topImages", topImages),
+ checkRequired("topImageTransforms", topImageTransforms),
+ checkRequired("topOtherAssets", topOtherAssets),
+ checkRequired("topReferrers", topReferrers),
+ checkRequired("topUserAgents", topUserAgents),
+ checkRequired("topVideos", topVideos),
+ checkRequired("topVideoTransforms", topVideoTransforms),
+ checkRequired("urlEndpoints", urlEndpoints),
+ checkRequired("videoProcessing", videoProcessing).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws ImageKitInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): UsageAnalyticsResponse = apply {
+ if (validated) {
+ return@apply
+ }
+
+ bandwidthBytes()
+ browser().validate()
+ cache().validate()
+ country().validate()
+ device().validate()
+ endDate()
+ errorReasons().forEach { it.validate() }
+ extensions().forEach { it.validate() }
+ format().validate()
+ generatedAt()
+ requestCount()
+ startDate()
+ statusCodes().forEach { it.validate() }
+ top404Assets().forEach { it.validate() }
+ topImages().validate()
+ topImageTransforms().validate()
+ topOtherAssets().validate()
+ topReferrers().validate()
+ topUserAgents().validate()
+ topVideos().validate()
+ topVideoTransforms().validate()
+ urlEndpoints().validate()
+ videoProcessing().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: ImageKitInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (bandwidthBytes.asKnown().isPresent) 1 else 0) +
+ (browser.asKnown().getOrNull()?.validity() ?: 0) +
+ (cache.asKnown().getOrNull()?.validity() ?: 0) +
+ (country.asKnown().getOrNull()?.validity() ?: 0) +
+ (device.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (endDate.asKnown().isPresent) 1 else 0) +
+ (errorReasons.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (extensions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (format.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (generatedAt.asKnown().isPresent) 1 else 0) +
+ (if (requestCount.asKnown().isPresent) 1 else 0) +
+ (if (startDate.asKnown().isPresent) 1 else 0) +
+ (statusCodes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (top404Assets.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (topImages.asKnown().getOrNull()?.validity() ?: 0) +
+ (topImageTransforms.asKnown().getOrNull()?.validity() ?: 0) +
+ (topOtherAssets.asKnown().getOrNull()?.validity() ?: 0) +
+ (topReferrers.asKnown().getOrNull()?.validity() ?: 0) +
+ (topUserAgents.asKnown().getOrNull()?.validity() ?: 0) +
+ (topVideos.asKnown().getOrNull()?.validity() ?: 0) +
+ (topVideoTransforms.asKnown().getOrNull()?.validity() ?: 0) +
+ (urlEndpoints.asKnown().getOrNull()?.validity() ?: 0) +
+ (videoProcessing.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /** CDN traffic grouped by browser. */
+ class Browser
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val byBandwidth: JsonField>,
+ private val byRequests: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("byBandwidth")
+ @ExcludeMissing
+ byBandwidth: JsonField> = JsonMissing.of(),
+ @JsonProperty("byRequests")
+ @ExcludeMissing
+ byRequests: JsonField> = JsonMissing.of(),
+ ) : this(byBandwidth, byRequests, mutableMapOf())
+
+ /**
+ * Top browsers sorted by bandwidth utilized.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun byBandwidth(): List = byBandwidth.getRequired("byBandwidth")
+
+ /**
+ * Top browsers sorted by request count.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun byRequests(): List = byRequests.getRequired("byRequests")
+
+ /**
+ * Returns the raw JSON value of [byBandwidth].
+ *
+ * Unlike [byBandwidth], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("byBandwidth")
+ @ExcludeMissing
+ fun _byBandwidth(): JsonField> = byBandwidth
+
+ /**
+ * Returns the raw JSON value of [byRequests].
+ *
+ * Unlike [byRequests], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("byRequests")
+ @ExcludeMissing
+ fun _byRequests(): JsonField> = byRequests
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Browser].
+ *
+ * The following fields are required:
+ * ```java
+ * .byBandwidth()
+ * .byRequests()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Browser]. */
+ class Builder internal constructor() {
+
+ private var byBandwidth: JsonField>? = null
+ private var byRequests: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(browser: Browser) = apply {
+ byBandwidth = browser.byBandwidth.map { it.toMutableList() }
+ byRequests = browser.byRequests.map { it.toMutableList() }
+ additionalProperties = browser.additionalProperties.toMutableMap()
+ }
+
+ /** Top browsers sorted by bandwidth utilized. */
+ fun byBandwidth(byBandwidth: List) = byBandwidth(JsonField.of(byBandwidth))
+
+ /**
+ * Sets [Builder.byBandwidth] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.byBandwidth] with a well-typed `List`
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun byBandwidth(byBandwidth: JsonField>) = apply {
+ this.byBandwidth = byBandwidth.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [ByBandwidth] to [Builder.byBandwidth].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addByBandwidth(byBandwidth: ByBandwidth) = apply {
+ this.byBandwidth =
+ (this.byBandwidth ?: JsonField.of(mutableListOf())).also {
+ checkKnown("byBandwidth", it).add(byBandwidth)
+ }
+ }
+
+ /** Top browsers sorted by request count. */
+ fun byRequests(byRequests: List) = byRequests(JsonField.of(byRequests))
+
+ /**
+ * Sets [Builder.byRequests] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.byRequests] with a well-typed `List`
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun byRequests(byRequests: JsonField>) = apply {
+ this.byRequests = byRequests.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [ByRequest] to [byRequests].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addByRequest(byRequest: ByRequest) = apply {
+ byRequests =
+ (byRequests ?: JsonField.of(mutableListOf())).also {
+ checkKnown("byRequests", it).add(byRequest)
+ }
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Browser].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .byBandwidth()
+ * .byRequests()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Browser =
+ Browser(
+ checkRequired("byBandwidth", byBandwidth).map { it.toImmutable() },
+ checkRequired("byRequests", byRequests).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws ImageKitInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Browser = apply {
+ if (validated) {
+ return@apply
+ }
+
+ byBandwidth().forEach { it.validate() }
+ byRequests().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: ImageKitInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (byBandwidth.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (byRequests.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ class ByBandwidth
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val bandwidthBytes: JsonField,
+ private val requestCount: JsonField,
+ private val name: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("bandwidthBytes")
+ @ExcludeMissing
+ bandwidthBytes: JsonField = JsonMissing.of(),
+ @JsonProperty("requestCount")
+ @ExcludeMissing
+ requestCount: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ ) : this(bandwidthBytes, requestCount, name, mutableMapOf())
+
+ fun toRequestBandwidthEntry(): RequestBandwidthEntry =
+ RequestBandwidthEntry.builder()
+ .bandwidthBytes(bandwidthBytes)
+ .requestCount(requestCount)
+ .build()
+
+ /**
+ * Total bandwidth used in bytes.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun bandwidthBytes(): Double = bandwidthBytes.getRequired("bandwidthBytes")
+
+ /**
+ * Number of requests.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun requestCount(): Double = requestCount.getRequired("requestCount")
+
+ /**
+ * Browser name (e.g. `Chrome`).
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun name(): String = name.getRequired("name")
+
+ /**
+ * Returns the raw JSON value of [bandwidthBytes].
+ *
+ * Unlike [bandwidthBytes], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("bandwidthBytes")
+ @ExcludeMissing
+ fun _bandwidthBytes(): JsonField = bandwidthBytes
+
+ /**
+ * Returns the raw JSON value of [requestCount].
+ *
+ * Unlike [requestCount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("requestCount")
+ @ExcludeMissing
+ fun _requestCount(): JsonField = requestCount
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [ByBandwidth].
+ *
+ * The following fields are required:
+ * ```java
+ * .bandwidthBytes()
+ * .requestCount()
+ * .name()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ByBandwidth]. */
+ class Builder internal constructor() {
+
+ private var bandwidthBytes: JsonField? = null
+ private var requestCount: JsonField? = null
+ private var name: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(byBandwidth: ByBandwidth) = apply {
+ bandwidthBytes = byBandwidth.bandwidthBytes
+ requestCount = byBandwidth.requestCount
+ name = byBandwidth.name
+ additionalProperties = byBandwidth.additionalProperties.toMutableMap()
+ }
+
+ /** Total bandwidth used in bytes. */
+ fun bandwidthBytes(bandwidthBytes: Double) =
+ bandwidthBytes(JsonField.of(bandwidthBytes))
+
+ /**
+ * Sets [Builder.bandwidthBytes] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.bandwidthBytes] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun bandwidthBytes(bandwidthBytes: JsonField) = apply {
+ this.bandwidthBytes = bandwidthBytes
+ }
+
+ /** Number of requests. */
+ fun requestCount(requestCount: Double) = requestCount(JsonField.of(requestCount))
+
+ /**
+ * Sets [Builder.requestCount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.requestCount] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun requestCount(requestCount: JsonField) = apply {
+ this.requestCount = requestCount
+ }
+
+ /** Browser name (e.g. `Chrome`). */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * Sets [Builder.name] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.name] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun name(name: JsonField) = apply { this.name = name }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ByBandwidth].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .bandwidthBytes()
+ * .requestCount()
+ * .name()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ByBandwidth =
+ ByBandwidth(
+ checkRequired("bandwidthBytes", bandwidthBytes),
+ checkRequired("requestCount", requestCount),
+ checkRequired("name", name),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws ImageKitInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): ByBandwidth = apply {
+ if (validated) {
+ return@apply
+ }
+
+ bandwidthBytes()
+ requestCount()
+ name()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: ImageKitInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (bandwidthBytes.asKnown().isPresent) 1 else 0) +
+ (if (requestCount.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ByBandwidth &&
+ bandwidthBytes == other.bandwidthBytes &&
+ requestCount == other.requestCount &&
+ name == other.name &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(bandwidthBytes, requestCount, name, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ByBandwidth{bandwidthBytes=$bandwidthBytes, requestCount=$requestCount, name=$name, additionalProperties=$additionalProperties}"
+ }
+
+ class ByRequest
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val bandwidthBytes: JsonField,
+ private val requestCount: JsonField,
+ private val name: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("bandwidthBytes")
+ @ExcludeMissing
+ bandwidthBytes: JsonField = JsonMissing.of(),
+ @JsonProperty("requestCount")
+ @ExcludeMissing
+ requestCount: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ ) : this(bandwidthBytes, requestCount, name, mutableMapOf())
+
+ fun toRequestBandwidthEntry(): RequestBandwidthEntry =
+ RequestBandwidthEntry.builder()
+ .bandwidthBytes(bandwidthBytes)
+ .requestCount(requestCount)
+ .build()
+
+ /**
+ * Total bandwidth used in bytes.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun bandwidthBytes(): Double = bandwidthBytes.getRequired("bandwidthBytes")
+
+ /**
+ * Number of requests.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun requestCount(): Double = requestCount.getRequired("requestCount")
+
+ /**
+ * Browser name (e.g. `Chrome`).
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun name(): String = name.getRequired("name")
+
+ /**
+ * Returns the raw JSON value of [bandwidthBytes].
+ *
+ * Unlike [bandwidthBytes], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("bandwidthBytes")
+ @ExcludeMissing
+ fun _bandwidthBytes(): JsonField = bandwidthBytes
+
+ /**
+ * Returns the raw JSON value of [requestCount].
+ *
+ * Unlike [requestCount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("requestCount")
+ @ExcludeMissing
+ fun _requestCount(): JsonField = requestCount
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [ByRequest].
+ *
+ * The following fields are required:
+ * ```java
+ * .bandwidthBytes()
+ * .requestCount()
+ * .name()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ByRequest]. */
+ class Builder internal constructor() {
+
+ private var bandwidthBytes: JsonField? = null
+ private var requestCount: JsonField? = null
+ private var name: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(byRequest: ByRequest) = apply {
+ bandwidthBytes = byRequest.bandwidthBytes
+ requestCount = byRequest.requestCount
+ name = byRequest.name
+ additionalProperties = byRequest.additionalProperties.toMutableMap()
+ }
+
+ /** Total bandwidth used in bytes. */
+ fun bandwidthBytes(bandwidthBytes: Double) =
+ bandwidthBytes(JsonField.of(bandwidthBytes))
+
+ /**
+ * Sets [Builder.bandwidthBytes] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.bandwidthBytes] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun bandwidthBytes(bandwidthBytes: JsonField) = apply {
+ this.bandwidthBytes = bandwidthBytes
+ }
+
+ /** Number of requests. */
+ fun requestCount(requestCount: Double) = requestCount(JsonField.of(requestCount))
+
+ /**
+ * Sets [Builder.requestCount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.requestCount] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun requestCount(requestCount: JsonField) = apply {
+ this.requestCount = requestCount
+ }
+
+ /** Browser name (e.g. `Chrome`). */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * Sets [Builder.name] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.name] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun name(name: JsonField) = apply { this.name = name }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [ByRequest].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .bandwidthBytes()
+ * .requestCount()
+ * .name()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ByRequest =
+ ByRequest(
+ checkRequired("bandwidthBytes", bandwidthBytes),
+ checkRequired("requestCount", requestCount),
+ checkRequired("name", name),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws ImageKitInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
+ fun validate(): ByRequest = apply {
+ if (validated) {
+ return@apply
+ }
+
+ bandwidthBytes()
+ requestCount()
+ name()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: ImageKitInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (bandwidthBytes.asKnown().isPresent) 1 else 0) +
+ (if (requestCount.asKnown().isPresent) 1 else 0) +
+ (if (name.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ByRequest &&
+ bandwidthBytes == other.bandwidthBytes &&
+ requestCount == other.requestCount &&
+ name == other.name &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(bandwidthBytes, requestCount, name, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ByRequest{bandwidthBytes=$bandwidthBytes, requestCount=$requestCount, name=$name, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Browser &&
+ byBandwidth == other.byBandwidth &&
+ byRequests == other.byRequests &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(byBandwidth, byRequests, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Browser{byBandwidth=$byBandwidth, byRequests=$byRequests, additionalProperties=$additionalProperties}"
+ }
+
+ /** CDN cache hit, miss and error counts for the date range. */
+ class Cache
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val errorCount: JsonField,
+ private val hitCount: JsonField,
+ private val missCount: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("errorCount")
+ @ExcludeMissing
+ errorCount: JsonField = JsonMissing.of(),
+ @JsonProperty("hitCount")
+ @ExcludeMissing
+ hitCount: JsonField = JsonMissing.of(),
+ @JsonProperty("missCount")
+ @ExcludeMissing
+ missCount: JsonField = JsonMissing.of(),
+ ) : this(errorCount, hitCount, missCount, mutableMapOf())
+
+ /**
+ * Number of requests where the CDN encountered a cache error or exceeded capacity while
+ * serving the response.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun errorCount(): Double = errorCount.getRequired("errorCount")
+
+ /**
+ * Number of requests served from cache, including full hits and revalidated hits.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun hitCount(): Double = hitCount.getRequired("hitCount")
+
+ /**
+ * Number of requests that were not found in cache and had to be fetched from origin.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun missCount(): Double = missCount.getRequired("missCount")
+
+ /**
+ * Returns the raw JSON value of [errorCount].
+ *
+ * Unlike [errorCount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("errorCount")
+ @ExcludeMissing
+ fun _errorCount(): JsonField = errorCount
+
+ /**
+ * Returns the raw JSON value of [hitCount].
+ *
+ * Unlike [hitCount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("hitCount") @ExcludeMissing fun _hitCount(): JsonField = hitCount
+
+ /**
+ * Returns the raw JSON value of [missCount].
+ *
+ * Unlike [missCount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("missCount") @ExcludeMissing fun _missCount(): JsonField = missCount
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [Cache].
+ *
+ * The following fields are required:
+ * ```java
+ * .errorCount()
+ * .hitCount()
+ * .missCount()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Cache]. */
+ class Builder internal constructor() {
+
+ private var errorCount: JsonField? = null
+ private var hitCount: JsonField? = null
+ private var missCount: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(cache: Cache) = apply {
+ errorCount = cache.errorCount
+ hitCount = cache.hitCount
+ missCount = cache.missCount
+ additionalProperties = cache.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Number of requests where the CDN encountered a cache error or exceeded capacity while
+ * serving the response.
+ */
+ fun errorCount(errorCount: Double) = errorCount(JsonField.of(errorCount))
+
+ /**
+ * Sets [Builder.errorCount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.errorCount] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun errorCount(errorCount: JsonField) = apply { this.errorCount = errorCount }
+
+ /** Number of requests served from cache, including full hits and revalidated hits. */
+ fun hitCount(hitCount: Double) = hitCount(JsonField.of(hitCount))
+
+ /**
+ * Sets [Builder.hitCount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.hitCount] with a well-typed [Double] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun hitCount(hitCount: JsonField) = apply { this.hitCount = hitCount }
+
+ /**
+ * Number of requests that were not found in cache and had to be fetched from origin.
+ */
+ fun missCount(missCount: Double) = missCount(JsonField.of(missCount))
+
+ /**
+ * Sets [Builder.missCount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.missCount] with a well-typed [Double] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun missCount(missCount: JsonField) = apply { this.missCount = missCount }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [Cache].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .errorCount()
+ * .hitCount()
+ * .missCount()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Cache =
+ Cache(
+ checkRequired("errorCount", errorCount),
+ checkRequired("hitCount", hitCount),
+ checkRequired("missCount", missCount),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws ImageKitInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Cache = apply {
+ if (validated) {
+ return@apply
+ }
+
+ errorCount()
+ hitCount()
+ missCount()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: ImageKitInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (errorCount.asKnown().isPresent) 1 else 0) +
+ (if (hitCount.asKnown().isPresent) 1 else 0) +
+ (if (missCount.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Cache &&
+ errorCount == other.errorCount &&
+ hitCount == other.hitCount &&
+ missCount == other.missCount &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(errorCount, hitCount, missCount, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Cache{errorCount=$errorCount, hitCount=$hitCount, missCount=$missCount, additionalProperties=$additionalProperties}"
+ }
+
+ /** CDN traffic grouped by country. */
+ class Country
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val byBandwidth: JsonField>,
+ private val byRequests: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("byBandwidth")
+ @ExcludeMissing
+ byBandwidth: JsonField> = JsonMissing.of(),
+ @JsonProperty("byRequests")
+ @ExcludeMissing
+ byRequests: JsonField> = JsonMissing.of(),
+ ) : this(byBandwidth, byRequests, mutableMapOf())
+
+ /**
+ * Top requesting countries sorted by total bandwidth utilized.
+ *
+ * @throws ImageKitInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun byBandwidth(): List