diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aaa4cc9..017bd77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,14 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'stl-preview-head/**' - - 'stl-preview-base/**' + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' pull_request: branches-ignore: - 'stl-preview-head/**' @@ -17,7 +19,7 @@ jobs: timeout-minutes: 15 name: lint runs-on: ${{ github.repository == 'stainless-sdks/arcade-engine-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@v6 @@ -44,7 +46,7 @@ jobs: contents: read id-token: write runs-on: ${{ github.repository == 'stainless-sdks/arcade-engine-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@v6 diff --git a/.gitignore b/.gitignore index b1346e6..90b85e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .prism.log +.stdy.log .gradle .idea .kotlin diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e8285b7..4f9005e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.5" + ".": "0.1.0-alpha.6" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index f7c06a5..f413d4c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-6ff494eafa2c154892716407682bb2296cff4f18c45765c5fb16bdf36f452ae1.yml -openapi_spec_hash: 63dde2481a7d51042a241bfba232b0b0 -config_hash: bf64816643634a621cd0ffd93d9c4347 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai/arcade-engine-22ce2a59bb1f308059c59ed19600698c5562a62c75f15c85429d186e9d8bdde6.yml +openapi_spec_hash: 2923fbda6c2899ade719d00540c34ff6 +config_hash: 2d4163acdeacd75903f978cd79c35d14 diff --git a/CHANGELOG.md b/CHANGELOG.md index 30401cf..ecd7eab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,57 @@ # Changelog +## 0.1.0-alpha.6 (2026-05-05) + +Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/ArcadeAI/arcade-java/compare/v0.1.0-alpha.5...v0.1.0-alpha.6) + +### Features + +* **api:** api update ([aa56504](https://github.com/ArcadeAI/arcade-java/commit/aa565048f02eb4a21657d4e51c4975376968b579)) +* **api:** api update ([f7f972b](https://github.com/ArcadeAI/arcade-java/commit/f7f972bc274de10da54ffe2004d9d50fa16bc5a3)) +* **api:** api update ([acfd5b0](https://github.com/ArcadeAI/arcade-java/commit/acfd5b0aedbb445e1269a6b879111ff19c8aeef5)) +* **api:** api update ([5871f8b](https://github.com/ArcadeAI/arcade-java/commit/5871f8b7d0a2a89a6cbb57561a292b32381c74b6)) +* **client:** more robust error parsing ([1043b59](https://github.com/ArcadeAI/arcade-java/commit/1043b591c5cee640130803058086ab444bd07b58)) +* support setting headers via env ([219088d](https://github.com/ArcadeAI/arcade-java/commit/219088d6cdc541d7ae57d36a438f2e6b8894f106)) + + +### Bug Fixes + +* **client:** allow updating header/query affecting fields in `toBuilder()` ([f86e1f2](https://github.com/ArcadeAI/arcade-java/commit/f86e1f2dff33a369dd6d52119ce670747dfd2392)) + + +### Performance Improvements + +* **client:** create one json mapper ([be74413](https://github.com/ArcadeAI/arcade-java/commit/be744132658d4afa95b3d42edc256a3d245a931a)) + + +### Chores + +* **ci:** skip lint on metadata-only changes ([d5942be](https://github.com/ArcadeAI/arcade-java/commit/d5942be3ea63057a3267602dc72046e71d9a5855)) +* **internal:** bump ktfmt ([f38504b](https://github.com/ArcadeAI/arcade-java/commit/f38504b554f72ac9f701716ff1ad40ec5f1a47b2)) +* **internal:** codegen related update ([317c328](https://github.com/ArcadeAI/arcade-java/commit/317c328ecaf054e2fbdea4b6dbfb3a1451bb5070)) +* **internal:** tweak CI branches ([5213191](https://github.com/ArcadeAI/arcade-java/commit/521319108a7b064979e96ecf2fff5e74681b56bf)) +* **internal:** update gitignore ([c9b3d8f](https://github.com/ArcadeAI/arcade-java/commit/c9b3d8f8b7825876526e6dca16859c9f12fcce37)) +* **internal:** update multipart form array serialization ([abeec96](https://github.com/ArcadeAI/arcade-java/commit/abeec961730398bb0c49f01ea13312468be4787c)) +* **internal:** update retry delay tests ([993657b](https://github.com/ArcadeAI/arcade-java/commit/993657b3ac45eafee6b85f76a578f2c6daaacfe2)) +* remove duplicated dokka setup ([8e3a087](https://github.com/ArcadeAI/arcade-java/commit/8e3a087be33daae54aa87f67cdc62a22f566d504)) +* **tests:** bump steady to v0.19.4 ([0d022df](https://github.com/ArcadeAI/arcade-java/commit/0d022dfe027631ea83e1794bcb9e79824ab28f0f)) +* **tests:** bump steady to v0.19.5 ([d186f97](https://github.com/ArcadeAI/arcade-java/commit/d186f9769310ebff3584418642cc0b31a13e1d1c)) +* **tests:** bump steady to v0.19.6 ([b5094e5](https://github.com/ArcadeAI/arcade-java/commit/b5094e5507917137cf7b30c90e1028c122bd1331)) +* **tests:** bump steady to v0.19.7 ([231a1a7](https://github.com/ArcadeAI/arcade-java/commit/231a1a764782bb5bdcd1118630b3bbd544333aa4)) +* **tests:** bump steady to v0.20.1 ([b936990](https://github.com/ArcadeAI/arcade-java/commit/b93699052685356a902c34f38d8e46a617e77454)) +* **tests:** bump steady to v0.20.2 ([7dfba2e](https://github.com/ArcadeAI/arcade-java/commit/7dfba2ef15e2c5f6412a64f23cde8138159c42ea)) +* **tests:** bump steady to v0.22.1 ([bca6f99](https://github.com/ArcadeAI/arcade-java/commit/bca6f993c4876c486640b25ca1d41ff45f299263)) + + +### Documentation + +* clarify forwards compat behavior ([0053367](https://github.com/ArcadeAI/arcade-java/commit/00533674a82a9ec0815ef3d6cb12390927aa9cd2)) + + +### Refactors + +* **tests:** switch from prism to steady ([ae8ff34](https://github.com/ArcadeAI/arcade-java/commit/ae8ff343537d6ff24a3346fac27516c2bc3e07d9)) + ## 0.1.0-alpha.5 (2026-03-16) Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/ArcadeAI/arcade-java/compare/v0.1.0-alpha.4...v0.1.0-alpha.5) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f910db9..ed588bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,7 +40,7 @@ Most tests require you to [run a mock server](https://github.com/stoplightio/pri ./scripts/mock --daemon ``` -The mock serer will run in the background allowing you to run tests from the command line `./gradlew test` or from your IDE. +The mock server will run in the background allowing you to run tests from the command line `./gradlew test` or from your IDE. To stop the mock server run: ```shell @@ -62,3 +62,22 @@ To format and fix all issues automatically: ```sh $ ./scripts/format ``` + +## Release and pull request process + +As mentioned above, most of the code in this repository is generated. So the pull requests process may different from what you are expecting. Here are the steps: + +- Custom code changes should target the `next` branch in [`ArcadeAI/arcade-java`](https://github.com/arcadeai/arcade-java). +- Be selective on what you are changing, as this may cause [merge conflicts](https://www.stainless.com/docs/sdks/configure/custom-code) with the generated code. +- Create a new pull request against `next`, CI will build and test it. +- Once it is merged to `next`, and when there have been upstream changes to the OpenAPI spec, you will see a pull request titled "release: " (where `` is the next version to be released) +- Review it, most of the changes will have been generated, make sure the changes from your pull request are included. +- Approve the PR, and merge it. + - The `next` branch will be rebased to `main`, so you will need to rewrite the branch, something like: `git fetch origin next && git reset --hard origin/next` +- Once changes are merged to `main` a CI job will deploy the version to [Maven Central](https://central.sonatype.com/search?q=arcade-java). There may be a delay between the time it is published until the time it shows up in the Maven Central search results. + +## Troubleshooting tips + +If you are running into issues deploying to Maven Central, run the [`Release Doctor`](https://github.com/ArcadeAI/arcade-java/actions/workflows/release-doctor.yml) CI job, this will check that the required environment variables are set correctly. + +The [`CI` workflow](https://github.com/ArcadeAI/arcade-java/blob/main/.github/workflows/ci.yml), includes a couple of `if` statments that look like: `github.repository == 'stainless-sdks/arcade-engine-java'`. These are ONLY used for pre-release builds when the Stainless SDK code is generated. These are NOT used currently (in the future if there are multiple Java project repositories, this Maven repository could be used to test nightly builds). Otherwise, [build from source](#building-the-repository-from-source). diff --git a/README.md b/README.md index e1b0ef4..ec9c47b 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/dev.arcade/arcade-java)](https://central.sonatype.com/artifact/dev.arcade/arcade-java/0.1.0-alpha.5) -[![javadoc](https://javadoc.io/badge2/dev.arcade/arcade-java/0.1.0-alpha.5/javadoc.svg)](https://javadoc.io/doc/dev.arcade/arcade-java/0.1.0-alpha.5) +[![Maven Central](https://img.shields.io/maven-central/v/dev.arcade/arcade-java)](https://central.sonatype.com/artifact/dev.arcade/arcade-java/0.1.0-alpha.6) +[![javadoc](https://javadoc.io/badge2/dev.arcade/arcade-java/0.1.0-alpha.6/javadoc.svg)](https://javadoc.io/doc/dev.arcade/arcade-java/0.1.0-alpha.6) @@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found on [docs.arcade.dev](https://docs.arcade.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/dev.arcade/arcade-java/0.1.0-alpha.5). +The REST API documentation can be found on [docs.arcade.dev](https://docs.arcade.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/dev.arcade/arcade-java/0.1.0-alpha.6). @@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.arcade.dev](https://docs.arcade ### Gradle ```kotlin -implementation("dev.arcade:arcade-java:0.1.0-alpha.5") +implementation("dev.arcade:arcade-java:0.1.0-alpha.6") ``` ### Maven @@ -33,7 +33,7 @@ implementation("dev.arcade:arcade-java:0.1.0-alpha.5") dev.arcade arcade-java - 0.1.0-alpha.5 + 0.1.0-alpha.6 ``` @@ -50,7 +50,6 @@ import dev.arcade.client.ArcadeClient; import dev.arcade.client.okhttp.ArcadeOkHttpClient; import dev.arcade.models.tools.ExecuteToolRequest; import dev.arcade.models.tools.ExecuteToolResponse; -import dev.arcade.models.tools.ToolExecuteParams; // Configures using the `arcade.apiKey` and `arcade.baseUrl` system properties // Or configures using the `ARCADE_API_KEY` and `ARCADE_BASE_URL` environment variables @@ -186,7 +185,6 @@ import dev.arcade.client.ArcadeClient; import dev.arcade.client.okhttp.ArcadeOkHttpClient; import dev.arcade.models.tools.ExecuteToolRequest; import dev.arcade.models.tools.ExecuteToolResponse; -import dev.arcade.models.tools.ToolExecuteParams; import java.util.concurrent.CompletableFuture; // Configures using the `arcade.apiKey` and `arcade.baseUrl` system properties @@ -206,7 +204,6 @@ import dev.arcade.client.ArcadeClientAsync; import dev.arcade.client.okhttp.ArcadeOkHttpClientAsync; import dev.arcade.models.tools.ExecuteToolRequest; import dev.arcade.models.tools.ExecuteToolResponse; -import dev.arcade.models.tools.ToolExecuteParams; import java.util.concurrent.CompletableFuture; // Configures using the `arcade.apiKey` and `arcade.baseUrl` system properties @@ -232,7 +229,6 @@ import dev.arcade.core.http.Headers; import dev.arcade.core.http.HttpResponseFor; import dev.arcade.models.chat.ChatRequest; import dev.arcade.models.chat.ChatResponse; -import dev.arcade.models.chat.completions.CompletionCreateParams; ChatRequest params = ChatRequest.builder().build(); HttpResponseFor chatResponse = client.chat().completions().withRawResponse().create(params); @@ -710,7 +706,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 [`ArcadeInvalidDataException`](arcade-java-core/src/main/kotlin/dev/arcade/errors/ArcadeInvalidDataException.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 dev.arcade.models.tools.ExecuteToolResponse; diff --git a/arcade-java-client-okhttp/src/main/kotlin/dev/arcade/client/okhttp/ArcadeOkHttpClient.kt b/arcade-java-client-okhttp/src/main/kotlin/dev/arcade/client/okhttp/ArcadeOkHttpClient.kt index df8b6ec..db14a9f 100644 --- a/arcade-java-client-okhttp/src/main/kotlin/dev/arcade/client/okhttp/ArcadeOkHttpClient.kt +++ b/arcade-java-client-okhttp/src/main/kotlin/dev/arcade/client/okhttp/ArcadeOkHttpClient.kt @@ -230,6 +230,9 @@ class ArcadeOkHttpClient 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. */ diff --git a/arcade-java-client-okhttp/src/main/kotlin/dev/arcade/client/okhttp/ArcadeOkHttpClientAsync.kt b/arcade-java-client-okhttp/src/main/kotlin/dev/arcade/client/okhttp/ArcadeOkHttpClientAsync.kt index 5eee0ac..f03cabe 100644 --- a/arcade-java-client-okhttp/src/main/kotlin/dev/arcade/client/okhttp/ArcadeOkHttpClientAsync.kt +++ b/arcade-java-client-okhttp/src/main/kotlin/dev/arcade/client/okhttp/ArcadeOkHttpClientAsync.kt @@ -230,6 +230,9 @@ class ArcadeOkHttpClientAsync 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. */ diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/core/ClientOptions.kt b/arcade-java-core/src/main/kotlin/dev/arcade/core/ClientOptions.kt index 65f5de9..ffa81fc 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/core/ClientOptions.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/core/ClientOptions.kt @@ -80,6 +80,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. */ @@ -260,6 +263,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. */ @@ -405,6 +411,14 @@ private constructor( (System.getProperty("arcade.apiKey") ?: System.getenv("ARCADE_API_KEY"))?.let { apiKey(it) } + System.getenv("ARCADE_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()) + } + } + } } /** @@ -453,13 +467,14 @@ private constructor( headers.put("X-Stainless-Runtime", "JRE") headers.put("X-Stainless-Runtime-Version", getJavaVersion()) headers.put("X-Stainless-Kotlin-Version", KotlinVersion.CURRENT.toString()) + // We replace after all the default headers to allow end-users to overwrite them. + headers.replaceAll(this.headers.build()) + queryParams.replaceAll(this.queryParams.build()) apiKey.let { if (!it.isEmpty()) { - headers.put("Authorization", it) + headers.replace("Authorization", it) } } - headers.replaceAll(this.headers.build()) - queryParams.replaceAll(this.queryParams.build()) return ClientOptions( httpClient, diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/core/ObjectMappers.kt b/arcade-java-core/src/main/kotlin/dev/arcade/core/ObjectMappers.kt index 9fb2ee7..6a815ab 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/core/ObjectMappers.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/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/arcade-java-core/src/main/kotlin/dev/arcade/core/RequestOptions.kt b/arcade-java-core/src/main/kotlin/dev/arcade/core/RequestOptions.kt index 59a7d7f..f1f8154 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/core/RequestOptions.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/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/arcade-java-core/src/main/kotlin/dev/arcade/errors/BadRequestException.kt b/arcade-java-core/src/main/kotlin/dev/arcade/errors/BadRequestException.kt index b5cd72d..9c90f64 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/errors/BadRequestException.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/errors/BadRequestException.kt @@ -5,12 +5,16 @@ package dev.arcade.errors import dev.arcade.core.JsonValue import dev.arcade.core.checkRequired import dev.arcade.core.http.Headers +import dev.arcade.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?) : - ArcadeServiceException("400: $body", cause) { + ArcadeServiceException( + "400: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 400 diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/errors/InternalServerException.kt b/arcade-java-core/src/main/kotlin/dev/arcade/errors/InternalServerException.kt index faa5ede..b3e6868 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/errors/InternalServerException.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/errors/InternalServerException.kt @@ -5,6 +5,7 @@ package dev.arcade.errors import dev.arcade.core.JsonValue import dev.arcade.core.checkRequired import dev.arcade.core.http.Headers +import dev.arcade.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?, -) : ArcadeServiceException("$statusCode: $body", cause) { +) : + ArcadeServiceException( + "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = statusCode diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/errors/NotFoundException.kt b/arcade-java-core/src/main/kotlin/dev/arcade/errors/NotFoundException.kt index b156be1..9971517 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/errors/NotFoundException.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/errors/NotFoundException.kt @@ -5,12 +5,16 @@ package dev.arcade.errors import dev.arcade.core.JsonValue import dev.arcade.core.checkRequired import dev.arcade.core.http.Headers +import dev.arcade.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?) : - ArcadeServiceException("404: $body", cause) { + ArcadeServiceException( + "404: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 404 diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/errors/PermissionDeniedException.kt b/arcade-java-core/src/main/kotlin/dev/arcade/errors/PermissionDeniedException.kt index 5c77c7a..9cbb855 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/errors/PermissionDeniedException.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/errors/PermissionDeniedException.kt @@ -5,12 +5,16 @@ package dev.arcade.errors import dev.arcade.core.JsonValue import dev.arcade.core.checkRequired import dev.arcade.core.http.Headers +import dev.arcade.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?) : - ArcadeServiceException("403: $body", cause) { + ArcadeServiceException( + "403: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 403 diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/errors/RateLimitException.kt b/arcade-java-core/src/main/kotlin/dev/arcade/errors/RateLimitException.kt index 290070c..f96f7ef 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/errors/RateLimitException.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/errors/RateLimitException.kt @@ -5,12 +5,16 @@ package dev.arcade.errors import dev.arcade.core.JsonValue import dev.arcade.core.checkRequired import dev.arcade.core.http.Headers +import dev.arcade.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?) : - ArcadeServiceException("429: $body", cause) { + ArcadeServiceException( + "429: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 429 diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnauthorizedException.kt b/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnauthorizedException.kt index 258076a..094b13f 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnauthorizedException.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnauthorizedException.kt @@ -5,12 +5,16 @@ package dev.arcade.errors import dev.arcade.core.JsonValue import dev.arcade.core.checkRequired import dev.arcade.core.http.Headers +import dev.arcade.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?) : - ArcadeServiceException("401: $body", cause) { + ArcadeServiceException( + "401: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 401 diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnexpectedStatusCodeException.kt b/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnexpectedStatusCodeException.kt index a7a0400..3813475 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnexpectedStatusCodeException.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnexpectedStatusCodeException.kt @@ -5,6 +5,7 @@ package dev.arcade.errors import dev.arcade.core.JsonValue import dev.arcade.core.checkRequired import dev.arcade.core.http.Headers +import dev.arcade.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?, -) : ArcadeServiceException("$statusCode: $body", cause) { +) : + ArcadeServiceException( + "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = statusCode diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnprocessableEntityException.kt b/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnprocessableEntityException.kt index b94b126..115d3b4 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnprocessableEntityException.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/errors/UnprocessableEntityException.kt @@ -5,12 +5,16 @@ package dev.arcade.errors import dev.arcade.core.JsonValue import dev.arcade.core.checkRequired import dev.arcade.core.http.Headers +import dev.arcade.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?) : - ArcadeServiceException("422: $body", cause) { + ArcadeServiceException( + "422: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}", + cause, + ) { override fun statusCode(): Int = 422 diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/AuthorizationContext.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/AuthorizationContext.kt index 6adbac1..0336aaf 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/AuthorizationContext.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/AuthorizationContext.kt @@ -140,6 +140,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthorizationContext = apply { if (validated) { return@apply @@ -226,6 +234,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserInfo = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/AuthorizationResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/AuthorizationResponse.kt index 0eddad8..4aa970f 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/AuthorizationResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/AuthorizationResponse.kt @@ -308,6 +308,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthorizationResponse = apply { if (validated) { return@apply @@ -445,6 +453,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Status = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/Error.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/Error.kt index 40800cb..2c37ff7 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/Error.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/Error.kt @@ -136,6 +136,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Error = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderCreateRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderCreateRequest.kt index dbff3f9..abe0c9a 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderCreateRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderCreateRequest.kt @@ -311,6 +311,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthProviderCreateRequest = apply { if (validated) { return@apply @@ -768,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply @@ -1190,6 +1207,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthorizeRequest = apply { if (validated) { return@apply @@ -1292,6 +1319,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -1433,6 +1470,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -1569,6 +1616,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -1668,6 +1725,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -1887,6 +1954,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Pkce = apply { if (validated) { return@apply @@ -2316,6 +2393,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RefreshRequest = apply { if (validated) { return@apply @@ -2418,6 +2505,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -2559,6 +2656,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -2695,6 +2802,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -2794,6 +2911,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -2969,6 +3096,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ScopeDelimiter = apply { if (validated) { return@apply @@ -3426,6 +3563,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TokenIntrospectionRequest = apply { if (validated) { return@apply @@ -3613,6 +3760,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Triggers = apply { if (validated) { return@apply @@ -3724,6 +3881,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -3865,6 +4032,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -4001,6 +4178,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -4100,6 +4287,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -4562,6 +4759,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TokenRequest = apply { if (validated) { return@apply @@ -4664,6 +4871,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -4805,6 +5022,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -4941,6 +5168,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -5040,6 +5277,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -5538,6 +5785,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserInfoRequest = apply { if (validated) { return@apply @@ -5725,6 +5982,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Triggers = apply { if (validated) { return@apply @@ -5836,6 +6103,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -5977,6 +6254,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -6113,6 +6400,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -6212,6 +6509,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponse.kt index d6bc9c0..4c94a07 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponse.kt @@ -245,6 +245,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthProviderListResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt index c00cfb8..5117fd4 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt @@ -359,6 +359,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthProviderResponse = apply { if (validated) { return@apply @@ -524,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Binding = apply { if (validated) { return@apply @@ -653,6 +670,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1153,6 +1180,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply @@ -1600,6 +1636,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthorizeRequest = apply { if (validated) { return@apply @@ -1704,6 +1750,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -1808,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -2087,6 +2153,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ClientSecret = apply { if (validated) { return@apply @@ -2225,6 +2301,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Binding = apply { if (validated) { return@apply @@ -2424,6 +2510,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Pkce = apply { if (validated) { return@apply @@ -2876,6 +2972,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RefreshRequest = apply { if (validated) { return@apply @@ -2980,6 +3086,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -3084,6 +3200,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -3640,6 +3766,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TokenIntrospectionRequest = apply { if (validated) { return@apply @@ -3748,6 +3884,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -3852,6 +3998,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -4040,6 +4196,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Triggers = apply { if (validated) { return@apply @@ -4535,6 +4701,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): TokenRequest = apply { if (validated) { return@apply @@ -4639,6 +4815,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -4743,6 +4929,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -5263,6 +5459,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserInfoRequest = apply { if (validated) { return@apply @@ -5369,6 +5575,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -5473,6 +5689,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -5661,6 +5887,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Triggers = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequest.kt index 159520d..9057d6c 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequest.kt @@ -264,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthProviderUpdateRequest = apply { if (validated) { return@apply @@ -309,6 +317,7 @@ private constructor( private val pkce: JsonField, private val refreshRequest: JsonField, private val scopeDelimiter: JsonField, + private val tokenIntrospectionRequest: JsonField, private val tokenRequest: JsonField, private val userInfoRequest: JsonField, private val additionalProperties: MutableMap, @@ -332,6 +341,9 @@ private constructor( @JsonProperty("scope_delimiter") @ExcludeMissing scopeDelimiter: JsonField = JsonMissing.of(), + @JsonProperty("token_introspection_request") + @ExcludeMissing + tokenIntrospectionRequest: JsonField = JsonMissing.of(), @JsonProperty("token_request") @ExcludeMissing tokenRequest: JsonField = JsonMissing.of(), @@ -345,6 +357,7 @@ private constructor( pkce, refreshRequest, scopeDelimiter, + tokenIntrospectionRequest, tokenRequest, userInfoRequest, mutableMapOf(), @@ -389,6 +402,13 @@ private constructor( fun scopeDelimiter(): Optional = scopeDelimiter.getOptional("scope_delimiter") + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun tokenIntrospectionRequest(): Optional = + tokenIntrospectionRequest.getOptional("token_introspection_request") + /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -456,6 +476,17 @@ private constructor( @ExcludeMissing fun _scopeDelimiter(): JsonField = scopeDelimiter + /** + * Returns the raw JSON value of [tokenIntrospectionRequest]. + * + * Unlike [tokenIntrospectionRequest], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("token_introspection_request") + @ExcludeMissing + fun _tokenIntrospectionRequest(): JsonField = + tokenIntrospectionRequest + /** * Returns the raw JSON value of [tokenRequest]. * @@ -503,6 +534,8 @@ private constructor( private var pkce: JsonField = JsonMissing.of() private var refreshRequest: JsonField = JsonMissing.of() private var scopeDelimiter: JsonField = JsonMissing.of() + private var tokenIntrospectionRequest: JsonField = + JsonMissing.of() private var tokenRequest: JsonField = JsonMissing.of() private var userInfoRequest: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -515,6 +548,7 @@ private constructor( pkce = oauth2.pkce refreshRequest = oauth2.refreshRequest scopeDelimiter = oauth2.scopeDelimiter + tokenIntrospectionRequest = oauth2.tokenIntrospectionRequest tokenRequest = oauth2.tokenRequest userInfoRequest = oauth2.userInfoRequest additionalProperties = oauth2.additionalProperties.toMutableMap() @@ -597,6 +631,20 @@ private constructor( this.scopeDelimiter = scopeDelimiter } + fun tokenIntrospectionRequest(tokenIntrospectionRequest: TokenIntrospectionRequest) = + tokenIntrospectionRequest(JsonField.of(tokenIntrospectionRequest)) + + /** + * Sets [Builder.tokenIntrospectionRequest] to an arbitrary JSON value. + * + * You should usually call [Builder.tokenIntrospectionRequest] with a well-typed + * [TokenIntrospectionRequest] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun tokenIntrospectionRequest( + tokenIntrospectionRequest: JsonField + ) = apply { this.tokenIntrospectionRequest = tokenIntrospectionRequest } + fun tokenRequest(tokenRequest: TokenRequest) = tokenRequest(JsonField.of(tokenRequest)) /** @@ -656,6 +704,7 @@ private constructor( pkce, refreshRequest, scopeDelimiter, + tokenIntrospectionRequest, tokenRequest, userInfoRequest, additionalProperties.toMutableMap(), @@ -664,6 +713,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply @@ -675,6 +733,7 @@ private constructor( pkce().ifPresent { it.validate() } refreshRequest().ifPresent { it.validate() } scopeDelimiter().ifPresent { it.validate() } + tokenIntrospectionRequest().ifPresent { it.validate() } tokenRequest().ifPresent { it.validate() } userInfoRequest().ifPresent { it.validate() } validated = true @@ -702,6 +761,7 @@ private constructor( (pkce.asKnown().getOrNull()?.validity() ?: 0) + (refreshRequest.asKnown().getOrNull()?.validity() ?: 0) + (scopeDelimiter.asKnown().getOrNull()?.validity() ?: 0) + + (tokenIntrospectionRequest.asKnown().getOrNull()?.validity() ?: 0) + (tokenRequest.asKnown().getOrNull()?.validity() ?: 0) + (userInfoRequest.asKnown().getOrNull()?.validity() ?: 0) @@ -1069,6 +1129,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthorizeRequest = apply { if (validated) { return@apply @@ -1171,6 +1241,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -1312,6 +1392,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -1448,6 +1538,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -1547,6 +1647,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -1766,6 +1876,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Pkce = apply { if (validated) { return@apply @@ -2180,6 +2300,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): RefreshRequest = apply { if (validated) { return@apply @@ -2282,6 +2412,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -2423,6 +2563,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -2559,6 +2709,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -2658,6 +2818,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -2833,6 +3003,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ScopeDelimiter = apply { if (validated) { return@apply @@ -2871,7 +3051,7 @@ private constructor( override fun toString() = value.toString() } - class TokenRequest + class TokenIntrospectionRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val authHeaderValueFormat: JsonField, @@ -2882,6 +3062,7 @@ private constructor( private val requestContentType: JsonField, private val responseContentType: JsonField, private val responseMap: JsonField, + private val triggers: JsonField, private val additionalProperties: MutableMap, ) { @@ -2911,6 +3092,9 @@ private constructor( @JsonProperty("response_map") @ExcludeMissing responseMap: JsonField = JsonMissing.of(), + @JsonProperty("triggers") + @ExcludeMissing + triggers: JsonField = JsonMissing.of(), ) : this( authHeaderValueFormat, authMethod, @@ -2920,6 +3104,7 @@ private constructor( requestContentType, responseContentType, responseMap, + triggers, mutableMapOf(), ) @@ -2974,6 +3159,12 @@ private constructor( */ fun responseMap(): Optional = responseMap.getOptional("response_map") + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun triggers(): Optional = triggers.getOptional("triggers") + /** * Returns the raw JSON value of [authHeaderValueFormat]. * @@ -3046,6 +3237,16 @@ private constructor( @ExcludeMissing fun _responseMap(): JsonField = responseMap + /** + * Returns the raw JSON value of [triggers]. + * + * Unlike [triggers], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("triggers") + @ExcludeMissing + fun _triggers(): JsonField = triggers + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -3060,11 +3261,14 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [TokenRequest]. */ + /** + * Returns a mutable builder for constructing an instance of + * [TokenIntrospectionRequest]. + */ @JvmStatic fun builder() = Builder() } - /** A builder for [TokenRequest]. */ + /** A builder for [TokenIntrospectionRequest]. */ class Builder internal constructor() { private var authHeaderValueFormat: JsonField = JsonMissing.of() @@ -3075,19 +3279,22 @@ private constructor( private var requestContentType: JsonField = JsonMissing.of() private var responseContentType: JsonField = JsonMissing.of() private var responseMap: JsonField = JsonMissing.of() + private var triggers: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(tokenRequest: TokenRequest) = apply { - authHeaderValueFormat = tokenRequest.authHeaderValueFormat - authMethod = tokenRequest.authMethod - endpoint = tokenRequest.endpoint - method = tokenRequest.method - params = tokenRequest.params - requestContentType = tokenRequest.requestContentType - responseContentType = tokenRequest.responseContentType - responseMap = tokenRequest.responseMap - additionalProperties = tokenRequest.additionalProperties.toMutableMap() + internal fun from(tokenIntrospectionRequest: TokenIntrospectionRequest) = apply { + authHeaderValueFormat = tokenIntrospectionRequest.authHeaderValueFormat + authMethod = tokenIntrospectionRequest.authMethod + endpoint = tokenIntrospectionRequest.endpoint + method = tokenIntrospectionRequest.method + params = tokenIntrospectionRequest.params + requestContentType = tokenIntrospectionRequest.requestContentType + responseContentType = tokenIntrospectionRequest.responseContentType + responseMap = tokenIntrospectionRequest.responseMap + triggers = tokenIntrospectionRequest.triggers + additionalProperties = + tokenIntrospectionRequest.additionalProperties.toMutableMap() } fun authHeaderValueFormat(authHeaderValueFormat: String) = @@ -3192,6 +3399,17 @@ private constructor( this.responseMap = responseMap } + fun triggers(triggers: Triggers) = triggers(JsonField.of(triggers)) + + /** + * Sets [Builder.triggers] to an arbitrary JSON value. + * + * You should usually call [Builder.triggers] with a well-typed [Triggers] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun triggers(triggers: JsonField) = apply { this.triggers = triggers } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3215,12 +3433,12 @@ private constructor( } /** - * Returns an immutable instance of [TokenRequest]. + * Returns an immutable instance of [TokenIntrospectionRequest]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): TokenRequest = - TokenRequest( + fun build(): TokenIntrospectionRequest = + TokenIntrospectionRequest( authHeaderValueFormat, authMethod, endpoint, @@ -3229,13 +3447,24 @@ private constructor( requestContentType, responseContentType, responseMap, + triggers, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): TokenRequest = apply { + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): TokenIntrospectionRequest = apply { if (validated) { return@apply } @@ -3248,6 +3477,7 @@ private constructor( requestContentType().ifPresent { it.validate() } responseContentType().ifPresent { it.validate() } responseMap().ifPresent { it.validate() } + triggers().ifPresent { it.validate() } validated = true } @@ -3274,7 +3504,8 @@ private constructor( (params.asKnown().getOrNull()?.validity() ?: 0) + (requestContentType.asKnown().getOrNull()?.validity() ?: 0) + (responseContentType.asKnown().getOrNull()?.validity() ?: 0) + - (responseMap.asKnown().getOrNull()?.validity() ?: 0) + (responseMap.asKnown().getOrNull()?.validity() ?: 0) + + (triggers.asKnown().getOrNull()?.validity() ?: 0) class Params @JsonCreator @@ -3337,6 +3568,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -3478,6 +3719,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -3614,6 +3865,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -3713,6 +3974,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -3757,66 +4028,1245 @@ private constructor( override fun toString() = "ResponseMap{additionalProperties=$additionalProperties}" } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TokenRequest && - authHeaderValueFormat == other.authHeaderValueFormat && - authMethod == other.authMethod && - endpoint == other.endpoint && - method == other.method && - params == other.params && - requestContentType == other.requestContentType && - responseContentType == other.responseContentType && - responseMap == other.responseMap && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - authHeaderValueFormat, - authMethod, - endpoint, - method, - params, - requestContentType, - responseContentType, - responseMap, - additionalProperties, - ) - } + class Triggers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val onTokenGrant: JsonField, + private val onTokenRefresh: JsonField, + private val additionalProperties: MutableMap, + ) { - override fun hashCode(): Int = hashCode + @JsonCreator + private constructor( + @JsonProperty("on_token_grant") + @ExcludeMissing + onTokenGrant: JsonField = JsonMissing.of(), + @JsonProperty("on_token_refresh") + @ExcludeMissing + onTokenRefresh: JsonField = JsonMissing.of(), + ) : this(onTokenGrant, onTokenRefresh, mutableMapOf()) - override fun toString() = - "TokenRequest{authHeaderValueFormat=$authHeaderValueFormat, authMethod=$authMethod, endpoint=$endpoint, method=$method, params=$params, requestContentType=$requestContentType, responseContentType=$responseContentType, responseMap=$responseMap, additionalProperties=$additionalProperties}" - } + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun onTokenGrant(): Optional = onTokenGrant.getOptional("on_token_grant") - class UserInfoRequest - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val authHeaderValueFormat: JsonField, - private val authMethod: JsonField, - private val endpoint: JsonField, - private val method: JsonField, - private val params: JsonField, - private val requestContentType: JsonField, - private val responseContentType: JsonField, - private val responseMap: JsonField, - private val triggers: JsonField, - private val additionalProperties: MutableMap, - ) { + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun onTokenRefresh(): Optional = + onTokenRefresh.getOptional("on_token_refresh") - @JsonCreator - private constructor( - @JsonProperty("auth_header_value_format") - @ExcludeMissing - authHeaderValueFormat: JsonField = JsonMissing.of(), - @JsonProperty("auth_method") + /** + * Returns the raw JSON value of [onTokenGrant]. + * + * Unlike [onTokenGrant], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("on_token_grant") @ExcludeMissing - authMethod: JsonField = JsonMissing.of(), + fun _onTokenGrant(): JsonField = onTokenGrant + + /** + * Returns the raw JSON value of [onTokenRefresh]. + * + * Unlike [onTokenRefresh], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("on_token_refresh") + @ExcludeMissing + fun _onTokenRefresh(): JsonField = onTokenRefresh + + @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 [Triggers]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Triggers]. */ + class Builder internal constructor() { + + private var onTokenGrant: JsonField = JsonMissing.of() + private var onTokenRefresh: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(triggers: Triggers) = apply { + onTokenGrant = triggers.onTokenGrant + onTokenRefresh = triggers.onTokenRefresh + additionalProperties = triggers.additionalProperties.toMutableMap() + } + + fun onTokenGrant(onTokenGrant: Boolean) = + onTokenGrant(JsonField.of(onTokenGrant)) + + /** + * Sets [Builder.onTokenGrant] to an arbitrary JSON value. + * + * You should usually call [Builder.onTokenGrant] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun onTokenGrant(onTokenGrant: JsonField) = apply { + this.onTokenGrant = onTokenGrant + } + + fun onTokenRefresh(onTokenRefresh: Boolean) = + onTokenRefresh(JsonField.of(onTokenRefresh)) + + /** + * Sets [Builder.onTokenRefresh] to an arbitrary JSON value. + * + * You should usually call [Builder.onTokenRefresh] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun onTokenRefresh(onTokenRefresh: JsonField) = apply { + this.onTokenRefresh = onTokenRefresh + } + + 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 [Triggers]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Triggers = + Triggers(onTokenGrant, onTokenRefresh, 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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Triggers = apply { + if (validated) { + return@apply + } + + onTokenGrant() + onTokenRefresh() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ArcadeInvalidDataException) { + 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 (onTokenGrant.asKnown().isPresent) 1 else 0) + + (if (onTokenRefresh.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Triggers && + onTokenGrant == other.onTokenGrant && + onTokenRefresh == other.onTokenRefresh && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(onTokenGrant, onTokenRefresh, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Triggers{onTokenGrant=$onTokenGrant, onTokenRefresh=$onTokenRefresh, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TokenIntrospectionRequest && + authHeaderValueFormat == other.authHeaderValueFormat && + authMethod == other.authMethod && + endpoint == other.endpoint && + method == other.method && + params == other.params && + requestContentType == other.requestContentType && + responseContentType == other.responseContentType && + responseMap == other.responseMap && + triggers == other.triggers && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + authHeaderValueFormat, + authMethod, + endpoint, + method, + params, + requestContentType, + responseContentType, + responseMap, + triggers, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TokenIntrospectionRequest{authHeaderValueFormat=$authHeaderValueFormat, authMethod=$authMethod, endpoint=$endpoint, method=$method, params=$params, requestContentType=$requestContentType, responseContentType=$responseContentType, responseMap=$responseMap, triggers=$triggers, additionalProperties=$additionalProperties}" + } + + class TokenRequest + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val authHeaderValueFormat: JsonField, + private val authMethod: JsonField, + private val endpoint: JsonField, + private val method: JsonField, + private val params: JsonField, + private val requestContentType: JsonField, + private val responseContentType: JsonField, + private val responseMap: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("auth_header_value_format") + @ExcludeMissing + authHeaderValueFormat: JsonField = JsonMissing.of(), + @JsonProperty("auth_method") + @ExcludeMissing + authMethod: JsonField = JsonMissing.of(), + @JsonProperty("endpoint") + @ExcludeMissing + endpoint: JsonField = JsonMissing.of(), + @JsonProperty("method") + @ExcludeMissing + method: JsonField = JsonMissing.of(), + @JsonProperty("params") + @ExcludeMissing + params: JsonField = JsonMissing.of(), + @JsonProperty("request_content_type") + @ExcludeMissing + requestContentType: JsonField = JsonMissing.of(), + @JsonProperty("response_content_type") + @ExcludeMissing + responseContentType: JsonField = JsonMissing.of(), + @JsonProperty("response_map") + @ExcludeMissing + responseMap: JsonField = JsonMissing.of(), + ) : this( + authHeaderValueFormat, + authMethod, + endpoint, + method, + params, + requestContentType, + responseContentType, + responseMap, + mutableMapOf(), + ) + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun authHeaderValueFormat(): Optional = + authHeaderValueFormat.getOptional("auth_header_value_format") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun authMethod(): Optional = authMethod.getOptional("auth_method") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun endpoint(): Optional = endpoint.getOptional("endpoint") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun method(): Optional = method.getOptional("method") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun params(): Optional = params.getOptional("params") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun requestContentType(): Optional = + requestContentType.getOptional("request_content_type") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun responseContentType(): Optional = + responseContentType.getOptional("response_content_type") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun responseMap(): Optional = responseMap.getOptional("response_map") + + /** + * Returns the raw JSON value of [authHeaderValueFormat]. + * + * Unlike [authHeaderValueFormat], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("auth_header_value_format") + @ExcludeMissing + fun _authHeaderValueFormat(): JsonField = authHeaderValueFormat + + /** + * Returns the raw JSON value of [authMethod]. + * + * Unlike [authMethod], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("auth_method") + @ExcludeMissing + fun _authMethod(): JsonField = authMethod + + /** + * Returns the raw JSON value of [endpoint]. + * + * Unlike [endpoint], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("endpoint") @ExcludeMissing fun _endpoint(): JsonField = endpoint + + /** + * Returns the raw JSON value of [method]. + * + * Unlike [method], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("method") @ExcludeMissing fun _method(): JsonField = method + + /** + * Returns the raw JSON value of [params]. + * + * Unlike [params], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("params") @ExcludeMissing fun _params(): JsonField = params + + /** + * Returns the raw JSON value of [requestContentType]. + * + * Unlike [requestContentType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("request_content_type") + @ExcludeMissing + fun _requestContentType(): JsonField = requestContentType + + /** + * Returns the raw JSON value of [responseContentType]. + * + * Unlike [responseContentType], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("response_content_type") + @ExcludeMissing + fun _responseContentType(): JsonField = responseContentType + + /** + * Returns the raw JSON value of [responseMap]. + * + * Unlike [responseMap], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("response_map") + @ExcludeMissing + fun _responseMap(): JsonField = responseMap + + @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 [TokenRequest]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TokenRequest]. */ + class Builder internal constructor() { + + private var authHeaderValueFormat: JsonField = JsonMissing.of() + private var authMethod: JsonField = JsonMissing.of() + private var endpoint: JsonField = JsonMissing.of() + private var method: JsonField = JsonMissing.of() + private var params: JsonField = JsonMissing.of() + private var requestContentType: JsonField = JsonMissing.of() + private var responseContentType: JsonField = JsonMissing.of() + private var responseMap: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(tokenRequest: TokenRequest) = apply { + authHeaderValueFormat = tokenRequest.authHeaderValueFormat + authMethod = tokenRequest.authMethod + endpoint = tokenRequest.endpoint + method = tokenRequest.method + params = tokenRequest.params + requestContentType = tokenRequest.requestContentType + responseContentType = tokenRequest.responseContentType + responseMap = tokenRequest.responseMap + additionalProperties = tokenRequest.additionalProperties.toMutableMap() + } + + fun authHeaderValueFormat(authHeaderValueFormat: String) = + authHeaderValueFormat(JsonField.of(authHeaderValueFormat)) + + /** + * Sets [Builder.authHeaderValueFormat] to an arbitrary JSON value. + * + * You should usually call [Builder.authHeaderValueFormat] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun authHeaderValueFormat(authHeaderValueFormat: JsonField) = apply { + this.authHeaderValueFormat = authHeaderValueFormat + } + + fun authMethod(authMethod: String) = authMethod(JsonField.of(authMethod)) + + /** + * Sets [Builder.authMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.authMethod] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun authMethod(authMethod: JsonField) = apply { + this.authMethod = authMethod + } + + fun endpoint(endpoint: String) = endpoint(JsonField.of(endpoint)) + + /** + * Sets [Builder.endpoint] to an arbitrary JSON value. + * + * You should usually call [Builder.endpoint] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun endpoint(endpoint: JsonField) = apply { this.endpoint = endpoint } + + fun method(method: String) = method(JsonField.of(method)) + + /** + * Sets [Builder.method] to an arbitrary JSON value. + * + * You should usually call [Builder.method] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun method(method: JsonField) = apply { this.method = method } + + fun params(params: Params) = params(JsonField.of(params)) + + /** + * Sets [Builder.params] to an arbitrary JSON value. + * + * You should usually call [Builder.params] with a well-typed [Params] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun params(params: JsonField) = apply { this.params = params } + + fun requestContentType(requestContentType: RequestContentType) = + requestContentType(JsonField.of(requestContentType)) + + /** + * Sets [Builder.requestContentType] to an arbitrary JSON value. + * + * You should usually call [Builder.requestContentType] with a well-typed + * [RequestContentType] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun requestContentType(requestContentType: JsonField) = apply { + this.requestContentType = requestContentType + } + + fun responseContentType(responseContentType: ResponseContentType) = + responseContentType(JsonField.of(responseContentType)) + + /** + * Sets [Builder.responseContentType] to an arbitrary JSON value. + * + * You should usually call [Builder.responseContentType] with a well-typed + * [ResponseContentType] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun responseContentType(responseContentType: JsonField) = + apply { + this.responseContentType = responseContentType + } + + fun responseMap(responseMap: ResponseMap) = responseMap(JsonField.of(responseMap)) + + /** + * Sets [Builder.responseMap] to an arbitrary JSON value. + * + * You should usually call [Builder.responseMap] with a well-typed [ResponseMap] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun responseMap(responseMap: JsonField) = apply { + this.responseMap = responseMap + } + + 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 [TokenRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): TokenRequest = + TokenRequest( + authHeaderValueFormat, + authMethod, + endpoint, + method, + params, + requestContentType, + responseContentType, + responseMap, + 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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): TokenRequest = apply { + if (validated) { + return@apply + } + + authHeaderValueFormat() + authMethod() + endpoint() + method() + params().ifPresent { it.validate() } + requestContentType().ifPresent { it.validate() } + responseContentType().ifPresent { it.validate() } + responseMap().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ArcadeInvalidDataException) { + 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 (authHeaderValueFormat.asKnown().isPresent) 1 else 0) + + (if (authMethod.asKnown().isPresent) 1 else 0) + + (if (endpoint.asKnown().isPresent) 1 else 0) + + (if (method.asKnown().isPresent) 1 else 0) + + (params.asKnown().getOrNull()?.validity() ?: 0) + + (requestContentType.asKnown().getOrNull()?.validity() ?: 0) + + (responseContentType.asKnown().getOrNull()?.validity() ?: 0) + + (responseMap.asKnown().getOrNull()?.validity() ?: 0) + + class Params + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Params]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Params]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(params: Params) = apply { + additionalProperties = params.additionalProperties.toMutableMap() + } + + 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 [Params]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Params = Params(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Params = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ArcadeInvalidDataException) { + 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Params && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Params{additionalProperties=$additionalProperties}" + } + + class RequestContentType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField + val APPLICATION_X_WWW_FORM_URLENCODED = of("application/x-www-form-urlencoded") + + @JvmField val APPLICATION_JSON = of("application/json") + + @JvmStatic fun of(value: String) = RequestContentType(JsonField.of(value)) + } + + /** An enum containing [RequestContentType]'s known values. */ + enum class Known { + APPLICATION_X_WWW_FORM_URLENCODED, + APPLICATION_JSON, + } + + /** + * An enum containing [RequestContentType]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [RequestContentType] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + APPLICATION_X_WWW_FORM_URLENCODED, + APPLICATION_JSON, + /** + * An enum member indicating that [RequestContentType] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + APPLICATION_X_WWW_FORM_URLENCODED -> Value.APPLICATION_X_WWW_FORM_URLENCODED + APPLICATION_JSON -> Value.APPLICATION_JSON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws ArcadeInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + APPLICATION_X_WWW_FORM_URLENCODED -> Known.APPLICATION_X_WWW_FORM_URLENCODED + APPLICATION_JSON -> Known.APPLICATION_JSON + else -> + throw ArcadeInvalidDataException("Unknown RequestContentType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws ArcadeInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ArcadeInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): RequestContentType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ArcadeInvalidDataException) { + 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 (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RequestContentType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class ResponseContentType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField + val APPLICATION_X_WWW_FORM_URLENCODED = of("application/x-www-form-urlencoded") + + @JvmField val APPLICATION_JSON = of("application/json") + + @JvmStatic fun of(value: String) = ResponseContentType(JsonField.of(value)) + } + + /** An enum containing [ResponseContentType]'s known values. */ + enum class Known { + APPLICATION_X_WWW_FORM_URLENCODED, + APPLICATION_JSON, + } + + /** + * An enum containing [ResponseContentType]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [ResponseContentType] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + APPLICATION_X_WWW_FORM_URLENCODED, + APPLICATION_JSON, + /** + * An enum member indicating that [ResponseContentType] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + APPLICATION_X_WWW_FORM_URLENCODED -> Value.APPLICATION_X_WWW_FORM_URLENCODED + APPLICATION_JSON -> Value.APPLICATION_JSON + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws ArcadeInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + APPLICATION_X_WWW_FORM_URLENCODED -> Known.APPLICATION_X_WWW_FORM_URLENCODED + APPLICATION_JSON -> Known.APPLICATION_JSON + else -> + throw ArcadeInvalidDataException("Unknown ResponseContentType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws ArcadeInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ArcadeInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ResponseContentType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ArcadeInvalidDataException) { + 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 (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResponseContentType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class ResponseMap + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ResponseMap]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResponseMap]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(responseMap: ResponseMap) = apply { + additionalProperties = responseMap.additionalProperties.toMutableMap() + } + + 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 [ResponseMap]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ResponseMap = ResponseMap(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ResponseMap = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ArcadeInvalidDataException) { + 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 = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ResponseMap && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ResponseMap{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TokenRequest && + authHeaderValueFormat == other.authHeaderValueFormat && + authMethod == other.authMethod && + endpoint == other.endpoint && + method == other.method && + params == other.params && + requestContentType == other.requestContentType && + responseContentType == other.responseContentType && + responseMap == other.responseMap && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + authHeaderValueFormat, + authMethod, + endpoint, + method, + params, + requestContentType, + responseContentType, + responseMap, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TokenRequest{authHeaderValueFormat=$authHeaderValueFormat, authMethod=$authMethod, endpoint=$endpoint, method=$method, params=$params, requestContentType=$requestContentType, responseContentType=$responseContentType, responseMap=$responseMap, additionalProperties=$additionalProperties}" + } + + class UserInfoRequest + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val authHeaderValueFormat: JsonField, + private val authMethod: JsonField, + private val endpoint: JsonField, + private val method: JsonField, + private val params: JsonField, + private val requestContentType: JsonField, + private val responseContentType: JsonField, + private val responseMap: JsonField, + private val triggers: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("auth_header_value_format") + @ExcludeMissing + authHeaderValueFormat: JsonField = JsonMissing.of(), + @JsonProperty("auth_method") + @ExcludeMissing + authMethod: JsonField = JsonMissing.of(), @JsonProperty("endpoint") @ExcludeMissing endpoint: JsonField = JsonMissing.of(), @@ -4193,6 +5643,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserInfoRequest = apply { if (validated) { return@apply @@ -4297,6 +5757,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Params = apply { if (validated) { return@apply @@ -4438,6 +5908,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): RequestContentType = apply { if (validated) { return@apply @@ -4574,6 +6054,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseContentType = apply { if (validated) { return@apply @@ -4673,6 +6163,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ResponseMap = apply { if (validated) { return@apply @@ -4861,6 +6361,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Triggers = apply { if (validated) { return@apply @@ -4962,6 +6472,7 @@ private constructor( pkce == other.pkce && refreshRequest == other.refreshRequest && scopeDelimiter == other.scopeDelimiter && + tokenIntrospectionRequest == other.tokenIntrospectionRequest && tokenRequest == other.tokenRequest && userInfoRequest == other.userInfoRequest && additionalProperties == other.additionalProperties @@ -4975,6 +6486,7 @@ private constructor( pkce, refreshRequest, scopeDelimiter, + tokenIntrospectionRequest, tokenRequest, userInfoRequest, additionalProperties, @@ -4984,7 +6496,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Oauth2{authorizeRequest=$authorizeRequest, clientId=$clientId, clientSecret=$clientSecret, pkce=$pkce, refreshRequest=$refreshRequest, scopeDelimiter=$scopeDelimiter, tokenRequest=$tokenRequest, userInfoRequest=$userInfoRequest, additionalProperties=$additionalProperties}" + "Oauth2{authorizeRequest=$authorizeRequest, clientId=$clientId, clientSecret=$clientSecret, pkce=$pkce, refreshRequest=$refreshRequest, scopeDelimiter=$scopeDelimiter, tokenIntrospectionRequest=$tokenIntrospectionRequest, tokenRequest=$tokenRequest, userInfoRequest=$userInfoRequest, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretCreateParams.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretCreateParams.kt index a52b828..d180e72 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretCreateParams.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretCreateParams.kt @@ -430,6 +430,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Body = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretListResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretListResponse.kt index 9459f39..3f5778d 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretListResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretListResponse.kt @@ -243,6 +243,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SecretListResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt index 4146152..5cf6ffe 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt @@ -295,6 +295,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): SecretResponse = apply { if (validated) { return@apply @@ -456,6 +464,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Binding = apply { if (validated) { return@apply @@ -585,6 +602,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListPageResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListPageResponse.kt index 3d40096..8b8c721 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListPageResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListPageResponse.kt @@ -249,6 +249,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserConnectionListPageResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionResponse.kt index e1ea340..7a71e2a 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionResponse.kt @@ -395,6 +395,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UserConnectionResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/AuthRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/AuthRequest.kt index 6c761a5..fee209b 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/AuthRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/AuthRequest.kt @@ -200,6 +200,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthRequest = apply { if (validated) { return@apply @@ -433,6 +441,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthRequirement = apply { if (validated) { return@apply @@ -584,6 +601,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/ConfirmUserRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/ConfirmUserRequest.kt index dcf9388..8cb22e2 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/ConfirmUserRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/ConfirmUserRequest.kt @@ -157,6 +157,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConfirmUserRequest = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/ConfirmUserResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/ConfirmUserResponse.kt index c76f5ba..cda22df 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/ConfirmUserResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/auth/ConfirmUserResponse.kt @@ -156,6 +156,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ConfirmUserResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatMessage.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatMessage.kt index d65d93a..6f6b40d 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatMessage.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatMessage.kt @@ -283,6 +283,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatMessage = apply { if (validated) { return@apply @@ -471,6 +479,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolCall = apply { if (validated) { return@apply @@ -634,6 +651,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Function = apply { if (validated) { return@apply @@ -767,6 +794,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatRequest.kt index 39bceff..1d7add6 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatRequest.kt @@ -768,6 +768,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatRequest = apply { if (validated) { return@apply @@ -891,6 +899,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): LogitBias = apply { if (validated) { return@apply @@ -1027,6 +1044,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ResponseFormat = apply { if (validated) { return@apply @@ -1141,6 +1167,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -1312,6 +1348,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): StreamOptions = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatResponse.kt index 20f907b..5530254 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/ChatResponse.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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ChatResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/Choice.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/Choice.kt index e652d4e..661cd0e 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/Choice.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/Choice.kt @@ -301,6 +301,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Choice = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/Usage.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/Usage.kt index 2166b90..1805d25 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/Usage.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/chat/Usage.kt @@ -181,6 +181,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Usage = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt index 27720dd..7d4d392 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt @@ -140,6 +140,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): HealthSchema = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/AuthorizeToolRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/AuthorizeToolRequest.kt index 4842ecd..826d1f3 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/AuthorizeToolRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/AuthorizeToolRequest.kt @@ -226,6 +226,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): AuthorizeToolRequest = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolRequest.kt index 487040d..1e922e5 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolRequest.kt @@ -308,6 +308,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExecuteToolRequest = apply { if (validated) { return@apply @@ -408,6 +416,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolResponse.kt index eb5c67b..de75202 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolResponse.kt @@ -380,6 +380,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ExecuteToolResponse = apply { if (validated) { return@apply @@ -687,6 +695,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -1128,6 +1145,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Error = apply { if (validated) { return@apply @@ -1231,6 +1258,17 @@ private constructor( @JvmField val UPSTREAM_RUNTIME_UNMAPPED = of("UPSTREAM_RUNTIME_UNMAPPED") + @JvmField + val NETWORK_TRANSPORT_RUNTIME_TIMEOUT = of("NETWORK_TRANSPORT_RUNTIME_TIMEOUT") + + @JvmField + val NETWORK_TRANSPORT_RUNTIME_UNREACHABLE = + of("NETWORK_TRANSPORT_RUNTIME_UNREACHABLE") + + @JvmField + val NETWORK_TRANSPORT_RUNTIME_UNMAPPED = + of("NETWORK_TRANSPORT_RUNTIME_UNMAPPED") + @JvmField val UNKNOWN = of("UNKNOWN") @JvmStatic fun of(value: String) = Kind(JsonField.of(value)) @@ -1257,6 +1295,9 @@ private constructor( UPSTREAM_RUNTIME_RATE_LIMIT, UPSTREAM_RUNTIME_SERVER_ERROR, UPSTREAM_RUNTIME_UNMAPPED, + NETWORK_TRANSPORT_RUNTIME_TIMEOUT, + NETWORK_TRANSPORT_RUNTIME_UNREACHABLE, + NETWORK_TRANSPORT_RUNTIME_UNMAPPED, UNKNOWN, } @@ -1289,6 +1330,9 @@ private constructor( UPSTREAM_RUNTIME_RATE_LIMIT, UPSTREAM_RUNTIME_SERVER_ERROR, UPSTREAM_RUNTIME_UNMAPPED, + NETWORK_TRANSPORT_RUNTIME_TIMEOUT, + NETWORK_TRANSPORT_RUNTIME_UNREACHABLE, + NETWORK_TRANSPORT_RUNTIME_UNMAPPED, UNKNOWN, /** * An enum member indicating that [Kind] was instantiated with an unknown value. @@ -1324,6 +1368,11 @@ private constructor( UPSTREAM_RUNTIME_RATE_LIMIT -> Value.UPSTREAM_RUNTIME_RATE_LIMIT UPSTREAM_RUNTIME_SERVER_ERROR -> Value.UPSTREAM_RUNTIME_SERVER_ERROR UPSTREAM_RUNTIME_UNMAPPED -> Value.UPSTREAM_RUNTIME_UNMAPPED + NETWORK_TRANSPORT_RUNTIME_TIMEOUT -> Value.NETWORK_TRANSPORT_RUNTIME_TIMEOUT + NETWORK_TRANSPORT_RUNTIME_UNREACHABLE -> + Value.NETWORK_TRANSPORT_RUNTIME_UNREACHABLE + NETWORK_TRANSPORT_RUNTIME_UNMAPPED -> + Value.NETWORK_TRANSPORT_RUNTIME_UNMAPPED UNKNOWN -> Value.UNKNOWN else -> Value._UNKNOWN } @@ -1358,6 +1407,11 @@ private constructor( UPSTREAM_RUNTIME_RATE_LIMIT -> Known.UPSTREAM_RUNTIME_RATE_LIMIT UPSTREAM_RUNTIME_SERVER_ERROR -> Known.UPSTREAM_RUNTIME_SERVER_ERROR UPSTREAM_RUNTIME_UNMAPPED -> Known.UPSTREAM_RUNTIME_UNMAPPED + NETWORK_TRANSPORT_RUNTIME_TIMEOUT -> Known.NETWORK_TRANSPORT_RUNTIME_TIMEOUT + NETWORK_TRANSPORT_RUNTIME_UNREACHABLE -> + Known.NETWORK_TRANSPORT_RUNTIME_UNREACHABLE + NETWORK_TRANSPORT_RUNTIME_UNMAPPED -> + Known.NETWORK_TRANSPORT_RUNTIME_UNMAPPED UNKNOWN -> Known.UNKNOWN else -> throw ArcadeInvalidDataException("Unknown Kind: $value") } @@ -1378,6 +1432,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Kind = apply { if (validated) { return@apply @@ -1477,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Extra = apply { if (validated) { return@apply @@ -1741,6 +1815,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Log = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt index 7be442a..ab6b906 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt @@ -440,6 +440,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolDefinition = apply { if (validated) { return@apply @@ -601,6 +609,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply @@ -888,6 +905,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Parameter = apply { if (validated) { return@apply @@ -1149,6 +1176,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Toolkit = apply { if (validated) { return@apply @@ -1260,6 +1296,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FormattedSchema = apply { if (validated) { return@apply @@ -1464,6 +1509,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Metadata = apply { if (validated) { return@apply @@ -1756,6 +1810,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Behavior = apply { if (validated) { return@apply @@ -1945,6 +2009,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Classification = apply { if (validated) { return@apply @@ -2050,6 +2124,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Extras = apply { if (validated) { return@apply @@ -2302,6 +2386,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -2536,6 +2629,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Requirements = apply { if (validated) { return@apply @@ -2884,6 +2986,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Authorization = apply { if (validated) { return@apply @@ -3044,6 +3156,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply @@ -3181,6 +3303,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Status = apply { if (validated) { return@apply @@ -3325,6 +3457,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): TokenStatus = apply { if (validated) { return@apply @@ -3580,6 +3722,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Secret = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolExecution.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolExecution.kt index f03513d..b110338 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolExecution.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolExecution.kt @@ -468,6 +468,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolExecution = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolExecutionAttempt.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolExecutionAttempt.kt index fd3dbb5..dbf0d89 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolExecutionAttempt.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolExecutionAttempt.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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolExecutionAttempt = apply { if (validated) { return@apply @@ -502,6 +510,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Output = apply { if (validated) { return@apply @@ -943,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Error = apply { if (validated) { return@apply @@ -1046,6 +1073,17 @@ private constructor( @JvmField val UPSTREAM_RUNTIME_UNMAPPED = of("UPSTREAM_RUNTIME_UNMAPPED") + @JvmField + val NETWORK_TRANSPORT_RUNTIME_TIMEOUT = of("NETWORK_TRANSPORT_RUNTIME_TIMEOUT") + + @JvmField + val NETWORK_TRANSPORT_RUNTIME_UNREACHABLE = + of("NETWORK_TRANSPORT_RUNTIME_UNREACHABLE") + + @JvmField + val NETWORK_TRANSPORT_RUNTIME_UNMAPPED = + of("NETWORK_TRANSPORT_RUNTIME_UNMAPPED") + @JvmField val UNKNOWN = of("UNKNOWN") @JvmStatic fun of(value: String) = Kind(JsonField.of(value)) @@ -1072,6 +1110,9 @@ private constructor( UPSTREAM_RUNTIME_RATE_LIMIT, UPSTREAM_RUNTIME_SERVER_ERROR, UPSTREAM_RUNTIME_UNMAPPED, + NETWORK_TRANSPORT_RUNTIME_TIMEOUT, + NETWORK_TRANSPORT_RUNTIME_UNREACHABLE, + NETWORK_TRANSPORT_RUNTIME_UNMAPPED, UNKNOWN, } @@ -1104,6 +1145,9 @@ private constructor( UPSTREAM_RUNTIME_RATE_LIMIT, UPSTREAM_RUNTIME_SERVER_ERROR, UPSTREAM_RUNTIME_UNMAPPED, + NETWORK_TRANSPORT_RUNTIME_TIMEOUT, + NETWORK_TRANSPORT_RUNTIME_UNREACHABLE, + NETWORK_TRANSPORT_RUNTIME_UNMAPPED, UNKNOWN, /** * An enum member indicating that [Kind] was instantiated with an unknown value. @@ -1139,6 +1183,11 @@ private constructor( UPSTREAM_RUNTIME_RATE_LIMIT -> Value.UPSTREAM_RUNTIME_RATE_LIMIT UPSTREAM_RUNTIME_SERVER_ERROR -> Value.UPSTREAM_RUNTIME_SERVER_ERROR UPSTREAM_RUNTIME_UNMAPPED -> Value.UPSTREAM_RUNTIME_UNMAPPED + NETWORK_TRANSPORT_RUNTIME_TIMEOUT -> Value.NETWORK_TRANSPORT_RUNTIME_TIMEOUT + NETWORK_TRANSPORT_RUNTIME_UNREACHABLE -> + Value.NETWORK_TRANSPORT_RUNTIME_UNREACHABLE + NETWORK_TRANSPORT_RUNTIME_UNMAPPED -> + Value.NETWORK_TRANSPORT_RUNTIME_UNMAPPED UNKNOWN -> Value.UNKNOWN else -> Value._UNKNOWN } @@ -1173,6 +1222,11 @@ private constructor( UPSTREAM_RUNTIME_RATE_LIMIT -> Known.UPSTREAM_RUNTIME_RATE_LIMIT UPSTREAM_RUNTIME_SERVER_ERROR -> Known.UPSTREAM_RUNTIME_SERVER_ERROR UPSTREAM_RUNTIME_UNMAPPED -> Known.UPSTREAM_RUNTIME_UNMAPPED + NETWORK_TRANSPORT_RUNTIME_TIMEOUT -> Known.NETWORK_TRANSPORT_RUNTIME_TIMEOUT + NETWORK_TRANSPORT_RUNTIME_UNREACHABLE -> + Known.NETWORK_TRANSPORT_RUNTIME_UNREACHABLE + NETWORK_TRANSPORT_RUNTIME_UNMAPPED -> + Known.NETWORK_TRANSPORT_RUNTIME_UNMAPPED UNKNOWN -> Known.UNKNOWN else -> throw ArcadeInvalidDataException("Unknown Kind: $value") } @@ -1193,6 +1247,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Kind = apply { if (validated) { return@apply @@ -1292,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Extra = apply { if (validated) { return@apply @@ -1556,6 +1630,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Log = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolGetParams.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolGetParams.kt index f851a95..301be76 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolGetParams.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolGetParams.kt @@ -323,6 +323,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IncludeFormat = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolListPageResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolListPageResponse.kt index 4910d9b..f961478 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolListPageResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolListPageResponse.kt @@ -243,6 +243,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ToolListPageResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolListParams.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolListParams.kt index f5c8025..0b27170 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolListParams.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolListParams.kt @@ -14,9 +14,13 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Returns a page of tools from the engine configuration, optionally filtered by toolkit */ +/** + * Returns a page of tools from the engine configuration, optionally filtered by toolkit and/or + * metadata + */ class ToolListParams private constructor( + private val filter: String?, private val includeAllVersions: Boolean?, private val includeFormat: List?, private val limit: Long?, @@ -27,6 +31,13 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * JSON metadata filter. Array fields (service_domains, operations): shorthand array or object + * with any_of/all_of/none_of operators (case-insensitive). Boolean fields: read_only, + * destructive, idempotent, open_world. Extras: case-sensitive key-value subset match. + */ + fun filter(): Optional = Optional.ofNullable(filter) + /** Include all versions of each tool */ fun includeAllVersions(): Optional = Optional.ofNullable(includeAllVersions) @@ -64,6 +75,7 @@ private constructor( /** A builder for [ToolListParams]. */ class Builder internal constructor() { + private var filter: String? = null private var includeAllVersions: Boolean? = null private var includeFormat: MutableList? = null private var limit: Long? = null @@ -75,6 +87,7 @@ private constructor( @JvmSynthetic internal fun from(toolListParams: ToolListParams) = apply { + filter = toolListParams.filter includeAllVersions = toolListParams.includeAllVersions includeFormat = toolListParams.includeFormat?.toMutableList() limit = toolListParams.limit @@ -85,6 +98,17 @@ private constructor( additionalQueryParams = toolListParams.additionalQueryParams.toBuilder() } + /** + * JSON metadata filter. Array fields (service_domains, operations): shorthand array or + * object with any_of/all_of/none_of operators (case-insensitive). Boolean fields: + * read_only, destructive, idempotent, open_world. Extras: case-sensitive key-value subset + * match. + */ + fun filter(filter: String?) = apply { this.filter = filter } + + /** Alias for calling [Builder.filter] with `filter.orElse(null)`. */ + fun filter(filter: Optional) = filter(filter.getOrNull()) + /** Include all versions of each tool */ fun includeAllVersions(includeAllVersions: Boolean?) = apply { this.includeAllVersions = includeAllVersions @@ -266,6 +290,7 @@ private constructor( */ fun build(): ToolListParams = ToolListParams( + filter, includeAllVersions, includeFormat?.toImmutable(), limit, @@ -282,6 +307,7 @@ private constructor( override fun _queryParams(): QueryParams = QueryParams.builder() .apply { + filter?.let { put("filter", it) } includeAllVersions?.let { put("include_all_versions", it.toString()) } includeFormat?.let { put("include_format", it.joinToString(",") { it.toString() }) } limit?.let { put("limit", it.toString()) } @@ -389,6 +415,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): IncludeFormat = apply { if (validated) { return@apply @@ -433,6 +468,7 @@ private constructor( } return other is ToolListParams && + filter == other.filter && includeAllVersions == other.includeAllVersions && includeFormat == other.includeFormat && limit == other.limit && @@ -445,6 +481,7 @@ private constructor( override fun hashCode(): Int = Objects.hash( + filter, includeAllVersions, includeFormat, limit, @@ -456,5 +493,5 @@ private constructor( ) override fun toString() = - "ToolListParams{includeAllVersions=$includeAllVersions, includeFormat=$includeFormat, limit=$limit, offset=$offset, toolkit=$toolkit, userId=$userId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "ToolListParams{filter=$filter, includeAllVersions=$includeAllVersions, includeFormat=$includeFormat, limit=$limit, offset=$offset, toolkit=$toolkit, userId=$userId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ValueSchema.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ValueSchema.kt index 06139a7..0e5223b 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ValueSchema.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ValueSchema.kt @@ -209,6 +209,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ValueSchema = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt index 3ebb65e..c0c1d55 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt @@ -68,6 +68,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FormattedGetResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponse.kt index 0d6c9cb..7494c4b 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponse.kt @@ -247,6 +247,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FormattedListPageResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListParams.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListParams.kt index 3112f34..4231263 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListParams.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListParams.kt @@ -15,6 +15,7 @@ import kotlin.jvm.optionals.getOrNull */ class FormattedListParams private constructor( + private val filter: String?, private val format: String?, private val includeAllVersions: Boolean?, private val limit: Long?, @@ -25,6 +26,13 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * JSON metadata filter. Array fields (service_domains, operations): shorthand array or object + * with any_of/all_of/none_of operators (case-insensitive). Boolean fields: read_only, + * destructive, idempotent, open_world. Extras: case-sensitive key-value subset match. + */ + fun filter(): Optional = Optional.ofNullable(filter) + /** Provider format */ fun format(): Optional = Optional.ofNullable(format) @@ -62,6 +70,7 @@ private constructor( /** A builder for [FormattedListParams]. */ class Builder internal constructor() { + private var filter: String? = null private var format: String? = null private var includeAllVersions: Boolean? = null private var limit: Long? = null @@ -73,6 +82,7 @@ private constructor( @JvmSynthetic internal fun from(formattedListParams: FormattedListParams) = apply { + filter = formattedListParams.filter format = formattedListParams.format includeAllVersions = formattedListParams.includeAllVersions limit = formattedListParams.limit @@ -83,6 +93,17 @@ private constructor( additionalQueryParams = formattedListParams.additionalQueryParams.toBuilder() } + /** + * JSON metadata filter. Array fields (service_domains, operations): shorthand array or + * object with any_of/all_of/none_of operators (case-insensitive). Boolean fields: + * read_only, destructive, idempotent, open_world. Extras: case-sensitive key-value subset + * match. + */ + fun filter(filter: String?) = apply { this.filter = filter } + + /** Alias for calling [Builder.filter] with `filter.orElse(null)`. */ + fun filter(filter: Optional) = filter(filter.getOrNull()) + /** Provider format */ fun format(format: String?) = apply { this.format = format } @@ -251,6 +272,7 @@ private constructor( */ fun build(): FormattedListParams = FormattedListParams( + filter, format, includeAllVersions, limit, @@ -267,6 +289,7 @@ private constructor( override fun _queryParams(): QueryParams = QueryParams.builder() .apply { + filter?.let { put("filter", it) } format?.let { put("format", it) } includeAllVersions?.let { put("include_all_versions", it.toString()) } limit?.let { put("limit", it.toString()) } @@ -283,6 +306,7 @@ private constructor( } return other is FormattedListParams && + filter == other.filter && format == other.format && includeAllVersions == other.includeAllVersions && limit == other.limit && @@ -295,6 +319,7 @@ private constructor( override fun hashCode(): Int = Objects.hash( + filter, format, includeAllVersions, limit, @@ -306,5 +331,5 @@ private constructor( ) override fun toString() = - "FormattedListParams{format=$format, includeAllVersions=$includeAllVersions, limit=$limit, offset=$offset, toolkit=$toolkit, userId=$userId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "FormattedListParams{filter=$filter, format=$format, includeAllVersions=$includeAllVersions, limit=$limit, offset=$offset, toolkit=$toolkit, userId=$userId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt index c2c3672..2ee357b 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): FormattedListResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/scheduled/ScheduledGetResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/scheduled/ScheduledGetResponse.kt index b8b575d..c4c95d1 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/scheduled/ScheduledGetResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/scheduled/ScheduledGetResponse.kt @@ -549,6 +549,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ScheduledGetResponse = apply { if (validated) { return@apply @@ -659,6 +667,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Input = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/scheduled/ScheduledListPageResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/scheduled/ScheduledListPageResponse.kt index 98f1c94..c637e90 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/scheduled/ScheduledListPageResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/scheduled/ScheduledListPageResponse.kt @@ -246,6 +246,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): ScheduledListPageResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/CreateWorkerRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/CreateWorkerRequest.kt index ed1a052..747f590 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/CreateWorkerRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/CreateWorkerRequest.kt @@ -242,6 +242,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): CreateWorkerRequest = apply { if (validated) { return@apply @@ -482,6 +490,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Http = apply { if (validated) { return@apply @@ -800,6 +817,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Mcp = apply { if (validated) { return@apply @@ -898,6 +924,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Headers = apply { if (validated) { return@apply @@ -1154,6 +1190,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply @@ -1277,6 +1323,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Secrets = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/UpdateWorkerRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/UpdateWorkerRequest.kt index 039958e..31bda7a 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/UpdateWorkerRequest.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/UpdateWorkerRequest.kt @@ -166,6 +166,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): UpdateWorkerRequest = apply { if (validated) { return@apply @@ -376,6 +384,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Http = apply { if (validated) { return@apply @@ -676,6 +693,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Mcp = apply { if (validated) { return@apply @@ -774,6 +800,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Headers = apply { if (validated) { return@apply @@ -994,6 +1030,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply @@ -1108,6 +1154,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Secrets = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerHealthResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerHealthResponse.kt index 8a54a8c..f9dae32 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerHealthResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerHealthResponse.kt @@ -191,6 +191,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WorkerHealthResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerListPageResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerListPageResponse.kt index 8609944..d9aea4b 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerListPageResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerListPageResponse.kt @@ -243,6 +243,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WorkerListPageResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerResponse.kt index 51843b5..444c77e 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerResponse.kt @@ -320,6 +320,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WorkerResponse = apply { if (validated) { return@apply @@ -483,6 +491,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Binding = apply { if (validated) { return@apply @@ -612,6 +629,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply @@ -849,6 +876,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Http = apply { if (validated) { return@apply @@ -1072,6 +1108,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Secret = apply { if (validated) { return@apply @@ -1210,6 +1256,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Binding = apply { if (validated) { return@apply @@ -1297,8 +1353,10 @@ private constructor( class Mcp @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val externalId: JsonField, private val headers: JsonField, private val oauth2: JsonField, + private val redirectUri: JsonField, private val retry: JsonField, private val secrets: JsonField, private val timeout: JsonField, @@ -1308,13 +1366,35 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("external_id") + @ExcludeMissing + externalId: JsonField = JsonMissing.of(), @JsonProperty("headers") @ExcludeMissing headers: JsonField = JsonMissing.of(), @JsonProperty("oauth2") @ExcludeMissing oauth2: JsonField = JsonMissing.of(), + @JsonProperty("redirect_uri") + @ExcludeMissing + redirectUri: JsonField = JsonMissing.of(), @JsonProperty("retry") @ExcludeMissing retry: JsonField = JsonMissing.of(), @JsonProperty("secrets") @ExcludeMissing secrets: JsonField = JsonMissing.of(), @JsonProperty("timeout") @ExcludeMissing timeout: JsonField = JsonMissing.of(), @JsonProperty("uri") @ExcludeMissing uri: JsonField = JsonMissing.of(), - ) : this(headers, oauth2, retry, secrets, timeout, uri, mutableMapOf()) + ) : this( + externalId, + headers, + oauth2, + redirectUri, + retry, + secrets, + timeout, + uri, + mutableMapOf(), + ) + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun externalId(): Optional = externalId.getOptional("external_id") /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -1328,6 +1408,12 @@ private constructor( */ fun oauth2(): Optional = oauth2.getOptional("oauth2") + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun redirectUri(): Optional = redirectUri.getOptional("redirect_uri") + /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1352,6 +1438,15 @@ private constructor( */ fun uri(): Optional = uri.getOptional("uri") + /** + * Returns the raw JSON value of [externalId]. + * + * Unlike [externalId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("external_id") + @ExcludeMissing + fun _externalId(): JsonField = externalId + /** * Returns the raw JSON value of [headers]. * @@ -1366,6 +1461,15 @@ private constructor( */ @JsonProperty("oauth2") @ExcludeMissing fun _oauth2(): JsonField = oauth2 + /** + * Returns the raw JSON value of [redirectUri]. + * + * Unlike [redirectUri], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("redirect_uri") + @ExcludeMissing + fun _redirectUri(): JsonField = redirectUri + /** * Returns the raw JSON value of [retry]. * @@ -1415,8 +1519,10 @@ private constructor( /** A builder for [Mcp]. */ class Builder internal constructor() { + private var externalId: JsonField = JsonMissing.of() private var headers: JsonField = JsonMissing.of() private var oauth2: JsonField = JsonMissing.of() + private var redirectUri: JsonField = JsonMissing.of() private var retry: JsonField = JsonMissing.of() private var secrets: JsonField = JsonMissing.of() private var timeout: JsonField = JsonMissing.of() @@ -1425,8 +1531,10 @@ private constructor( @JvmSynthetic internal fun from(mcp: Mcp) = apply { + externalId = mcp.externalId headers = mcp.headers oauth2 = mcp.oauth2 + redirectUri = mcp.redirectUri retry = mcp.retry secrets = mcp.secrets timeout = mcp.timeout @@ -1434,6 +1542,17 @@ private constructor( additionalProperties = mcp.additionalProperties.toMutableMap() } + fun externalId(externalId: String) = externalId(JsonField.of(externalId)) + + /** + * Sets [Builder.externalId] to an arbitrary JSON value. + * + * You should usually call [Builder.externalId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun externalId(externalId: JsonField) = apply { this.externalId = externalId } + fun headers(headers: Headers) = headers(JsonField.of(headers)) /** @@ -1456,6 +1575,19 @@ private constructor( */ fun oauth2(oauth2: JsonField) = apply { this.oauth2 = oauth2 } + fun redirectUri(redirectUri: String) = redirectUri(JsonField.of(redirectUri)) + + /** + * Sets [Builder.redirectUri] to an arbitrary JSON value. + * + * You should usually call [Builder.redirectUri] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun redirectUri(redirectUri: JsonField) = apply { + this.redirectUri = redirectUri + } + fun retry(retry: Long) = retry(JsonField.of(retry)) /** @@ -1526,8 +1658,10 @@ private constructor( */ fun build(): Mcp = Mcp( + externalId, headers, oauth2, + redirectUri, retry, secrets, timeout, @@ -1538,13 +1672,24 @@ private constructor( private var validated: Boolean = false + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Mcp = apply { if (validated) { return@apply } + externalId() headers().ifPresent { it.validate() } oauth2().ifPresent { it.validate() } + redirectUri() retry() secrets().ifPresent { it.validate() } timeout() @@ -1568,8 +1713,10 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (headers.asKnown().getOrNull()?.validity() ?: 0) + + (if (externalId.asKnown().isPresent) 1 else 0) + + (headers.asKnown().getOrNull()?.validity() ?: 0) + (oauth2.asKnown().getOrNull()?.validity() ?: 0) + + (if (redirectUri.asKnown().isPresent) 1 else 0) + (if (retry.asKnown().isPresent) 1 else 0) + (secrets.asKnown().getOrNull()?.validity() ?: 0) + (if (timeout.asKnown().isPresent) 1 else 0) + @@ -1636,6 +1783,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Headers = apply { if (validated) { return@apply @@ -1987,6 +2144,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply @@ -2229,6 +2396,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): ClientSecret = apply { if (validated) { return@apply @@ -2369,6 +2546,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 ArcadeInvalidDataException if any value type in this object doesn't + * match its expected type. + */ fun validate(): Binding = apply { if (validated) { return@apply @@ -2525,6 +2712,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Secrets = apply { if (validated) { return@apply @@ -2572,8 +2769,10 @@ private constructor( } return other is Mcp && + externalId == other.externalId && headers == other.headers && oauth2 == other.oauth2 && + redirectUri == other.redirectUri && retry == other.retry && secrets == other.secrets && timeout == other.timeout && @@ -2582,13 +2781,23 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(headers, oauth2, retry, secrets, timeout, uri, additionalProperties) + Objects.hash( + externalId, + headers, + oauth2, + redirectUri, + retry, + secrets, + timeout, + uri, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "Mcp{headers=$headers, oauth2=$oauth2, retry=$retry, secrets=$secrets, timeout=$timeout, uri=$uri, additionalProperties=$additionalProperties}" + "Mcp{externalId=$externalId, headers=$headers, oauth2=$oauth2, redirectUri=$redirectUri, retry=$retry, secrets=$secrets, timeout=$timeout, uri=$uri, additionalProperties=$additionalProperties}" } class Requirements @@ -2723,6 +2932,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Requirements = apply { if (validated) { return@apply @@ -2879,6 +3097,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Authorization = apply { if (validated) { return@apply @@ -3006,6 +3234,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 ArcadeInvalidDataException if any value type in this object doesn't match + * its expected type. + */ fun validate(): Oauth2 = apply { if (validated) { return@apply @@ -3180,6 +3418,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): Type = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerToolsPageResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerToolsPageResponse.kt index b585877..d4f4d91 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerToolsPageResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerToolsPageResponse.kt @@ -244,6 +244,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 ArcadeInvalidDataException if any value type in this object doesn't match its + * expected type. + */ fun validate(): WorkerToolsPageResponse = apply { if (validated) { return@apply diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/services/async/ToolServiceAsync.kt b/arcade-java-core/src/main/kotlin/dev/arcade/services/async/ToolServiceAsync.kt index 4a773b7..c59e0f6 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/services/async/ToolServiceAsync.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/services/async/ToolServiceAsync.kt @@ -38,7 +38,10 @@ interface ToolServiceAsync { fun formatted(): FormattedServiceAsync - /** Returns a page of tools from the engine configuration, optionally filtered by toolkit */ + /** + * Returns a page of tools from the engine configuration, optionally filtered by toolkit and/or + * metadata + */ fun list(): CompletableFuture = list(ToolListParams.none()) /** @see list */ diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/services/blocking/ToolService.kt b/arcade-java-core/src/main/kotlin/dev/arcade/services/blocking/ToolService.kt index 22a6d53..c10f1fa 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/services/blocking/ToolService.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/services/blocking/ToolService.kt @@ -38,7 +38,10 @@ interface ToolService { fun formatted(): FormattedService - /** Returns a page of tools from the engine configuration, optionally filtered by toolkit */ + /** + * Returns a page of tools from the engine configuration, optionally filtered by toolkit and/or + * metadata + */ fun list(): ToolListPage = list(ToolListParams.none()) /** @see list */ diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/core/ClientOptionsTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/core/ClientOptionsTest.kt index 8a79f69..10e787e 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/core/ClientOptionsTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/core/ClientOptionsTest.kt @@ -16,6 +16,29 @@ internal class ClientOptionsTest { private val httpClient = mock() + @Test + fun putHeader_canOverwriteDefaultHeader() { + val clientOptions = + ClientOptions.builder() + .httpClient(httpClient) + .putHeader("User-Agent", "My User Agent") + .apiKey("My API Key") + .build() + + assertThat(clientOptions.headers.values("User-Agent")).containsExactly("My User Agent") + } + + @Test + fun toBuilder_bearerCanBeUpdated() { + var clientOptions = + ClientOptions.builder().httpClient(httpClient).apiKey("My API Key").build() + + clientOptions = clientOptions.toBuilder().apiKey("another My API Key").build() + + assertThat(clientOptions.headers.values("Authorization")) + .containsExactly("another My API Key") + } + @Test fun toBuilder_whenOriginalClientOptionsGarbageCollected_doesNotCloseOriginalClient() { var clientOptions = diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/core/http/RetryingHttpClientTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/core/http/RetryingHttpClientTest.kt index 1e64d8e..b7a4609 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/core/http/RetryingHttpClientTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/core/http/RetryingHttpClientTest.kt @@ -400,9 +400,9 @@ internal class RetryingHttpClientTest { assertThat(sleeper.durations).hasSize(3) // retries=1: 0.5s * [0.75, 1.0] assertThat(sleeper.durations[0]).isBetween(Duration.ofMillis(375), Duration.ofMillis(500)) - // retries=2: 1.0s * [0.75, 1.0] + // retries=2: 1s * [0.75, 1.0] assertThat(sleeper.durations[1]).isBetween(Duration.ofMillis(750), Duration.ofMillis(1000)) - // retries=3: 2.0s * [0.75, 1.0] + // retries=3: 2s * [0.75, 1.0] assertThat(sleeper.durations[2]).isBetween(Duration.ofMillis(1500), Duration.ofMillis(2000)) assertNoResponseLeaks() } @@ -427,9 +427,9 @@ internal class RetryingHttpClientTest { assertThat(response.statusCode()).isEqualTo(503) verify(7, postRequestedFor(urlPathEqualTo("/something"))) assertThat(sleeper.durations).hasSize(6) - // retries=5: min(0.5 * 2^4, 8) = 8.0s * [0.75, 1.0] + // retries=5: backoff hits the 8s cap * [0.75, 1.0] assertThat(sleeper.durations[4]).isBetween(Duration.ofMillis(6000), Duration.ofMillis(8000)) - // retries=6: min(0.5 * 2^5, 8) = min(16, 8) = 8.0s * [0.75, 1.0] (capped) + // retries=6: still capped at 8s * [0.75, 1.0] assertThat(sleeper.durations[5]).isBetween(Duration.ofMillis(6000), Duration.ofMillis(8000)) assertNoResponseLeaks() } diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderPatchParamsTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderPatchParamsTest.kt index 6e659de..b0d2dab 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderPatchParamsTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderPatchParamsTest.kt @@ -90,6 +90,46 @@ internal class AuthProviderPatchParamsTest { .scopeDelimiter( AuthProviderUpdateRequest.Oauth2.ScopeDelimiter.Unknown2 ) + .tokenIntrospectionRequest( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest.builder() + .authHeaderValueFormat("auth_header_value_format") + .authMethod("auth_method") + .endpoint("endpoint") + .method("method") + .params( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .Params + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .requestContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .RequestContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseMap( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseMap + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .triggers( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .Triggers + .builder() + .onTokenGrant(true) + .onTokenRefresh(true) + .build() + ) + .build() + ) .tokenRequest( AuthProviderUpdateRequest.Oauth2.TokenRequest.builder() .authHeaderValueFormat("auth_header_value_format") @@ -276,6 +316,58 @@ internal class AuthProviderPatchParamsTest { .scopeDelimiter( AuthProviderUpdateRequest.Oauth2.ScopeDelimiter.Unknown2 ) + .tokenIntrospectionRequest( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .builder() + .authHeaderValueFormat("auth_header_value_format") + .authMethod("auth_method") + .endpoint("endpoint") + .method("method") + .params( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .Params + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string"), + ) + .build() + ) + .requestContentType( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .RequestContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseContentType( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .ResponseContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseMap( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .ResponseMap + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string"), + ) + .build() + ) + .triggers( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .Triggers + .builder() + .onTokenGrant(true) + .onTokenRefresh(true) + .build() + ) + .build() + ) .tokenRequest( AuthProviderUpdateRequest.Oauth2.TokenRequest.builder() .authHeaderValueFormat("auth_header_value_format") @@ -448,6 +540,46 @@ internal class AuthProviderPatchParamsTest { .scopeDelimiter( AuthProviderUpdateRequest.Oauth2.ScopeDelimiter.Unknown2 ) + .tokenIntrospectionRequest( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest.builder() + .authHeaderValueFormat("auth_header_value_format") + .authMethod("auth_method") + .endpoint("endpoint") + .method("method") + .params( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .Params + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .requestContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .RequestContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseMap( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseMap + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .triggers( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .Triggers + .builder() + .onTokenGrant(true) + .onTokenRefresh(true) + .build() + ) + .build() + ) .tokenRequest( AuthProviderUpdateRequest.Oauth2.TokenRequest.builder() .authHeaderValueFormat("auth_header_value_format") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequestTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequestTest.kt index c551713..b07bc1d 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequestTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequestTest.kt @@ -86,6 +86,46 @@ internal class AuthProviderUpdateRequestTest { .build() ) .scopeDelimiter(AuthProviderUpdateRequest.Oauth2.ScopeDelimiter.Unknown2) + .tokenIntrospectionRequest( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest.builder() + .authHeaderValueFormat("auth_header_value_format") + .authMethod("auth_method") + .endpoint("endpoint") + .method("method") + .params( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .Params + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .requestContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .RequestContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseMap( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseMap + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .triggers( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .Triggers + .builder() + .onTokenGrant(true) + .onTokenRefresh(true) + .build() + ) + .build() + ) .tokenRequest( AuthProviderUpdateRequest.Oauth2.TokenRequest.builder() .authHeaderValueFormat("auth_header_value_format") @@ -227,6 +267,44 @@ internal class AuthProviderUpdateRequestTest { .build() ) .scopeDelimiter(AuthProviderUpdateRequest.Oauth2.ScopeDelimiter.Unknown2) + .tokenIntrospectionRequest( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest.builder() + .authHeaderValueFormat("auth_header_value_format") + .authMethod("auth_method") + .endpoint("endpoint") + .method("method") + .params( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest.Params + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .requestContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .RequestContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseMap( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseMap + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .triggers( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest.Triggers + .builder() + .onTokenGrant(true) + .onTokenRefresh(true) + .build() + ) + .build() + ) .tokenRequest( AuthProviderUpdateRequest.Oauth2.TokenRequest.builder() .authHeaderValueFormat("auth_header_value_format") @@ -370,6 +448,46 @@ internal class AuthProviderUpdateRequestTest { .build() ) .scopeDelimiter(AuthProviderUpdateRequest.Oauth2.ScopeDelimiter.Unknown2) + .tokenIntrospectionRequest( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest.builder() + .authHeaderValueFormat("auth_header_value_format") + .authMethod("auth_method") + .endpoint("endpoint") + .method("method") + .params( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .Params + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .requestContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .RequestContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseContentType( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseMap( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .ResponseMap + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .triggers( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .Triggers + .builder() + .onTokenGrant(true) + .onTokenRefresh(true) + .build() + ) + .build() + ) .tokenRequest( AuthProviderUpdateRequest.Oauth2.TokenRequest.builder() .authHeaderValueFormat("auth_header_value_format") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListParamsTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListParamsTest.kt index 2c07652..9f3f267 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListParamsTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListParamsTest.kt @@ -11,6 +11,7 @@ internal class ToolListParamsTest { @Test fun create() { ToolListParams.builder() + .filter("filter") .includeAllVersions(true) .addIncludeFormat(ToolListParams.IncludeFormat.ARCADE) .limit(0L) @@ -24,6 +25,7 @@ internal class ToolListParamsTest { fun queryParams() { val params = ToolListParams.builder() + .filter("filter") .includeAllVersions(true) .addIncludeFormat(ToolListParams.IncludeFormat.ARCADE) .limit(0L) @@ -37,6 +39,7 @@ internal class ToolListParamsTest { assertThat(queryParams) .isEqualTo( QueryParams.builder() + .put("filter", "filter") .put("include_all_versions", "true") .put("include_format", listOf("arcade").joinToString(",")) .put("limit", "0") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListParamsTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListParamsTest.kt index 48d2dad..06a3344 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListParamsTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListParamsTest.kt @@ -11,6 +11,7 @@ internal class FormattedListParamsTest { @Test fun create() { FormattedListParams.builder() + .filter("filter") .format("format") .includeAllVersions(true) .limit(0L) @@ -24,6 +25,7 @@ internal class FormattedListParamsTest { fun queryParams() { val params = FormattedListParams.builder() + .filter("filter") .format("format") .includeAllVersions(true) .limit(0L) @@ -37,6 +39,7 @@ internal class FormattedListParamsTest { assertThat(queryParams) .isEqualTo( QueryParams.builder() + .put("filter", "filter") .put("format", "format") .put("include_all_versions", "true") .put("limit", "0") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerListPageResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerListPageResponseTest.kt index bfe4dee..36db9bd 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerListPageResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerListPageResponseTest.kt @@ -43,6 +43,7 @@ internal class WorkerListPageResponseTest { .managed(true) .mcp( WorkerResponse.Mcp.builder() + .externalId("external_id") .headers( WorkerResponse.Mcp.Headers.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -68,6 +69,7 @@ internal class WorkerListPageResponseTest { .addSupportedScope("string") .build() ) + .redirectUri("redirect_uri") .retry(0L) .secrets( WorkerResponse.Mcp.Secrets.builder() @@ -142,6 +144,7 @@ internal class WorkerListPageResponseTest { .managed(true) .mcp( WorkerResponse.Mcp.builder() + .externalId("external_id") .headers( WorkerResponse.Mcp.Headers.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -167,6 +170,7 @@ internal class WorkerListPageResponseTest { .addSupportedScope("string") .build() ) + .redirectUri("redirect_uri") .retry(0L) .secrets( WorkerResponse.Mcp.Secrets.builder() @@ -244,6 +248,7 @@ internal class WorkerListPageResponseTest { .managed(true) .mcp( WorkerResponse.Mcp.builder() + .externalId("external_id") .headers( WorkerResponse.Mcp.Headers.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -269,6 +274,7 @@ internal class WorkerListPageResponseTest { .addSupportedScope("string") .build() ) + .redirectUri("redirect_uri") .retry(0L) .secrets( WorkerResponse.Mcp.Secrets.builder() diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerResponseTest.kt index c280d01..bf49033 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerResponseTest.kt @@ -40,6 +40,7 @@ internal class WorkerResponseTest { .managed(true) .mcp( WorkerResponse.Mcp.builder() + .externalId("external_id") .headers( WorkerResponse.Mcp.Headers.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -64,6 +65,7 @@ internal class WorkerResponseTest { .addSupportedScope("string") .build() ) + .redirectUri("redirect_uri") .retry(0L) .secrets( WorkerResponse.Mcp.Secrets.builder() @@ -131,6 +133,7 @@ internal class WorkerResponseTest { assertThat(workerResponse.mcp()) .contains( WorkerResponse.Mcp.builder() + .externalId("external_id") .headers( WorkerResponse.Mcp.Headers.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -153,6 +156,7 @@ internal class WorkerResponseTest { .addSupportedScope("string") .build() ) + .redirectUri("redirect_uri") .retry(0L) .secrets( WorkerResponse.Mcp.Secrets.builder() @@ -223,6 +227,7 @@ internal class WorkerResponseTest { .managed(true) .mcp( WorkerResponse.Mcp.builder() + .externalId("external_id") .headers( WorkerResponse.Mcp.Headers.builder() .putAdditionalProperty("foo", JsonValue.from("string")) @@ -247,6 +252,7 @@ internal class WorkerResponseTest { .addSupportedScope("string") .build() ) + .redirectUri("redirect_uri") .retry(0L) .secrets( WorkerResponse.Mcp.Secrets.builder() diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/services/async/admin/AuthProviderServiceAsyncTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/services/async/admin/AuthProviderServiceAsyncTest.kt index 04a3bb6..6c53381 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/services/async/admin/AuthProviderServiceAsyncTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/services/async/admin/AuthProviderServiceAsyncTest.kt @@ -373,6 +373,58 @@ internal class AuthProviderServiceAsyncTest { .scopeDelimiter( AuthProviderUpdateRequest.Oauth2.ScopeDelimiter.Unknown2 ) + .tokenIntrospectionRequest( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .builder() + .authHeaderValueFormat("auth_header_value_format") + .authMethod("auth_method") + .endpoint("endpoint") + .method("method") + .params( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .Params + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string"), + ) + .build() + ) + .requestContentType( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .RequestContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseContentType( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .ResponseContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseMap( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .ResponseMap + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string"), + ) + .build() + ) + .triggers( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .Triggers + .builder() + .onTokenGrant(true) + .onTokenRefresh(true) + .build() + ) + .build() + ) .tokenRequest( AuthProviderUpdateRequest.Oauth2.TokenRequest.builder() .authHeaderValueFormat("auth_header_value_format") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/services/blocking/admin/AuthProviderServiceTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/services/blocking/admin/AuthProviderServiceTest.kt index dcfea65..aa06f1e 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/services/blocking/admin/AuthProviderServiceTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/services/blocking/admin/AuthProviderServiceTest.kt @@ -369,6 +369,58 @@ internal class AuthProviderServiceTest { .scopeDelimiter( AuthProviderUpdateRequest.Oauth2.ScopeDelimiter.Unknown2 ) + .tokenIntrospectionRequest( + AuthProviderUpdateRequest.Oauth2.TokenIntrospectionRequest + .builder() + .authHeaderValueFormat("auth_header_value_format") + .authMethod("auth_method") + .endpoint("endpoint") + .method("method") + .params( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .Params + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string"), + ) + .build() + ) + .requestContentType( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .RequestContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseContentType( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .ResponseContentType + .APPLICATION_X_WWW_FORM_URLENCODED + ) + .responseMap( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .ResponseMap + .builder() + .putAdditionalProperty( + "foo", + JsonValue.from("string"), + ) + .build() + ) + .triggers( + AuthProviderUpdateRequest.Oauth2 + .TokenIntrospectionRequest + .Triggers + .builder() + .onTokenGrant(true) + .onTokenRefresh(true) + .build() + ) + .build() + ) .tokenRequest( AuthProviderUpdateRequest.Oauth2.TokenRequest.builder() .authHeaderValueFormat("auth_header_value_format") diff --git a/build.gradle.kts b/build.gradle.kts index 2348249..aec4e08 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ repositories { allprojects { group = "dev.arcade" - version = "0.1.0-alpha.5" // x-release-please-version + version = "0.1.0-alpha.6" // x-release-please-version } subprojects { @@ -22,7 +22,6 @@ subprojects { group = "Verification" description = "Verifies all source files are formatted." } - apply(plugin = "org.jetbrains.dokka") } subprojects { diff --git a/buildSrc/src/main/kotlin/arcade.kotlin.gradle.kts b/buildSrc/src/main/kotlin/arcade.kotlin.gradle.kts index 08c21f3..1fa9c32 100644 --- a/buildSrc/src/main/kotlin/arcade.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.kotlin.gradle.kts @@ -40,7 +40,7 @@ tasks.withType().configureEach { val ktfmt by configurations.creating dependencies { - ktfmt("com.facebook:ktfmt:0.56") + ktfmt("com.facebook:ktfmt:0.61") } fun registerKtfmt( diff --git a/scripts/fast-format b/scripts/fast-format index 1b3bc47..35a1dee 100755 --- a/scripts/fast-format +++ b/scripts/fast-format @@ -24,8 +24,8 @@ if [ ! -f "$FILE_LIST" ]; then exit 1 fi -if ! command -v ktfmt-fast-format &> /dev/null; then - echo "Error: ktfmt-fast-format not found" +if ! command -v ktfmt &> /dev/null; then + echo "Error: ktfmt not found" exit 1 fi @@ -36,7 +36,7 @@ echo "==> Done looking for Kotlin files" if [[ -n "$kt_files" ]]; then echo "==> will format Kotlin files" - echo "$kt_files" | tr '\n' '\0' | xargs -0 ktfmt-fast-format --kotlinlang-style "$@" + echo "$kt_files" | tr '\n' '\0' | xargs -0 ktfmt --kotlinlang-style "$@" else echo "No Kotlin files to format -- expected outcome during incremental formatting" fi diff --git a/scripts/mock b/scripts/mock index bcf3b39..feebe5e 100755 --- a/scripts/mock +++ b/scripts/mock @@ -19,34 +19,34 @@ fi echo "==> Starting mock server with URL ${URL}" -# Run prism mock on the given spec +# Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stdy/cli@0.22.1 -- steady --version - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & - # Wait for server to come online (max 30s) + # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" attempts=0 - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + if ! kill -0 $! 2>/dev/null; then + echo + cat .stdy.log + exit 1 + fi attempts=$((attempts + 1)) if [ "$attempts" -ge 300 ]; then echo - echo "Timed out waiting for Prism server to start" - cat .prism.log + echo "Timed out waiting for Steady server to start" + cat .stdy.log exit 1 fi echo -n "." sleep 0.1 done - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - echo else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" + npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 047bc1d..7d7f08e 100755 --- a/scripts/test +++ b/scripts/test @@ -9,8 +9,8 @@ GREEN='\033[0;32m' YELLOW='\033[0;33m' NC='\033[0m' # No Color -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 +function steady_is_running() { + curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 } kill_server_on_port() { @@ -25,7 +25,7 @@ function is_overriding_api_base_url() { [ -n "$TEST_API_BASE_URL" ] } -if ! is_overriding_api_base_url && ! prism_is_running ; then +if ! is_overriding_api_base_url && ! steady_is_running ; then # When we exit this script, make sure to kill the background mock server process trap 'kill_server_on_port 4010' EXIT @@ -36,19 +36,19 @@ fi if is_overriding_api_base_url ; then echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" echo -elif ! prism_is_running ; then - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" +elif ! steady_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server" echo -e "running against your OpenAPI spec." echo echo -e "To run the server, pass in the path or url of your OpenAPI" - echo -e "spec to the prism command:" + echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}" echo fi