diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7186ff6..e136c7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,9 @@ jobs: build: timeout-minutes: 15 name: build + permissions: + contents: read + id-token: write runs-on: ${{ github.repository == 'stainless-sdks/stagehand-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork @@ -61,6 +64,21 @@ jobs: - name: Build SDK run: ./scripts/build + - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/stagehand-java' + id: github-oidc + uses: actions/github-script@v6 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Build and upload Maven artifacts + if: github.repository == 'stainless-sdks/stagehand-java' + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + PROJECT: stagehand-java + run: ./scripts/upload-artifacts test: timeout-minutes: 15 name: test diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2aca35a..4208b5c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.0" + ".": "0.6.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b120b66..a03dd75 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 7 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-39cd9547d16412cf0568f6ce2ad8d43805dffe65bde830beeff630b903ae3b38.yml -openapi_spec_hash: 9cd7c9fefa686f9711392782d948470f -config_hash: 3c21550e2c94cad4339d3093d794beb0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-419940ce988c43313660d30a5bb5b5c2d89b3b19a0f80fe050331e0f4e8c58d2.yml +openapi_spec_hash: a621ca69697ebba7286cbf9e475c46ad +config_hash: 74111faa0876db6b053526281c444498 diff --git a/CHANGELOG.md b/CHANGELOG.md index 10cbeca..779c1bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.6.0 (2026-01-13) + +Full Changelog: [v0.5.0...v0.6.0](https://github.com/browserbase/stagehand-java/compare/v0.5.0...v0.6.0) + +### Features + +* **client:** allow configuring dispatcher executor service ([b67a0d6](https://github.com/browserbase/stagehand-java/commit/b67a0d62fe7f2e15a73bc033c0a421daf88e6915)) +* Removed requiring x-language and x-sdk-version from openapi spec ([2690cf4](https://github.com/browserbase/stagehand-java/commit/2690cf4d826f3a356f6049a5640fd15bf6e962ee)) +* Using provider/model syntax in modelName examples within openapi spec ([aae3dce](https://github.com/browserbase/stagehand-java/commit/aae3dce8134b19c0bb3d24b848a73dd8a523aaec)) + + +### Chores + +* **internal:** support uploading Maven repo artifacts to stainless package server ([32f6329](https://github.com/browserbase/stagehand-java/commit/32f6329e2ec8e30b1b2f701e9ed2f039e934fd49)) + ## 0.5.0 (2026-01-07) Full Changelog: [v0.4.0...v0.5.0](https://github.com/browserbase/stagehand-java/compare/v0.4.0...v0.5.0) diff --git a/README.md b/README.md index 79c6b2b..d70fc2e 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.browserbase.api/stagehand-java)](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/0.5.0) -[![javadoc](https://javadoc.io/badge2/com.browserbase.api/stagehand-java/0.5.0/javadoc.svg)](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.5.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.browserbase.api/stagehand-java)](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/0.6.0) +[![javadoc](https://javadoc.io/badge2/com.browserbase.api/stagehand-java/0.6.0/javadoc.svg)](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.6.0) @@ -22,7 +22,7 @@ Use the Stagehand MCP Server to enable AI assistants to interact with this API, -The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.5.0). +The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.6.0). @@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.stagehand.dev](https://docs.sta ### Gradle ```kotlin -implementation("com.browserbase.api:stagehand-java:0.5.0") +implementation("com.browserbase.api:stagehand-java:0.6.0") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.browserbase.api:stagehand-java:0.5.0") com.browserbase.api stagehand-java - 0.5.0 + 0.6.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 0db3fe0..4036935 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ repositories { allprojects { group = "com.browserbase.api" - version = "0.5.0" // x-release-please-version + version = "0.6.0" // x-release-please-version } subprojects { diff --git a/buildSrc/src/main/kotlin/stagehand.publish.gradle.kts b/buildSrc/src/main/kotlin/stagehand.publish.gradle.kts index 7b0ce3f..facd8ed 100644 --- a/buildSrc/src/main/kotlin/stagehand.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/stagehand.publish.gradle.kts @@ -39,6 +39,14 @@ configure { } } } + repositories { + if (project.hasProperty("publishLocal")) { + maven { + name = "LocalFileSystem" + url = uri("${rootProject.layout.buildDirectory.get()}/local-maven-repo") + } + } + } } signing { diff --git a/scripts/upload-artifacts b/scripts/upload-artifacts new file mode 100755 index 0000000..729e6f2 --- /dev/null +++ b/scripts/upload-artifacts @@ -0,0 +1,96 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# ANSI Color Codes +GREEN='\033[32m' +RED='\033[31m' +NC='\033[0m' # No Color + +log_error() { + local msg="$1" + local headers="$2" + local body="$3" + echo -e "${RED}${msg}${NC}" + [[ -f "$headers" ]] && echo -e "${RED}Headers:$(cat "$headers")${NC}" + echo -e "${RED}Body: ${body}${NC}" + exit 1 +} + +upload_file() { + local file_name="$1" + local tmp_headers + tmp_headers=$(mktemp) + + if [ -f "$file_name" ]; then + echo -e "${GREEN}Processing file: $file_name${NC}" + pkg_file_name="mvn${file_name#./build/local-maven-repo}" + + # Get signed URL for uploading artifact file + signed_url_response=$(curl -X POST -G "$URL" \ + -sS --retry 5 \ + -D "$tmp_headers" \ + --data-urlencode "filename=$pkg_file_name" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + + # Validate JSON and extract URL + if ! signed_url=$(echo "$signed_url_response" | jq -e -r '.url' 2>/dev/null) || [[ "$signed_url" == "null" ]]; then + log_error "Failed to get valid signed URL" "$tmp_headers" "$signed_url_response" + fi + + # Set content-type based on file extension + local extension="${file_name##*.}" + local content_type + case "$extension" in + jar) content_type="application/java-archive" ;; + md5|sha1|sha256|sha512) content_type="text/plain" ;; + module) content_type="application/json" ;; + pom|xml) content_type="application/xml" ;; + *) content_type="application/octet-stream" ;; + esac + + # Upload file + upload_response=$(curl -v -X PUT \ + --retry 5 \ + -D "$tmp_headers" \ + -H "Content-Type: $content_type" \ + --data-binary "@${file_name}" "$signed_url" 2>&1) + + if ! echo "$upload_response" | grep -q "HTTP/[0-9.]* 200"; then + log_error "Failed upload artifact file" "$tmp_headers" "$upload_response" + fi + + # Insert small throttle to reduce rate limiting risk + sleep 0.1 + fi +} + +walk_tree() { + local current_dir="$1" + + for entry in "$current_dir"/*; do + # Check that entry is valid + [ -e "$entry" ] || [ -h "$entry" ] || continue + + if [ -d "$entry" ]; then + walk_tree "$entry" + else + upload_file "$entry" + fi + done +} + +cd "$(dirname "$0")/.." + +echo "::group::Creating local Maven content" +./gradlew publishMavenPublicationToLocalFileSystemRepository -PpublishLocal +echo "::endgroup::" + +echo "::group::Uploading to pkg.stainless.com" +walk_tree "./build/local-maven-repo" +echo "::endgroup::" + +echo "::group::Generating instructions" +echo "Configure maven or gradle to use the repo located at 'https://pkg.stainless.com/s/${PROJECT}/${SHA}/mvn'" +echo "::endgroup::" diff --git a/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/OkHttpClient.kt b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/OkHttpClient.kt index c03dd12..116714c 100644 --- a/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/OkHttpClient.kt +++ b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/OkHttpClient.kt @@ -15,11 +15,13 @@ import java.net.Proxy import java.time.Duration import java.util.concurrent.CancellationException import java.util.concurrent.CompletableFuture +import java.util.concurrent.ExecutorService import javax.net.ssl.HostnameVerifier import javax.net.ssl.SSLSocketFactory import javax.net.ssl.X509TrustManager import okhttp3.Call import okhttp3.Callback +import okhttp3.Dispatcher import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaType @@ -202,6 +204,7 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien private var timeout: Timeout = Timeout.default() private var proxy: Proxy? = null + private var dispatcherExecutorService: ExecutorService? = null private var sslSocketFactory: SSLSocketFactory? = null private var trustManager: X509TrustManager? = null private var hostnameVerifier: HostnameVerifier? = null @@ -212,6 +215,10 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } + fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply { + this.dispatcherExecutorService = dispatcherExecutorService + } + fun sslSocketFactory(sslSocketFactory: SSLSocketFactory?) = apply { this.sslSocketFactory = sslSocketFactory } @@ -233,6 +240,8 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien .callTimeout(timeout.request()) .proxy(proxy) .apply { + dispatcherExecutorService?.let { dispatcher(Dispatcher(it)) } + val sslSocketFactory = sslSocketFactory val trustManager = trustManager if (sslSocketFactory != null && trustManager != null) { diff --git a/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt index 0588b0d..f5d6ff5 100644 --- a/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt +++ b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt @@ -18,6 +18,7 @@ import java.time.Clock import java.time.Duration import java.util.Optional import java.util.concurrent.Executor +import java.util.concurrent.ExecutorService import javax.net.ssl.HostnameVerifier import javax.net.ssl.SSLSocketFactory import javax.net.ssl.X509TrustManager @@ -46,11 +47,31 @@ class StagehandOkHttpClient private constructor() { class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() + private var dispatcherExecutorService: ExecutorService? = null private var proxy: Proxy? = null private var sslSocketFactory: SSLSocketFactory? = null private var trustManager: X509TrustManager? = null private var hostnameVerifier: HostnameVerifier? = null + /** + * The executor service to use for running HTTP requests. + * + * Defaults to OkHttp's + * [default executor service](https://github.com/square/okhttp/blob/ace792f443b2ffb17974f5c0d1cecdf589309f26/okhttp/src/commonJvmAndroid/kotlin/okhttp3/Dispatcher.kt#L98-L104). + * + * This class takes ownership of the executor service and shuts it down when closed. + */ + fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply { + this.dispatcherExecutorService = dispatcherExecutorService + } + + /** + * Alias for calling [Builder.dispatcherExecutorService] with + * `dispatcherExecutorService.orElse(null)`. + */ + fun dispatcherExecutorService(dispatcherExecutorService: Optional) = + dispatcherExecutorService(dispatcherExecutorService.getOrNull()) + fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */ @@ -320,6 +341,7 @@ class StagehandOkHttpClient private constructor() { OkHttpClient.builder() .timeout(clientOptions.timeout()) .proxy(proxy) + .dispatcherExecutorService(dispatcherExecutorService) .sslSocketFactory(sslSocketFactory) .trustManager(trustManager) .hostnameVerifier(hostnameVerifier) diff --git a/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt index 7f2ea56..9f8bbb7 100644 --- a/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt +++ b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt @@ -18,6 +18,7 @@ import java.time.Clock import java.time.Duration import java.util.Optional import java.util.concurrent.Executor +import java.util.concurrent.ExecutorService import javax.net.ssl.HostnameVerifier import javax.net.ssl.SSLSocketFactory import javax.net.ssl.X509TrustManager @@ -46,11 +47,31 @@ class StagehandOkHttpClientAsync private constructor() { class Builder internal constructor() { private var clientOptions: ClientOptions.Builder = ClientOptions.builder() + private var dispatcherExecutorService: ExecutorService? = null private var proxy: Proxy? = null private var sslSocketFactory: SSLSocketFactory? = null private var trustManager: X509TrustManager? = null private var hostnameVerifier: HostnameVerifier? = null + /** + * The executor service to use for running HTTP requests. + * + * Defaults to OkHttp's + * [default executor service](https://github.com/square/okhttp/blob/ace792f443b2ffb17974f5c0d1cecdf589309f26/okhttp/src/commonJvmAndroid/kotlin/okhttp3/Dispatcher.kt#L98-L104). + * + * This class takes ownership of the executor service and shuts it down when closed. + */ + fun dispatcherExecutorService(dispatcherExecutorService: ExecutorService?) = apply { + this.dispatcherExecutorService = dispatcherExecutorService + } + + /** + * Alias for calling [Builder.dispatcherExecutorService] with + * `dispatcherExecutorService.orElse(null)`. + */ + fun dispatcherExecutorService(dispatcherExecutorService: Optional) = + dispatcherExecutorService(dispatcherExecutorService.getOrNull()) + fun proxy(proxy: Proxy?) = apply { this.proxy = proxy } /** Alias for calling [Builder.proxy] with `proxy.orElse(null)`. */ @@ -320,6 +341,7 @@ class StagehandOkHttpClientAsync private constructor() { OkHttpClient.builder() .timeout(clientOptions.timeout()) .proxy(proxy) + .dispatcherExecutorService(dispatcherExecutorService) .sslSocketFactory(sslSocketFactory) .trustManager(trustManager) .hostnameVerifier(hostnameVerifier) diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt index bfbf0aa..ce0785b 100644 --- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt @@ -243,7 +243,7 @@ private constructor( ) : this(modelName, apiKey, baseUrl, provider, mutableMapOf()) /** - * Model name string without prefix (e.g., 'gpt-5-nano', 'claude-4.5-opus') + * Model name string (e.g., 'openai/gpt-5-nano', 'anthropic/claude-4.5-opus') * * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -345,7 +345,7 @@ private constructor( additionalProperties = modelConfigObject.additionalProperties.toMutableMap() } - /** Model name string without prefix (e.g., 'gpt-5-nano', 'claude-4.5-opus') */ + /** Model name string (e.g., 'openai/gpt-5-nano', 'anthropic/claude-4.5-opus') */ fun modelName(modelName: String) = modelName(JsonField.of(modelName)) /** diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt index a37780c..182931c 100644 --- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt @@ -39,8 +39,6 @@ import kotlin.jvm.optionals.getOrNull class SessionActParams private constructor( private val id: String?, - private val xLanguage: XLanguage?, - private val xSdkVersion: String?, private val xSentAt: OffsetDateTime?, private val xStreamResponse: XStreamResponse?, private val body: Body, @@ -51,12 +49,6 @@ private constructor( /** Unique session identifier */ fun id(): Optional = Optional.ofNullable(id) - /** Client SDK language */ - fun xLanguage(): Optional = Optional.ofNullable(xLanguage) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(): Optional = Optional.ofNullable(xSdkVersion) - /** ISO timestamp when request was sent */ fun xSentAt(): Optional = Optional.ofNullable(xSentAt) @@ -133,8 +125,6 @@ private constructor( class Builder internal constructor() { private var id: String? = null - private var xLanguage: XLanguage? = null - private var xSdkVersion: String? = null private var xSentAt: OffsetDateTime? = null private var xStreamResponse: XStreamResponse? = null private var body: Body.Builder = Body.builder() @@ -144,8 +134,6 @@ private constructor( @JvmSynthetic internal fun from(sessionActParams: SessionActParams) = apply { id = sessionActParams.id - xLanguage = sessionActParams.xLanguage - xSdkVersion = sessionActParams.xSdkVersion xSentAt = sessionActParams.xSentAt xStreamResponse = sessionActParams.xStreamResponse body = sessionActParams.body.toBuilder() @@ -159,18 +147,6 @@ private constructor( /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) - /** Client SDK language */ - fun xLanguage(xLanguage: XLanguage?) = apply { this.xLanguage = xLanguage } - - /** Alias for calling [Builder.xLanguage] with `xLanguage.orElse(null)`. */ - fun xLanguage(xLanguage: Optional) = xLanguage(xLanguage.getOrNull()) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(xSdkVersion: String?) = apply { this.xSdkVersion = xSdkVersion } - - /** Alias for calling [Builder.xSdkVersion] with `xSdkVersion.orElse(null)`. */ - fun xSdkVersion(xSdkVersion: Optional) = xSdkVersion(xSdkVersion.getOrNull()) - /** ISO timestamp when request was sent */ fun xSentAt(xSentAt: OffsetDateTime?) = apply { this.xSentAt = xSentAt } @@ -367,8 +343,6 @@ private constructor( fun build(): SessionActParams = SessionActParams( id, - xLanguage, - xSdkVersion, xSentAt, xStreamResponse, body.build(), @@ -388,8 +362,6 @@ private constructor( override fun _headers(): Headers = Headers.builder() .apply { - xLanguage?.let { put("x-language", it.toString()) } - xSdkVersion?.let { put("x-sdk-version", it) } xSentAt?.let { put("x-sent-at", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } xStreamResponse?.let { put("x-stream-response", it.toString()) } putAll(additionalHeaders) @@ -1142,142 +1114,6 @@ private constructor( "Options{model=$model, timeout=$timeout, variables=$variables, additionalProperties=$additionalProperties}" } - /** Client SDK language */ - class XLanguage @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TYPESCRIPT = of("typescript") - - @JvmField val PYTHON = of("python") - - @JvmField val PLAYGROUND = of("playground") - - @JvmStatic fun of(value: String) = XLanguage(JsonField.of(value)) - } - - /** An enum containing [XLanguage]'s known values. */ - enum class Known { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - } - - /** - * An enum containing [XLanguage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [XLanguage] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - /** - * An enum member indicating that [XLanguage] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TYPESCRIPT -> Value.TYPESCRIPT - PYTHON -> Value.PYTHON - PLAYGROUND -> Value.PLAYGROUND - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws StagehandInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TYPESCRIPT -> Known.TYPESCRIPT - PYTHON -> Known.PYTHON - PLAYGROUND -> Known.PLAYGROUND - else -> throw StagehandInvalidDataException("Unknown XLanguage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws StagehandInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - StagehandInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): XLanguage = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: StagehandInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is XLanguage && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** Whether to stream the response via SSE */ class XStreamResponse @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1417,8 +1253,6 @@ private constructor( return other is SessionActParams && id == other.id && - xLanguage == other.xLanguage && - xSdkVersion == other.xSdkVersion && xSentAt == other.xSentAt && xStreamResponse == other.xStreamResponse && body == other.body && @@ -1427,17 +1261,8 @@ private constructor( } override fun hashCode(): Int = - Objects.hash( - id, - xLanguage, - xSdkVersion, - xSentAt, - xStreamResponse, - body, - additionalHeaders, - additionalQueryParams, - ) + Objects.hash(id, xSentAt, xStreamResponse, body, additionalHeaders, additionalQueryParams) override fun toString() = - "SessionActParams{id=$id, xLanguage=$xLanguage, xSdkVersion=$xSdkVersion, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "SessionActParams{id=$id, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndParams.kt index e10e438..c861cc2 100644 --- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndParams.kt @@ -26,8 +26,6 @@ import kotlin.jvm.optionals.getOrNull class SessionEndParams private constructor( private val id: String?, - private val xLanguage: XLanguage?, - private val xSdkVersion: String?, private val xSentAt: OffsetDateTime?, private val xStreamResponse: XStreamResponse?, private val body: Body, @@ -38,12 +36,6 @@ private constructor( /** Unique session identifier */ fun id(): Optional = Optional.ofNullable(id) - /** Client SDK language */ - fun xLanguage(): Optional = Optional.ofNullable(xLanguage) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(): Optional = Optional.ofNullable(xSdkVersion) - /** ISO timestamp when request was sent */ fun xSentAt(): Optional = Optional.ofNullable(xSentAt) @@ -74,8 +66,6 @@ private constructor( class Builder internal constructor() { private var id: String? = null - private var xLanguage: XLanguage? = null - private var xSdkVersion: String? = null private var xSentAt: OffsetDateTime? = null private var xStreamResponse: XStreamResponse? = null private var body: Body.Builder = Body.builder() @@ -85,8 +75,6 @@ private constructor( @JvmSynthetic internal fun from(sessionEndParams: SessionEndParams) = apply { id = sessionEndParams.id - xLanguage = sessionEndParams.xLanguage - xSdkVersion = sessionEndParams.xSdkVersion xSentAt = sessionEndParams.xSentAt xStreamResponse = sessionEndParams.xStreamResponse body = sessionEndParams.body.toBuilder() @@ -100,18 +88,6 @@ private constructor( /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) - /** Client SDK language */ - fun xLanguage(xLanguage: XLanguage?) = apply { this.xLanguage = xLanguage } - - /** Alias for calling [Builder.xLanguage] with `xLanguage.orElse(null)`. */ - fun xLanguage(xLanguage: Optional) = xLanguage(xLanguage.getOrNull()) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(xSdkVersion: String?) = apply { this.xSdkVersion = xSdkVersion } - - /** Alias for calling [Builder.xSdkVersion] with `xSdkVersion.orElse(null)`. */ - fun xSdkVersion(xSdkVersion: Optional) = xSdkVersion(xSdkVersion.getOrNull()) - /** ISO timestamp when request was sent */ fun xSentAt(xSentAt: OffsetDateTime?) = apply { this.xSentAt = xSentAt } @@ -263,8 +239,6 @@ private constructor( fun build(): SessionEndParams = SessionEndParams( id, - xLanguage, - xSdkVersion, xSentAt, xStreamResponse, body.build(), @@ -284,8 +258,6 @@ private constructor( override fun _headers(): Headers = Headers.builder() .apply { - xLanguage?.let { put("x-language", it.toString()) } - xSdkVersion?.let { put("x-sdk-version", it) } xSentAt?.let { put("x-sent-at", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } xStreamResponse?.let { put("x-stream-response", it.toString()) } putAll(additionalHeaders) @@ -411,142 +383,6 @@ private constructor( "Body{_forceBody=$_forceBody, additionalProperties=$additionalProperties}" } - /** Client SDK language */ - class XLanguage @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TYPESCRIPT = of("typescript") - - @JvmField val PYTHON = of("python") - - @JvmField val PLAYGROUND = of("playground") - - @JvmStatic fun of(value: String) = XLanguage(JsonField.of(value)) - } - - /** An enum containing [XLanguage]'s known values. */ - enum class Known { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - } - - /** - * An enum containing [XLanguage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [XLanguage] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - /** - * An enum member indicating that [XLanguage] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TYPESCRIPT -> Value.TYPESCRIPT - PYTHON -> Value.PYTHON - PLAYGROUND -> Value.PLAYGROUND - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws StagehandInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TYPESCRIPT -> Known.TYPESCRIPT - PYTHON -> Known.PYTHON - PLAYGROUND -> Known.PLAYGROUND - else -> throw StagehandInvalidDataException("Unknown XLanguage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws StagehandInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - StagehandInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): XLanguage = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: StagehandInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is XLanguage && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** Whether to stream the response via SSE */ class XStreamResponse @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -686,8 +522,6 @@ private constructor( return other is SessionEndParams && id == other.id && - xLanguage == other.xLanguage && - xSdkVersion == other.xSdkVersion && xSentAt == other.xSentAt && xStreamResponse == other.xStreamResponse && body == other.body && @@ -696,17 +530,8 @@ private constructor( } override fun hashCode(): Int = - Objects.hash( - id, - xLanguage, - xSdkVersion, - xSentAt, - xStreamResponse, - body, - additionalHeaders, - additionalQueryParams, - ) + Objects.hash(id, xSentAt, xStreamResponse, body, additionalHeaders, additionalQueryParams) override fun toString() = - "SessionEndParams{id=$id, xLanguage=$xLanguage, xSdkVersion=$xSdkVersion, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "SessionEndParams{id=$id, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteParams.kt index 8cb0da8..813b432 100644 --- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteParams.kt @@ -27,8 +27,6 @@ import kotlin.jvm.optionals.getOrNull class SessionExecuteParams private constructor( private val id: String?, - private val xLanguage: XLanguage?, - private val xSdkVersion: String?, private val xSentAt: OffsetDateTime?, private val xStreamResponse: XStreamResponse?, private val body: Body, @@ -39,12 +37,6 @@ private constructor( /** Unique session identifier */ fun id(): Optional = Optional.ofNullable(id) - /** Client SDK language */ - fun xLanguage(): Optional = Optional.ofNullable(xLanguage) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(): Optional = Optional.ofNullable(xSdkVersion) - /** ISO timestamp when request was sent */ fun xSentAt(): Optional = Optional.ofNullable(xSentAt) @@ -120,8 +112,6 @@ private constructor( class Builder internal constructor() { private var id: String? = null - private var xLanguage: XLanguage? = null - private var xSdkVersion: String? = null private var xSentAt: OffsetDateTime? = null private var xStreamResponse: XStreamResponse? = null private var body: Body.Builder = Body.builder() @@ -131,8 +121,6 @@ private constructor( @JvmSynthetic internal fun from(sessionExecuteParams: SessionExecuteParams) = apply { id = sessionExecuteParams.id - xLanguage = sessionExecuteParams.xLanguage - xSdkVersion = sessionExecuteParams.xSdkVersion xSentAt = sessionExecuteParams.xSentAt xStreamResponse = sessionExecuteParams.xStreamResponse body = sessionExecuteParams.body.toBuilder() @@ -146,18 +134,6 @@ private constructor( /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) - /** Client SDK language */ - fun xLanguage(xLanguage: XLanguage?) = apply { this.xLanguage = xLanguage } - - /** Alias for calling [Builder.xLanguage] with `xLanguage.orElse(null)`. */ - fun xLanguage(xLanguage: Optional) = xLanguage(xLanguage.getOrNull()) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(xSdkVersion: String?) = apply { this.xSdkVersion = xSdkVersion } - - /** Alias for calling [Builder.xSdkVersion] with `xSdkVersion.orElse(null)`. */ - fun xSdkVersion(xSdkVersion: Optional) = xSdkVersion(xSdkVersion.getOrNull()) - /** ISO timestamp when request was sent */ fun xSentAt(xSentAt: OffsetDateTime?) = apply { this.xSentAt = xSentAt } @@ -356,8 +332,6 @@ private constructor( fun build(): SessionExecuteParams = SessionExecuteParams( id, - xLanguage, - xSdkVersion, xSentAt, xStreamResponse, body.build(), @@ -377,8 +351,6 @@ private constructor( override fun _headers(): Headers = Headers.builder() .apply { - xLanguage?.let { put("x-language", it.toString()) } - xSdkVersion?.let { put("x-sdk-version", it) } xSentAt?.let { put("x-sent-at", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } xStreamResponse?.let { put("x-stream-response", it.toString()) } putAll(additionalHeaders) @@ -1290,142 +1262,6 @@ private constructor( "ExecuteOptions{instruction=$instruction, highlightCursor=$highlightCursor, maxSteps=$maxSteps, additionalProperties=$additionalProperties}" } - /** Client SDK language */ - class XLanguage @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TYPESCRIPT = of("typescript") - - @JvmField val PYTHON = of("python") - - @JvmField val PLAYGROUND = of("playground") - - @JvmStatic fun of(value: String) = XLanguage(JsonField.of(value)) - } - - /** An enum containing [XLanguage]'s known values. */ - enum class Known { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - } - - /** - * An enum containing [XLanguage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [XLanguage] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - /** - * An enum member indicating that [XLanguage] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TYPESCRIPT -> Value.TYPESCRIPT - PYTHON -> Value.PYTHON - PLAYGROUND -> Value.PLAYGROUND - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws StagehandInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TYPESCRIPT -> Known.TYPESCRIPT - PYTHON -> Known.PYTHON - PLAYGROUND -> Known.PLAYGROUND - else -> throw StagehandInvalidDataException("Unknown XLanguage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws StagehandInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - StagehandInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): XLanguage = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: StagehandInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is XLanguage && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** Whether to stream the response via SSE */ class XStreamResponse @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1565,8 +1401,6 @@ private constructor( return other is SessionExecuteParams && id == other.id && - xLanguage == other.xLanguage && - xSdkVersion == other.xSdkVersion && xSentAt == other.xSentAt && xStreamResponse == other.xStreamResponse && body == other.body && @@ -1575,17 +1409,8 @@ private constructor( } override fun hashCode(): Int = - Objects.hash( - id, - xLanguage, - xSdkVersion, - xSentAt, - xStreamResponse, - body, - additionalHeaders, - additionalQueryParams, - ) + Objects.hash(id, xSentAt, xStreamResponse, body, additionalHeaders, additionalQueryParams) override fun toString() = - "SessionExecuteParams{id=$id, xLanguage=$xLanguage, xSdkVersion=$xSdkVersion, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "SessionExecuteParams{id=$id, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractParams.kt index 3a5c4bd..3ef55df 100644 --- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractParams.kt @@ -27,8 +27,6 @@ import kotlin.jvm.optionals.getOrNull class SessionExtractParams private constructor( private val id: String?, - private val xLanguage: XLanguage?, - private val xSdkVersion: String?, private val xSentAt: OffsetDateTime?, private val xStreamResponse: XStreamResponse?, private val body: Body, @@ -39,12 +37,6 @@ private constructor( /** Unique session identifier */ fun id(): Optional = Optional.ofNullable(id) - /** Client SDK language */ - fun xLanguage(): Optional = Optional.ofNullable(xLanguage) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(): Optional = Optional.ofNullable(xSdkVersion) - /** ISO timestamp when request was sent */ fun xSentAt(): Optional = Optional.ofNullable(xSentAt) @@ -131,8 +123,6 @@ private constructor( class Builder internal constructor() { private var id: String? = null - private var xLanguage: XLanguage? = null - private var xSdkVersion: String? = null private var xSentAt: OffsetDateTime? = null private var xStreamResponse: XStreamResponse? = null private var body: Body.Builder = Body.builder() @@ -142,8 +132,6 @@ private constructor( @JvmSynthetic internal fun from(sessionExtractParams: SessionExtractParams) = apply { id = sessionExtractParams.id - xLanguage = sessionExtractParams.xLanguage - xSdkVersion = sessionExtractParams.xSdkVersion xSentAt = sessionExtractParams.xSentAt xStreamResponse = sessionExtractParams.xStreamResponse body = sessionExtractParams.body.toBuilder() @@ -157,18 +145,6 @@ private constructor( /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) - /** Client SDK language */ - fun xLanguage(xLanguage: XLanguage?) = apply { this.xLanguage = xLanguage } - - /** Alias for calling [Builder.xLanguage] with `xLanguage.orElse(null)`. */ - fun xLanguage(xLanguage: Optional) = xLanguage(xLanguage.getOrNull()) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(xSdkVersion: String?) = apply { this.xSdkVersion = xSdkVersion } - - /** Alias for calling [Builder.xSdkVersion] with `xSdkVersion.orElse(null)`. */ - fun xSdkVersion(xSdkVersion: Optional) = xSdkVersion(xSdkVersion.getOrNull()) - /** ISO timestamp when request was sent */ fun xSentAt(xSentAt: OffsetDateTime?) = apply { this.xSentAt = xSentAt } @@ -365,8 +341,6 @@ private constructor( fun build(): SessionExtractParams = SessionExtractParams( id, - xLanguage, - xSdkVersion, xSentAt, xStreamResponse, body.build(), @@ -386,8 +360,6 @@ private constructor( override fun _headers(): Headers = Headers.builder() .apply { - xLanguage?.let { put("x-language", it.toString()) } - xSdkVersion?.let { put("x-sdk-version", it) } xSentAt?.let { put("x-sent-at", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } xStreamResponse?.let { put("x-stream-response", it.toString()) } putAll(additionalHeaders) @@ -976,142 +948,6 @@ private constructor( override fun toString() = "Schema{additionalProperties=$additionalProperties}" } - /** Client SDK language */ - class XLanguage @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TYPESCRIPT = of("typescript") - - @JvmField val PYTHON = of("python") - - @JvmField val PLAYGROUND = of("playground") - - @JvmStatic fun of(value: String) = XLanguage(JsonField.of(value)) - } - - /** An enum containing [XLanguage]'s known values. */ - enum class Known { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - } - - /** - * An enum containing [XLanguage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [XLanguage] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - /** - * An enum member indicating that [XLanguage] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TYPESCRIPT -> Value.TYPESCRIPT - PYTHON -> Value.PYTHON - PLAYGROUND -> Value.PLAYGROUND - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws StagehandInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TYPESCRIPT -> Known.TYPESCRIPT - PYTHON -> Known.PYTHON - PLAYGROUND -> Known.PLAYGROUND - else -> throw StagehandInvalidDataException("Unknown XLanguage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws StagehandInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - StagehandInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): XLanguage = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: StagehandInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is XLanguage && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** Whether to stream the response via SSE */ class XStreamResponse @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1251,8 +1087,6 @@ private constructor( return other is SessionExtractParams && id == other.id && - xLanguage == other.xLanguage && - xSdkVersion == other.xSdkVersion && xSentAt == other.xSentAt && xStreamResponse == other.xStreamResponse && body == other.body && @@ -1261,17 +1095,8 @@ private constructor( } override fun hashCode(): Int = - Objects.hash( - id, - xLanguage, - xSdkVersion, - xSentAt, - xStreamResponse, - body, - additionalHeaders, - additionalQueryParams, - ) + Objects.hash(id, xSentAt, xStreamResponse, body, additionalHeaders, additionalQueryParams) override fun toString() = - "SessionExtractParams{id=$id, xLanguage=$xLanguage, xSdkVersion=$xSdkVersion, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "SessionExtractParams{id=$id, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateParams.kt index 112be92..2d63849 100644 --- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateParams.kt @@ -27,8 +27,6 @@ import kotlin.jvm.optionals.getOrNull class SessionNavigateParams private constructor( private val id: String?, - private val xLanguage: XLanguage?, - private val xSdkVersion: String?, private val xSentAt: OffsetDateTime?, private val xStreamResponse: XStreamResponse?, private val body: Body, @@ -39,12 +37,6 @@ private constructor( /** Unique session identifier */ fun id(): Optional = Optional.ofNullable(id) - /** Client SDK language */ - fun xLanguage(): Optional = Optional.ofNullable(xLanguage) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(): Optional = Optional.ofNullable(xSdkVersion) - /** ISO timestamp when request was sent */ fun xSentAt(): Optional = Optional.ofNullable(xSentAt) @@ -136,8 +128,6 @@ private constructor( class Builder internal constructor() { private var id: String? = null - private var xLanguage: XLanguage? = null - private var xSdkVersion: String? = null private var xSentAt: OffsetDateTime? = null private var xStreamResponse: XStreamResponse? = null private var body: Body.Builder = Body.builder() @@ -147,8 +137,6 @@ private constructor( @JvmSynthetic internal fun from(sessionNavigateParams: SessionNavigateParams) = apply { id = sessionNavigateParams.id - xLanguage = sessionNavigateParams.xLanguage - xSdkVersion = sessionNavigateParams.xSdkVersion xSentAt = sessionNavigateParams.xSentAt xStreamResponse = sessionNavigateParams.xStreamResponse body = sessionNavigateParams.body.toBuilder() @@ -162,18 +150,6 @@ private constructor( /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) - /** Client SDK language */ - fun xLanguage(xLanguage: XLanguage?) = apply { this.xLanguage = xLanguage } - - /** Alias for calling [Builder.xLanguage] with `xLanguage.orElse(null)`. */ - fun xLanguage(xLanguage: Optional) = xLanguage(xLanguage.getOrNull()) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(xSdkVersion: String?) = apply { this.xSdkVersion = xSdkVersion } - - /** Alias for calling [Builder.xSdkVersion] with `xSdkVersion.orElse(null)`. */ - fun xSdkVersion(xSdkVersion: Optional) = xSdkVersion(xSdkVersion.getOrNull()) - /** ISO timestamp when request was sent */ fun xSentAt(xSentAt: OffsetDateTime?) = apply { this.xSentAt = xSentAt } @@ -379,8 +355,6 @@ private constructor( fun build(): SessionNavigateParams = SessionNavigateParams( id, - xLanguage, - xSdkVersion, xSentAt, xStreamResponse, body.build(), @@ -400,8 +374,6 @@ private constructor( override fun _headers(): Headers = Headers.builder() .apply { - xLanguage?.let { put("x-language", it.toString()) } - xSdkVersion?.let { put("x-sdk-version", it) } xSentAt?.let { put("x-sent-at", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } xStreamResponse?.let { put("x-stream-response", it.toString()) } putAll(additionalHeaders) @@ -1039,142 +1011,6 @@ private constructor( "Options{referer=$referer, timeout=$timeout, waitUntil=$waitUntil, additionalProperties=$additionalProperties}" } - /** Client SDK language */ - class XLanguage @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TYPESCRIPT = of("typescript") - - @JvmField val PYTHON = of("python") - - @JvmField val PLAYGROUND = of("playground") - - @JvmStatic fun of(value: String) = XLanguage(JsonField.of(value)) - } - - /** An enum containing [XLanguage]'s known values. */ - enum class Known { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - } - - /** - * An enum containing [XLanguage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [XLanguage] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - /** - * An enum member indicating that [XLanguage] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TYPESCRIPT -> Value.TYPESCRIPT - PYTHON -> Value.PYTHON - PLAYGROUND -> Value.PLAYGROUND - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws StagehandInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TYPESCRIPT -> Known.TYPESCRIPT - PYTHON -> Known.PYTHON - PLAYGROUND -> Known.PLAYGROUND - else -> throw StagehandInvalidDataException("Unknown XLanguage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws StagehandInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - StagehandInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): XLanguage = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: StagehandInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is XLanguage && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** Whether to stream the response via SSE */ class XStreamResponse @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1314,8 +1150,6 @@ private constructor( return other is SessionNavigateParams && id == other.id && - xLanguage == other.xLanguage && - xSdkVersion == other.xSdkVersion && xSentAt == other.xSentAt && xStreamResponse == other.xStreamResponse && body == other.body && @@ -1324,17 +1158,8 @@ private constructor( } override fun hashCode(): Int = - Objects.hash( - id, - xLanguage, - xSdkVersion, - xSentAt, - xStreamResponse, - body, - additionalHeaders, - additionalQueryParams, - ) + Objects.hash(id, xSentAt, xStreamResponse, body, additionalHeaders, additionalQueryParams) override fun toString() = - "SessionNavigateParams{id=$id, xLanguage=$xLanguage, xSdkVersion=$xSdkVersion, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "SessionNavigateParams{id=$id, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveParams.kt index 66c3b91..37efafd 100644 --- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveParams.kt @@ -28,8 +28,6 @@ import kotlin.jvm.optionals.getOrNull class SessionObserveParams private constructor( private val id: String?, - private val xLanguage: XLanguage?, - private val xSdkVersion: String?, private val xSentAt: OffsetDateTime?, private val xStreamResponse: XStreamResponse?, private val body: Body, @@ -40,12 +38,6 @@ private constructor( /** Unique session identifier */ fun id(): Optional = Optional.ofNullable(id) - /** Client SDK language */ - fun xLanguage(): Optional = Optional.ofNullable(xLanguage) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(): Optional = Optional.ofNullable(xSdkVersion) - /** ISO timestamp when request was sent */ fun xSentAt(): Optional = Optional.ofNullable(xSentAt) @@ -117,8 +109,6 @@ private constructor( class Builder internal constructor() { private var id: String? = null - private var xLanguage: XLanguage? = null - private var xSdkVersion: String? = null private var xSentAt: OffsetDateTime? = null private var xStreamResponse: XStreamResponse? = null private var body: Body.Builder = Body.builder() @@ -128,8 +118,6 @@ private constructor( @JvmSynthetic internal fun from(sessionObserveParams: SessionObserveParams) = apply { id = sessionObserveParams.id - xLanguage = sessionObserveParams.xLanguage - xSdkVersion = sessionObserveParams.xSdkVersion xSentAt = sessionObserveParams.xSentAt xStreamResponse = sessionObserveParams.xStreamResponse body = sessionObserveParams.body.toBuilder() @@ -143,18 +131,6 @@ private constructor( /** Alias for calling [Builder.id] with `id.orElse(null)`. */ fun id(id: Optional) = id(id.getOrNull()) - /** Client SDK language */ - fun xLanguage(xLanguage: XLanguage?) = apply { this.xLanguage = xLanguage } - - /** Alias for calling [Builder.xLanguage] with `xLanguage.orElse(null)`. */ - fun xLanguage(xLanguage: Optional) = xLanguage(xLanguage.getOrNull()) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(xSdkVersion: String?) = apply { this.xSdkVersion = xSdkVersion } - - /** Alias for calling [Builder.xSdkVersion] with `xSdkVersion.orElse(null)`. */ - fun xSdkVersion(xSdkVersion: Optional) = xSdkVersion(xSdkVersion.getOrNull()) - /** ISO timestamp when request was sent */ fun xSentAt(xSentAt: OffsetDateTime?) = apply { this.xSentAt = xSentAt } @@ -339,8 +315,6 @@ private constructor( fun build(): SessionObserveParams = SessionObserveParams( id, - xLanguage, - xSdkVersion, xSentAt, xStreamResponse, body.build(), @@ -360,8 +334,6 @@ private constructor( override fun _headers(): Headers = Headers.builder() .apply { - xLanguage?.let { put("x-language", it.toString()) } - xSdkVersion?.let { put("x-sdk-version", it) } xSentAt?.let { put("x-sent-at", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } xStreamResponse?.let { put("x-stream-response", it.toString()) } putAll(additionalHeaders) @@ -816,142 +788,6 @@ private constructor( "Options{model=$model, selector=$selector, timeout=$timeout, additionalProperties=$additionalProperties}" } - /** Client SDK language */ - class XLanguage @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TYPESCRIPT = of("typescript") - - @JvmField val PYTHON = of("python") - - @JvmField val PLAYGROUND = of("playground") - - @JvmStatic fun of(value: String) = XLanguage(JsonField.of(value)) - } - - /** An enum containing [XLanguage]'s known values. */ - enum class Known { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - } - - /** - * An enum containing [XLanguage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [XLanguage] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - /** - * An enum member indicating that [XLanguage] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TYPESCRIPT -> Value.TYPESCRIPT - PYTHON -> Value.PYTHON - PLAYGROUND -> Value.PLAYGROUND - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws StagehandInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TYPESCRIPT -> Known.TYPESCRIPT - PYTHON -> Known.PYTHON - PLAYGROUND -> Known.PLAYGROUND - else -> throw StagehandInvalidDataException("Unknown XLanguage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws StagehandInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - StagehandInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): XLanguage = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: StagehandInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is XLanguage && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** Whether to stream the response via SSE */ class XStreamResponse @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1091,8 +927,6 @@ private constructor( return other is SessionObserveParams && id == other.id && - xLanguage == other.xLanguage && - xSdkVersion == other.xSdkVersion && xSentAt == other.xSentAt && xStreamResponse == other.xStreamResponse && body == other.body && @@ -1101,17 +935,8 @@ private constructor( } override fun hashCode(): Int = - Objects.hash( - id, - xLanguage, - xSdkVersion, - xSentAt, - xStreamResponse, - body, - additionalHeaders, - additionalQueryParams, - ) + Objects.hash(id, xSentAt, xStreamResponse, body, additionalHeaders, additionalQueryParams) override fun toString() = - "SessionObserveParams{id=$id, xLanguage=$xLanguage, xSdkVersion=$xSdkVersion, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "SessionObserveParams{id=$id, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartParams.kt index 3a7009b..2d3ece2 100644 --- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartParams.kt @@ -42,8 +42,6 @@ import kotlin.jvm.optionals.getOrNull */ class SessionStartParams private constructor( - private val xLanguage: XLanguage?, - private val xSdkVersion: String?, private val xSentAt: OffsetDateTime?, private val xStreamResponse: XStreamResponse?, private val body: Body, @@ -51,12 +49,6 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** Client SDK language */ - fun xLanguage(): Optional = Optional.ofNullable(xLanguage) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(): Optional = Optional.ofNullable(xSdkVersion) - /** ISO timestamp when request was sent */ fun xSentAt(): Optional = Optional.ofNullable(xSentAt) @@ -254,8 +246,6 @@ private constructor( /** A builder for [SessionStartParams]. */ class Builder internal constructor() { - private var xLanguage: XLanguage? = null - private var xSdkVersion: String? = null private var xSentAt: OffsetDateTime? = null private var xStreamResponse: XStreamResponse? = null private var body: Body.Builder = Body.builder() @@ -264,8 +254,6 @@ private constructor( @JvmSynthetic internal fun from(sessionStartParams: SessionStartParams) = apply { - xLanguage = sessionStartParams.xLanguage - xSdkVersion = sessionStartParams.xSdkVersion xSentAt = sessionStartParams.xSentAt xStreamResponse = sessionStartParams.xStreamResponse body = sessionStartParams.body.toBuilder() @@ -273,18 +261,6 @@ private constructor( additionalQueryParams = sessionStartParams.additionalQueryParams.toBuilder() } - /** Client SDK language */ - fun xLanguage(xLanguage: XLanguage?) = apply { this.xLanguage = xLanguage } - - /** Alias for calling [Builder.xLanguage] with `xLanguage.orElse(null)`. */ - fun xLanguage(xLanguage: Optional) = xLanguage(xLanguage.getOrNull()) - - /** Version of the Stagehand SDK */ - fun xSdkVersion(xSdkVersion: String?) = apply { this.xSdkVersion = xSdkVersion } - - /** Alias for calling [Builder.xSdkVersion] with `xSdkVersion.orElse(null)`. */ - fun xSdkVersion(xSdkVersion: Optional) = xSdkVersion(xSdkVersion.getOrNull()) - /** ISO timestamp when request was sent */ fun xSentAt(xSentAt: OffsetDateTime?) = apply { this.xSentAt = xSentAt } @@ -594,8 +570,6 @@ private constructor( */ fun build(): SessionStartParams = SessionStartParams( - xLanguage, - xSdkVersion, xSentAt, xStreamResponse, body.build(), @@ -609,8 +583,6 @@ private constructor( override fun _headers(): Headers = Headers.builder() .apply { - xLanguage?.let { put("x-language", it.toString()) } - xSdkVersion?.let { put("x-sdk-version", it) } xSentAt?.let { put("x-sent-at", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } xStreamResponse?.let { put("x-stream-response", it.toString()) } putAll(additionalHeaders) @@ -7190,142 +7162,6 @@ private constructor( override fun toString() = value.toString() } - /** Client SDK language */ - class XLanguage @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val TYPESCRIPT = of("typescript") - - @JvmField val PYTHON = of("python") - - @JvmField val PLAYGROUND = of("playground") - - @JvmStatic fun of(value: String) = XLanguage(JsonField.of(value)) - } - - /** An enum containing [XLanguage]'s known values. */ - enum class Known { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - } - - /** - * An enum containing [XLanguage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [XLanguage] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - TYPESCRIPT, - PYTHON, - PLAYGROUND, - /** - * An enum member indicating that [XLanguage] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - TYPESCRIPT -> Value.TYPESCRIPT - PYTHON -> Value.PYTHON - PLAYGROUND -> Value.PLAYGROUND - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws StagehandInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - TYPESCRIPT -> Known.TYPESCRIPT - PYTHON -> Known.PYTHON - PLAYGROUND -> Known.PLAYGROUND - else -> throw StagehandInvalidDataException("Unknown XLanguage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws StagehandInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - StagehandInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): XLanguage = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: StagehandInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is XLanguage && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - /** Whether to stream the response via SSE */ class XStreamResponse @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -7464,8 +7300,6 @@ private constructor( } return other is SessionStartParams && - xLanguage == other.xLanguage && - xSdkVersion == other.xSdkVersion && xSentAt == other.xSentAt && xStreamResponse == other.xStreamResponse && body == other.body && @@ -7474,16 +7308,8 @@ private constructor( } override fun hashCode(): Int = - Objects.hash( - xLanguage, - xSdkVersion, - xSentAt, - xStreamResponse, - body, - additionalHeaders, - additionalQueryParams, - ) + Objects.hash(xSentAt, xStreamResponse, body, additionalHeaders, additionalQueryParams) override fun toString() = - "SessionStartParams{xLanguage=$xLanguage, xSdkVersion=$xSdkVersion, xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "SessionStartParams{xSentAt=$xSentAt, xStreamResponse=$xStreamResponse, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ModelConfigTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ModelConfigTest.kt index fc5ea48..db47f8d 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ModelConfigTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ModelConfigTest.kt @@ -40,7 +40,7 @@ internal class ModelConfigTest { fun ofModelConfigObject() { val modelConfigObject = ModelConfig.ModelConfigObject.builder() - .modelName("gpt-5-nano") + .modelName("openai/gpt-5-nano") .apiKey("sk-some-openai-api-key") .baseUrl("https://api.openai.com/v1") .provider(ModelConfig.ModelConfigObject.Provider.OPENAI) @@ -58,7 +58,7 @@ internal class ModelConfigTest { val modelConfig = ModelConfig.ofModelConfigObject( ModelConfig.ModelConfigObject.builder() - .modelName("gpt-5-nano") + .modelName("openai/gpt-5-nano") .apiKey("sk-some-openai-api-key") .baseUrl("https://api.openai.com/v1") .provider(ModelConfig.ModelConfigObject.Provider.OPENAI) diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActParamsTest.kt index 9c19cb7..54acc4f 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActParamsTest.kt @@ -14,8 +14,6 @@ internal class SessionActParamsTest { fun create() { SessionActParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionActParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionActParams.XStreamResponse.TRUE) .input("Click the login button") @@ -52,8 +50,6 @@ internal class SessionActParamsTest { val params = SessionActParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionActParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionActParams.XStreamResponse.TRUE) .input("Click the login button") @@ -76,8 +72,6 @@ internal class SessionActParamsTest { assertThat(headers) .isEqualTo( Headers.builder() - .put("x-language", "typescript") - .put("x-sdk-version", "3.0.6") .put("x-sent-at", "2025-01-15T10:30:00Z") .put("x-stream-response", "true") .build() @@ -102,8 +96,6 @@ internal class SessionActParamsTest { val params = SessionActParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionActParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionActParams.XStreamResponse.TRUE) .input("Click the login button") diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndParamsTest.kt index 3150dad..9081b87 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndParamsTest.kt @@ -14,8 +14,6 @@ internal class SessionEndParamsTest { fun create() { SessionEndParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionEndParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionEndParams.XStreamResponse.TRUE) ._forceBody(JsonValue.from(mapOf())) @@ -36,8 +34,6 @@ internal class SessionEndParamsTest { val params = SessionEndParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionEndParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionEndParams.XStreamResponse.TRUE) ._forceBody(JsonValue.from(mapOf())) @@ -48,8 +44,6 @@ internal class SessionEndParamsTest { assertThat(headers) .isEqualTo( Headers.builder() - .put("x-language", "typescript") - .put("x-sdk-version", "3.0.6") .put("x-sent-at", "2025-01-15T10:30:00Z") .put("x-stream-response", "true") .build() @@ -70,8 +64,6 @@ internal class SessionEndParamsTest { val params = SessionEndParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionEndParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionEndParams.XStreamResponse.TRUE) ._forceBody(JsonValue.from(mapOf())) diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteParamsTest.kt index 8869791..2064b33 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteParamsTest.kt @@ -13,8 +13,6 @@ internal class SessionExecuteParamsTest { fun create() { SessionExecuteParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExecuteParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExecuteParams.XStreamResponse.TRUE) .agentConfig( @@ -63,8 +61,6 @@ internal class SessionExecuteParamsTest { val params = SessionExecuteParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExecuteParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExecuteParams.XStreamResponse.TRUE) .agentConfig( @@ -92,8 +88,6 @@ internal class SessionExecuteParamsTest { assertThat(headers) .isEqualTo( Headers.builder() - .put("x-language", "typescript") - .put("x-sdk-version", "3.0.6") .put("x-sent-at", "2025-01-15T10:30:00Z") .put("x-stream-response", "true") .build() @@ -125,8 +119,6 @@ internal class SessionExecuteParamsTest { val params = SessionExecuteParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExecuteParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExecuteParams.XStreamResponse.TRUE) .agentConfig( diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractParamsTest.kt index b8d0a00..54b80a6 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractParamsTest.kt @@ -14,8 +14,6 @@ internal class SessionExtractParamsTest { fun create() { SessionExtractParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExtractParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExtractParams.XStreamResponse.TRUE) .frameId("frameId") @@ -50,8 +48,6 @@ internal class SessionExtractParamsTest { val params = SessionExtractParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExtractParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExtractParams.XStreamResponse.TRUE) .frameId("frameId") @@ -75,8 +71,6 @@ internal class SessionExtractParamsTest { assertThat(headers) .isEqualTo( Headers.builder() - .put("x-language", "typescript") - .put("x-sdk-version", "3.0.6") .put("x-sent-at", "2025-01-15T10:30:00Z") .put("x-stream-response", "true") .build() @@ -98,8 +92,6 @@ internal class SessionExtractParamsTest { val params = SessionExtractParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExtractParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExtractParams.XStreamResponse.TRUE) .frameId("frameId") diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateParamsTest.kt index 169d089..3616da2 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateParamsTest.kt @@ -13,8 +13,6 @@ internal class SessionNavigateParamsTest { fun create() { SessionNavigateParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionNavigateParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionNavigateParams.XStreamResponse.TRUE) .url("https://example.com") @@ -48,8 +46,6 @@ internal class SessionNavigateParamsTest { val params = SessionNavigateParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionNavigateParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionNavigateParams.XStreamResponse.TRUE) .url("https://example.com") @@ -69,8 +65,6 @@ internal class SessionNavigateParamsTest { assertThat(headers) .isEqualTo( Headers.builder() - .put("x-language", "typescript") - .put("x-sdk-version", "3.0.6") .put("x-sent-at", "2025-01-15T10:30:00Z") .put("x-stream-response", "true") .build() @@ -95,8 +89,6 @@ internal class SessionNavigateParamsTest { val params = SessionNavigateParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionNavigateParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionNavigateParams.XStreamResponse.TRUE) .url("https://example.com") diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionObserveParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionObserveParamsTest.kt index db03460..eeb111b 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionObserveParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionObserveParamsTest.kt @@ -13,8 +13,6 @@ internal class SessionObserveParamsTest { fun create() { SessionObserveParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionObserveParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionObserveParams.XStreamResponse.TRUE) .frameId("frameId") @@ -44,8 +42,6 @@ internal class SessionObserveParamsTest { val params = SessionObserveParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionObserveParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionObserveParams.XStreamResponse.TRUE) .frameId("frameId") @@ -64,8 +60,6 @@ internal class SessionObserveParamsTest { assertThat(headers) .isEqualTo( Headers.builder() - .put("x-language", "typescript") - .put("x-sdk-version", "3.0.6") .put("x-sent-at", "2025-01-15T10:30:00Z") .put("x-stream-response", "true") .build() @@ -87,8 +81,6 @@ internal class SessionObserveParamsTest { val params = SessionObserveParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionObserveParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionObserveParams.XStreamResponse.TRUE) .frameId("frameId") diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartParamsTest.kt index 765a962..4e4e0dc 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartParamsTest.kt @@ -13,11 +13,9 @@ internal class SessionStartParamsTest { @Test fun create() { SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -161,11 +159,9 @@ internal class SessionStartParamsTest { fun headers() { val params = SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -313,8 +309,6 @@ internal class SessionStartParamsTest { assertThat(headers) .isEqualTo( Headers.builder() - .put("x-language", "typescript") - .put("x-sdk-version", "3.0.6") .put("x-sent-at", "2025-01-15T10:30:00Z") .put("x-stream-response", "true") .build() @@ -323,7 +317,7 @@ internal class SessionStartParamsTest { @Test fun headersWithoutOptionalFields() { - val params = SessionStartParams.builder().modelName("gpt-4o").build() + val params = SessionStartParams.builder().modelName("openai/gpt-4o").build() val headers = params._headers() @@ -334,11 +328,9 @@ internal class SessionStartParamsTest { fun body() { val params = SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -483,7 +475,7 @@ internal class SessionStartParamsTest { val body = params._body() - assertThat(body.modelName()).isEqualTo("gpt-4o") + assertThat(body.modelName()).isEqualTo("openai/gpt-4o") assertThat(body.actTimeoutMs()).contains(0.0) assertThat(body.browser()) .contains( @@ -626,10 +618,10 @@ internal class SessionStartParamsTest { @Test fun bodyWithoutOptionalFields() { - val params = SessionStartParams.builder().modelName("gpt-4o").build() + val params = SessionStartParams.builder().modelName("openai/gpt-4o").build() val body = params._body() - assertThat(body.modelName()).isEqualTo("gpt-4o") + assertThat(body.modelName()).isEqualTo("openai/gpt-4o") } } diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ErrorHandlingTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ErrorHandlingTest.kt index f704c1a..6dab5ba 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ErrorHandlingTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ErrorHandlingTest.kt @@ -75,11 +75,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -254,11 +252,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -433,11 +429,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -612,11 +606,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -791,11 +783,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -970,11 +960,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -1149,11 +1137,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -1328,11 +1314,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -1507,11 +1491,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -1686,11 +1668,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -1865,11 +1845,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -2044,11 +2022,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -2223,11 +2199,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -2402,11 +2376,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -2581,11 +2553,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -2760,11 +2730,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -2937,11 +2905,9 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ServiceParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ServiceParamsTest.kt index 2243046..33f0206 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ServiceParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ServiceParamsTest.kt @@ -48,11 +48,9 @@ internal class ServiceParamsTest { sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() @@ -216,8 +214,6 @@ internal class ServiceParamsTest { sessionService.act( SessionActParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionActParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionActParams.XStreamResponse.TRUE) .input("Click the login button") diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/async/SessionServiceAsyncTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/async/SessionServiceAsyncTest.kt index 8a517d2..d457ad4 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/async/SessionServiceAsyncTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/async/SessionServiceAsyncTest.kt @@ -36,8 +36,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.act( SessionActParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionActParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionActParams.XStreamResponse.TRUE) .input("Click the login button") @@ -76,8 +74,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.actStreaming( SessionActParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionActParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionActParams.XStreamResponse.TRUE) .input("Click the login button") @@ -117,8 +113,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.end( SessionEndParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionEndParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionEndParams.XStreamResponse.TRUE) ._forceBody(JsonValue.from(mapOf())) @@ -145,8 +139,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.execute( SessionExecuteParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExecuteParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExecuteParams.XStreamResponse.TRUE) .agentConfig( @@ -190,8 +182,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.executeStreaming( SessionExecuteParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExecuteParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExecuteParams.XStreamResponse.TRUE) .agentConfig( @@ -236,8 +226,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.extract( SessionExtractParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExtractParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExtractParams.XStreamResponse.TRUE) .frameId("frameId") @@ -277,8 +265,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.extractStreaming( SessionExtractParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExtractParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExtractParams.XStreamResponse.TRUE) .frameId("frameId") @@ -319,8 +305,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.navigate( SessionNavigateParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionNavigateParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionNavigateParams.XStreamResponse.TRUE) .url("https://example.com") @@ -356,8 +340,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.observe( SessionObserveParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionObserveParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionObserveParams.XStreamResponse.TRUE) .frameId("frameId") @@ -392,8 +374,6 @@ internal class SessionServiceAsyncTest { sessionServiceAsync.observeStreaming( SessionObserveParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionObserveParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionObserveParams.XStreamResponse.TRUE) .frameId("frameId") @@ -428,11 +408,9 @@ internal class SessionServiceAsyncTest { val responseFuture = sessionServiceAsync.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder() diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/blocking/SessionServiceTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/blocking/SessionServiceTest.kt index 1a94b1f..b7d0e6b 100644 --- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/blocking/SessionServiceTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/blocking/SessionServiceTest.kt @@ -36,8 +36,6 @@ internal class SessionServiceTest { sessionService.act( SessionActParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionActParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionActParams.XStreamResponse.TRUE) .input("Click the login button") @@ -75,8 +73,6 @@ internal class SessionServiceTest { sessionService.actStreaming( SessionActParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionActParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionActParams.XStreamResponse.TRUE) .input("Click the login button") @@ -116,8 +112,6 @@ internal class SessionServiceTest { sessionService.end( SessionEndParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionEndParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionEndParams.XStreamResponse.TRUE) ._forceBody(JsonValue.from(mapOf())) @@ -143,8 +137,6 @@ internal class SessionServiceTest { sessionService.execute( SessionExecuteParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExecuteParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExecuteParams.XStreamResponse.TRUE) .agentConfig( @@ -187,8 +179,6 @@ internal class SessionServiceTest { sessionService.executeStreaming( SessionExecuteParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExecuteParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExecuteParams.XStreamResponse.TRUE) .agentConfig( @@ -233,8 +223,6 @@ internal class SessionServiceTest { sessionService.extract( SessionExtractParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExtractParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExtractParams.XStreamResponse.TRUE) .frameId("frameId") @@ -273,8 +261,6 @@ internal class SessionServiceTest { sessionService.extractStreaming( SessionExtractParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionExtractParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionExtractParams.XStreamResponse.TRUE) .frameId("frameId") @@ -315,8 +301,6 @@ internal class SessionServiceTest { sessionService.navigate( SessionNavigateParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionNavigateParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionNavigateParams.XStreamResponse.TRUE) .url("https://example.com") @@ -351,8 +335,6 @@ internal class SessionServiceTest { sessionService.observe( SessionObserveParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionObserveParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionObserveParams.XStreamResponse.TRUE) .frameId("frameId") @@ -386,8 +368,6 @@ internal class SessionServiceTest { sessionService.observeStreaming( SessionObserveParams.builder() .id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123") - .xLanguage(SessionObserveParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionObserveParams.XStreamResponse.TRUE) .frameId("frameId") @@ -422,11 +402,9 @@ internal class SessionServiceTest { val response = sessionService.start( SessionStartParams.builder() - .xLanguage(SessionStartParams.XLanguage.TYPESCRIPT) - .xSdkVersion("3.0.6") .xSentAt(OffsetDateTime.parse("2025-01-15T10:30:00Z")) .xStreamResponse(SessionStartParams.XStreamResponse.TRUE) - .modelName("gpt-4o") + .modelName("openai/gpt-4o") .actTimeoutMs(0.0) .browser( SessionStartParams.Browser.builder()