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..87ac9c3 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%2Farcade-engine-f5fe6dab09f0766f1c01cec4951802c6a83945ce0c4cba226990134098508c2f.yml +openapi_spec_hash: 2923fbda6c2899ade719d00540c34ff6 +config_hash: 2d4163acdeacd75903f978cd79c35d14 diff --git a/CHANGELOG.md b/CHANGELOG.md index 30401cf..5da6797 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,44 @@ # Changelog +## 0.1.0-alpha.6 (2026-04-28) + +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)) +* 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)) + + +### 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:** 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)) +* **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)) + + +### 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..624b6de 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 ``` 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..40f36d7 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 @@ -405,6 +405,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 +461,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/models/admin/authproviders/AuthProviderUpdateRequest.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderUpdateRequest.kt index 159520d..0a4ffff 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 @@ -309,6 +309,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 +333,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 +349,7 @@ private constructor( pkce, refreshRequest, scopeDelimiter, + tokenIntrospectionRequest, tokenRequest, userInfoRequest, mutableMapOf(), @@ -389,6 +394,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 +468,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 +526,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 +540,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 +623,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 +696,7 @@ private constructor( pkce, refreshRequest, scopeDelimiter, + tokenIntrospectionRequest, tokenRequest, userInfoRequest, additionalProperties.toMutableMap(), @@ -675,6 +716,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 +744,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) @@ -2871,6 +2914,1166 @@ private constructor( override fun toString() = value.toString() } + class TokenIntrospectionRequest + @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(), + @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(), + @JsonProperty("triggers") + @ExcludeMissing + triggers: JsonField = JsonMissing.of(), + ) : this( + authHeaderValueFormat, + authMethod, + endpoint, + method, + params, + requestContentType, + responseContentType, + responseMap, + triggers, + 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") + + /** + * @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]. + * + * 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 + + /** + * 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) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [TokenIntrospectionRequest]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TokenIntrospectionRequest]. */ + 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 triggers: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + 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) = + 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 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) + } + + 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 [TokenIntrospectionRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): TokenIntrospectionRequest = + TokenIntrospectionRequest( + authHeaderValueFormat, + authMethod, + endpoint, + method, + params, + requestContentType, + responseContentType, + responseMap, + triggers, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TokenIntrospectionRequest = 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() } + triggers().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) + + (triggers.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 + + 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 + + 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 + + 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 + + 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}" + } + + class Triggers + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val onTokenGrant: JsonField, + private val onTokenRefresh: JsonField, + private val additionalProperties: MutableMap, + ) { + + @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()) + + /** + * @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") + + /** + * @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") + + /** + * 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 + 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 + + 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( @@ -4962,6 +6165,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 +6179,7 @@ private constructor( pkce, refreshRequest, scopeDelimiter, + tokenIntrospectionRequest, tokenRequest, userInfoRequest, additionalProperties, @@ -4984,7 +6189,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/tools/ExecuteToolResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ExecuteToolResponse.kt index eb5c67b..88d33a0 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 @@ -1231,6 +1231,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 +1268,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 +1303,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 +1341,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 +1380,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") } 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..42fd644 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 @@ -1046,6 +1046,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 +1083,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 +1118,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 +1156,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 +1195,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") } 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..ad4ae18 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()) } @@ -433,6 +459,7 @@ private constructor( } return other is ToolListParams && + filter == other.filter && includeAllVersions == other.includeAllVersions && includeFormat == other.includeFormat && limit == other.limit && @@ -445,6 +472,7 @@ private constructor( override fun hashCode(): Int = Objects.hash( + filter, includeAllVersions, includeFormat, limit, @@ -456,5 +484,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/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/workers/WorkerResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/workers/WorkerResponse.kt index 51843b5..45ff0b1 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 @@ -1297,8 +1297,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 +1310,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 +1352,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 +1382,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 +1405,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 +1463,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 +1475,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 +1486,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 +1519,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 +1602,10 @@ private constructor( */ fun build(): Mcp = Mcp( + externalId, headers, oauth2, + redirectUri, retry, secrets, timeout, @@ -1543,8 +1621,10 @@ private constructor( return@apply } + externalId() headers().ifPresent { it.validate() } oauth2().ifPresent { it.validate() } + redirectUri() retry() secrets().ifPresent { it.validate() } timeout() @@ -1568,8 +1648,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) + @@ -2572,8 +2654,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 +2666,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 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..59c4067 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 { 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