From 4e1dd23facb1daf92135fde91bbeb1fefc9e1b76 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 22:23:47 +0000 Subject: [PATCH 01/12] feat(api): Enable publishing for Java SDK The default setting publishes to Sonatype OSSRH server which has been EoL'd, this setting configures the build to use the newer publishing API. --- .github/workflows/publish-sonatype.yml | 2 +- .stats.yml | 2 +- build.gradle.kts | 13 --- buildSrc/build.gradle.kts | 3 + .../src/main/kotlin/arcade.java.gradle.kts | 9 -- .../src/main/kotlin/arcade.publish.gradle.kts | 107 +++++++++--------- 6 files changed, 60 insertions(+), 76 deletions(-) diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 860cf22..02fc7e3 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -33,7 +33,7 @@ jobs: export -- GPG_SIGNING_KEY_ID printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" - ./gradlew publish --no-configuration-cache + ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache env: SONATYPE_USERNAME: ${{ secrets.ARCADE_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.ARCADE_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} diff --git a/.stats.yml b/.stats.yml index f7c06a5..1282f13 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 +config_hash: 9894d174e6b6fe15b31d60b296ffb6e7 diff --git a/build.gradle.kts b/build.gradle.kts index 7316284..85f3c5f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - id("io.github.gradle-nexus.publish-plugin") version "1.1.0" id("org.jetbrains.dokka") version "2.0.0" } @@ -35,15 +34,3 @@ tasks.named("dokkaJavadocCollector").configure { .filter { it.project.name != "arcade-java" && it.name == "dokkaJavadocJar" } .forEach { mustRunAfter(it) } } - -nexusPublishing { - repositories { - sonatype { - nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) - snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) - - username.set(System.getenv("SONATYPE_USERNAME")) - password.set(System.getenv("SONATYPE_PASSWORD")) - } - } -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 0b14135..c6dc92e 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,12 +1,15 @@ plugins { `kotlin-dsl` kotlin("jvm") version "1.9.20" + id("com.vanniktech.maven.publish") version "0.28.0" } repositories { gradlePluginPortal() + mavenCentral() } dependencies { implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") + implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/arcade.java.gradle.kts b/buildSrc/src/main/kotlin/arcade.java.gradle.kts index 81d5d32..70fc33f 100644 --- a/buildSrc/src/main/kotlin/arcade.java.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.java.gradle.kts @@ -8,11 +8,6 @@ repositories { mavenCentral() } -configure { - withJavadocJar() - withSourcesJar() -} - java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) @@ -27,10 +22,6 @@ tasks.withType().configureEach { options.release.set(8) } -tasks.named("javadocJar") { - setZip64(true) -} - tasks.named("jar") { manifest { attributes(mapOf( diff --git a/buildSrc/src/main/kotlin/arcade.publish.gradle.kts b/buildSrc/src/main/kotlin/arcade.publish.gradle.kts index 39290bc..06c05b5 100644 --- a/buildSrc/src/main/kotlin/arcade.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.publish.gradle.kts @@ -1,69 +1,72 @@ +import com.vanniktech.maven.publish.JavadocJar +import com.vanniktech.maven.publish.KotlinJvm +import com.vanniktech.maven.publish.MavenPublishBaseExtension +import com.vanniktech.maven.publish.SonatypeHost + plugins { - `maven-publish` - signing + id("com.vanniktech.maven.publish") +} + +publishing { + repositories { + if (project.hasProperty("publishLocal")) { + maven { + name = "LocalFileSystem" + url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") + } + } + } } -configure { - publications { - register("maven") { - from(components["java"]) +repositories { + gradlePluginPortal() + mavenCentral() +} - pom { - name.set("Arcade API") - description.set("Reference Documentation for Arcade Engine API") - url.set("https://docs.arcade.dev") +extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY") +extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID") +extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD") - licenses { - license { - name.set("MIT") - } - } +configure { + if (!project.hasProperty("publishLocal")) { + signAllPublications() + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) + } - developers { - developer { - name.set("Arcade") - email.set("dev@arcade.dev") - } - } + coordinates(project.group.toString(), project.name, project.version.toString()) + configure( + KotlinJvm( + javadocJar = JavadocJar.Dokka("dokkaJavadoc"), + sourcesJar = true, + ) + ) - scm { - connection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") - developerConnection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") - url.set("https://github.com/ArcadeAI/arcade-java") - } + pom { + name.set("Arcade API") + description.set("Reference Documentation for Arcade Engine API") + url.set("https://docs.arcade.dev") - versionMapping { - allVariants { - fromResolutionResult() - } - } + licenses { + license { + name.set("MIT") } } - } - repositories { - if (project.hasProperty("publishLocal")) { - maven { - name = "LocalFileSystem" - url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") + + developers { + developer { + name.set("Arcade") + email.set("dev@arcade.dev") } } - } -} -signing { - val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")?.ifBlank { null } - val signingKey = System.getenv("GPG_SIGNING_KEY")?.ifBlank { null } - val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null } - if (signingKey != null && signingPassword != null) { - useInMemoryPgpKeys( - signingKeyId, - signingKey, - signingPassword, - ) - sign(publishing.publications["maven"]) + scm { + connection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") + developerConnection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") + url.set("https://github.com/ArcadeAI/arcade-java") + } } } -tasks.named("publish") { - dependsOn(":closeAndReleaseSonatypeStagingRepository") +tasks.withType().configureEach { + isZip64 = true } From a9067a6b9e05ec27d0a4c3bd5a50b5fd568a617f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 22:25:32 +0000 Subject: [PATCH 02/12] feat(api): api update --- .github/workflows/publish-sonatype.yml | 2 +- .stats.yml | 2 +- build.gradle.kts | 13 +++ buildSrc/build.gradle.kts | 3 - .../src/main/kotlin/arcade.java.gradle.kts | 9 ++ .../src/main/kotlin/arcade.publish.gradle.kts | 107 +++++++++--------- 6 files changed, 76 insertions(+), 60 deletions(-) diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 02fc7e3..860cf22 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -33,7 +33,7 @@ jobs: export -- GPG_SIGNING_KEY_ID printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" - ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache + ./gradlew publish --no-configuration-cache env: SONATYPE_USERNAME: ${{ secrets.ARCADE_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.ARCADE_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} diff --git a/.stats.yml b/.stats.yml index 1282f13..f7c06a5 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: 9894d174e6b6fe15b31d60b296ffb6e7 +config_hash: bf64816643634a621cd0ffd93d9c4347 diff --git a/build.gradle.kts b/build.gradle.kts index 85f3c5f..7316284 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ plugins { + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" id("org.jetbrains.dokka") version "2.0.0" } @@ -34,3 +35,15 @@ tasks.named("dokkaJavadocCollector").configure { .filter { it.project.name != "arcade-java" && it.name == "dokkaJavadocJar" } .forEach { mustRunAfter(it) } } + +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + + username.set(System.getenv("SONATYPE_USERNAME")) + password.set(System.getenv("SONATYPE_PASSWORD")) + } + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index c6dc92e..0b14135 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,15 +1,12 @@ plugins { `kotlin-dsl` kotlin("jvm") version "1.9.20" - id("com.vanniktech.maven.publish") version "0.28.0" } repositories { gradlePluginPortal() - mavenCentral() } dependencies { implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") - implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/arcade.java.gradle.kts b/buildSrc/src/main/kotlin/arcade.java.gradle.kts index 70fc33f..81d5d32 100644 --- a/buildSrc/src/main/kotlin/arcade.java.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.java.gradle.kts @@ -8,6 +8,11 @@ repositories { mavenCentral() } +configure { + withJavadocJar() + withSourcesJar() +} + java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) @@ -22,6 +27,10 @@ tasks.withType().configureEach { options.release.set(8) } +tasks.named("javadocJar") { + setZip64(true) +} + tasks.named("jar") { manifest { attributes(mapOf( diff --git a/buildSrc/src/main/kotlin/arcade.publish.gradle.kts b/buildSrc/src/main/kotlin/arcade.publish.gradle.kts index 06c05b5..39290bc 100644 --- a/buildSrc/src/main/kotlin/arcade.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.publish.gradle.kts @@ -1,72 +1,69 @@ -import com.vanniktech.maven.publish.JavadocJar -import com.vanniktech.maven.publish.KotlinJvm -import com.vanniktech.maven.publish.MavenPublishBaseExtension -import com.vanniktech.maven.publish.SonatypeHost - plugins { - id("com.vanniktech.maven.publish") -} - -publishing { - repositories { - if (project.hasProperty("publishLocal")) { - maven { - name = "LocalFileSystem" - url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") - } - } - } + `maven-publish` + signing } -repositories { - gradlePluginPortal() - mavenCentral() -} +configure { + publications { + register("maven") { + from(components["java"]) -extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY") -extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID") -extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD") + pom { + name.set("Arcade API") + description.set("Reference Documentation for Arcade Engine API") + url.set("https://docs.arcade.dev") -configure { - if (!project.hasProperty("publishLocal")) { - signAllPublications() - publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) - } + licenses { + license { + name.set("MIT") + } + } - coordinates(project.group.toString(), project.name, project.version.toString()) - configure( - KotlinJvm( - javadocJar = JavadocJar.Dokka("dokkaJavadoc"), - sourcesJar = true, - ) - ) + developers { + developer { + name.set("Arcade") + email.set("dev@arcade.dev") + } + } - pom { - name.set("Arcade API") - description.set("Reference Documentation for Arcade Engine API") - url.set("https://docs.arcade.dev") + scm { + connection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") + developerConnection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") + url.set("https://github.com/ArcadeAI/arcade-java") + } - licenses { - license { - name.set("MIT") + versionMapping { + allVariants { + fromResolutionResult() + } + } } } - - developers { - developer { - name.set("Arcade") - email.set("dev@arcade.dev") + } + repositories { + if (project.hasProperty("publishLocal")) { + maven { + name = "LocalFileSystem" + url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") } } + } +} - scm { - connection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") - developerConnection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") - url.set("https://github.com/ArcadeAI/arcade-java") - } +signing { + val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")?.ifBlank { null } + val signingKey = System.getenv("GPG_SIGNING_KEY")?.ifBlank { null } + val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null } + if (signingKey != null && signingPassword != null) { + useInMemoryPgpKeys( + signingKeyId, + signingKey, + signingPassword, + ) + sign(publishing.publications["maven"]) } } -tasks.withType().configureEach { - isZip64 = true +tasks.named("publish") { + dependsOn(":closeAndReleaseSonatypeStagingRepository") } From ab083dc5b22c66bd1a216107ed5d427270f7535f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 01:07:25 +0000 Subject: [PATCH 03/12] feat(api): api update --- .stats.yml | 6 +- .../authproviders/AuthProviderResponse.kt | 38 +- .../models/admin/secrets/SecretResponse.kt | 46 +- .../UserConnectionListParams.kt | 280 +++++- .../dev/arcade/models/health/HealthSchema.kt | 47 +- .../models/tools/ExecuteToolResponse.kt | 12 - .../dev/arcade/models/tools/ToolDefinition.kt | 848 +----------------- .../models/tools/ToolExecutionAttempt.kt | 12 - .../tools/formatted/FormattedGetResponse.kt | 27 +- .../tools/formatted/FormattedListResponse.kt | 26 +- .../arcade/models/workers/WorkerResponse.kt | 196 ++-- .../AuthProviderListResponseTest.kt | 3 + .../authproviders/AuthProviderResponseTest.kt | 3 + .../admin/secrets/SecretListResponseTest.kt | 3 + .../admin/secrets/SecretResponseTest.kt | 3 + .../UserConnectionListParamsTest.kt | 12 +- .../arcade/models/health/HealthSchemaTest.kt | 5 +- .../arcade/models/tools/ToolDefinitionTest.kt | 70 -- .../models/tools/ToolListPageResponseTest.kt | 69 -- .../formatted/FormattedGetResponseTest.kt | 11 +- .../FormattedListPageResponseTest.kt | 19 +- .../formatted/FormattedListResponseTest.kt | 11 +- .../workers/WorkerListPageResponseTest.kt | 15 +- .../models/workers/WorkerResponseTest.kt | 15 +- .../workers/WorkerToolsPageResponseTest.kt | 69 -- 25 files changed, 502 insertions(+), 1344 deletions(-) diff --git a/.stats.yml b/.stats.yml index f7c06a5..9883e5e 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-7ecb40b6650ff002eed02efd1b59c630abe1fb9eb70c9c916c15b115260e5003.yml +openapi_spec_hash: 2e5c04d1a50afcd0bdbd9737cec227c9 +config_hash: 01e6bd1df0d14c729087edec4e6b6650 diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt index c00cfb8..e677a81 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt @@ -1897,6 +1897,7 @@ private constructor( private val binding: JsonField, private val editable: JsonField, private val exists: JsonField, + private val hint: JsonField, private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -1912,8 +1913,9 @@ private constructor( @JsonProperty("exists") @ExcludeMissing exists: JsonField = JsonMissing.of(), + @JsonProperty("hint") @ExcludeMissing hint: JsonField = JsonMissing.of(), @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), - ) : this(binding, editable, exists, value, mutableMapOf()) + ) : this(binding, editable, exists, hint, value, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if @@ -1933,6 +1935,12 @@ private constructor( */ fun exists(): Optional = exists.getOptional("exists") + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun hint(): Optional = hint.getOptional("hint") + /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1961,6 +1969,13 @@ private constructor( */ @JsonProperty("exists") @ExcludeMissing fun _exists(): JsonField = exists + /** + * Returns the raw JSON value of [hint]. + * + * Unlike [hint], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("hint") @ExcludeMissing fun _hint(): JsonField = hint + /** * Returns the raw JSON value of [value]. * @@ -1992,6 +2007,7 @@ private constructor( private var binding: JsonField = JsonMissing.of() private var editable: JsonField = JsonMissing.of() private var exists: JsonField = JsonMissing.of() + private var hint: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2000,6 +2016,7 @@ private constructor( binding = clientSecret.binding editable = clientSecret.editable exists = clientSecret.exists + hint = clientSecret.hint value = clientSecret.value additionalProperties = clientSecret.additionalProperties.toMutableMap() } @@ -2037,6 +2054,17 @@ private constructor( */ fun exists(exists: JsonField) = apply { this.exists = exists } + fun hint(hint: String) = hint(JsonField.of(hint)) + + /** + * Sets [Builder.hint] to an arbitrary JSON value. + * + * You should usually call [Builder.hint] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun hint(hint: JsonField) = apply { this.hint = hint } + fun value(value: String) = value(JsonField.of(value)) /** @@ -2080,6 +2108,7 @@ private constructor( binding, editable, exists, + hint, value, additionalProperties.toMutableMap(), ) @@ -2095,6 +2124,7 @@ private constructor( binding().ifPresent { it.validate() } editable() exists() + hint() value() validated = true } @@ -2118,6 +2148,7 @@ private constructor( (binding.asKnown().getOrNull()?.validity() ?: 0) + (if (editable.asKnown().isPresent) 1 else 0) + (if (exists.asKnown().isPresent) 1 else 0) + + (if (hint.asKnown().isPresent) 1 else 0) + (if (value.asKnown().isPresent) 1 else 0) class Binding @JsonCreator private constructor(private val value: JsonField) : @@ -2272,18 +2303,19 @@ private constructor( binding == other.binding && editable == other.editable && exists == other.exists && + hint == other.hint && value == other.value && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(binding, editable, exists, value, additionalProperties) + Objects.hash(binding, editable, exists, hint, value, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "ClientSecret{binding=$binding, editable=$editable, exists=$exists, value=$value, additionalProperties=$additionalProperties}" + "ClientSecret{binding=$binding, editable=$editable, exists=$exists, hint=$hint, value=$value, additionalProperties=$additionalProperties}" } class Pkce diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt index 4146152..3a34368 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt @@ -24,6 +24,7 @@ private constructor( private val binding: JsonField, private val createdAt: JsonField, private val description: JsonField, + private val hint: JsonField, private val key: JsonField, private val lastAccessedAt: JsonField, private val updatedAt: JsonField, @@ -38,12 +39,23 @@ private constructor( @JsonProperty("description") @ExcludeMissing description: JsonField = JsonMissing.of(), + @JsonProperty("hint") @ExcludeMissing hint: JsonField = JsonMissing.of(), @JsonProperty("key") @ExcludeMissing key: JsonField = JsonMissing.of(), @JsonProperty("last_accessed_at") @ExcludeMissing lastAccessedAt: JsonField = JsonMissing.of(), @JsonProperty("updated_at") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), - ) : this(id, binding, createdAt, description, key, lastAccessedAt, updatedAt, mutableMapOf()) + ) : this( + id, + binding, + createdAt, + description, + hint, + key, + lastAccessedAt, + updatedAt, + mutableMapOf(), + ) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -69,6 +81,12 @@ private constructor( */ fun description(): Optional = description.getOptional("description") + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun hint(): Optional = hint.getOptional("hint") + /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -115,6 +133,13 @@ private constructor( */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description + /** + * Returns the raw JSON value of [hint]. + * + * Unlike [hint], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("hint") @ExcludeMissing fun _hint(): JsonField = hint + /** * Returns the raw JSON value of [key]. * @@ -163,6 +188,7 @@ private constructor( private var binding: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() + private var hint: JsonField = JsonMissing.of() private var key: JsonField = JsonMissing.of() private var lastAccessedAt: JsonField = JsonMissing.of() private var updatedAt: JsonField = JsonMissing.of() @@ -174,6 +200,7 @@ private constructor( binding = secretResponse.binding createdAt = secretResponse.createdAt description = secretResponse.description + hint = secretResponse.hint key = secretResponse.key lastAccessedAt = secretResponse.lastAccessedAt updatedAt = secretResponse.updatedAt @@ -222,6 +249,16 @@ private constructor( */ fun description(description: JsonField) = apply { this.description = description } + fun hint(hint: String) = hint(JsonField.of(hint)) + + /** + * Sets [Builder.hint] to an arbitrary JSON value. + * + * You should usually call [Builder.hint] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun hint(hint: JsonField) = apply { this.hint = hint } + fun key(key: String) = key(JsonField.of(key)) /** @@ -286,6 +323,7 @@ private constructor( binding, createdAt, description, + hint, key, lastAccessedAt, updatedAt, @@ -304,6 +342,7 @@ private constructor( binding().ifPresent { it.validate() } createdAt() description() + hint() key() lastAccessedAt() updatedAt() @@ -329,6 +368,7 @@ private constructor( (binding.asKnown().getOrNull()?.validity() ?: 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + + (if (hint.asKnown().isPresent) 1 else 0) + (if (key.asKnown().isPresent) 1 else 0) + (if (lastAccessedAt.asKnown().isPresent) 1 else 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) @@ -652,6 +692,7 @@ private constructor( binding == other.binding && createdAt == other.createdAt && description == other.description && + hint == other.hint && key == other.key && lastAccessedAt == other.lastAccessedAt && updatedAt == other.updatedAt && @@ -664,6 +705,7 @@ private constructor( binding, createdAt, description, + hint, key, lastAccessedAt, updatedAt, @@ -674,5 +716,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SecretResponse{id=$id, binding=$binding, createdAt=$createdAt, description=$description, key=$key, lastAccessedAt=$lastAccessedAt, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" + "SecretResponse{id=$id, binding=$binding, createdAt=$createdAt, description=$description, hint=$hint, key=$key, lastAccessedAt=$lastAccessedAt, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" } diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParams.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParams.kt index 5f6611c..15743ac 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParams.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParams.kt @@ -14,8 +14,8 @@ class UserConnectionListParams private constructor( private val limit: Long?, private val offset: Long?, - private val providerId: String?, - private val userId: String?, + private val provider: Provider?, + private val user: User?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -26,11 +26,9 @@ private constructor( /** Page offset */ fun offset(): Optional = Optional.ofNullable(offset) - /** Provider ID */ - fun providerId(): Optional = Optional.ofNullable(providerId) + fun provider(): Optional = Optional.ofNullable(provider) - /** User ID */ - fun userId(): Optional = Optional.ofNullable(userId) + fun user(): Optional = Optional.ofNullable(user) /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -53,8 +51,8 @@ private constructor( private var limit: Long? = null private var offset: Long? = null - private var providerId: String? = null - private var userId: String? = null + private var provider: Provider? = null + private var user: User? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -62,8 +60,8 @@ private constructor( internal fun from(userConnectionListParams: UserConnectionListParams) = apply { limit = userConnectionListParams.limit offset = userConnectionListParams.offset - providerId = userConnectionListParams.providerId - userId = userConnectionListParams.userId + provider = userConnectionListParams.provider + user = userConnectionListParams.user additionalHeaders = userConnectionListParams.additionalHeaders.toBuilder() additionalQueryParams = userConnectionListParams.additionalQueryParams.toBuilder() } @@ -94,17 +92,15 @@ private constructor( /** Alias for calling [Builder.offset] with `offset.orElse(null)`. */ fun offset(offset: Optional) = offset(offset.getOrNull()) - /** Provider ID */ - fun providerId(providerId: String?) = apply { this.providerId = providerId } + fun provider(provider: Provider?) = apply { this.provider = provider } - /** Alias for calling [Builder.providerId] with `providerId.orElse(null)`. */ - fun providerId(providerId: Optional) = providerId(providerId.getOrNull()) + /** Alias for calling [Builder.provider] with `provider.orElse(null)`. */ + fun provider(provider: Optional) = provider(provider.getOrNull()) - /** User ID */ - fun userId(userId: String?) = apply { this.userId = userId } + fun user(user: User?) = apply { this.user = user } - /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ - fun userId(userId: Optional) = userId(userId.getOrNull()) + /** Alias for calling [Builder.user] with `user.orElse(null)`. */ + fun user(user: Optional) = user(user.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -213,8 +209,8 @@ private constructor( UserConnectionListParams( limit, offset, - providerId, - userId, + provider, + user, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -227,12 +223,244 @@ private constructor( .apply { limit?.let { put("limit", it.toString()) } offset?.let { put("offset", it.toString()) } - providerId?.let { put("provider_id", it) } - userId?.let { put("user_id", it) } + provider?.let { + it.id().ifPresent { put("provider[id]", it) } + it._additionalProperties().keys().forEach { key -> + it._additionalProperties().values(key).forEach { value -> + put("provider[$key]", value) + } + } + } + user?.let { + it.id().ifPresent { put("user[id]", it) } + it._additionalProperties().keys().forEach { key -> + it._additionalProperties().values(key).forEach { value -> + put("user[$key]", value) + } + } + } putAll(additionalQueryParams) } .build() + class Provider + private constructor(private val id: String?, private val additionalProperties: QueryParams) { + + /** Provider ID */ + fun id(): Optional = Optional.ofNullable(id) + + /** Query params to send with the request. */ + fun _additionalProperties(): QueryParams = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Provider]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Provider]. */ + class Builder internal constructor() { + + private var id: String? = null + private var additionalProperties: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(provider: Provider) = apply { + id = provider.id + additionalProperties = provider.additionalProperties.toBuilder() + } + + /** Provider ID */ + fun id(id: String?) = apply { this.id = id } + + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ + fun id(id: Optional) = id(id.getOrNull()) + + fun additionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun additionalProperties(additionalProperties: Map>) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: String) = apply { + additionalProperties.put(key, value) + } + + fun putAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.put(key, values) + } + + fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun putAllAdditionalProperties(additionalProperties: Map>) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun replaceAdditionalProperties(key: String, value: String) = apply { + additionalProperties.replace(key, value) + } + + fun replaceAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.replace(key, values) + } + + fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.replaceAll(additionalProperties) + } + + fun replaceAllAdditionalProperties( + additionalProperties: Map> + ) = apply { this.additionalProperties.replaceAll(additionalProperties) } + + fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + additionalProperties.removeAll(keys) + } + + /** + * Returns an immutable instance of [Provider]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Provider = Provider(id, additionalProperties.build()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Provider && + id == other.id && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Provider{id=$id, additionalProperties=$additionalProperties}" + } + + class User + private constructor(private val id: String?, private val additionalProperties: QueryParams) { + + /** User ID */ + fun id(): Optional = Optional.ofNullable(id) + + /** Query params to send with the request. */ + fun _additionalProperties(): QueryParams = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [User]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [User]. */ + class Builder internal constructor() { + + private var id: String? = null + private var additionalProperties: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(user: User) = apply { + id = user.id + additionalProperties = user.additionalProperties.toBuilder() + } + + /** User ID */ + fun id(id: String?) = apply { this.id = id } + + /** Alias for calling [Builder.id] with `id.orElse(null)`. */ + fun id(id: Optional) = id(id.getOrNull()) + + fun additionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun additionalProperties(additionalProperties: Map>) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: String) = apply { + additionalProperties.put(key, value) + } + + fun putAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.put(key, values) + } + + fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun putAllAdditionalProperties(additionalProperties: Map>) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun replaceAdditionalProperties(key: String, value: String) = apply { + additionalProperties.replace(key, value) + } + + fun replaceAdditionalProperties(key: String, values: Iterable) = apply { + additionalProperties.replace(key, values) + } + + fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { + this.additionalProperties.replaceAll(additionalProperties) + } + + fun replaceAllAdditionalProperties( + additionalProperties: Map> + ) = apply { this.additionalProperties.replaceAll(additionalProperties) } + + fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + additionalProperties.removeAll(keys) + } + + /** + * Returns an immutable instance of [User]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): User = User(id, additionalProperties.build()) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is User && + id == other.id && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "User{id=$id, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -241,15 +469,15 @@ private constructor( return other is UserConnectionListParams && limit == other.limit && offset == other.offset && - providerId == other.providerId && - userId == other.userId && + provider == other.provider && + user == other.user && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } override fun hashCode(): Int = - Objects.hash(limit, offset, providerId, userId, additionalHeaders, additionalQueryParams) + Objects.hash(limit, offset, provider, user, additionalHeaders, additionalQueryParams) override fun toString() = - "UserConnectionListParams{limit=$limit, offset=$offset, providerId=$providerId, userId=$userId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "UserConnectionListParams{limit=$limit, offset=$offset, provider=$provider, user=$user, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt index 27720dd..7276511 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt @@ -19,15 +19,13 @@ class HealthSchema @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val healthy: JsonField, - private val reason: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("healthy") @ExcludeMissing healthy: JsonField = JsonMissing.of(), - @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), - ) : this(healthy, reason, mutableMapOf()) + @JsonProperty("healthy") @ExcludeMissing healthy: JsonField = JsonMissing.of() + ) : this(healthy, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -35,14 +33,6 @@ private constructor( */ fun healthy(): Optional = healthy.getOptional("healthy") - /** - * Optional: explains why unhealthy - * - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun reason(): Optional = reason.getOptional("reason") - /** * Returns the raw JSON value of [healthy]. * @@ -50,13 +40,6 @@ private constructor( */ @JsonProperty("healthy") @ExcludeMissing fun _healthy(): JsonField = healthy - /** - * Returns the raw JSON value of [reason]. - * - * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -79,13 +62,11 @@ private constructor( class Builder internal constructor() { private var healthy: JsonField = JsonMissing.of() - private var reason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(healthSchema: HealthSchema) = apply { healthy = healthSchema.healthy - reason = healthSchema.reason additionalProperties = healthSchema.additionalProperties.toMutableMap() } @@ -99,17 +80,6 @@ private constructor( */ fun healthy(healthy: JsonField) = apply { this.healthy = healthy } - /** Optional: explains why unhealthy */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** - * Sets [Builder.reason] to an arbitrary JSON value. - * - * You should usually call [Builder.reason] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun reason(reason: JsonField) = apply { this.reason = reason } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -134,8 +104,7 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): HealthSchema = - HealthSchema(healthy, reason, additionalProperties.toMutableMap()) + fun build(): HealthSchema = HealthSchema(healthy, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -146,7 +115,6 @@ private constructor( } healthy() - reason() validated = true } @@ -163,9 +131,7 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic - internal fun validity(): Int = - (if (healthy.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) + @JvmSynthetic internal fun validity(): Int = (if (healthy.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -174,14 +140,13 @@ private constructor( return other is HealthSchema && healthy == other.healthy && - reason == other.reason && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(healthy, reason, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(healthy, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "HealthSchema{healthy=$healthy, reason=$reason, additionalProperties=$additionalProperties}" + "HealthSchema{healthy=$healthy, additionalProperties=$additionalProperties}" } 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..dd233a6 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 @@ -1211,10 +1211,6 @@ private constructor( @JvmField val TOOL_RUNTIME_FATAL = of("TOOL_RUNTIME_FATAL") - @JvmField val CONTEXT_CHECK_FAILED = of("CONTEXT_CHECK_FAILED") - - @JvmField val CONTEXT_DENIED = of("CONTEXT_DENIED") - @JvmField val UPSTREAM_RUNTIME_BAD_REQUEST = of("UPSTREAM_RUNTIME_BAD_REQUEST") @JvmField val UPSTREAM_RUNTIME_AUTH_ERROR = of("UPSTREAM_RUNTIME_AUTH_ERROR") @@ -1248,8 +1244,6 @@ private constructor( TOOL_RUNTIME_RETRY, TOOL_RUNTIME_CONTEXT_REQUIRED, TOOL_RUNTIME_FATAL, - CONTEXT_CHECK_FAILED, - CONTEXT_DENIED, UPSTREAM_RUNTIME_BAD_REQUEST, UPSTREAM_RUNTIME_AUTH_ERROR, UPSTREAM_RUNTIME_NOT_FOUND, @@ -1280,8 +1274,6 @@ private constructor( TOOL_RUNTIME_RETRY, TOOL_RUNTIME_CONTEXT_REQUIRED, TOOL_RUNTIME_FATAL, - CONTEXT_CHECK_FAILED, - CONTEXT_DENIED, UPSTREAM_RUNTIME_BAD_REQUEST, UPSTREAM_RUNTIME_AUTH_ERROR, UPSTREAM_RUNTIME_NOT_FOUND, @@ -1315,8 +1307,6 @@ private constructor( TOOL_RUNTIME_RETRY -> Value.TOOL_RUNTIME_RETRY TOOL_RUNTIME_CONTEXT_REQUIRED -> Value.TOOL_RUNTIME_CONTEXT_REQUIRED TOOL_RUNTIME_FATAL -> Value.TOOL_RUNTIME_FATAL - CONTEXT_CHECK_FAILED -> Value.CONTEXT_CHECK_FAILED - CONTEXT_DENIED -> Value.CONTEXT_DENIED UPSTREAM_RUNTIME_BAD_REQUEST -> Value.UPSTREAM_RUNTIME_BAD_REQUEST UPSTREAM_RUNTIME_AUTH_ERROR -> Value.UPSTREAM_RUNTIME_AUTH_ERROR UPSTREAM_RUNTIME_NOT_FOUND -> Value.UPSTREAM_RUNTIME_NOT_FOUND @@ -1349,8 +1339,6 @@ private constructor( TOOL_RUNTIME_RETRY -> Known.TOOL_RUNTIME_RETRY TOOL_RUNTIME_CONTEXT_REQUIRED -> Known.TOOL_RUNTIME_CONTEXT_REQUIRED TOOL_RUNTIME_FATAL -> Known.TOOL_RUNTIME_FATAL - CONTEXT_CHECK_FAILED -> Known.CONTEXT_CHECK_FAILED - CONTEXT_DENIED -> Known.CONTEXT_DENIED UPSTREAM_RUNTIME_BAD_REQUEST -> Known.UPSTREAM_RUNTIME_BAD_REQUEST UPSTREAM_RUNTIME_AUTH_ERROR -> Known.UPSTREAM_RUNTIME_AUTH_ERROR UPSTREAM_RUNTIME_NOT_FOUND -> Known.UPSTREAM_RUNTIME_NOT_FOUND diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt index 7be442a..dc1a2ab 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt @@ -30,7 +30,6 @@ private constructor( private val toolkit: JsonField, private val description: JsonField, private val formattedSchema: JsonField, - private val metadata: JsonField, private val output: JsonField, private val requirements: JsonField, private val additionalProperties: MutableMap, @@ -53,7 +52,6 @@ private constructor( @JsonProperty("formatted_schema") @ExcludeMissing formattedSchema: JsonField = JsonMissing.of(), - @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), @JsonProperty("output") @ExcludeMissing output: JsonField = JsonMissing.of(), @JsonProperty("requirements") @ExcludeMissing @@ -66,7 +64,6 @@ private constructor( toolkit, description, formattedSchema, - metadata, output, requirements, mutableMapOf(), @@ -115,12 +112,6 @@ private constructor( fun formattedSchema(): Optional = formattedSchema.getOptional("formatted_schema") - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun metadata(): Optional = metadata.getOptional("metadata") - /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -189,13 +180,6 @@ private constructor( @ExcludeMissing fun _formattedSchema(): JsonField = formattedSchema - /** - * Returns the raw JSON value of [metadata]. - * - * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata - /** * Returns the raw JSON value of [output]. * @@ -251,7 +235,6 @@ private constructor( private var toolkit: JsonField? = null private var description: JsonField = JsonMissing.of() private var formattedSchema: JsonField = JsonMissing.of() - private var metadata: JsonField = JsonMissing.of() private var output: JsonField = JsonMissing.of() private var requirements: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -265,7 +248,6 @@ private constructor( toolkit = toolDefinition.toolkit description = toolDefinition.description formattedSchema = toolDefinition.formattedSchema - metadata = toolDefinition.metadata output = toolDefinition.output requirements = toolDefinition.requirements additionalProperties = toolDefinition.additionalProperties.toMutableMap() @@ -353,17 +335,6 @@ private constructor( this.formattedSchema = formattedSchema } - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) - - /** - * Sets [Builder.metadata] to an arbitrary JSON value. - * - * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - fun output(output: Output) = output(JsonField.of(output)) /** @@ -431,7 +402,6 @@ private constructor( checkRequired("toolkit", toolkit), description, formattedSchema, - metadata, output, requirements, additionalProperties.toMutableMap(), @@ -452,7 +422,6 @@ private constructor( toolkit().validate() description() formattedSchema().ifPresent { it.validate() } - metadata().ifPresent { it.validate() } output().ifPresent { it.validate() } requirements().ifPresent { it.validate() } validated = true @@ -480,7 +449,6 @@ private constructor( (toolkit.asKnown().getOrNull()?.validity() ?: 0) + (if (description.asKnown().isPresent) 1 else 0) + (formattedSchema.asKnown().getOrNull()?.validity() ?: 0) + - (metadata.asKnown().getOrNull()?.validity() ?: 0) + (output.asKnown().getOrNull()?.validity() ?: 0) + (requirements.asKnown().getOrNull()?.validity() ?: 0) @@ -1301,818 +1269,6 @@ private constructor( override fun toString() = "FormattedSchema{additionalProperties=$additionalProperties}" } - class Metadata - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val behavior: JsonField, - private val classification: JsonField, - private val extras: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("behavior") - @ExcludeMissing - behavior: JsonField = JsonMissing.of(), - @JsonProperty("classification") - @ExcludeMissing - classification: JsonField = JsonMissing.of(), - @JsonProperty("extras") @ExcludeMissing extras: JsonField = JsonMissing.of(), - ) : this(behavior, classification, extras, mutableMapOf()) - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun behavior(): Optional = behavior.getOptional("behavior") - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun classification(): Optional = - classification.getOptional("classification") - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun extras(): Optional = extras.getOptional("extras") - - /** - * Returns the raw JSON value of [behavior]. - * - * Unlike [behavior], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("behavior") @ExcludeMissing fun _behavior(): JsonField = behavior - - /** - * Returns the raw JSON value of [classification]. - * - * Unlike [classification], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("classification") - @ExcludeMissing - fun _classification(): JsonField = classification - - /** - * Returns the raw JSON value of [extras]. - * - * Unlike [extras], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("extras") @ExcludeMissing fun _extras(): JsonField = extras - - @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 [Metadata]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Metadata]. */ - class Builder internal constructor() { - - private var behavior: JsonField = JsonMissing.of() - private var classification: JsonField = JsonMissing.of() - private var extras: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - behavior = metadata.behavior - classification = metadata.classification - extras = metadata.extras - additionalProperties = metadata.additionalProperties.toMutableMap() - } - - fun behavior(behavior: Behavior) = behavior(JsonField.of(behavior)) - - /** - * Sets [Builder.behavior] to an arbitrary JSON value. - * - * You should usually call [Builder.behavior] with a well-typed [Behavior] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun behavior(behavior: JsonField) = apply { this.behavior = behavior } - - fun classification(classification: Classification) = - classification(JsonField.of(classification)) - - /** - * Sets [Builder.classification] to an arbitrary JSON value. - * - * You should usually call [Builder.classification] with a well-typed [Classification] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun classification(classification: JsonField) = apply { - this.classification = classification - } - - fun extras(extras: Extras) = extras(JsonField.of(extras)) - - /** - * Sets [Builder.extras] to an arbitrary JSON value. - * - * You should usually call [Builder.extras] with a well-typed [Extras] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun extras(extras: JsonField) = apply { this.extras = extras } - - 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 [Metadata]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Metadata = - Metadata(behavior, classification, extras, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - behavior().ifPresent { it.validate() } - classification().ifPresent { it.validate() } - extras().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 = - (behavior.asKnown().getOrNull()?.validity() ?: 0) + - (classification.asKnown().getOrNull()?.validity() ?: 0) + - (extras.asKnown().getOrNull()?.validity() ?: 0) - - class Behavior - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val destructive: JsonField, - private val idempotent: JsonField, - private val openWorld: JsonField, - private val operations: JsonField>, - private val readOnly: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("destructive") - @ExcludeMissing - destructive: JsonField = JsonMissing.of(), - @JsonProperty("idempotent") - @ExcludeMissing - idempotent: JsonField = JsonMissing.of(), - @JsonProperty("open_world") - @ExcludeMissing - openWorld: JsonField = JsonMissing.of(), - @JsonProperty("operations") - @ExcludeMissing - operations: JsonField> = JsonMissing.of(), - @JsonProperty("read_only") - @ExcludeMissing - readOnly: JsonField = JsonMissing.of(), - ) : this(destructive, idempotent, openWorld, operations, readOnly, mutableMapOf()) - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun destructive(): Optional = destructive.getOptional("destructive") - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun idempotent(): Optional = idempotent.getOptional("idempotent") - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun openWorld(): Optional = openWorld.getOptional("open_world") - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun operations(): Optional> = operations.getOptional("operations") - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun readOnly(): Optional = readOnly.getOptional("read_only") - - /** - * Returns the raw JSON value of [destructive]. - * - * Unlike [destructive], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("destructive") - @ExcludeMissing - fun _destructive(): JsonField = destructive - - /** - * Returns the raw JSON value of [idempotent]. - * - * Unlike [idempotent], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("idempotent") - @ExcludeMissing - fun _idempotent(): JsonField = idempotent - - /** - * Returns the raw JSON value of [openWorld]. - * - * Unlike [openWorld], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("open_world") - @ExcludeMissing - fun _openWorld(): JsonField = openWorld - - /** - * Returns the raw JSON value of [operations]. - * - * Unlike [operations], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("operations") - @ExcludeMissing - fun _operations(): JsonField> = operations - - /** - * Returns the raw JSON value of [readOnly]. - * - * Unlike [readOnly], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("read_only") - @ExcludeMissing - fun _readOnly(): JsonField = readOnly - - @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 [Behavior]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Behavior]. */ - class Builder internal constructor() { - - private var destructive: JsonField = JsonMissing.of() - private var idempotent: JsonField = JsonMissing.of() - private var openWorld: JsonField = JsonMissing.of() - private var operations: JsonField>? = null - private var readOnly: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(behavior: Behavior) = apply { - destructive = behavior.destructive - idempotent = behavior.idempotent - openWorld = behavior.openWorld - operations = behavior.operations.map { it.toMutableList() } - readOnly = behavior.readOnly - additionalProperties = behavior.additionalProperties.toMutableMap() - } - - fun destructive(destructive: Boolean) = destructive(JsonField.of(destructive)) - - /** - * Sets [Builder.destructive] to an arbitrary JSON value. - * - * You should usually call [Builder.destructive] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun destructive(destructive: JsonField) = apply { - this.destructive = destructive - } - - fun idempotent(idempotent: Boolean) = idempotent(JsonField.of(idempotent)) - - /** - * Sets [Builder.idempotent] to an arbitrary JSON value. - * - * You should usually call [Builder.idempotent] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun idempotent(idempotent: JsonField) = apply { - this.idempotent = idempotent - } - - fun openWorld(openWorld: Boolean) = openWorld(JsonField.of(openWorld)) - - /** - * Sets [Builder.openWorld] to an arbitrary JSON value. - * - * You should usually call [Builder.openWorld] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun openWorld(openWorld: JsonField) = apply { this.openWorld = openWorld } - - fun operations(operations: List) = operations(JsonField.of(operations)) - - /** - * Sets [Builder.operations] to an arbitrary JSON value. - * - * You should usually call [Builder.operations] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun operations(operations: JsonField>) = apply { - this.operations = operations.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [operations]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addOperation(operation: String) = apply { - operations = - (operations ?: JsonField.of(mutableListOf())).also { - checkKnown("operations", it).add(operation) - } - } - - fun readOnly(readOnly: Boolean) = readOnly(JsonField.of(readOnly)) - - /** - * Sets [Builder.readOnly] to an arbitrary JSON value. - * - * You should usually call [Builder.readOnly] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun readOnly(readOnly: JsonField) = apply { this.readOnly = readOnly } - - 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 [Behavior]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Behavior = - Behavior( - destructive, - idempotent, - openWorld, - (operations ?: JsonMissing.of()).map { it.toImmutable() }, - readOnly, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Behavior = apply { - if (validated) { - return@apply - } - - destructive() - idempotent() - openWorld() - operations() - readOnly() - 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 (destructive.asKnown().isPresent) 1 else 0) + - (if (idempotent.asKnown().isPresent) 1 else 0) + - (if (openWorld.asKnown().isPresent) 1 else 0) + - (operations.asKnown().getOrNull()?.size ?: 0) + - (if (readOnly.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Behavior && - destructive == other.destructive && - idempotent == other.idempotent && - openWorld == other.openWorld && - operations == other.operations && - readOnly == other.readOnly && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - destructive, - idempotent, - openWorld, - operations, - readOnly, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Behavior{destructive=$destructive, idempotent=$idempotent, openWorld=$openWorld, operations=$operations, readOnly=$readOnly, additionalProperties=$additionalProperties}" - } - - class Classification - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val serviceDomains: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("service_domains") - @ExcludeMissing - serviceDomains: JsonField> = JsonMissing.of() - ) : this(serviceDomains, mutableMapOf()) - - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun serviceDomains(): Optional> = - serviceDomains.getOptional("service_domains") - - /** - * Returns the raw JSON value of [serviceDomains]. - * - * Unlike [serviceDomains], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("service_domains") - @ExcludeMissing - fun _serviceDomains(): JsonField> = serviceDomains - - @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 [Classification]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Classification]. */ - class Builder internal constructor() { - - private var serviceDomains: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(classification: Classification) = apply { - serviceDomains = classification.serviceDomains.map { it.toMutableList() } - additionalProperties = classification.additionalProperties.toMutableMap() - } - - fun serviceDomains(serviceDomains: List) = - serviceDomains(JsonField.of(serviceDomains)) - - /** - * Sets [Builder.serviceDomains] to an arbitrary JSON value. - * - * You should usually call [Builder.serviceDomains] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun serviceDomains(serviceDomains: JsonField>) = apply { - this.serviceDomains = serviceDomains.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [serviceDomains]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addServiceDomain(serviceDomain: String) = apply { - serviceDomains = - (serviceDomains ?: JsonField.of(mutableListOf())).also { - checkKnown("serviceDomains", it).add(serviceDomain) - } - } - - 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 [Classification]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Classification = - Classification( - (serviceDomains ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Classification = apply { - if (validated) { - return@apply - } - - serviceDomains() - 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 = (serviceDomains.asKnown().getOrNull()?.size ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Classification && - serviceDomains == other.serviceDomains && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(serviceDomains, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Classification{serviceDomains=$serviceDomains, additionalProperties=$additionalProperties}" - } - - class Extras - @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 [Extras]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Extras]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(extras: Extras) = apply { - additionalProperties = extras.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 [Extras]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Extras = Extras(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): Extras = 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 Extras && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Extras{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Metadata && - behavior == other.behavior && - classification == other.classification && - extras == other.extras && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(behavior, classification, extras, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Metadata{behavior=$behavior, classification=$classification, extras=$extras, additionalProperties=$additionalProperties}" - } - class Output @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -3668,7 +2824,6 @@ private constructor( toolkit == other.toolkit && description == other.description && formattedSchema == other.formattedSchema && - metadata == other.metadata && output == other.output && requirements == other.requirements && additionalProperties == other.additionalProperties @@ -3683,7 +2838,6 @@ private constructor( toolkit, description, formattedSchema, - metadata, output, requirements, additionalProperties, @@ -3693,5 +2847,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ToolDefinition{fullyQualifiedName=$fullyQualifiedName, input=$input, name=$name, qualifiedName=$qualifiedName, toolkit=$toolkit, description=$description, formattedSchema=$formattedSchema, metadata=$metadata, output=$output, requirements=$requirements, additionalProperties=$additionalProperties}" + "ToolDefinition{fullyQualifiedName=$fullyQualifiedName, input=$input, name=$name, qualifiedName=$qualifiedName, toolkit=$toolkit, description=$description, formattedSchema=$formattedSchema, output=$output, requirements=$requirements, additionalProperties=$additionalProperties}" } 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..da60092 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 @@ -1026,10 +1026,6 @@ private constructor( @JvmField val TOOL_RUNTIME_FATAL = of("TOOL_RUNTIME_FATAL") - @JvmField val CONTEXT_CHECK_FAILED = of("CONTEXT_CHECK_FAILED") - - @JvmField val CONTEXT_DENIED = of("CONTEXT_DENIED") - @JvmField val UPSTREAM_RUNTIME_BAD_REQUEST = of("UPSTREAM_RUNTIME_BAD_REQUEST") @JvmField val UPSTREAM_RUNTIME_AUTH_ERROR = of("UPSTREAM_RUNTIME_AUTH_ERROR") @@ -1063,8 +1059,6 @@ private constructor( TOOL_RUNTIME_RETRY, TOOL_RUNTIME_CONTEXT_REQUIRED, TOOL_RUNTIME_FATAL, - CONTEXT_CHECK_FAILED, - CONTEXT_DENIED, UPSTREAM_RUNTIME_BAD_REQUEST, UPSTREAM_RUNTIME_AUTH_ERROR, UPSTREAM_RUNTIME_NOT_FOUND, @@ -1095,8 +1089,6 @@ private constructor( TOOL_RUNTIME_RETRY, TOOL_RUNTIME_CONTEXT_REQUIRED, TOOL_RUNTIME_FATAL, - CONTEXT_CHECK_FAILED, - CONTEXT_DENIED, UPSTREAM_RUNTIME_BAD_REQUEST, UPSTREAM_RUNTIME_AUTH_ERROR, UPSTREAM_RUNTIME_NOT_FOUND, @@ -1130,8 +1122,6 @@ private constructor( TOOL_RUNTIME_RETRY -> Value.TOOL_RUNTIME_RETRY TOOL_RUNTIME_CONTEXT_REQUIRED -> Value.TOOL_RUNTIME_CONTEXT_REQUIRED TOOL_RUNTIME_FATAL -> Value.TOOL_RUNTIME_FATAL - CONTEXT_CHECK_FAILED -> Value.CONTEXT_CHECK_FAILED - CONTEXT_DENIED -> Value.CONTEXT_DENIED UPSTREAM_RUNTIME_BAD_REQUEST -> Value.UPSTREAM_RUNTIME_BAD_REQUEST UPSTREAM_RUNTIME_AUTH_ERROR -> Value.UPSTREAM_RUNTIME_AUTH_ERROR UPSTREAM_RUNTIME_NOT_FOUND -> Value.UPSTREAM_RUNTIME_NOT_FOUND @@ -1164,8 +1154,6 @@ private constructor( TOOL_RUNTIME_RETRY -> Known.TOOL_RUNTIME_RETRY TOOL_RUNTIME_CONTEXT_REQUIRED -> Known.TOOL_RUNTIME_CONTEXT_REQUIRED TOOL_RUNTIME_FATAL -> Known.TOOL_RUNTIME_FATAL - CONTEXT_CHECK_FAILED -> Known.CONTEXT_CHECK_FAILED - CONTEXT_DENIED -> Known.CONTEXT_DENIED UPSTREAM_RUNTIME_BAD_REQUEST -> Known.UPSTREAM_RUNTIME_BAD_REQUEST UPSTREAM_RUNTIME_AUTH_ERROR -> Known.UPSTREAM_RUNTIME_AUTH_ERROR UPSTREAM_RUNTIME_NOT_FOUND -> Known.UPSTREAM_RUNTIME_NOT_FOUND diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt index 3ebb65e..8cab0e9 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt @@ -3,23 +3,29 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import dev.arcade.core.ExcludeMissing import dev.arcade.core.JsonValue -import dev.arcade.core.toImmutable import dev.arcade.errors.ArcadeInvalidDataException +import java.util.Collections import java.util.Objects class FormattedGetResponse -@JsonCreator -private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map -) { +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor(private val additionalProperties: MutableMap) { + + @JsonCreator private constructor() : this(mutableMapOf()) + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -63,7 +69,8 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): FormattedGetResponse = FormattedGetResponse(additionalProperties.toImmutable()) + fun build(): FormattedGetResponse = + FormattedGetResponse(additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -89,9 +96,7 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + @JvmSynthetic internal fun validity(): Int = 0 override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt index c2c3672..2b3dae7 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt @@ -3,23 +3,29 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import dev.arcade.core.ExcludeMissing import dev.arcade.core.JsonValue -import dev.arcade.core.toImmutable import dev.arcade.errors.ArcadeInvalidDataException +import java.util.Collections import java.util.Objects class FormattedListResponse -@JsonCreator -private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map -) { +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor(private val additionalProperties: MutableMap) { + + @JsonCreator private constructor() : this(mutableMapOf()) + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) @@ -64,7 +70,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): FormattedListResponse = - FormattedListResponse(additionalProperties.toImmutable()) + FormattedListResponse(additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -90,9 +96,7 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + @JvmSynthetic internal fun validity(): Int = 0 override fun equals(other: Any?): Boolean { if (this === other) { 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..f1fe162 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 @@ -11,7 +11,6 @@ import dev.arcade.core.ExcludeMissing import dev.arcade.core.JsonField import dev.arcade.core.JsonMissing import dev.arcade.core.JsonValue -import dev.arcade.core.checkKnown import dev.arcade.core.toImmutable import dev.arcade.errors.ArcadeInvalidDataException import java.util.Collections @@ -888,6 +887,7 @@ private constructor( private val binding: JsonField, private val editable: JsonField, private val exists: JsonField, + private val hint: JsonField, private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -903,8 +903,9 @@ private constructor( @JsonProperty("exists") @ExcludeMissing exists: JsonField = JsonMissing.of(), + @JsonProperty("hint") @ExcludeMissing hint: JsonField = JsonMissing.of(), @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), - ) : this(binding, editable, exists, value, mutableMapOf()) + ) : this(binding, editable, exists, hint, value, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if @@ -924,6 +925,12 @@ private constructor( */ fun exists(): Optional = exists.getOptional("exists") + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun hint(): Optional = hint.getOptional("hint") + /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -952,6 +959,13 @@ private constructor( */ @JsonProperty("exists") @ExcludeMissing fun _exists(): JsonField = exists + /** + * Returns the raw JSON value of [hint]. + * + * Unlike [hint], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("hint") @ExcludeMissing fun _hint(): JsonField = hint + /** * Returns the raw JSON value of [value]. * @@ -983,6 +997,7 @@ private constructor( private var binding: JsonField = JsonMissing.of() private var editable: JsonField = JsonMissing.of() private var exists: JsonField = JsonMissing.of() + private var hint: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -991,6 +1006,7 @@ private constructor( binding = secret.binding editable = secret.editable exists = secret.exists + hint = secret.hint value = secret.value additionalProperties = secret.additionalProperties.toMutableMap() } @@ -1028,6 +1044,17 @@ private constructor( */ fun exists(exists: JsonField) = apply { this.exists = exists } + fun hint(hint: String) = hint(JsonField.of(hint)) + + /** + * Sets [Builder.hint] to an arbitrary JSON value. + * + * You should usually call [Builder.hint] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun hint(hint: JsonField) = apply { this.hint = hint } + fun value(value: String) = value(JsonField.of(value)) /** @@ -1067,7 +1094,14 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Secret = - Secret(binding, editable, exists, value, additionalProperties.toMutableMap()) + Secret( + binding, + editable, + exists, + hint, + value, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -1080,6 +1114,7 @@ private constructor( binding().ifPresent { it.validate() } editable() exists() + hint() value() validated = true } @@ -1103,6 +1138,7 @@ private constructor( (binding.asKnown().getOrNull()?.validity() ?: 0) + (if (editable.asKnown().isPresent) 1 else 0) + (if (exists.asKnown().isPresent) 1 else 0) + + (if (hint.asKnown().isPresent) 1 else 0) + (if (value.asKnown().isPresent) 1 else 0) class Binding @JsonCreator private constructor(private val value: JsonField) : @@ -1257,18 +1293,19 @@ private constructor( binding == other.binding && editable == other.editable && exists == other.exists && + hint == other.hint && value == other.value && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(binding, editable, exists, value, additionalProperties) + Objects.hash(binding, editable, exists, hint, value, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Secret{binding=$binding, editable=$editable, exists=$exists, value=$value, additionalProperties=$additionalProperties}" + "Secret{binding=$binding, editable=$editable, exists=$exists, hint=$hint, value=$value, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1683,9 +1720,7 @@ private constructor( private val authorizationUrl: JsonField, private val clientId: JsonField, private val clientSecret: JsonField, - private val externalId: JsonField, private val redirectUri: JsonField, - private val supportedScopes: JsonField>, private val additionalProperties: MutableMap, ) { @@ -1700,24 +1735,10 @@ private constructor( @JsonProperty("client_secret") @ExcludeMissing clientSecret: JsonField = JsonMissing.of(), - @JsonProperty("external_id") - @ExcludeMissing - externalId: JsonField = JsonMissing.of(), @JsonProperty("redirect_uri") @ExcludeMissing redirectUri: JsonField = JsonMissing.of(), - @JsonProperty("supported_scopes") - @ExcludeMissing - supportedScopes: JsonField> = JsonMissing.of(), - ) : this( - authorizationUrl, - clientId, - clientSecret, - externalId, - redirectUri, - supportedScopes, - mutableMapOf(), - ) + ) : this(authorizationUrl, clientId, clientSecret, redirectUri, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if @@ -1738,25 +1759,12 @@ private constructor( */ fun clientSecret(): Optional = clientSecret.getOptional("client_secret") - /** - * @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 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). - */ - fun supportedScopes(): Optional> = - supportedScopes.getOptional("supported_scopes") - /** * Returns the raw JSON value of [authorizationUrl]. * @@ -1785,16 +1793,6 @@ private constructor( @ExcludeMissing fun _clientSecret(): JsonField = clientSecret - /** - * 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 [redirectUri]. * @@ -1805,16 +1803,6 @@ private constructor( @ExcludeMissing fun _redirectUri(): JsonField = redirectUri - /** - * Returns the raw JSON value of [supportedScopes]. - * - * Unlike [supportedScopes], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("supported_scopes") - @ExcludeMissing - fun _supportedScopes(): JsonField> = supportedScopes - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1839,9 +1827,7 @@ private constructor( private var authorizationUrl: JsonField = JsonMissing.of() private var clientId: JsonField = JsonMissing.of() private var clientSecret: JsonField = JsonMissing.of() - private var externalId: JsonField = JsonMissing.of() private var redirectUri: JsonField = JsonMissing.of() - private var supportedScopes: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1849,9 +1835,7 @@ private constructor( authorizationUrl = oauth2.authorizationUrl clientId = oauth2.clientId clientSecret = oauth2.clientSecret - externalId = oauth2.externalId redirectUri = oauth2.redirectUri - supportedScopes = oauth2.supportedScopes.map { it.toMutableList() } additionalProperties = oauth2.additionalProperties.toMutableMap() } @@ -1894,19 +1878,6 @@ private constructor( this.clientSecret = clientSecret } - 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 redirectUri(redirectUri: String) = redirectUri(JsonField.of(redirectUri)) /** @@ -1920,32 +1891,6 @@ private constructor( this.redirectUri = redirectUri } - fun supportedScopes(supportedScopes: List) = - supportedScopes(JsonField.of(supportedScopes)) - - /** - * Sets [Builder.supportedScopes] to an arbitrary JSON value. - * - * You should usually call [Builder.supportedScopes] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun supportedScopes(supportedScopes: JsonField>) = apply { - this.supportedScopes = supportedScopes.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [supportedScopes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addSupportedScope(supportedScope: String) = apply { - supportedScopes = - (supportedScopes ?: JsonField.of(mutableListOf())).also { - checkKnown("supportedScopes", it).add(supportedScope) - } - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1978,9 +1923,7 @@ private constructor( authorizationUrl, clientId, clientSecret, - externalId, redirectUri, - (supportedScopes ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } @@ -1995,9 +1938,7 @@ private constructor( authorizationUrl() clientId() clientSecret().ifPresent { it.validate() } - externalId() redirectUri() - supportedScopes() validated = true } @@ -2020,9 +1961,7 @@ private constructor( (if (authorizationUrl.asKnown().isPresent) 1 else 0) + (if (clientId.asKnown().isPresent) 1 else 0) + (clientSecret.asKnown().getOrNull()?.validity() ?: 0) + - (if (externalId.asKnown().isPresent) 1 else 0) + - (if (redirectUri.asKnown().isPresent) 1 else 0) + - (supportedScopes.asKnown().getOrNull()?.size ?: 0) + (if (redirectUri.asKnown().isPresent) 1 else 0) class ClientSecret @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -2030,6 +1969,7 @@ private constructor( private val binding: JsonField, private val editable: JsonField, private val exists: JsonField, + private val hint: JsonField, private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -2045,10 +1985,13 @@ private constructor( @JsonProperty("exists") @ExcludeMissing exists: JsonField = JsonMissing.of(), + @JsonProperty("hint") + @ExcludeMissing + hint: JsonField = JsonMissing.of(), @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), - ) : this(binding, editable, exists, value, mutableMapOf()) + ) : this(binding, editable, exists, hint, value, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. @@ -2068,6 +2011,12 @@ private constructor( */ fun exists(): Optional = exists.getOptional("exists") + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun hint(): Optional = hint.getOptional("hint") + /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2102,6 +2051,14 @@ private constructor( */ @JsonProperty("exists") @ExcludeMissing fun _exists(): JsonField = exists + /** + * Returns the raw JSON value of [hint]. + * + * Unlike [hint], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("hint") @ExcludeMissing fun _hint(): JsonField = hint + /** * Returns the raw JSON value of [value]. * @@ -2134,6 +2091,7 @@ private constructor( private var binding: JsonField = JsonMissing.of() private var editable: JsonField = JsonMissing.of() private var exists: JsonField = JsonMissing.of() + private var hint: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2142,6 +2100,7 @@ private constructor( binding = clientSecret.binding editable = clientSecret.editable exists = clientSecret.exists + hint = clientSecret.hint value = clientSecret.value additionalProperties = clientSecret.additionalProperties.toMutableMap() } @@ -2179,6 +2138,17 @@ private constructor( */ fun exists(exists: JsonField) = apply { this.exists = exists } + fun hint(hint: String) = hint(JsonField.of(hint)) + + /** + * Sets [Builder.hint] to an arbitrary JSON value. + * + * You should usually call [Builder.hint] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun hint(hint: JsonField) = apply { this.hint = hint } + fun value(value: String) = value(JsonField.of(value)) /** @@ -2222,6 +2192,7 @@ private constructor( binding, editable, exists, + hint, value, additionalProperties.toMutableMap(), ) @@ -2237,6 +2208,7 @@ private constructor( binding().ifPresent { it.validate() } editable() exists() + hint() value() validated = true } @@ -2260,6 +2232,7 @@ private constructor( (binding.asKnown().getOrNull()?.validity() ?: 0) + (if (editable.asKnown().isPresent) 1 else 0) + (if (exists.asKnown().isPresent) 1 else 0) + + (if (hint.asKnown().isPresent) 1 else 0) + (if (value.asKnown().isPresent) 1 else 0) class Binding @@ -2417,18 +2390,19 @@ private constructor( binding == other.binding && editable == other.editable && exists == other.exists && + hint == other.hint && value == other.value && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(binding, editable, exists, value, additionalProperties) + Objects.hash(binding, editable, exists, hint, value, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "ClientSecret{binding=$binding, editable=$editable, exists=$exists, value=$value, additionalProperties=$additionalProperties}" + "ClientSecret{binding=$binding, editable=$editable, exists=$exists, hint=$hint, value=$value, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2440,9 +2414,7 @@ private constructor( authorizationUrl == other.authorizationUrl && clientId == other.clientId && clientSecret == other.clientSecret && - externalId == other.externalId && redirectUri == other.redirectUri && - supportedScopes == other.supportedScopes && additionalProperties == other.additionalProperties } @@ -2451,9 +2423,7 @@ private constructor( authorizationUrl, clientId, clientSecret, - externalId, redirectUri, - supportedScopes, additionalProperties, ) } @@ -2461,7 +2431,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Oauth2{authorizationUrl=$authorizationUrl, clientId=$clientId, clientSecret=$clientSecret, externalId=$externalId, redirectUri=$redirectUri, supportedScopes=$supportedScopes, additionalProperties=$additionalProperties}" + "Oauth2{authorizationUrl=$authorizationUrl, clientId=$clientId, clientSecret=$clientSecret, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" } class Secrets diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponseTest.kt index bf6ff84..e5a12b2 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponseTest.kt @@ -65,6 +65,7 @@ internal class AuthProviderListResponseTest { ) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -269,6 +270,7 @@ internal class AuthProviderListResponseTest { ) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -455,6 +457,7 @@ internal class AuthProviderListResponseTest { ) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponseTest.kt index a5fe088..7a8b6e3 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponseTest.kt @@ -53,6 +53,7 @@ internal class AuthProviderResponseTest { .binding(AuthProviderResponse.Oauth2.ClientSecret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -214,6 +215,7 @@ internal class AuthProviderResponseTest { .binding(AuthProviderResponse.Oauth2.ClientSecret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -377,6 +379,7 @@ internal class AuthProviderResponseTest { .binding(AuthProviderResponse.Oauth2.ClientSecret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretListResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretListResponseTest.kt index 03d5c8f..10542a6 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretListResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretListResponseTest.kt @@ -25,6 +25,7 @@ internal class SecretListResponseTest { ) .createdAt("created_at") .description("description") + .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") @@ -48,6 +49,7 @@ internal class SecretListResponseTest { ) .createdAt("created_at") .description("description") + .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") @@ -75,6 +77,7 @@ internal class SecretListResponseTest { ) .createdAt("created_at") .description("description") + .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretResponseTest.kt index c36c4f8..ca81ae6 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretResponseTest.kt @@ -22,6 +22,7 @@ internal class SecretResponseTest { ) .createdAt("created_at") .description("description") + .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") @@ -37,6 +38,7 @@ internal class SecretResponseTest { ) assertThat(secretResponse.createdAt()).contains("created_at") assertThat(secretResponse.description()).contains("description") + assertThat(secretResponse.hint()).contains("hint") assertThat(secretResponse.key()).contains("key") assertThat(secretResponse.lastAccessedAt()).contains("last_accessed_at") assertThat(secretResponse.updatedAt()).contains("updated_at") @@ -56,6 +58,7 @@ internal class SecretResponseTest { ) .createdAt("created_at") .description("description") + .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParamsTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParamsTest.kt index 72afc34..c890603 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParamsTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParamsTest.kt @@ -13,8 +13,8 @@ internal class UserConnectionListParamsTest { UserConnectionListParams.builder() .limit(0L) .offset(0L) - .providerId("provider_id") - .userId("user_id") + .provider(UserConnectionListParams.Provider.builder().id("id").build()) + .user(UserConnectionListParams.User.builder().id("id").build()) .build() } @@ -24,8 +24,8 @@ internal class UserConnectionListParamsTest { UserConnectionListParams.builder() .limit(0L) .offset(0L) - .providerId("provider_id") - .userId("user_id") + .provider(UserConnectionListParams.Provider.builder().id("id").build()) + .user(UserConnectionListParams.User.builder().id("id").build()) .build() val queryParams = params._queryParams() @@ -35,8 +35,8 @@ internal class UserConnectionListParamsTest { QueryParams.builder() .put("limit", "0") .put("offset", "0") - .put("provider_id", "provider_id") - .put("user_id", "user_id") + .put("provider[id]", "id") + .put("user[id]", "id") .build() ) } diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/health/HealthSchemaTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/health/HealthSchemaTest.kt index dac534f..864e844 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/health/HealthSchemaTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/health/HealthSchemaTest.kt @@ -11,16 +11,15 @@ internal class HealthSchemaTest { @Test fun create() { - val healthSchema = HealthSchema.builder().healthy(true).reason("reason").build() + val healthSchema = HealthSchema.builder().healthy(true).build() assertThat(healthSchema.healthy()).contains(true) - assertThat(healthSchema.reason()).contains("reason") } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val healthSchema = HealthSchema.builder().healthy(true).reason("reason").build() + val healthSchema = HealthSchema.builder().healthy(true).build() val roundtrippedHealthSchema = jsonMapper.readValue( diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolDefinitionTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolDefinitionTest.kt index 7d7a237..73ec069 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolDefinitionTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolDefinitionTest.kt @@ -49,29 +49,6 @@ internal class ToolDefinitionTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .metadata( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -155,30 +132,6 @@ internal class ToolDefinitionTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - assertThat(toolDefinition.metadata()) - .contains( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) assertThat(toolDefinition.output()) .contains( ToolDefinition.Output.builder() @@ -265,29 +218,6 @@ internal class ToolDefinitionTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .metadata( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListPageResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListPageResponseTest.kt index 426c0bd..d67e36a 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListPageResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListPageResponseTest.kt @@ -52,29 +52,6 @@ internal class ToolListPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .metadata( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -167,29 +144,6 @@ internal class ToolListPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .metadata( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -283,29 +237,6 @@ internal class ToolListPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .metadata( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponseTest.kt index d5d77d8..c70e1b7 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponseTest.kt @@ -3,7 +3,6 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import dev.arcade.core.JsonValue import dev.arcade.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -12,19 +11,13 @@ internal class FormattedGetResponseTest { @Test fun create() { - val formattedGetResponse = - FormattedGetResponse.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() + val formattedGetResponse = FormattedGetResponse.builder().build() } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val formattedGetResponse = - FormattedGetResponse.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() + val formattedGetResponse = FormattedGetResponse.builder().build() val roundtrippedFormattedGetResponse = jsonMapper.readValue( diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponseTest.kt index 5b0505c..e53881b 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponseTest.kt @@ -3,7 +3,6 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import dev.arcade.core.JsonValue import dev.arcade.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat @@ -15,11 +14,7 @@ internal class FormattedListPageResponseTest { fun create() { val formattedListPageResponse = FormattedListPageResponse.builder() - .addItem( - FormattedListResponse.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) + .addItem(FormattedListResponse.builder().build()) .limit(0L) .offset(0L) .pageCount(0L) @@ -27,11 +22,7 @@ internal class FormattedListPageResponseTest { .build() assertThat(formattedListPageResponse.items().getOrNull()) - .containsExactly( - FormattedListResponse.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) + .containsExactly(FormattedListResponse.builder().build()) assertThat(formattedListPageResponse.limit()).contains(0L) assertThat(formattedListPageResponse.offset()).contains(0L) assertThat(formattedListPageResponse.pageCount()).contains(0L) @@ -43,11 +34,7 @@ internal class FormattedListPageResponseTest { val jsonMapper = jsonMapper() val formattedListPageResponse = FormattedListPageResponse.builder() - .addItem( - FormattedListResponse.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) + .addItem(FormattedListResponse.builder().build()) .limit(0L) .offset(0L) .pageCount(0L) diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListResponseTest.kt index 0d8e2f2..ffd6dfa 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListResponseTest.kt @@ -3,7 +3,6 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import dev.arcade.core.JsonValue import dev.arcade.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -12,19 +11,13 @@ internal class FormattedListResponseTest { @Test fun create() { - val formattedListResponse = - FormattedListResponse.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() + val formattedListResponse = FormattedListResponse.builder().build() } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val formattedListResponse = - FormattedListResponse.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() + val formattedListResponse = FormattedListResponse.builder().build() val roundtrippedFormattedListResponse = jsonMapper.readValue( 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..ec4904a 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 @@ -33,6 +33,7 @@ internal class WorkerListPageResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -60,12 +61,11 @@ internal class WorkerListPageResponseTest { ) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) - .externalId("external_id") .redirectUri("redirect_uri") - .addSupportedScope("string") .build() ) .retry(0L) @@ -78,6 +78,7 @@ internal class WorkerListPageResponseTest { "binding" to "static", "editable" to true, "exists" to true, + "hint" to "hint", "value" to "value", ) ), @@ -132,6 +133,7 @@ internal class WorkerListPageResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -159,12 +161,11 @@ internal class WorkerListPageResponseTest { ) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) - .externalId("external_id") .redirectUri("redirect_uri") - .addSupportedScope("string") .build() ) .retry(0L) @@ -177,6 +178,7 @@ internal class WorkerListPageResponseTest { "binding" to "static", "editable" to true, "exists" to true, + "hint" to "hint", "value" to "value", ) ), @@ -234,6 +236,7 @@ internal class WorkerListPageResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -261,12 +264,11 @@ internal class WorkerListPageResponseTest { ) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) - .externalId("external_id") .redirectUri("redirect_uri") - .addSupportedScope("string") .build() ) .retry(0L) @@ -279,6 +281,7 @@ internal class WorkerListPageResponseTest { "binding" to "static", "editable" to true, "exists" to true, + "hint" to "hint", "value" to "value", ) ), 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..c9ccba7 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 @@ -30,6 +30,7 @@ internal class WorkerResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -56,12 +57,11 @@ internal class WorkerResponseTest { ) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) - .externalId("external_id") .redirectUri("redirect_uri") - .addSupportedScope("string") .build() ) .retry(0L) @@ -74,6 +74,7 @@ internal class WorkerResponseTest { "binding" to "static", "editable" to true, "exists" to true, + "hint" to "hint", "value" to "value", ) ), @@ -120,6 +121,7 @@ internal class WorkerResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -145,12 +147,11 @@ internal class WorkerResponseTest { .binding(WorkerResponse.Mcp.Oauth2.ClientSecret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) - .externalId("external_id") .redirectUri("redirect_uri") - .addSupportedScope("string") .build() ) .retry(0L) @@ -163,6 +164,7 @@ internal class WorkerResponseTest { "binding" to "static", "editable" to true, "exists" to true, + "hint" to "hint", "value" to "value", ) ), @@ -213,6 +215,7 @@ internal class WorkerResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) @@ -239,12 +242,11 @@ internal class WorkerResponseTest { ) .editable(true) .exists(true) + .hint("hint") .value("value") .build() ) - .externalId("external_id") .redirectUri("redirect_uri") - .addSupportedScope("string") .build() ) .retry(0L) @@ -257,6 +259,7 @@ internal class WorkerResponseTest { "binding" to "static", "editable" to true, "exists" to true, + "hint" to "hint", "value" to "value", ) ), diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerToolsPageResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerToolsPageResponseTest.kt index 975e7ba..7a39eda 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerToolsPageResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerToolsPageResponseTest.kt @@ -54,29 +54,6 @@ internal class WorkerToolsPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .metadata( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -169,29 +146,6 @@ internal class WorkerToolsPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .metadata( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -285,29 +239,6 @@ internal class WorkerToolsPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) - .metadata( - ToolDefinition.Metadata.builder() - .behavior( - ToolDefinition.Metadata.Behavior.builder() - .destructive(true) - .idempotent(true) - .openWorld(true) - .addOperation("string") - .readOnly(true) - .build() - ) - .classification( - ToolDefinition.Metadata.Classification.builder() - .addServiceDomain("string") - .build() - ) - .extras( - ToolDefinition.Metadata.Extras.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") From 883756053127934e8dc3d1ee90148f51c0a48f28 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 06:16:54 +0000 Subject: [PATCH 04/12] chore(internal): codegen related update --- .../kotlin/dev/arcade/core/http/RetryingHttpClient.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/core/http/RetryingHttpClient.kt b/arcade-java-core/src/main/kotlin/dev/arcade/core/http/RetryingHttpClient.kt index 6fe3c03..d1b6f0c 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/core/http/RetryingHttpClient.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/core/http/RetryingHttpClient.kt @@ -214,13 +214,8 @@ private constructor( } } ?.let { retryAfterNanos -> - // If the API asks us to wait a certain amount of time (and it's a reasonable - // amount), just - // do what it says. - val retryAfter = Duration.ofNanos(retryAfterNanos.toLong()) - if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) { - return retryAfter - } + // If the API asks us to wait a certain amount of time, do what it says. + return Duration.ofNanos(retryAfterNanos.toLong()) } // Apply exponential backoff, but not more than the max. From b1ebae8ff127b1402785df354f2687408ff248b0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 06:19:05 +0000 Subject: [PATCH 05/12] chore(internal): bump palantir-java-format --- buildSrc/src/main/kotlin/arcade.java.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/arcade.java.gradle.kts b/buildSrc/src/main/kotlin/arcade.java.gradle.kts index 81d5d32..a3cfe28 100644 --- a/buildSrc/src/main/kotlin/arcade.java.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.java.gradle.kts @@ -54,7 +54,7 @@ tasks.withType().configureEach { val palantir by configurations.creating dependencies { - palantir("com.palantir.javaformat:palantir-java-format:2.73.0") + palantir("com.palantir.javaformat:palantir-java-format:2.89.0") } fun registerPalantir( From 4432b393c3ce20da89bb217f019dbf3221d41d0e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 06:28:53 +0000 Subject: [PATCH 06/12] chore(test): do not count install time for mock server timeout --- scripts/mock | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/mock b/scripts/mock index 0b28f6e..bcf3b39 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}" # Run prism 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=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - # Wait for server to come online + # Wait for server to come online (max 30s) echo -n "Waiting for server" + attempts=0 while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + attempts=$((attempts + 1)) + if [ "$attempts" -ge 300 ]; then + echo + echo "Timed out waiting for Prism server to start" + cat .prism.log + exit 1 + fi echo -n "." sleep 0.1 done From e37cb5d7f6f23e6be986ae5e3784898e3854a79c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Mar 2026 00:34:53 +0000 Subject: [PATCH 07/12] chore(ci): skip uploading artifacts on stainless-internal branches --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66bfb3c..aaa4cc9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,14 +65,18 @@ jobs: run: ./scripts/build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/arcade-engine-java' + if: |- + github.repository == 'stainless-sdks/arcade-engine-java' && + !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Build and upload Maven artifacts - if: github.repository == 'stainless-sdks/arcade-engine-java' + if: |- + github.repository == 'stainless-sdks/arcade-engine-java' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From b62bebeaa3c5341aed692f28cdb76c24ef4588d7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Mar 2026 23:28:32 +0000 Subject: [PATCH 08/12] feat(api): api update --- .stats.yml | 6 +- .../authproviders/AuthProviderResponse.kt | 38 +- .../models/admin/secrets/SecretResponse.kt | 46 +- .../UserConnectionListParams.kt | 280 +----- .../dev/arcade/models/health/HealthSchema.kt | 47 +- .../models/tools/ExecuteToolResponse.kt | 12 + .../dev/arcade/models/tools/ToolDefinition.kt | 848 +++++++++++++++++- .../models/tools/ToolExecutionAttempt.kt | 12 + .../tools/formatted/FormattedGetResponse.kt | 27 +- .../tools/formatted/FormattedListResponse.kt | 26 +- .../arcade/models/workers/WorkerResponse.kt | 196 ++-- .../AuthProviderListResponseTest.kt | 3 - .../authproviders/AuthProviderResponseTest.kt | 3 - .../admin/secrets/SecretListResponseTest.kt | 3 - .../admin/secrets/SecretResponseTest.kt | 3 - .../UserConnectionListParamsTest.kt | 12 +- .../arcade/models/health/HealthSchemaTest.kt | 5 +- .../arcade/models/tools/ToolDefinitionTest.kt | 70 ++ .../models/tools/ToolListPageResponseTest.kt | 69 ++ .../formatted/FormattedGetResponseTest.kt | 11 +- .../FormattedListPageResponseTest.kt | 19 +- .../formatted/FormattedListResponseTest.kt | 11 +- .../workers/WorkerListPageResponseTest.kt | 15 +- .../models/workers/WorkerResponseTest.kt | 15 +- .../workers/WorkerToolsPageResponseTest.kt | 69 ++ 25 files changed, 1344 insertions(+), 502 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9883e5e..f7c06a5 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-7ecb40b6650ff002eed02efd1b59c630abe1fb9eb70c9c916c15b115260e5003.yml -openapi_spec_hash: 2e5c04d1a50afcd0bdbd9737cec227c9 -config_hash: 01e6bd1df0d14c729087edec4e6b6650 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-6ff494eafa2c154892716407682bb2296cff4f18c45765c5fb16bdf36f452ae1.yml +openapi_spec_hash: 63dde2481a7d51042a241bfba232b0b0 +config_hash: bf64816643634a621cd0ffd93d9c4347 diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt index e677a81..c00cfb8 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponse.kt @@ -1897,7 +1897,6 @@ private constructor( private val binding: JsonField, private val editable: JsonField, private val exists: JsonField, - private val hint: JsonField, private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -1913,9 +1912,8 @@ private constructor( @JsonProperty("exists") @ExcludeMissing exists: JsonField = JsonMissing.of(), - @JsonProperty("hint") @ExcludeMissing hint: JsonField = JsonMissing.of(), @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), - ) : this(binding, editable, exists, hint, value, mutableMapOf()) + ) : this(binding, editable, exists, value, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if @@ -1935,12 +1933,6 @@ private constructor( */ fun exists(): Optional = exists.getOptional("exists") - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun hint(): Optional = hint.getOptional("hint") - /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1969,13 +1961,6 @@ private constructor( */ @JsonProperty("exists") @ExcludeMissing fun _exists(): JsonField = exists - /** - * Returns the raw JSON value of [hint]. - * - * Unlike [hint], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("hint") @ExcludeMissing fun _hint(): JsonField = hint - /** * Returns the raw JSON value of [value]. * @@ -2007,7 +1992,6 @@ private constructor( private var binding: JsonField = JsonMissing.of() private var editable: JsonField = JsonMissing.of() private var exists: JsonField = JsonMissing.of() - private var hint: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2016,7 +2000,6 @@ private constructor( binding = clientSecret.binding editable = clientSecret.editable exists = clientSecret.exists - hint = clientSecret.hint value = clientSecret.value additionalProperties = clientSecret.additionalProperties.toMutableMap() } @@ -2054,17 +2037,6 @@ private constructor( */ fun exists(exists: JsonField) = apply { this.exists = exists } - fun hint(hint: String) = hint(JsonField.of(hint)) - - /** - * Sets [Builder.hint] to an arbitrary JSON value. - * - * You should usually call [Builder.hint] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun hint(hint: JsonField) = apply { this.hint = hint } - fun value(value: String) = value(JsonField.of(value)) /** @@ -2108,7 +2080,6 @@ private constructor( binding, editable, exists, - hint, value, additionalProperties.toMutableMap(), ) @@ -2124,7 +2095,6 @@ private constructor( binding().ifPresent { it.validate() } editable() exists() - hint() value() validated = true } @@ -2148,7 +2118,6 @@ private constructor( (binding.asKnown().getOrNull()?.validity() ?: 0) + (if (editable.asKnown().isPresent) 1 else 0) + (if (exists.asKnown().isPresent) 1 else 0) + - (if (hint.asKnown().isPresent) 1 else 0) + (if (value.asKnown().isPresent) 1 else 0) class Binding @JsonCreator private constructor(private val value: JsonField) : @@ -2303,19 +2272,18 @@ private constructor( binding == other.binding && editable == other.editable && exists == other.exists && - hint == other.hint && value == other.value && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(binding, editable, exists, hint, value, additionalProperties) + Objects.hash(binding, editable, exists, value, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "ClientSecret{binding=$binding, editable=$editable, exists=$exists, hint=$hint, value=$value, additionalProperties=$additionalProperties}" + "ClientSecret{binding=$binding, editable=$editable, exists=$exists, value=$value, additionalProperties=$additionalProperties}" } class Pkce diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt index 3a34368..4146152 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/secrets/SecretResponse.kt @@ -24,7 +24,6 @@ private constructor( private val binding: JsonField, private val createdAt: JsonField, private val description: JsonField, - private val hint: JsonField, private val key: JsonField, private val lastAccessedAt: JsonField, private val updatedAt: JsonField, @@ -39,23 +38,12 @@ private constructor( @JsonProperty("description") @ExcludeMissing description: JsonField = JsonMissing.of(), - @JsonProperty("hint") @ExcludeMissing hint: JsonField = JsonMissing.of(), @JsonProperty("key") @ExcludeMissing key: JsonField = JsonMissing.of(), @JsonProperty("last_accessed_at") @ExcludeMissing lastAccessedAt: JsonField = JsonMissing.of(), @JsonProperty("updated_at") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), - ) : this( - id, - binding, - createdAt, - description, - hint, - key, - lastAccessedAt, - updatedAt, - mutableMapOf(), - ) + ) : this(id, binding, createdAt, description, key, lastAccessedAt, updatedAt, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -81,12 +69,6 @@ private constructor( */ fun description(): Optional = description.getOptional("description") - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun hint(): Optional = hint.getOptional("hint") - /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -133,13 +115,6 @@ private constructor( */ @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description - /** - * Returns the raw JSON value of [hint]. - * - * Unlike [hint], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("hint") @ExcludeMissing fun _hint(): JsonField = hint - /** * Returns the raw JSON value of [key]. * @@ -188,7 +163,6 @@ private constructor( private var binding: JsonField = JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() - private var hint: JsonField = JsonMissing.of() private var key: JsonField = JsonMissing.of() private var lastAccessedAt: JsonField = JsonMissing.of() private var updatedAt: JsonField = JsonMissing.of() @@ -200,7 +174,6 @@ private constructor( binding = secretResponse.binding createdAt = secretResponse.createdAt description = secretResponse.description - hint = secretResponse.hint key = secretResponse.key lastAccessedAt = secretResponse.lastAccessedAt updatedAt = secretResponse.updatedAt @@ -249,16 +222,6 @@ private constructor( */ fun description(description: JsonField) = apply { this.description = description } - fun hint(hint: String) = hint(JsonField.of(hint)) - - /** - * Sets [Builder.hint] to an arbitrary JSON value. - * - * You should usually call [Builder.hint] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun hint(hint: JsonField) = apply { this.hint = hint } - fun key(key: String) = key(JsonField.of(key)) /** @@ -323,7 +286,6 @@ private constructor( binding, createdAt, description, - hint, key, lastAccessedAt, updatedAt, @@ -342,7 +304,6 @@ private constructor( binding().ifPresent { it.validate() } createdAt() description() - hint() key() lastAccessedAt() updatedAt() @@ -368,7 +329,6 @@ private constructor( (binding.asKnown().getOrNull()?.validity() ?: 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + - (if (hint.asKnown().isPresent) 1 else 0) + (if (key.asKnown().isPresent) 1 else 0) + (if (lastAccessedAt.asKnown().isPresent) 1 else 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) @@ -692,7 +652,6 @@ private constructor( binding == other.binding && createdAt == other.createdAt && description == other.description && - hint == other.hint && key == other.key && lastAccessedAt == other.lastAccessedAt && updatedAt == other.updatedAt && @@ -705,7 +664,6 @@ private constructor( binding, createdAt, description, - hint, key, lastAccessedAt, updatedAt, @@ -716,5 +674,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "SecretResponse{id=$id, binding=$binding, createdAt=$createdAt, description=$description, hint=$hint, key=$key, lastAccessedAt=$lastAccessedAt, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" + "SecretResponse{id=$id, binding=$binding, createdAt=$createdAt, description=$description, key=$key, lastAccessedAt=$lastAccessedAt, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" } diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParams.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParams.kt index 15743ac..5f6611c 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParams.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParams.kt @@ -14,8 +14,8 @@ class UserConnectionListParams private constructor( private val limit: Long?, private val offset: Long?, - private val provider: Provider?, - private val user: User?, + private val providerId: String?, + private val userId: String?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -26,9 +26,11 @@ private constructor( /** Page offset */ fun offset(): Optional = Optional.ofNullable(offset) - fun provider(): Optional = Optional.ofNullable(provider) + /** Provider ID */ + fun providerId(): Optional = Optional.ofNullable(providerId) - fun user(): Optional = Optional.ofNullable(user) + /** User ID */ + fun userId(): Optional = Optional.ofNullable(userId) /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -51,8 +53,8 @@ private constructor( private var limit: Long? = null private var offset: Long? = null - private var provider: Provider? = null - private var user: User? = null + private var providerId: String? = null + private var userId: String? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -60,8 +62,8 @@ private constructor( internal fun from(userConnectionListParams: UserConnectionListParams) = apply { limit = userConnectionListParams.limit offset = userConnectionListParams.offset - provider = userConnectionListParams.provider - user = userConnectionListParams.user + providerId = userConnectionListParams.providerId + userId = userConnectionListParams.userId additionalHeaders = userConnectionListParams.additionalHeaders.toBuilder() additionalQueryParams = userConnectionListParams.additionalQueryParams.toBuilder() } @@ -92,15 +94,17 @@ private constructor( /** Alias for calling [Builder.offset] with `offset.orElse(null)`. */ fun offset(offset: Optional) = offset(offset.getOrNull()) - fun provider(provider: Provider?) = apply { this.provider = provider } + /** Provider ID */ + fun providerId(providerId: String?) = apply { this.providerId = providerId } - /** Alias for calling [Builder.provider] with `provider.orElse(null)`. */ - fun provider(provider: Optional) = provider(provider.getOrNull()) + /** Alias for calling [Builder.providerId] with `providerId.orElse(null)`. */ + fun providerId(providerId: Optional) = providerId(providerId.getOrNull()) - fun user(user: User?) = apply { this.user = user } + /** User ID */ + fun userId(userId: String?) = apply { this.userId = userId } - /** Alias for calling [Builder.user] with `user.orElse(null)`. */ - fun user(user: Optional) = user(user.getOrNull()) + /** Alias for calling [Builder.userId] with `userId.orElse(null)`. */ + fun userId(userId: Optional) = userId(userId.getOrNull()) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -209,8 +213,8 @@ private constructor( UserConnectionListParams( limit, offset, - provider, - user, + providerId, + userId, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -223,244 +227,12 @@ private constructor( .apply { limit?.let { put("limit", it.toString()) } offset?.let { put("offset", it.toString()) } - provider?.let { - it.id().ifPresent { put("provider[id]", it) } - it._additionalProperties().keys().forEach { key -> - it._additionalProperties().values(key).forEach { value -> - put("provider[$key]", value) - } - } - } - user?.let { - it.id().ifPresent { put("user[id]", it) } - it._additionalProperties().keys().forEach { key -> - it._additionalProperties().values(key).forEach { value -> - put("user[$key]", value) - } - } - } + providerId?.let { put("provider_id", it) } + userId?.let { put("user_id", it) } putAll(additionalQueryParams) } .build() - class Provider - private constructor(private val id: String?, private val additionalProperties: QueryParams) { - - /** Provider ID */ - fun id(): Optional = Optional.ofNullable(id) - - /** Query params to send with the request. */ - fun _additionalProperties(): QueryParams = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Provider]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Provider]. */ - class Builder internal constructor() { - - private var id: String? = null - private var additionalProperties: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(provider: Provider) = apply { - id = provider.id - additionalProperties = provider.additionalProperties.toBuilder() - } - - /** Provider ID */ - fun id(id: String?) = apply { this.id = id } - - /** Alias for calling [Builder.id] with `id.orElse(null)`. */ - fun id(id: Optional) = id(id.getOrNull()) - - fun additionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun additionalProperties(additionalProperties: Map>) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: String) = apply { - additionalProperties.put(key, value) - } - - fun putAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.put(key, values) - } - - fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun putAllAdditionalProperties(additionalProperties: Map>) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun replaceAdditionalProperties(key: String, value: String) = apply { - additionalProperties.replace(key, value) - } - - fun replaceAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.replace(key, values) - } - - fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.replaceAll(additionalProperties) - } - - fun replaceAllAdditionalProperties( - additionalProperties: Map> - ) = apply { this.additionalProperties.replaceAll(additionalProperties) } - - fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - additionalProperties.removeAll(keys) - } - - /** - * Returns an immutable instance of [Provider]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Provider = Provider(id, additionalProperties.build()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Provider && - id == other.id && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Provider{id=$id, additionalProperties=$additionalProperties}" - } - - class User - private constructor(private val id: String?, private val additionalProperties: QueryParams) { - - /** User ID */ - fun id(): Optional = Optional.ofNullable(id) - - /** Query params to send with the request. */ - fun _additionalProperties(): QueryParams = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [User]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [User]. */ - class Builder internal constructor() { - - private var id: String? = null - private var additionalProperties: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(user: User) = apply { - id = user.id - additionalProperties = user.additionalProperties.toBuilder() - } - - /** User ID */ - fun id(id: String?) = apply { this.id = id } - - /** Alias for calling [Builder.id] with `id.orElse(null)`. */ - fun id(id: Optional) = id(id.getOrNull()) - - fun additionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun additionalProperties(additionalProperties: Map>) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: String) = apply { - additionalProperties.put(key, value) - } - - fun putAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.put(key, values) - } - - fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun putAllAdditionalProperties(additionalProperties: Map>) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun replaceAdditionalProperties(key: String, value: String) = apply { - additionalProperties.replace(key, value) - } - - fun replaceAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.replace(key, values) - } - - fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.replaceAll(additionalProperties) - } - - fun replaceAllAdditionalProperties( - additionalProperties: Map> - ) = apply { this.additionalProperties.replaceAll(additionalProperties) } - - fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - additionalProperties.removeAll(keys) - } - - /** - * Returns an immutable instance of [User]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): User = User(id, additionalProperties.build()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is User && - id == other.id && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(id, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "User{id=$id, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -469,15 +241,15 @@ private constructor( return other is UserConnectionListParams && limit == other.limit && offset == other.offset && - provider == other.provider && - user == other.user && + providerId == other.providerId && + userId == other.userId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } override fun hashCode(): Int = - Objects.hash(limit, offset, provider, user, additionalHeaders, additionalQueryParams) + Objects.hash(limit, offset, providerId, userId, additionalHeaders, additionalQueryParams) override fun toString() = - "UserConnectionListParams{limit=$limit, offset=$offset, provider=$provider, user=$user, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "UserConnectionListParams{limit=$limit, offset=$offset, providerId=$providerId, userId=$userId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt index 7276511..27720dd 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/health/HealthSchema.kt @@ -19,13 +19,15 @@ class HealthSchema @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val healthy: JsonField, + private val reason: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("healthy") @ExcludeMissing healthy: JsonField = JsonMissing.of() - ) : this(healthy, mutableMapOf()) + @JsonProperty("healthy") @ExcludeMissing healthy: JsonField = JsonMissing.of(), + @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + ) : this(healthy, reason, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -33,6 +35,14 @@ private constructor( */ fun healthy(): Optional = healthy.getOptional("healthy") + /** + * Optional: explains why unhealthy + * + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + /** * Returns the raw JSON value of [healthy]. * @@ -40,6 +50,13 @@ private constructor( */ @JsonProperty("healthy") @ExcludeMissing fun _healthy(): JsonField = healthy + /** + * Returns the raw JSON value of [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -62,11 +79,13 @@ private constructor( class Builder internal constructor() { private var healthy: JsonField = JsonMissing.of() + private var reason: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(healthSchema: HealthSchema) = apply { healthy = healthSchema.healthy + reason = healthSchema.reason additionalProperties = healthSchema.additionalProperties.toMutableMap() } @@ -80,6 +99,17 @@ private constructor( */ fun healthy(healthy: JsonField) = apply { this.healthy = healthy } + /** Optional: explains why unhealthy */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -104,7 +134,8 @@ private constructor( * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): HealthSchema = HealthSchema(healthy, additionalProperties.toMutableMap()) + fun build(): HealthSchema = + HealthSchema(healthy, reason, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -115,6 +146,7 @@ private constructor( } healthy() + reason() validated = true } @@ -131,7 +163,9 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = (if (healthy.asKnown().isPresent) 1 else 0) + @JvmSynthetic + internal fun validity(): Int = + (if (healthy.asKnown().isPresent) 1 else 0) + (if (reason.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -140,13 +174,14 @@ private constructor( return other is HealthSchema && healthy == other.healthy && + reason == other.reason && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(healthy, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(healthy, reason, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "HealthSchema{healthy=$healthy, additionalProperties=$additionalProperties}" + "HealthSchema{healthy=$healthy, reason=$reason, additionalProperties=$additionalProperties}" } 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 dd233a6..eb5c67b 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 @@ -1211,6 +1211,10 @@ private constructor( @JvmField val TOOL_RUNTIME_FATAL = of("TOOL_RUNTIME_FATAL") + @JvmField val CONTEXT_CHECK_FAILED = of("CONTEXT_CHECK_FAILED") + + @JvmField val CONTEXT_DENIED = of("CONTEXT_DENIED") + @JvmField val UPSTREAM_RUNTIME_BAD_REQUEST = of("UPSTREAM_RUNTIME_BAD_REQUEST") @JvmField val UPSTREAM_RUNTIME_AUTH_ERROR = of("UPSTREAM_RUNTIME_AUTH_ERROR") @@ -1244,6 +1248,8 @@ private constructor( TOOL_RUNTIME_RETRY, TOOL_RUNTIME_CONTEXT_REQUIRED, TOOL_RUNTIME_FATAL, + CONTEXT_CHECK_FAILED, + CONTEXT_DENIED, UPSTREAM_RUNTIME_BAD_REQUEST, UPSTREAM_RUNTIME_AUTH_ERROR, UPSTREAM_RUNTIME_NOT_FOUND, @@ -1274,6 +1280,8 @@ private constructor( TOOL_RUNTIME_RETRY, TOOL_RUNTIME_CONTEXT_REQUIRED, TOOL_RUNTIME_FATAL, + CONTEXT_CHECK_FAILED, + CONTEXT_DENIED, UPSTREAM_RUNTIME_BAD_REQUEST, UPSTREAM_RUNTIME_AUTH_ERROR, UPSTREAM_RUNTIME_NOT_FOUND, @@ -1307,6 +1315,8 @@ private constructor( TOOL_RUNTIME_RETRY -> Value.TOOL_RUNTIME_RETRY TOOL_RUNTIME_CONTEXT_REQUIRED -> Value.TOOL_RUNTIME_CONTEXT_REQUIRED TOOL_RUNTIME_FATAL -> Value.TOOL_RUNTIME_FATAL + CONTEXT_CHECK_FAILED -> Value.CONTEXT_CHECK_FAILED + CONTEXT_DENIED -> Value.CONTEXT_DENIED UPSTREAM_RUNTIME_BAD_REQUEST -> Value.UPSTREAM_RUNTIME_BAD_REQUEST UPSTREAM_RUNTIME_AUTH_ERROR -> Value.UPSTREAM_RUNTIME_AUTH_ERROR UPSTREAM_RUNTIME_NOT_FOUND -> Value.UPSTREAM_RUNTIME_NOT_FOUND @@ -1339,6 +1349,8 @@ private constructor( TOOL_RUNTIME_RETRY -> Known.TOOL_RUNTIME_RETRY TOOL_RUNTIME_CONTEXT_REQUIRED -> Known.TOOL_RUNTIME_CONTEXT_REQUIRED TOOL_RUNTIME_FATAL -> Known.TOOL_RUNTIME_FATAL + CONTEXT_CHECK_FAILED -> Known.CONTEXT_CHECK_FAILED + CONTEXT_DENIED -> Known.CONTEXT_DENIED UPSTREAM_RUNTIME_BAD_REQUEST -> Known.UPSTREAM_RUNTIME_BAD_REQUEST UPSTREAM_RUNTIME_AUTH_ERROR -> Known.UPSTREAM_RUNTIME_AUTH_ERROR UPSTREAM_RUNTIME_NOT_FOUND -> Known.UPSTREAM_RUNTIME_NOT_FOUND diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt index dc1a2ab..7be442a 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/ToolDefinition.kt @@ -30,6 +30,7 @@ private constructor( private val toolkit: JsonField, private val description: JsonField, private val formattedSchema: JsonField, + private val metadata: JsonField, private val output: JsonField, private val requirements: JsonField, private val additionalProperties: MutableMap, @@ -52,6 +53,7 @@ private constructor( @JsonProperty("formatted_schema") @ExcludeMissing formattedSchema: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), @JsonProperty("output") @ExcludeMissing output: JsonField = JsonMissing.of(), @JsonProperty("requirements") @ExcludeMissing @@ -64,6 +66,7 @@ private constructor( toolkit, description, formattedSchema, + metadata, output, requirements, mutableMapOf(), @@ -112,6 +115,12 @@ private constructor( fun formattedSchema(): Optional = formattedSchema.getOptional("formatted_schema") + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun metadata(): Optional = metadata.getOptional("metadata") + /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -180,6 +189,13 @@ private constructor( @ExcludeMissing fun _formattedSchema(): JsonField = formattedSchema + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata + /** * Returns the raw JSON value of [output]. * @@ -235,6 +251,7 @@ private constructor( private var toolkit: JsonField? = null private var description: JsonField = JsonMissing.of() private var formattedSchema: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() private var output: JsonField = JsonMissing.of() private var requirements: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -248,6 +265,7 @@ private constructor( toolkit = toolDefinition.toolkit description = toolDefinition.description formattedSchema = toolDefinition.formattedSchema + metadata = toolDefinition.metadata output = toolDefinition.output requirements = toolDefinition.requirements additionalProperties = toolDefinition.additionalProperties.toMutableMap() @@ -335,6 +353,17 @@ private constructor( this.formattedSchema = formattedSchema } + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + fun output(output: Output) = output(JsonField.of(output)) /** @@ -402,6 +431,7 @@ private constructor( checkRequired("toolkit", toolkit), description, formattedSchema, + metadata, output, requirements, additionalProperties.toMutableMap(), @@ -422,6 +452,7 @@ private constructor( toolkit().validate() description() formattedSchema().ifPresent { it.validate() } + metadata().ifPresent { it.validate() } output().ifPresent { it.validate() } requirements().ifPresent { it.validate() } validated = true @@ -449,6 +480,7 @@ private constructor( (toolkit.asKnown().getOrNull()?.validity() ?: 0) + (if (description.asKnown().isPresent) 1 else 0) + (formattedSchema.asKnown().getOrNull()?.validity() ?: 0) + + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (output.asKnown().getOrNull()?.validity() ?: 0) + (requirements.asKnown().getOrNull()?.validity() ?: 0) @@ -1269,6 +1301,818 @@ private constructor( override fun toString() = "FormattedSchema{additionalProperties=$additionalProperties}" } + class Metadata + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val behavior: JsonField, + private val classification: JsonField, + private val extras: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("behavior") + @ExcludeMissing + behavior: JsonField = JsonMissing.of(), + @JsonProperty("classification") + @ExcludeMissing + classification: JsonField = JsonMissing.of(), + @JsonProperty("extras") @ExcludeMissing extras: JsonField = JsonMissing.of(), + ) : this(behavior, classification, extras, mutableMapOf()) + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun behavior(): Optional = behavior.getOptional("behavior") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun classification(): Optional = + classification.getOptional("classification") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun extras(): Optional = extras.getOptional("extras") + + /** + * Returns the raw JSON value of [behavior]. + * + * Unlike [behavior], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("behavior") @ExcludeMissing fun _behavior(): JsonField = behavior + + /** + * Returns the raw JSON value of [classification]. + * + * Unlike [classification], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("classification") + @ExcludeMissing + fun _classification(): JsonField = classification + + /** + * Returns the raw JSON value of [extras]. + * + * Unlike [extras], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("extras") @ExcludeMissing fun _extras(): JsonField = extras + + @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 [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var behavior: JsonField = JsonMissing.of() + private var classification: JsonField = JsonMissing.of() + private var extras: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + behavior = metadata.behavior + classification = metadata.classification + extras = metadata.extras + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun behavior(behavior: Behavior) = behavior(JsonField.of(behavior)) + + /** + * Sets [Builder.behavior] to an arbitrary JSON value. + * + * You should usually call [Builder.behavior] with a well-typed [Behavior] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun behavior(behavior: JsonField) = apply { this.behavior = behavior } + + fun classification(classification: Classification) = + classification(JsonField.of(classification)) + + /** + * Sets [Builder.classification] to an arbitrary JSON value. + * + * You should usually call [Builder.classification] with a well-typed [Classification] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun classification(classification: JsonField) = apply { + this.classification = classification + } + + fun extras(extras: Extras) = extras(JsonField.of(extras)) + + /** + * Sets [Builder.extras] to an arbitrary JSON value. + * + * You should usually call [Builder.extras] with a well-typed [Extras] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun extras(extras: JsonField) = apply { this.extras = extras } + + 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 [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Metadata = + Metadata(behavior, classification, extras, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + behavior().ifPresent { it.validate() } + classification().ifPresent { it.validate() } + extras().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 = + (behavior.asKnown().getOrNull()?.validity() ?: 0) + + (classification.asKnown().getOrNull()?.validity() ?: 0) + + (extras.asKnown().getOrNull()?.validity() ?: 0) + + class Behavior + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val destructive: JsonField, + private val idempotent: JsonField, + private val openWorld: JsonField, + private val operations: JsonField>, + private val readOnly: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("destructive") + @ExcludeMissing + destructive: JsonField = JsonMissing.of(), + @JsonProperty("idempotent") + @ExcludeMissing + idempotent: JsonField = JsonMissing.of(), + @JsonProperty("open_world") + @ExcludeMissing + openWorld: JsonField = JsonMissing.of(), + @JsonProperty("operations") + @ExcludeMissing + operations: JsonField> = JsonMissing.of(), + @JsonProperty("read_only") + @ExcludeMissing + readOnly: JsonField = JsonMissing.of(), + ) : this(destructive, idempotent, openWorld, operations, readOnly, mutableMapOf()) + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun destructive(): Optional = destructive.getOptional("destructive") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun idempotent(): Optional = idempotent.getOptional("idempotent") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun openWorld(): Optional = openWorld.getOptional("open_world") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun operations(): Optional> = operations.getOptional("operations") + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun readOnly(): Optional = readOnly.getOptional("read_only") + + /** + * Returns the raw JSON value of [destructive]. + * + * Unlike [destructive], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("destructive") + @ExcludeMissing + fun _destructive(): JsonField = destructive + + /** + * Returns the raw JSON value of [idempotent]. + * + * Unlike [idempotent], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("idempotent") + @ExcludeMissing + fun _idempotent(): JsonField = idempotent + + /** + * Returns the raw JSON value of [openWorld]. + * + * Unlike [openWorld], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("open_world") + @ExcludeMissing + fun _openWorld(): JsonField = openWorld + + /** + * Returns the raw JSON value of [operations]. + * + * Unlike [operations], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("operations") + @ExcludeMissing + fun _operations(): JsonField> = operations + + /** + * Returns the raw JSON value of [readOnly]. + * + * Unlike [readOnly], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("read_only") + @ExcludeMissing + fun _readOnly(): JsonField = readOnly + + @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 [Behavior]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Behavior]. */ + class Builder internal constructor() { + + private var destructive: JsonField = JsonMissing.of() + private var idempotent: JsonField = JsonMissing.of() + private var openWorld: JsonField = JsonMissing.of() + private var operations: JsonField>? = null + private var readOnly: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(behavior: Behavior) = apply { + destructive = behavior.destructive + idempotent = behavior.idempotent + openWorld = behavior.openWorld + operations = behavior.operations.map { it.toMutableList() } + readOnly = behavior.readOnly + additionalProperties = behavior.additionalProperties.toMutableMap() + } + + fun destructive(destructive: Boolean) = destructive(JsonField.of(destructive)) + + /** + * Sets [Builder.destructive] to an arbitrary JSON value. + * + * You should usually call [Builder.destructive] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun destructive(destructive: JsonField) = apply { + this.destructive = destructive + } + + fun idempotent(idempotent: Boolean) = idempotent(JsonField.of(idempotent)) + + /** + * Sets [Builder.idempotent] to an arbitrary JSON value. + * + * You should usually call [Builder.idempotent] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun idempotent(idempotent: JsonField) = apply { + this.idempotent = idempotent + } + + fun openWorld(openWorld: Boolean) = openWorld(JsonField.of(openWorld)) + + /** + * Sets [Builder.openWorld] to an arbitrary JSON value. + * + * You should usually call [Builder.openWorld] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun openWorld(openWorld: JsonField) = apply { this.openWorld = openWorld } + + fun operations(operations: List) = operations(JsonField.of(operations)) + + /** + * Sets [Builder.operations] to an arbitrary JSON value. + * + * You should usually call [Builder.operations] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun operations(operations: JsonField>) = apply { + this.operations = operations.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [operations]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addOperation(operation: String) = apply { + operations = + (operations ?: JsonField.of(mutableListOf())).also { + checkKnown("operations", it).add(operation) + } + } + + fun readOnly(readOnly: Boolean) = readOnly(JsonField.of(readOnly)) + + /** + * Sets [Builder.readOnly] to an arbitrary JSON value. + * + * You should usually call [Builder.readOnly] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun readOnly(readOnly: JsonField) = apply { this.readOnly = readOnly } + + 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 [Behavior]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Behavior = + Behavior( + destructive, + idempotent, + openWorld, + (operations ?: JsonMissing.of()).map { it.toImmutable() }, + readOnly, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Behavior = apply { + if (validated) { + return@apply + } + + destructive() + idempotent() + openWorld() + operations() + readOnly() + 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 (destructive.asKnown().isPresent) 1 else 0) + + (if (idempotent.asKnown().isPresent) 1 else 0) + + (if (openWorld.asKnown().isPresent) 1 else 0) + + (operations.asKnown().getOrNull()?.size ?: 0) + + (if (readOnly.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Behavior && + destructive == other.destructive && + idempotent == other.idempotent && + openWorld == other.openWorld && + operations == other.operations && + readOnly == other.readOnly && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + destructive, + idempotent, + openWorld, + operations, + readOnly, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Behavior{destructive=$destructive, idempotent=$idempotent, openWorld=$openWorld, operations=$operations, readOnly=$readOnly, additionalProperties=$additionalProperties}" + } + + class Classification + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val serviceDomains: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("service_domains") + @ExcludeMissing + serviceDomains: JsonField> = JsonMissing.of() + ) : this(serviceDomains, mutableMapOf()) + + /** + * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun serviceDomains(): Optional> = + serviceDomains.getOptional("service_domains") + + /** + * Returns the raw JSON value of [serviceDomains]. + * + * Unlike [serviceDomains], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("service_domains") + @ExcludeMissing + fun _serviceDomains(): JsonField> = serviceDomains + + @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 [Classification]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Classification]. */ + class Builder internal constructor() { + + private var serviceDomains: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(classification: Classification) = apply { + serviceDomains = classification.serviceDomains.map { it.toMutableList() } + additionalProperties = classification.additionalProperties.toMutableMap() + } + + fun serviceDomains(serviceDomains: List) = + serviceDomains(JsonField.of(serviceDomains)) + + /** + * Sets [Builder.serviceDomains] to an arbitrary JSON value. + * + * You should usually call [Builder.serviceDomains] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun serviceDomains(serviceDomains: JsonField>) = apply { + this.serviceDomains = serviceDomains.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [serviceDomains]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addServiceDomain(serviceDomain: String) = apply { + serviceDomains = + (serviceDomains ?: JsonField.of(mutableListOf())).also { + checkKnown("serviceDomains", it).add(serviceDomain) + } + } + + 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 [Classification]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Classification = + Classification( + (serviceDomains ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Classification = apply { + if (validated) { + return@apply + } + + serviceDomains() + 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 = (serviceDomains.asKnown().getOrNull()?.size ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Classification && + serviceDomains == other.serviceDomains && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(serviceDomains, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Classification{serviceDomains=$serviceDomains, additionalProperties=$additionalProperties}" + } + + class Extras + @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 [Extras]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Extras]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(extras: Extras) = apply { + additionalProperties = extras.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 [Extras]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Extras = Extras(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): Extras = 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 Extras && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Extras{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Metadata && + behavior == other.behavior && + classification == other.classification && + extras == other.extras && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(behavior, classification, extras, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Metadata{behavior=$behavior, classification=$classification, extras=$extras, additionalProperties=$additionalProperties}" + } + class Output @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -2824,6 +3668,7 @@ private constructor( toolkit == other.toolkit && description == other.description && formattedSchema == other.formattedSchema && + metadata == other.metadata && output == other.output && requirements == other.requirements && additionalProperties == other.additionalProperties @@ -2838,6 +3683,7 @@ private constructor( toolkit, description, formattedSchema, + metadata, output, requirements, additionalProperties, @@ -2847,5 +3693,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ToolDefinition{fullyQualifiedName=$fullyQualifiedName, input=$input, name=$name, qualifiedName=$qualifiedName, toolkit=$toolkit, description=$description, formattedSchema=$formattedSchema, output=$output, requirements=$requirements, additionalProperties=$additionalProperties}" + "ToolDefinition{fullyQualifiedName=$fullyQualifiedName, input=$input, name=$name, qualifiedName=$qualifiedName, toolkit=$toolkit, description=$description, formattedSchema=$formattedSchema, metadata=$metadata, output=$output, requirements=$requirements, additionalProperties=$additionalProperties}" } 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 da60092..fd3dbb5 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 @@ -1026,6 +1026,10 @@ private constructor( @JvmField val TOOL_RUNTIME_FATAL = of("TOOL_RUNTIME_FATAL") + @JvmField val CONTEXT_CHECK_FAILED = of("CONTEXT_CHECK_FAILED") + + @JvmField val CONTEXT_DENIED = of("CONTEXT_DENIED") + @JvmField val UPSTREAM_RUNTIME_BAD_REQUEST = of("UPSTREAM_RUNTIME_BAD_REQUEST") @JvmField val UPSTREAM_RUNTIME_AUTH_ERROR = of("UPSTREAM_RUNTIME_AUTH_ERROR") @@ -1059,6 +1063,8 @@ private constructor( TOOL_RUNTIME_RETRY, TOOL_RUNTIME_CONTEXT_REQUIRED, TOOL_RUNTIME_FATAL, + CONTEXT_CHECK_FAILED, + CONTEXT_DENIED, UPSTREAM_RUNTIME_BAD_REQUEST, UPSTREAM_RUNTIME_AUTH_ERROR, UPSTREAM_RUNTIME_NOT_FOUND, @@ -1089,6 +1095,8 @@ private constructor( TOOL_RUNTIME_RETRY, TOOL_RUNTIME_CONTEXT_REQUIRED, TOOL_RUNTIME_FATAL, + CONTEXT_CHECK_FAILED, + CONTEXT_DENIED, UPSTREAM_RUNTIME_BAD_REQUEST, UPSTREAM_RUNTIME_AUTH_ERROR, UPSTREAM_RUNTIME_NOT_FOUND, @@ -1122,6 +1130,8 @@ private constructor( TOOL_RUNTIME_RETRY -> Value.TOOL_RUNTIME_RETRY TOOL_RUNTIME_CONTEXT_REQUIRED -> Value.TOOL_RUNTIME_CONTEXT_REQUIRED TOOL_RUNTIME_FATAL -> Value.TOOL_RUNTIME_FATAL + CONTEXT_CHECK_FAILED -> Value.CONTEXT_CHECK_FAILED + CONTEXT_DENIED -> Value.CONTEXT_DENIED UPSTREAM_RUNTIME_BAD_REQUEST -> Value.UPSTREAM_RUNTIME_BAD_REQUEST UPSTREAM_RUNTIME_AUTH_ERROR -> Value.UPSTREAM_RUNTIME_AUTH_ERROR UPSTREAM_RUNTIME_NOT_FOUND -> Value.UPSTREAM_RUNTIME_NOT_FOUND @@ -1154,6 +1164,8 @@ private constructor( TOOL_RUNTIME_RETRY -> Known.TOOL_RUNTIME_RETRY TOOL_RUNTIME_CONTEXT_REQUIRED -> Known.TOOL_RUNTIME_CONTEXT_REQUIRED TOOL_RUNTIME_FATAL -> Known.TOOL_RUNTIME_FATAL + CONTEXT_CHECK_FAILED -> Known.CONTEXT_CHECK_FAILED + CONTEXT_DENIED -> Known.CONTEXT_DENIED UPSTREAM_RUNTIME_BAD_REQUEST -> Known.UPSTREAM_RUNTIME_BAD_REQUEST UPSTREAM_RUNTIME_AUTH_ERROR -> Known.UPSTREAM_RUNTIME_AUTH_ERROR UPSTREAM_RUNTIME_NOT_FOUND -> Known.UPSTREAM_RUNTIME_NOT_FOUND diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt index 8cab0e9..3ebb65e 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponse.kt @@ -3,29 +3,23 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import dev.arcade.core.ExcludeMissing import dev.arcade.core.JsonValue +import dev.arcade.core.toImmutable import dev.arcade.errors.ArcadeInvalidDataException -import java.util.Collections import java.util.Objects class FormattedGetResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor(private val additionalProperties: MutableMap) { - - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } +@JsonCreator +private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map +) { @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -69,8 +63,7 @@ private constructor(private val additionalProperties: MutableMap !value.isNull() && !value.isMissing() } override fun equals(other: Any?): Boolean { if (this === other) { diff --git a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt index 2b3dae7..c2c3672 100644 --- a/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt +++ b/arcade-java-core/src/main/kotlin/dev/arcade/models/tools/formatted/FormattedListResponse.kt @@ -3,29 +3,23 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import dev.arcade.core.ExcludeMissing import dev.arcade.core.JsonValue +import dev.arcade.core.toImmutable import dev.arcade.errors.ArcadeInvalidDataException -import java.util.Collections import java.util.Objects class FormattedListResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor(private val additionalProperties: MutableMap) { - - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } +@JsonCreator +private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map +) { @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) @@ -70,7 +64,7 @@ private constructor(private val additionalProperties: MutableMap !value.isNull() && !value.isMissing() } override fun equals(other: Any?): Boolean { if (this === other) { 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 f1fe162..51843b5 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 @@ -11,6 +11,7 @@ import dev.arcade.core.ExcludeMissing import dev.arcade.core.JsonField import dev.arcade.core.JsonMissing import dev.arcade.core.JsonValue +import dev.arcade.core.checkKnown import dev.arcade.core.toImmutable import dev.arcade.errors.ArcadeInvalidDataException import java.util.Collections @@ -887,7 +888,6 @@ private constructor( private val binding: JsonField, private val editable: JsonField, private val exists: JsonField, - private val hint: JsonField, private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -903,9 +903,8 @@ private constructor( @JsonProperty("exists") @ExcludeMissing exists: JsonField = JsonMissing.of(), - @JsonProperty("hint") @ExcludeMissing hint: JsonField = JsonMissing.of(), @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), - ) : this(binding, editable, exists, hint, value, mutableMapOf()) + ) : this(binding, editable, exists, value, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if @@ -925,12 +924,6 @@ private constructor( */ fun exists(): Optional = exists.getOptional("exists") - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun hint(): Optional = hint.getOptional("hint") - /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -959,13 +952,6 @@ private constructor( */ @JsonProperty("exists") @ExcludeMissing fun _exists(): JsonField = exists - /** - * Returns the raw JSON value of [hint]. - * - * Unlike [hint], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("hint") @ExcludeMissing fun _hint(): JsonField = hint - /** * Returns the raw JSON value of [value]. * @@ -997,7 +983,6 @@ private constructor( private var binding: JsonField = JsonMissing.of() private var editable: JsonField = JsonMissing.of() private var exists: JsonField = JsonMissing.of() - private var hint: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -1006,7 +991,6 @@ private constructor( binding = secret.binding editable = secret.editable exists = secret.exists - hint = secret.hint value = secret.value additionalProperties = secret.additionalProperties.toMutableMap() } @@ -1044,17 +1028,6 @@ private constructor( */ fun exists(exists: JsonField) = apply { this.exists = exists } - fun hint(hint: String) = hint(JsonField.of(hint)) - - /** - * Sets [Builder.hint] to an arbitrary JSON value. - * - * You should usually call [Builder.hint] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun hint(hint: JsonField) = apply { this.hint = hint } - fun value(value: String) = value(JsonField.of(value)) /** @@ -1094,14 +1067,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Secret = - Secret( - binding, - editable, - exists, - hint, - value, - additionalProperties.toMutableMap(), - ) + Secret(binding, editable, exists, value, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -1114,7 +1080,6 @@ private constructor( binding().ifPresent { it.validate() } editable() exists() - hint() value() validated = true } @@ -1138,7 +1103,6 @@ private constructor( (binding.asKnown().getOrNull()?.validity() ?: 0) + (if (editable.asKnown().isPresent) 1 else 0) + (if (exists.asKnown().isPresent) 1 else 0) + - (if (hint.asKnown().isPresent) 1 else 0) + (if (value.asKnown().isPresent) 1 else 0) class Binding @JsonCreator private constructor(private val value: JsonField) : @@ -1293,19 +1257,18 @@ private constructor( binding == other.binding && editable == other.editable && exists == other.exists && - hint == other.hint && value == other.value && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(binding, editable, exists, hint, value, additionalProperties) + Objects.hash(binding, editable, exists, value, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Secret{binding=$binding, editable=$editable, exists=$exists, hint=$hint, value=$value, additionalProperties=$additionalProperties}" + "Secret{binding=$binding, editable=$editable, exists=$exists, value=$value, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1720,7 +1683,9 @@ private constructor( private val authorizationUrl: JsonField, private val clientId: JsonField, private val clientSecret: JsonField, + private val externalId: JsonField, private val redirectUri: JsonField, + private val supportedScopes: JsonField>, private val additionalProperties: MutableMap, ) { @@ -1735,10 +1700,24 @@ private constructor( @JsonProperty("client_secret") @ExcludeMissing clientSecret: JsonField = JsonMissing.of(), + @JsonProperty("external_id") + @ExcludeMissing + externalId: JsonField = JsonMissing.of(), @JsonProperty("redirect_uri") @ExcludeMissing redirectUri: JsonField = JsonMissing.of(), - ) : this(authorizationUrl, clientId, clientSecret, redirectUri, mutableMapOf()) + @JsonProperty("supported_scopes") + @ExcludeMissing + supportedScopes: JsonField> = JsonMissing.of(), + ) : this( + authorizationUrl, + clientId, + clientSecret, + externalId, + redirectUri, + supportedScopes, + mutableMapOf(), + ) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. if @@ -1759,12 +1738,25 @@ private constructor( */ fun clientSecret(): Optional = clientSecret.getOptional("client_secret") + /** + * @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 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). + */ + fun supportedScopes(): Optional> = + supportedScopes.getOptional("supported_scopes") + /** * Returns the raw JSON value of [authorizationUrl]. * @@ -1793,6 +1785,16 @@ private constructor( @ExcludeMissing fun _clientSecret(): JsonField = clientSecret + /** + * 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 [redirectUri]. * @@ -1803,6 +1805,16 @@ private constructor( @ExcludeMissing fun _redirectUri(): JsonField = redirectUri + /** + * Returns the raw JSON value of [supportedScopes]. + * + * Unlike [supportedScopes], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("supported_scopes") + @ExcludeMissing + fun _supportedScopes(): JsonField> = supportedScopes + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1827,7 +1839,9 @@ private constructor( private var authorizationUrl: JsonField = JsonMissing.of() private var clientId: JsonField = JsonMissing.of() private var clientSecret: JsonField = JsonMissing.of() + private var externalId: JsonField = JsonMissing.of() private var redirectUri: JsonField = JsonMissing.of() + private var supportedScopes: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1835,7 +1849,9 @@ private constructor( authorizationUrl = oauth2.authorizationUrl clientId = oauth2.clientId clientSecret = oauth2.clientSecret + externalId = oauth2.externalId redirectUri = oauth2.redirectUri + supportedScopes = oauth2.supportedScopes.map { it.toMutableList() } additionalProperties = oauth2.additionalProperties.toMutableMap() } @@ -1878,6 +1894,19 @@ private constructor( this.clientSecret = clientSecret } + 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 redirectUri(redirectUri: String) = redirectUri(JsonField.of(redirectUri)) /** @@ -1891,6 +1920,32 @@ private constructor( this.redirectUri = redirectUri } + fun supportedScopes(supportedScopes: List) = + supportedScopes(JsonField.of(supportedScopes)) + + /** + * Sets [Builder.supportedScopes] to an arbitrary JSON value. + * + * You should usually call [Builder.supportedScopes] with a well-typed + * `List` value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun supportedScopes(supportedScopes: JsonField>) = apply { + this.supportedScopes = supportedScopes.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [supportedScopes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSupportedScope(supportedScope: String) = apply { + supportedScopes = + (supportedScopes ?: JsonField.of(mutableListOf())).also { + checkKnown("supportedScopes", it).add(supportedScope) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1923,7 +1978,9 @@ private constructor( authorizationUrl, clientId, clientSecret, + externalId, redirectUri, + (supportedScopes ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } @@ -1938,7 +1995,9 @@ private constructor( authorizationUrl() clientId() clientSecret().ifPresent { it.validate() } + externalId() redirectUri() + supportedScopes() validated = true } @@ -1961,7 +2020,9 @@ private constructor( (if (authorizationUrl.asKnown().isPresent) 1 else 0) + (if (clientId.asKnown().isPresent) 1 else 0) + (clientSecret.asKnown().getOrNull()?.validity() ?: 0) + - (if (redirectUri.asKnown().isPresent) 1 else 0) + (if (externalId.asKnown().isPresent) 1 else 0) + + (if (redirectUri.asKnown().isPresent) 1 else 0) + + (supportedScopes.asKnown().getOrNull()?.size ?: 0) class ClientSecret @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -1969,7 +2030,6 @@ private constructor( private val binding: JsonField, private val editable: JsonField, private val exists: JsonField, - private val hint: JsonField, private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -1985,13 +2045,10 @@ private constructor( @JsonProperty("exists") @ExcludeMissing exists: JsonField = JsonMissing.of(), - @JsonProperty("hint") - @ExcludeMissing - hint: JsonField = JsonMissing.of(), @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), - ) : this(binding, editable, exists, hint, value, mutableMapOf()) + ) : this(binding, editable, exists, value, mutableMapOf()) /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. @@ -2011,12 +2068,6 @@ private constructor( */ fun exists(): Optional = exists.getOptional("exists") - /** - * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun hint(): Optional = hint.getOptional("hint") - /** * @throws ArcadeInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2051,14 +2102,6 @@ private constructor( */ @JsonProperty("exists") @ExcludeMissing fun _exists(): JsonField = exists - /** - * Returns the raw JSON value of [hint]. - * - * Unlike [hint], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("hint") @ExcludeMissing fun _hint(): JsonField = hint - /** * Returns the raw JSON value of [value]. * @@ -2091,7 +2134,6 @@ private constructor( private var binding: JsonField = JsonMissing.of() private var editable: JsonField = JsonMissing.of() private var exists: JsonField = JsonMissing.of() - private var hint: JsonField = JsonMissing.of() private var value: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2100,7 +2142,6 @@ private constructor( binding = clientSecret.binding editable = clientSecret.editable exists = clientSecret.exists - hint = clientSecret.hint value = clientSecret.value additionalProperties = clientSecret.additionalProperties.toMutableMap() } @@ -2138,17 +2179,6 @@ private constructor( */ fun exists(exists: JsonField) = apply { this.exists = exists } - fun hint(hint: String) = hint(JsonField.of(hint)) - - /** - * Sets [Builder.hint] to an arbitrary JSON value. - * - * You should usually call [Builder.hint] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun hint(hint: JsonField) = apply { this.hint = hint } - fun value(value: String) = value(JsonField.of(value)) /** @@ -2192,7 +2222,6 @@ private constructor( binding, editable, exists, - hint, value, additionalProperties.toMutableMap(), ) @@ -2208,7 +2237,6 @@ private constructor( binding().ifPresent { it.validate() } editable() exists() - hint() value() validated = true } @@ -2232,7 +2260,6 @@ private constructor( (binding.asKnown().getOrNull()?.validity() ?: 0) + (if (editable.asKnown().isPresent) 1 else 0) + (if (exists.asKnown().isPresent) 1 else 0) + - (if (hint.asKnown().isPresent) 1 else 0) + (if (value.asKnown().isPresent) 1 else 0) class Binding @@ -2390,19 +2417,18 @@ private constructor( binding == other.binding && editable == other.editable && exists == other.exists && - hint == other.hint && value == other.value && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(binding, editable, exists, hint, value, additionalProperties) + Objects.hash(binding, editable, exists, value, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "ClientSecret{binding=$binding, editable=$editable, exists=$exists, hint=$hint, value=$value, additionalProperties=$additionalProperties}" + "ClientSecret{binding=$binding, editable=$editable, exists=$exists, value=$value, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -2414,7 +2440,9 @@ private constructor( authorizationUrl == other.authorizationUrl && clientId == other.clientId && clientSecret == other.clientSecret && + externalId == other.externalId && redirectUri == other.redirectUri && + supportedScopes == other.supportedScopes && additionalProperties == other.additionalProperties } @@ -2423,7 +2451,9 @@ private constructor( authorizationUrl, clientId, clientSecret, + externalId, redirectUri, + supportedScopes, additionalProperties, ) } @@ -2431,7 +2461,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Oauth2{authorizationUrl=$authorizationUrl, clientId=$clientId, clientSecret=$clientSecret, redirectUri=$redirectUri, additionalProperties=$additionalProperties}" + "Oauth2{authorizationUrl=$authorizationUrl, clientId=$clientId, clientSecret=$clientSecret, externalId=$externalId, redirectUri=$redirectUri, supportedScopes=$supportedScopes, additionalProperties=$additionalProperties}" } class Secrets diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponseTest.kt index e5a12b2..bf6ff84 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderListResponseTest.kt @@ -65,7 +65,6 @@ internal class AuthProviderListResponseTest { ) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -270,7 +269,6 @@ internal class AuthProviderListResponseTest { ) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -457,7 +455,6 @@ internal class AuthProviderListResponseTest { ) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponseTest.kt index 7a8b6e3..a5fe088 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/authproviders/AuthProviderResponseTest.kt @@ -53,7 +53,6 @@ internal class AuthProviderResponseTest { .binding(AuthProviderResponse.Oauth2.ClientSecret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -215,7 +214,6 @@ internal class AuthProviderResponseTest { .binding(AuthProviderResponse.Oauth2.ClientSecret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -379,7 +377,6 @@ internal class AuthProviderResponseTest { .binding(AuthProviderResponse.Oauth2.ClientSecret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretListResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretListResponseTest.kt index 10542a6..03d5c8f 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretListResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretListResponseTest.kt @@ -25,7 +25,6 @@ internal class SecretListResponseTest { ) .createdAt("created_at") .description("description") - .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") @@ -49,7 +48,6 @@ internal class SecretListResponseTest { ) .createdAt("created_at") .description("description") - .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") @@ -77,7 +75,6 @@ internal class SecretListResponseTest { ) .createdAt("created_at") .description("description") - .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretResponseTest.kt index ca81ae6..c36c4f8 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/secrets/SecretResponseTest.kt @@ -22,7 +22,6 @@ internal class SecretResponseTest { ) .createdAt("created_at") .description("description") - .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") @@ -38,7 +37,6 @@ internal class SecretResponseTest { ) assertThat(secretResponse.createdAt()).contains("created_at") assertThat(secretResponse.description()).contains("description") - assertThat(secretResponse.hint()).contains("hint") assertThat(secretResponse.key()).contains("key") assertThat(secretResponse.lastAccessedAt()).contains("last_accessed_at") assertThat(secretResponse.updatedAt()).contains("updated_at") @@ -58,7 +56,6 @@ internal class SecretResponseTest { ) .createdAt("created_at") .description("description") - .hint("hint") .key("key") .lastAccessedAt("last_accessed_at") .updatedAt("updated_at") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParamsTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParamsTest.kt index c890603..72afc34 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParamsTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/admin/userconnections/UserConnectionListParamsTest.kt @@ -13,8 +13,8 @@ internal class UserConnectionListParamsTest { UserConnectionListParams.builder() .limit(0L) .offset(0L) - .provider(UserConnectionListParams.Provider.builder().id("id").build()) - .user(UserConnectionListParams.User.builder().id("id").build()) + .providerId("provider_id") + .userId("user_id") .build() } @@ -24,8 +24,8 @@ internal class UserConnectionListParamsTest { UserConnectionListParams.builder() .limit(0L) .offset(0L) - .provider(UserConnectionListParams.Provider.builder().id("id").build()) - .user(UserConnectionListParams.User.builder().id("id").build()) + .providerId("provider_id") + .userId("user_id") .build() val queryParams = params._queryParams() @@ -35,8 +35,8 @@ internal class UserConnectionListParamsTest { QueryParams.builder() .put("limit", "0") .put("offset", "0") - .put("provider[id]", "id") - .put("user[id]", "id") + .put("provider_id", "provider_id") + .put("user_id", "user_id") .build() ) } diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/health/HealthSchemaTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/health/HealthSchemaTest.kt index 864e844..dac534f 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/health/HealthSchemaTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/health/HealthSchemaTest.kt @@ -11,15 +11,16 @@ internal class HealthSchemaTest { @Test fun create() { - val healthSchema = HealthSchema.builder().healthy(true).build() + val healthSchema = HealthSchema.builder().healthy(true).reason("reason").build() assertThat(healthSchema.healthy()).contains(true) + assertThat(healthSchema.reason()).contains("reason") } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val healthSchema = HealthSchema.builder().healthy(true).build() + val healthSchema = HealthSchema.builder().healthy(true).reason("reason").build() val roundtrippedHealthSchema = jsonMapper.readValue( diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolDefinitionTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolDefinitionTest.kt index 73ec069..7d7a237 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolDefinitionTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolDefinitionTest.kt @@ -49,6 +49,29 @@ internal class ToolDefinitionTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .metadata( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -132,6 +155,30 @@ internal class ToolDefinitionTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + assertThat(toolDefinition.metadata()) + .contains( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) assertThat(toolDefinition.output()) .contains( ToolDefinition.Output.builder() @@ -218,6 +265,29 @@ internal class ToolDefinitionTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .metadata( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListPageResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListPageResponseTest.kt index d67e36a..426c0bd 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListPageResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/ToolListPageResponseTest.kt @@ -52,6 +52,29 @@ internal class ToolListPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .metadata( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -144,6 +167,29 @@ internal class ToolListPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .metadata( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -237,6 +283,29 @@ internal class ToolListPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .metadata( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponseTest.kt index c70e1b7..d5d77d8 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedGetResponseTest.kt @@ -3,6 +3,7 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import dev.arcade.core.JsonValue import dev.arcade.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -11,13 +12,19 @@ internal class FormattedGetResponseTest { @Test fun create() { - val formattedGetResponse = FormattedGetResponse.builder().build() + val formattedGetResponse = + FormattedGetResponse.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val formattedGetResponse = FormattedGetResponse.builder().build() + val formattedGetResponse = + FormattedGetResponse.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() val roundtrippedFormattedGetResponse = jsonMapper.readValue( diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponseTest.kt index e53881b..5b0505c 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListPageResponseTest.kt @@ -3,6 +3,7 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import dev.arcade.core.JsonValue import dev.arcade.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat @@ -14,7 +15,11 @@ internal class FormattedListPageResponseTest { fun create() { val formattedListPageResponse = FormattedListPageResponse.builder() - .addItem(FormattedListResponse.builder().build()) + .addItem( + FormattedListResponse.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .limit(0L) .offset(0L) .pageCount(0L) @@ -22,7 +27,11 @@ internal class FormattedListPageResponseTest { .build() assertThat(formattedListPageResponse.items().getOrNull()) - .containsExactly(FormattedListResponse.builder().build()) + .containsExactly( + FormattedListResponse.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) assertThat(formattedListPageResponse.limit()).contains(0L) assertThat(formattedListPageResponse.offset()).contains(0L) assertThat(formattedListPageResponse.pageCount()).contains(0L) @@ -34,7 +43,11 @@ internal class FormattedListPageResponseTest { val jsonMapper = jsonMapper() val formattedListPageResponse = FormattedListPageResponse.builder() - .addItem(FormattedListResponse.builder().build()) + .addItem( + FormattedListResponse.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .limit(0L) .offset(0L) .pageCount(0L) diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListResponseTest.kt index ffd6dfa..0d8e2f2 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/tools/formatted/FormattedListResponseTest.kt @@ -3,6 +3,7 @@ package dev.arcade.models.tools.formatted import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import dev.arcade.core.JsonValue import dev.arcade.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -11,13 +12,19 @@ internal class FormattedListResponseTest { @Test fun create() { - val formattedListResponse = FormattedListResponse.builder().build() + val formattedListResponse = + FormattedListResponse.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val formattedListResponse = FormattedListResponse.builder().build() + val formattedListResponse = + FormattedListResponse.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() val roundtrippedFormattedListResponse = jsonMapper.readValue( 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 ec4904a..bfe4dee 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 @@ -33,7 +33,6 @@ internal class WorkerListPageResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -61,11 +60,12 @@ internal class WorkerListPageResponseTest { ) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) + .externalId("external_id") .redirectUri("redirect_uri") + .addSupportedScope("string") .build() ) .retry(0L) @@ -78,7 +78,6 @@ internal class WorkerListPageResponseTest { "binding" to "static", "editable" to true, "exists" to true, - "hint" to "hint", "value" to "value", ) ), @@ -133,7 +132,6 @@ internal class WorkerListPageResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -161,11 +159,12 @@ internal class WorkerListPageResponseTest { ) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) + .externalId("external_id") .redirectUri("redirect_uri") + .addSupportedScope("string") .build() ) .retry(0L) @@ -178,7 +177,6 @@ internal class WorkerListPageResponseTest { "binding" to "static", "editable" to true, "exists" to true, - "hint" to "hint", "value" to "value", ) ), @@ -236,7 +234,6 @@ internal class WorkerListPageResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -264,11 +261,12 @@ internal class WorkerListPageResponseTest { ) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) + .externalId("external_id") .redirectUri("redirect_uri") + .addSupportedScope("string") .build() ) .retry(0L) @@ -281,7 +279,6 @@ internal class WorkerListPageResponseTest { "binding" to "static", "editable" to true, "exists" to true, - "hint" to "hint", "value" to "value", ) ), 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 c9ccba7..c280d01 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 @@ -30,7 +30,6 @@ internal class WorkerResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -57,11 +56,12 @@ internal class WorkerResponseTest { ) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) + .externalId("external_id") .redirectUri("redirect_uri") + .addSupportedScope("string") .build() ) .retry(0L) @@ -74,7 +74,6 @@ internal class WorkerResponseTest { "binding" to "static", "editable" to true, "exists" to true, - "hint" to "hint", "value" to "value", ) ), @@ -121,7 +120,6 @@ internal class WorkerResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -147,11 +145,12 @@ internal class WorkerResponseTest { .binding(WorkerResponse.Mcp.Oauth2.ClientSecret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) + .externalId("external_id") .redirectUri("redirect_uri") + .addSupportedScope("string") .build() ) .retry(0L) @@ -164,7 +163,6 @@ internal class WorkerResponseTest { "binding" to "static", "editable" to true, "exists" to true, - "hint" to "hint", "value" to "value", ) ), @@ -215,7 +213,6 @@ internal class WorkerResponseTest { .binding(WorkerResponse.Http.Secret.Binding.STATIC) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) @@ -242,11 +239,12 @@ internal class WorkerResponseTest { ) .editable(true) .exists(true) - .hint("hint") .value("value") .build() ) + .externalId("external_id") .redirectUri("redirect_uri") + .addSupportedScope("string") .build() ) .retry(0L) @@ -259,7 +257,6 @@ internal class WorkerResponseTest { "binding" to "static", "editable" to true, "exists" to true, - "hint" to "hint", "value" to "value", ) ), diff --git a/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerToolsPageResponseTest.kt b/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerToolsPageResponseTest.kt index 7a39eda..975e7ba 100644 --- a/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerToolsPageResponseTest.kt +++ b/arcade-java-core/src/test/kotlin/dev/arcade/models/workers/WorkerToolsPageResponseTest.kt @@ -54,6 +54,29 @@ internal class WorkerToolsPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .metadata( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -146,6 +169,29 @@ internal class WorkerToolsPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .metadata( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") @@ -239,6 +285,29 @@ internal class WorkerToolsPageResponseTest { .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) + .metadata( + ToolDefinition.Metadata.builder() + .behavior( + ToolDefinition.Metadata.Behavior.builder() + .destructive(true) + .idempotent(true) + .openWorld(true) + .addOperation("string") + .readOnly(true) + .build() + ) + .classification( + ToolDefinition.Metadata.Classification.builder() + .addServiceDomain("string") + .build() + ) + .extras( + ToolDefinition.Metadata.Extras.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + ) .output( ToolDefinition.Output.builder() .addAvailableMode("string") From 327cb1a7e32417aea7501ca22a67acd02733892c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 21:06:47 +0000 Subject: [PATCH 09/12] ci: Update arcade-java deployment to use Sonatype Portal The Stainless default for publishing Maven packages is EOL, new projects need to use the newer Sonatype portal --- .github/workflows/publish-sonatype.yml | 2 +- .stats.yml | 2 +- build.gradle.kts | 13 --- buildSrc/build.gradle.kts | 3 + .../src/main/kotlin/arcade.java.gradle.kts | 9 -- .../src/main/kotlin/arcade.publish.gradle.kts | 107 +++++++++--------- 6 files changed, 60 insertions(+), 76 deletions(-) diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 860cf22..02fc7e3 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -33,7 +33,7 @@ jobs: export -- GPG_SIGNING_KEY_ID printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" - ./gradlew publish --no-configuration-cache + ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache env: SONATYPE_USERNAME: ${{ secrets.ARCADE_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.ARCADE_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} diff --git a/.stats.yml b/.stats.yml index f7c06a5..1282f13 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 +config_hash: 9894d174e6b6fe15b31d60b296ffb6e7 diff --git a/build.gradle.kts b/build.gradle.kts index 7316284..85f3c5f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - id("io.github.gradle-nexus.publish-plugin") version "1.1.0" id("org.jetbrains.dokka") version "2.0.0" } @@ -35,15 +34,3 @@ tasks.named("dokkaJavadocCollector").configure { .filter { it.project.name != "arcade-java" && it.name == "dokkaJavadocJar" } .forEach { mustRunAfter(it) } } - -nexusPublishing { - repositories { - sonatype { - nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) - snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) - - username.set(System.getenv("SONATYPE_USERNAME")) - password.set(System.getenv("SONATYPE_PASSWORD")) - } - } -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 0b14135..c6dc92e 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,12 +1,15 @@ plugins { `kotlin-dsl` kotlin("jvm") version "1.9.20" + id("com.vanniktech.maven.publish") version "0.28.0" } repositories { gradlePluginPortal() + mavenCentral() } dependencies { implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") + implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/arcade.java.gradle.kts b/buildSrc/src/main/kotlin/arcade.java.gradle.kts index a3cfe28..8f4f902 100644 --- a/buildSrc/src/main/kotlin/arcade.java.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.java.gradle.kts @@ -8,11 +8,6 @@ repositories { mavenCentral() } -configure { - withJavadocJar() - withSourcesJar() -} - java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) @@ -27,10 +22,6 @@ tasks.withType().configureEach { options.release.set(8) } -tasks.named("javadocJar") { - setZip64(true) -} - tasks.named("jar") { manifest { attributes(mapOf( diff --git a/buildSrc/src/main/kotlin/arcade.publish.gradle.kts b/buildSrc/src/main/kotlin/arcade.publish.gradle.kts index 39290bc..06c05b5 100644 --- a/buildSrc/src/main/kotlin/arcade.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.publish.gradle.kts @@ -1,69 +1,72 @@ +import com.vanniktech.maven.publish.JavadocJar +import com.vanniktech.maven.publish.KotlinJvm +import com.vanniktech.maven.publish.MavenPublishBaseExtension +import com.vanniktech.maven.publish.SonatypeHost + plugins { - `maven-publish` - signing + id("com.vanniktech.maven.publish") +} + +publishing { + repositories { + if (project.hasProperty("publishLocal")) { + maven { + name = "LocalFileSystem" + url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") + } + } + } } -configure { - publications { - register("maven") { - from(components["java"]) +repositories { + gradlePluginPortal() + mavenCentral() +} - pom { - name.set("Arcade API") - description.set("Reference Documentation for Arcade Engine API") - url.set("https://docs.arcade.dev") +extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY") +extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID") +extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD") - licenses { - license { - name.set("MIT") - } - } +configure { + if (!project.hasProperty("publishLocal")) { + signAllPublications() + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) + } - developers { - developer { - name.set("Arcade") - email.set("dev@arcade.dev") - } - } + coordinates(project.group.toString(), project.name, project.version.toString()) + configure( + KotlinJvm( + javadocJar = JavadocJar.Dokka("dokkaJavadoc"), + sourcesJar = true, + ) + ) - scm { - connection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") - developerConnection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") - url.set("https://github.com/ArcadeAI/arcade-java") - } + pom { + name.set("Arcade API") + description.set("Reference Documentation for Arcade Engine API") + url.set("https://docs.arcade.dev") - versionMapping { - allVariants { - fromResolutionResult() - } - } + licenses { + license { + name.set("MIT") } } - } - repositories { - if (project.hasProperty("publishLocal")) { - maven { - name = "LocalFileSystem" - url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") + + developers { + developer { + name.set("Arcade") + email.set("dev@arcade.dev") } } - } -} -signing { - val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")?.ifBlank { null } - val signingKey = System.getenv("GPG_SIGNING_KEY")?.ifBlank { null } - val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null } - if (signingKey != null && signingPassword != null) { - useInMemoryPgpKeys( - signingKeyId, - signingKey, - signingPassword, - ) - sign(publishing.publications["maven"]) + scm { + connection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") + developerConnection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") + url.set("https://github.com/ArcadeAI/arcade-java") + } } } -tasks.named("publish") { - dependsOn(":closeAndReleaseSonatypeStagingRepository") +tasks.withType().configureEach { + isZip64 = true } From 4a4a38bd6eb8848183c7a553ab23d28f44a7ca6e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 21:35:33 +0000 Subject: [PATCH 10/12] feat(api): api update --- .github/workflows/publish-sonatype.yml | 2 +- .stats.yml | 2 +- build.gradle.kts | 13 +++ buildSrc/build.gradle.kts | 3 - .../src/main/kotlin/arcade.java.gradle.kts | 9 ++ .../src/main/kotlin/arcade.publish.gradle.kts | 107 +++++++++--------- 6 files changed, 76 insertions(+), 60 deletions(-) diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 02fc7e3..860cf22 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -33,7 +33,7 @@ jobs: export -- GPG_SIGNING_KEY_ID printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" - ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache + ./gradlew publish --no-configuration-cache env: SONATYPE_USERNAME: ${{ secrets.ARCADE_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.ARCADE_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} diff --git a/.stats.yml b/.stats.yml index 1282f13..f7c06a5 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: 9894d174e6b6fe15b31d60b296ffb6e7 +config_hash: bf64816643634a621cd0ffd93d9c4347 diff --git a/build.gradle.kts b/build.gradle.kts index 85f3c5f..7316284 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ plugins { + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" id("org.jetbrains.dokka") version "2.0.0" } @@ -34,3 +35,15 @@ tasks.named("dokkaJavadocCollector").configure { .filter { it.project.name != "arcade-java" && it.name == "dokkaJavadocJar" } .forEach { mustRunAfter(it) } } + +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + + username.set(System.getenv("SONATYPE_USERNAME")) + password.set(System.getenv("SONATYPE_PASSWORD")) + } + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index c6dc92e..0b14135 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,15 +1,12 @@ plugins { `kotlin-dsl` kotlin("jvm") version "1.9.20" - id("com.vanniktech.maven.publish") version "0.28.0" } repositories { gradlePluginPortal() - mavenCentral() } dependencies { implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") - implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") } diff --git a/buildSrc/src/main/kotlin/arcade.java.gradle.kts b/buildSrc/src/main/kotlin/arcade.java.gradle.kts index 8f4f902..a3cfe28 100644 --- a/buildSrc/src/main/kotlin/arcade.java.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.java.gradle.kts @@ -8,6 +8,11 @@ repositories { mavenCentral() } +configure { + withJavadocJar() + withSourcesJar() +} + java { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) @@ -22,6 +27,10 @@ tasks.withType().configureEach { options.release.set(8) } +tasks.named("javadocJar") { + setZip64(true) +} + tasks.named("jar") { manifest { attributes(mapOf( diff --git a/buildSrc/src/main/kotlin/arcade.publish.gradle.kts b/buildSrc/src/main/kotlin/arcade.publish.gradle.kts index 06c05b5..39290bc 100644 --- a/buildSrc/src/main/kotlin/arcade.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/arcade.publish.gradle.kts @@ -1,72 +1,69 @@ -import com.vanniktech.maven.publish.JavadocJar -import com.vanniktech.maven.publish.KotlinJvm -import com.vanniktech.maven.publish.MavenPublishBaseExtension -import com.vanniktech.maven.publish.SonatypeHost - plugins { - id("com.vanniktech.maven.publish") -} - -publishing { - repositories { - if (project.hasProperty("publishLocal")) { - maven { - name = "LocalFileSystem" - url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") - } - } - } + `maven-publish` + signing } -repositories { - gradlePluginPortal() - mavenCentral() -} +configure { + publications { + register("maven") { + from(components["java"]) -extra["signingInMemoryKey"] = System.getenv("GPG_SIGNING_KEY") -extra["signingInMemoryKeyId"] = System.getenv("GPG_SIGNING_KEY_ID") -extra["signingInMemoryKeyPassword"] = System.getenv("GPG_SIGNING_PASSWORD") + pom { + name.set("Arcade API") + description.set("Reference Documentation for Arcade Engine API") + url.set("https://docs.arcade.dev") -configure { - if (!project.hasProperty("publishLocal")) { - signAllPublications() - publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) - } + licenses { + license { + name.set("MIT") + } + } - coordinates(project.group.toString(), project.name, project.version.toString()) - configure( - KotlinJvm( - javadocJar = JavadocJar.Dokka("dokkaJavadoc"), - sourcesJar = true, - ) - ) + developers { + developer { + name.set("Arcade") + email.set("dev@arcade.dev") + } + } - pom { - name.set("Arcade API") - description.set("Reference Documentation for Arcade Engine API") - url.set("https://docs.arcade.dev") + scm { + connection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") + developerConnection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") + url.set("https://github.com/ArcadeAI/arcade-java") + } - licenses { - license { - name.set("MIT") + versionMapping { + allVariants { + fromResolutionResult() + } + } } } - - developers { - developer { - name.set("Arcade") - email.set("dev@arcade.dev") + } + repositories { + if (project.hasProperty("publishLocal")) { + maven { + name = "LocalFileSystem" + url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") } } + } +} - scm { - connection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") - developerConnection.set("scm:git:git://github.com/ArcadeAI/arcade-java.git") - url.set("https://github.com/ArcadeAI/arcade-java") - } +signing { + val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")?.ifBlank { null } + val signingKey = System.getenv("GPG_SIGNING_KEY")?.ifBlank { null } + val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")?.ifBlank { null } + if (signingKey != null && signingPassword != null) { + useInMemoryPgpKeys( + signingKeyId, + signingKey, + signingPassword, + ) + sign(publishing.publications["maven"]) } } -tasks.withType().configureEach { - isZip64 = true +tasks.named("publish") { + dependsOn(":closeAndReleaseSonatypeStagingRepository") } From 9433c8d0b6f0c4aa58448087598b3ec8121a75a7 Mon Sep 17 00:00:00 2001 From: Brian Demers Date: Mon, 9 Mar 2026 17:37:19 -0400 Subject: [PATCH 11/12] Fix lint errors (#13) --- .../dev/arcade/example/QuickStartExample.java | 36 ++++++++----------- .../example/springai/SpringAIExample.java | 16 ++++----- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/arcade-java-example/src/main/java/dev/arcade/example/QuickStartExample.java b/arcade-java-example/src/main/java/dev/arcade/example/QuickStartExample.java index 4bad391..a866c60 100644 --- a/arcade-java-example/src/main/java/dev/arcade/example/QuickStartExample.java +++ b/arcade-java-example/src/main/java/dev/arcade/example/QuickStartExample.java @@ -67,19 +67,16 @@ public static void main(String[] args) { userId); // Print the response from the tool call - logger.info( - """ - Success! Check your email at {} - - You just chained 3 tools together: - 1. Searched Google News for stories about MCP URL mode elicitation - 2. Created a Google Doc with the results - 3. Sent yourself an email with the document link - - Email metadata: {} - """, - userId, - sendEmailResult); + logger.info(""" + Success! Check your email at {} + + You just chained 3 tools together: + 1. Searched Google News for stories about MCP URL mode elicitation + 2. Created a Google Doc with the results + 3. Sent yourself an email with the document link + + Email metadata: {} + """, userId, sendEmailResult); } /** @@ -101,14 +98,11 @@ public static Map authorizeAndRunTool( .status() .filter(status -> status != AuthorizationResponse.Status.COMPLETED) .flatMap(status -> authResponse.url()) - .ifPresent(url -> logger.info( - """ - Click this link to authorize {}: - {}. - The process will continue once you have authorized the app. - """, - toolName, - url)); + .ifPresent(url -> logger.info(""" + Click this link to authorize {}: + {}. + The process will continue once you have authorized the app. + """, toolName, url)); client.auth().waitForCompletion(authResponse); // Execute the tool and extract the output as a Map diff --git a/arcade-java-example/src/main/java/dev/arcade/example/springai/SpringAIExample.java b/arcade-java-example/src/main/java/dev/arcade/example/springai/SpringAIExample.java index 2b4a6b7..aec82cf 100644 --- a/arcade-java-example/src/main/java/dev/arcade/example/springai/SpringAIExample.java +++ b/arcade-java-example/src/main/java/dev/arcade/example/springai/SpringAIExample.java @@ -22,8 +22,7 @@ @SpringBootApplication public class SpringAIExample { - private static final String SYSTEM_PROMPT = - """ + private static final String SYSTEM_PROMPT = """ You are a specialized Music Assistant with access to two MCP tools: get_spotify_state and play_song. Your goal is to provide a seamless, proactive audio experience. Follow these operational guidelines: Context Awareness: Before playing any music, always use get_spotify_state to see if music is already playing. If it is, acknowledge what is currently playing before switching to the new track. @@ -86,14 +85,11 @@ String play(@ToolParam(description = "The name of the artist to play") String na * * @return A string object of the playback state. */ - @Tool( - name = "get_spotify_state", - description = - """ - Get information about the user's current playback state, - including track or episode, and active device. - This tool does not perform any actions. Use other tools to control playback. - """) + @Tool(name = "get_spotify_state", description = """ + Get information about the user's current playback state, + including track or episode, and active device. + This tool does not perform any actions. Use other tools to control playback. + """) String playbackState() { return executeTool("Spotify.GetPlaybackState", Map.of()); } From 403319c5d1e64363edbdeb3bde79b61a4a4eb25d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 21:37:37 +0000 Subject: [PATCH 12/12] release: 0.1.0-alpha.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 20 ++++++++++++++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f14b480..aaf968a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.2" + ".": "0.1.0-alpha.3" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 60fe4f5..ff7d0be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 0.1.0-alpha.3 (2026-03-09) + +Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/ArcadeAI/arcade-java/compare/v0.1.0-alpha.2...v0.1.0-alpha.3) + +### Features + +* **api:** api update ([4a4a38b](https://github.com/ArcadeAI/arcade-java/commit/4a4a38bd6eb8848183c7a553ab23d28f44a7ca6e)) +* **api:** api update ([b62bebe](https://github.com/ArcadeAI/arcade-java/commit/b62bebeaa3c5341aed692f28cdb76c24ef4588d7)) +* **api:** api update ([ab083dc](https://github.com/ArcadeAI/arcade-java/commit/ab083dc5b22c66bd1a216107ed5d427270f7535f)) +* **api:** api update ([a9067a6](https://github.com/ArcadeAI/arcade-java/commit/a9067a6b9e05ec27d0a4c3bd5a50b5fd568a617f)) +* **api:** Enable publishing for Java SDK ([4e1dd23](https://github.com/ArcadeAI/arcade-java/commit/4e1dd23facb1daf92135fde91bbeb1fefc9e1b76)) + + +### Chores + +* **ci:** skip uploading artifacts on stainless-internal branches ([e37cb5d](https://github.com/ArcadeAI/arcade-java/commit/e37cb5d7f6f23e6be986ae5e3784898e3854a79c)) +* **internal:** bump palantir-java-format ([b1ebae8](https://github.com/ArcadeAI/arcade-java/commit/b1ebae8ff127b1402785df354f2687408ff248b0)) +* **internal:** codegen related update ([8837560](https://github.com/ArcadeAI/arcade-java/commit/883756053127934e8dc3d1ee90148f51c0a48f28)) +* **test:** do not count install time for mock server timeout ([4432b39](https://github.com/ArcadeAI/arcade-java/commit/4432b393c3ce20da89bb217f019dbf3221d41d0e)) + ## 0.1.0-alpha.2 (2026-02-28) Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/ArcadeAI/arcade-java/compare/v0.1.0-alpha.1...v0.1.0-alpha.2) diff --git a/README.md b/README.md index ba7b7af..1e76d79 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.2) -[![javadoc](https://javadoc.io/badge2/dev.arcade/arcade-java/0.1.0-alpha.2/javadoc.svg)](https://javadoc.io/doc/dev.arcade/arcade-java/0.1.0-alpha.2) +[![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.3) +[![javadoc](https://javadoc.io/badge2/dev.arcade/arcade-java/0.1.0-alpha.3/javadoc.svg)](https://javadoc.io/doc/dev.arcade/arcade-java/0.1.0-alpha.3) @@ -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.2). +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.3). @@ -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.2") +implementation("dev.arcade:arcade-java:0.1.0-alpha.3") ``` ### Maven @@ -33,7 +33,7 @@ implementation("dev.arcade:arcade-java:0.1.0-alpha.2") dev.arcade arcade-java - 0.1.0-alpha.2 + 0.1.0-alpha.3 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 7316284..33d4c61 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ repositories { allprojects { group = "dev.arcade" - version = "0.1.0-alpha.2" // x-release-please-version + version = "0.1.0-alpha.3" // x-release-please-version } subprojects {