diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 911c623..d11c8fc 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "3.19.3"
+ ".": "3.20.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index ac9e78a..b17eb0a 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 8
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-b969ce378479c79ee64c05127c0ed6c6ce2edbee017ecd037242fb618a5ebc9f.yml
-openapi_spec_hash: a24aabaa5214effb679808b7f2be0ad4
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-dbbff1a35360850898f7d60588e257faeac145a73cfcae634cfeb1b70109b6af.yml
+openapi_spec_hash: 28c4b734a5309067c39bb4c4b709b9ab
config_hash: a962ae71493deb11a1c903256fb25386
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c3ce73..fa437db 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,33 @@
# Changelog
+## 3.20.0 (2026-05-05)
+
+Full Changelog: [v3.19.3...v3.20.0](https://github.com/browserbase/stagehand-java/compare/v3.19.3...v3.20.0)
+
+### Features
+
+* [STG-1798] feat: support Browserbase verified sessions ([59ee151](https://github.com/browserbase/stagehand-java/commit/59ee1516eb17d6b8474b12d2722ff4627fa2557c))
+* Bedrock auth passthrough ([7d5037a](https://github.com/browserbase/stagehand-java/commit/7d5037abacedbee829f0fe238565ed81c211eba9))
+* **client:** more robust error parsing ([c7d063a](https://github.com/browserbase/stagehand-java/commit/c7d063aa513f6b62ca7e95d0031a5018516a114f))
+* Revert "[STG-1573] Add providerOptions for extensible model auth ([#1822](https://github.com/browserbase/stagehand-java/issues/1822))" ([c337e61](https://github.com/browserbase/stagehand-java/commit/c337e61dd9b2cc366bceec0e7119874acdc3b069))
+* support setting headers via env ([ab67768](https://github.com/browserbase/stagehand-java/commit/ab677681d664219c7f006c72b49b723922280a26))
+
+
+### Performance Improvements
+
+* **client:** create one json mapper ([5f27b6b](https://github.com/browserbase/stagehand-java/commit/5f27b6bdce009ea88970dea1ce52cd1d29169c98))
+
+
+### Chores
+
+* remove duplicated dokka setup ([25bb04d](https://github.com/browserbase/stagehand-java/commit/25bb04d02c26e2929adf6b2e1ea0d37b2843880f))
+
+
+### Documentation
+
+* clarify forwards compat behavior ([0463c65](https://github.com/browserbase/stagehand-java/commit/0463c65a44d0b165f9a6f850d0096cb6af207b97))
+* remove bad semicolon ([b3e9df1](https://github.com/browserbase/stagehand-java/commit/b3e9df1d14045e2a4ebc18bb16b75453856e6311))
+
## 3.19.3 (2026-04-03)
Full Changelog: [v3.18.0...v3.19.3](https://github.com/browserbase/stagehand-java/compare/v3.18.0...v3.19.3)
diff --git a/README.md b/README.md
index 7179a61..6d2b56b 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/3.19.3)
-[](https://javadoc.io/doc/com.browserbase.api/stagehand-java/3.19.3)
+[](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/3.20.0)
+[](https://javadoc.io/doc/com.browserbase.api/stagehand-java/3.20.0)
@@ -85,7 +85,7 @@ Most existing browser automation tools either require you to write low-level cod
### Gradle
```kotlin
-implementation("com.browserbase.api:stagehand-java:3.19.3")
+implementation("com.browserbase.api:stagehand-java:3.20.0")
```
### Maven
@@ -94,7 +94,7 @@ implementation("com.browserbase.api:stagehand-java:3.19.3")
com.browserbase.api
stagehand-java
- 3.19.3
+ 3.20.0
```
@@ -259,7 +259,7 @@ import com.browserbase.api.client.StagehandClient;
import com.browserbase.api.client.okhttp.StagehandOkHttpClient;
// Configures using the `stagehand.browserbaseApiKey`, `stagehand.browserbaseProjectId`, `stagehand.modelApiKey` and `stagehand.baseUrl` system properties
-// Or configures using the `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID`, `MODEL_API_KEY` and `STAGEHAND_BASE_URL` environment variables
+// Or configures using the `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID`, `MODEL_API_KEY` and `STAGEHAND_API_URL` environment variables
StagehandClient client = StagehandOkHttpClient.fromEnv();
```
@@ -284,7 +284,7 @@ import com.browserbase.api.client.okhttp.StagehandOkHttpClient;
StagehandClient client = StagehandOkHttpClient.builder()
// Configures using the `stagehand.browserbaseApiKey`, `stagehand.browserbaseProjectId`, `stagehand.modelApiKey` and `stagehand.baseUrl` system properties
- // Or configures using the `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID`, `MODEL_API_KEY` and `STAGEHAND_BASE_URL` environment variables
+ // Or configures using the `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID`, `MODEL_API_KEY` and `STAGEHAND_API_URL` environment variables
.fromEnv()
.browserbaseApiKey("My Browserbase API Key")
.build();
@@ -297,7 +297,7 @@ See this table for the available options:
| `browserbaseApiKey` | `stagehand.browserbaseApiKey` | `BROWSERBASE_API_KEY` | true | - |
| `browserbaseProjectId` | `stagehand.browserbaseProjectId` | `BROWSERBASE_PROJECT_ID` | true | - |
| `modelApiKey` | `stagehand.modelApiKey` | `MODEL_API_KEY` | true | - |
-| `baseUrl` | `stagehand.baseUrl` | `STAGEHAND_BASE_URL` | true | `"https://api.stagehand.browserbase.com"` |
+| `baseUrl` | `stagehand.baseUrl` | `STAGEHAND_API_URL` | true | `"https://api.stagehand.browserbase.com"` |
System properties take precedence over environment variables.
@@ -346,7 +346,7 @@ import com.browserbase.api.models.sessions.SessionActResponse;
import java.util.concurrent.CompletableFuture;
// Configures using the `stagehand.browserbaseApiKey`, `stagehand.browserbaseProjectId`, `stagehand.modelApiKey` and `stagehand.baseUrl` system properties
-// Or configures using the `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID`, `MODEL_API_KEY` and `STAGEHAND_BASE_URL` environment variables
+// Or configures using the `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID`, `MODEL_API_KEY` and `STAGEHAND_API_URL` environment variables
StagehandClient client = StagehandOkHttpClient.fromEnv();
SessionActParams params = SessionActParams.builder()
@@ -366,7 +366,7 @@ import com.browserbase.api.models.sessions.SessionActResponse;
import java.util.concurrent.CompletableFuture;
// Configures using the `stagehand.browserbaseApiKey`, `stagehand.browserbaseProjectId`, `stagehand.modelApiKey` and `stagehand.baseUrl` system properties
-// Or configures using the `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID`, `MODEL_API_KEY` and `STAGEHAND_BASE_URL` environment variables
+// Or configures using the `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID`, `MODEL_API_KEY` and `STAGEHAND_API_URL` environment variables
StagehandClientAsync client = StagehandOkHttpClientAsync.fromEnv();
SessionActParams params = SessionActParams.builder()
@@ -432,7 +432,7 @@ client.async().sessions().actStreaming(params)
.subscribe(chunk -> {
System.out.println(chunk);
})
- .onCompleteFuture();
+ .onCompleteFuture()
.whenComplete((unused, error) -> {
if (error != null) {
System.out.println("Something went wrong!");
@@ -873,7 +873,9 @@ In rare cases, the API may return a response that doesn't match the expected typ
By default, the SDK will not throw an exception in this case. It will throw [`StagehandInvalidDataException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandInvalidDataException.kt) only if you directly access the property.
-If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:
+Validating the response is _not_ forwards compatible with new types from the API for existing fields.
+
+If you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`:
```java
import com.browserbase.api.models.sessions.SessionActResponse;
diff --git a/build.gradle.kts b/build.gradle.kts
index 7d91da7..4602d16 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.browserbase.api"
- version = "3.19.3" // x-release-please-version
+ version = "3.20.0" // x-release-please-version
}
subprojects {
@@ -21,7 +21,6 @@ subprojects {
group = "Verification"
description = "Verifies all source files are formatted."
}
- apply(plugin = "org.jetbrains.dokka")
}
subprojects {
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 2137ec6..b5e471d 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
@@ -230,6 +230,9 @@ class StagehandOkHttpClient private constructor() {
/**
* Whether to call `validate` on every response before returning it.
*
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
diff --git a/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 ffacd17..924c40f 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
@@ -230,6 +230,9 @@ class StagehandOkHttpClientAsync private constructor() {
/**
* Whether to call `validate` on every response before returning it.
*
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt
index ac6a5ef..0514abf 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt
@@ -80,6 +80,9 @@ private constructor(
/**
* Whether to call `validate` on every response before returning it.
*
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
@@ -270,6 +273,9 @@ private constructor(
/**
* Whether to call `validate` on every response before returning it.
*
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
@@ -416,23 +422,33 @@ private constructor(
* |`browserbaseApiKey` |`stagehand.browserbaseApiKey` |`BROWSERBASE_API_KEY` |true |- |
* |`browserbaseProjectId`|`stagehand.browserbaseProjectId`|`BROWSERBASE_PROJECT_ID`|true |- |
* |`modelApiKey` |`stagehand.modelApiKey` |`MODEL_API_KEY` |true |- |
- * |`baseUrl` |`stagehand.baseUrl` |`STAGEHAND_BASE_URL` |true |`"https://api.stagehand.browserbase.com"`|
+ * |`baseUrl` |`stagehand.baseUrl` |`STAGEHAND_API_URL` |true |`"https://api.stagehand.browserbase.com"`|
*
* System properties take precedence over environment variables.
*/
- fun fromEnv() = apply {
- (System.getProperty("stagehand.baseUrl") ?: System.getenv("STAGEHAND_BASE_URL"))?.let {
- baseUrl(it)
- }
- (System.getProperty("stagehand.browserbaseApiKey")
- ?: System.getenv("BROWSERBASE_API_KEY"))
+ fun fromEnv() = fromEnv(System::getenv)
+
+ internal fun fromEnv(getEnv: (String) -> String?) = apply {
+ (System.getProperty("stagehand.baseUrl")
+ ?: getEnv("STAGEHAND_API_URL")
+ ?: getEnv("STAGEHAND_BASE_URL"))
+ ?.let { baseUrl(it) }
+ (System.getProperty("stagehand.browserbaseApiKey") ?: getEnv("BROWSERBASE_API_KEY"))
?.let { browserbaseApiKey(it) }
(System.getProperty("stagehand.browserbaseProjectId")
- ?: System.getenv("BROWSERBASE_PROJECT_ID"))
+ ?: getEnv("BROWSERBASE_PROJECT_ID"))
?.let { browserbaseProjectId(it) }
- (System.getProperty("stagehand.modelApiKey") ?: System.getenv("MODEL_API_KEY"))?.let {
+ (System.getProperty("stagehand.modelApiKey") ?: getEnv("MODEL_API_KEY"))?.let {
modelApiKey(it)
}
+ getEnv("STAGEHAND_CUSTOM_HEADERS")?.let { customHeadersEnv ->
+ for (line in customHeadersEnv.split("\n")) {
+ val colon = line.indexOf(':')
+ if (colon >= 0) {
+ putHeader(line.substring(0, colon).trim(), line.substring(colon + 1).trim())
+ }
+ }
+ }
}
/**
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ObjectMappers.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ObjectMappers.kt
index 5200d47..65b7e72 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ObjectMappers.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ObjectMappers.kt
@@ -29,7 +29,9 @@ import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoField
-fun jsonMapper(): JsonMapper =
+fun jsonMapper(): JsonMapper = JSON_MAPPER
+
+private val JSON_MAPPER: JsonMapper =
JsonMapper.builder()
.addModule(kotlinModule())
.addModule(Jdk8Module())
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/RequestOptions.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/RequestOptions.kt
index 9674a09..795cdd5 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/RequestOptions.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/RequestOptions.kt
@@ -33,6 +33,15 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t
private var responseValidation: Boolean? = null
private var timeout: Timeout? = null
+ /**
+ * Whether to call `validate` on the response before returning it.
+ *
+ * Setting this to `true` is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * Defaults to false, which means the shape of the response will not be validated upfront.
+ * Instead, validation will only occur for the parts of the response that are accessed.
+ */
fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
}
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/BadRequestException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/BadRequestException.kt
index c56095d..3f21e7c 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/BadRequestException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/BadRequestException.kt
@@ -5,12 +5,16 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
class BadRequestException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- StagehandServiceException("400: $body", cause) {
+ StagehandServiceException(
+ "400: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = 400
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt
index c2b0d58..1f782c0 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt
@@ -5,6 +5,7 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
@@ -14,7 +15,11 @@ private constructor(
private val headers: Headers,
private val body: JsonValue,
cause: Throwable?,
-) : StagehandServiceException("$statusCode: $body", cause) {
+) :
+ StagehandServiceException(
+ "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = statusCode
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/NotFoundException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/NotFoundException.kt
index b8dcbd2..b3e3f6f 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/NotFoundException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/NotFoundException.kt
@@ -5,12 +5,16 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
class NotFoundException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- StagehandServiceException("404: $body", cause) {
+ StagehandServiceException(
+ "404: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = 404
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/PermissionDeniedException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/PermissionDeniedException.kt
index 4c37a8a..79c4ddb 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/PermissionDeniedException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/PermissionDeniedException.kt
@@ -5,12 +5,16 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
class PermissionDeniedException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- StagehandServiceException("403: $body", cause) {
+ StagehandServiceException(
+ "403: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = 403
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/RateLimitException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/RateLimitException.kt
index b72ef4f..34c3d23 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/RateLimitException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/RateLimitException.kt
@@ -5,12 +5,16 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
class RateLimitException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- StagehandServiceException("429: $body", cause) {
+ StagehandServiceException(
+ "429: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = 429
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/SseException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/SseException.kt
index 0dfdd2f..8c902f5 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/SseException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/SseException.kt
@@ -5,6 +5,7 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
@@ -14,7 +15,11 @@ private constructor(
private val headers: Headers,
private val body: JsonValue,
cause: Throwable?,
-) : StagehandServiceException("$statusCode: $body", cause) {
+) :
+ StagehandServiceException(
+ "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = statusCode
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnauthorizedException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnauthorizedException.kt
index 23ed90e..37597f5 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnauthorizedException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnauthorizedException.kt
@@ -5,12 +5,16 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
class UnauthorizedException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- StagehandServiceException("401: $body", cause) {
+ StagehandServiceException(
+ "401: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = 401
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt
index c375faa..e013e77 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt
@@ -5,6 +5,7 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
@@ -14,7 +15,11 @@ private constructor(
private val headers: Headers,
private val body: JsonValue,
cause: Throwable?,
-) : StagehandServiceException("$statusCode: $body", cause) {
+) :
+ StagehandServiceException(
+ "$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = statusCode
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnprocessableEntityException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnprocessableEntityException.kt
index a162609..233efac 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnprocessableEntityException.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnprocessableEntityException.kt
@@ -5,12 +5,16 @@ package com.browserbase.api.errors
import com.browserbase.api.core.JsonValue
import com.browserbase.api.core.checkRequired
import com.browserbase.api.core.http.Headers
+import com.browserbase.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
class UnprocessableEntityException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- StagehandServiceException("422: $body", cause) {
+ StagehandServiceException(
+ "422: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
+ cause,
+ ) {
override fun statusCode(): Int = 422
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/Action.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/Action.kt
index 2ce760b..a77aa3d 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/Action.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/Action.kt
@@ -288,6 +288,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Action = apply {
if (validated) {
return@apply
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 4e46131..b20ac9d 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
@@ -260,6 +260,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ModelConfig = apply {
if (validated) {
return@apply
@@ -353,6 +361,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Headers = apply {
if (validated) {
return@apply
@@ -502,6 +519,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Provider = apply {
if (validated) {
return@apply
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 6d92b39..a72cbeb 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
@@ -543,6 +543,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
@@ -622,6 +631,35 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of
+ * the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = input.accept(new Input.Visitor>() {
+ * @Override
+ * public Optional visitString(String string) {
+ * return Optional.of(string.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in [visitor]
+ * and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
string != null -> visitor.visitString(string)
@@ -631,6 +669,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Input = apply {
if (validated) {
return@apply
@@ -945,6 +992,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Options = apply {
if (validated) {
return@apply
@@ -1000,6 +1056,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = model.accept(new Model.Visitor>() {
+ * @Override
+ * public Optional visitConfig(ModelConfig config) {
+ * return Optional.of(config.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
config != null -> visitor.visitConfig(config)
@@ -1009,6 +1095,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Model = apply {
if (validated) {
return@apply
@@ -1213,6 +1309,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Variables = apply {
if (validated) {
return@apply
@@ -1370,6 +1476,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): XStreamResponse = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActResponse.kt
index 62bec51..90bf268 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActResponse.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActResponse.kt
@@ -164,6 +164,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): SessionActResponse = apply {
if (validated) {
return@apply
@@ -332,6 +340,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -616,6 +633,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Result = apply {
if (validated) {
return@apply
@@ -943,6 +970,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Action = apply {
if (validated) {
return@apply
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 cf9a245..ff13fdc 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
@@ -331,6 +331,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): XStreamResponse = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndResponse.kt
index 3a886e7..d3f370f 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndResponse.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndResponse.kt
@@ -130,6 +130,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): SessionEndResponse = apply {
if (validated) {
return@apply
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 f68232a..c850bce 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
@@ -616,6 +616,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
@@ -973,6 +982,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): AgentConfig = apply {
if (validated) {
return@apply
@@ -1038,6 +1056,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = executionModel.accept(new ExecutionModel.Visitor>() {
+ * @Override
+ * public Optional visitModelConfig(ModelConfig modelConfig) {
+ * return Optional.of(modelConfig.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
modelConfig != null -> visitor.visitModelConfig(modelConfig)
@@ -1047,6 +1095,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): ExecutionModel = apply {
if (validated) {
return@apply
@@ -1288,6 +1346,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Mode = apply {
if (validated) {
return@apply
@@ -1350,6 +1418,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = model.accept(new Model.Visitor>() {
+ * @Override
+ * public Optional visitConfig(ModelConfig config) {
+ * return Optional.of(config.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
config != null -> visitor.visitConfig(config)
@@ -1359,6 +1457,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Model = apply {
if (validated) {
return@apply
@@ -1609,6 +1717,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Provider = apply {
if (validated) {
return@apply
@@ -1948,6 +2066,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): ExecuteOptions = apply {
if (validated) {
return@apply
@@ -2108,6 +2235,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): XStreamResponse = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteResponse.kt
index 9b16655..c2837fc 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteResponse.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteResponse.kt
@@ -164,6 +164,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): SessionExecuteResponse = apply {
if (validated) {
return@apply
@@ -339,6 +347,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -680,6 +697,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Result = apply {
if (validated) {
return@apply
@@ -1095,6 +1122,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Action = apply {
if (validated) {
return@apply
@@ -1234,6 +1271,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Metadata = apply {
if (validated) {
return@apply
@@ -1564,6 +1611,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Usage = apply {
if (validated) {
return@apply
@@ -1807,6 +1864,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): CacheEntry = apply {
if (validated) {
return@apply
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 d732dbe..2e7574c 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
@@ -564,6 +564,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
@@ -789,6 +798,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Options = apply {
if (validated) {
return@apply
@@ -844,6 +862,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = model.accept(new Model.Visitor>() {
+ * @Override
+ * public Optional visitConfig(ModelConfig config) {
+ * return Optional.of(config.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
config != null -> visitor.visitConfig(config)
@@ -853,6 +901,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Model = apply {
if (validated) {
return@apply
@@ -1073,6 +1131,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Schema = apply {
if (validated) {
return@apply
@@ -1208,6 +1275,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): XStreamResponse = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractResponse.kt
index 306abcd..e029256 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractResponse.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractResponse.kt
@@ -162,6 +162,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): SessionExtractResponse = apply {
if (validated) {
return@apply
@@ -319,6 +327,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
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 d848600..7abd8a2 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
@@ -589,6 +589,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
@@ -810,6 +819,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Options = apply {
if (validated) {
return@apply
@@ -941,6 +959,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): WaitUntil = apply {
if (validated) {
return@apply
@@ -1095,6 +1123,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): XStreamResponse = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponse.kt
index 1f6e688..a4ccaa6 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponse.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponse.kt
@@ -162,6 +162,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): SessionNavigateResponse = apply {
if (validated) {
return@apply
@@ -319,6 +327,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
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 d18eb4a..8331e8b 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
@@ -508,6 +508,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
@@ -771,6 +780,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Options = apply {
if (validated) {
return@apply
@@ -828,6 +846,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = model.accept(new Model.Visitor>() {
+ * @Override
+ * public Optional visitConfig(ModelConfig config) {
+ * return Optional.of(config.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
config != null -> visitor.visitConfig(config)
@@ -837,6 +885,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Model = apply {
if (validated) {
return@apply
@@ -1042,6 +1100,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Variables = apply {
if (validated) {
return@apply
@@ -1200,6 +1268,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): XStreamResponse = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveResponse.kt
index 9c1c551..c28a2b3 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveResponse.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveResponse.kt
@@ -164,6 +164,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): SessionObserveResponse = apply {
if (validated) {
return@apply
@@ -352,6 +360,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -670,6 +687,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Result = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionReplayParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionReplayParams.kt
index 093a776..2d25194 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionReplayParams.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionReplayParams.kt
@@ -297,6 +297,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): XStreamResponse = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionReplayResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionReplayResponse.kt
index 5ac9a0d..a063510 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionReplayResponse.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionReplayResponse.kt
@@ -164,6 +164,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): SessionReplayResponse = apply {
if (validated) {
return@apply
@@ -355,6 +363,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -623,6 +640,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Page = apply {
if (validated) {
return@apply
@@ -957,6 +984,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Action = apply {
if (validated) {
return@apply
@@ -1058,6 +1095,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): Parameters = apply {
if (validated) {
return@apply
@@ -1165,6 +1212,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): Result = apply {
if (validated) {
return@apply
@@ -1424,6 +1481,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): TokenUsage = apply {
if (validated) {
return@apply
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 5e09071..d940a91 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
@@ -1080,6 +1080,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Body = apply {
if (validated) {
return@apply
@@ -1336,6 +1345,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Browser = apply {
if (validated) {
return@apply
@@ -2180,6 +2198,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): LaunchOptions = apply {
if (validated) {
return@apply
@@ -2306,6 +2334,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): CdpHeaders = apply {
if (validated) {
return@apply
@@ -2372,6 +2410,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the
+ * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known
+ * to this version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = ignoreDefaultArgs.accept(new IgnoreDefaultArgs.Visitor>() {
+ * @Override
+ * public Optional visitBool(Boolean bool) {
+ * return Optional.of(bool.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
bool != null -> visitor.visitBool(bool)
@@ -2381,6 +2449,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): IgnoreDefaultArgs = apply {
if (validated) {
return@apply
@@ -2746,6 +2824,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Proxy = apply {
if (validated) {
return@apply
@@ -2957,6 +3045,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Viewport = apply {
if (validated) {
return@apply
@@ -3158,6 +3256,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Type = apply {
if (validated) {
return@apply
@@ -3568,6 +3676,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): BrowserbaseSessionCreateParams = apply {
if (validated) {
return@apply
@@ -3614,12 +3731,16 @@ private constructor(
private constructor(
private val advancedStealth: JsonField,
private val blockAds: JsonField,
+ private val captchaImageSelector: JsonField,
+ private val captchaInputSelector: JsonField,
private val context: JsonField,
private val extensionId: JsonField,
private val fingerprint: JsonField,
private val logSession: JsonField,
+ private val os: JsonField,
private val recordSession: JsonField,
private val solveCaptchas: JsonField,
+ private val verified: JsonField,
private val viewport: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -3632,6 +3753,12 @@ private constructor(
@JsonProperty("blockAds")
@ExcludeMissing
blockAds: JsonField = JsonMissing.of(),
+ @JsonProperty("captchaImageSelector")
+ @ExcludeMissing
+ captchaImageSelector: JsonField = JsonMissing.of(),
+ @JsonProperty("captchaInputSelector")
+ @ExcludeMissing
+ captchaInputSelector: JsonField = JsonMissing.of(),
@JsonProperty("context")
@ExcludeMissing
context: JsonField = JsonMissing.of(),
@@ -3644,24 +3771,32 @@ private constructor(
@JsonProperty("logSession")
@ExcludeMissing
logSession: JsonField = JsonMissing.of(),
+ @JsonProperty("os") @ExcludeMissing os: JsonField = JsonMissing.of(),
@JsonProperty("recordSession")
@ExcludeMissing
recordSession: JsonField = JsonMissing.of(),
@JsonProperty("solveCaptchas")
@ExcludeMissing
solveCaptchas: JsonField = JsonMissing.of(),
+ @JsonProperty("verified")
+ @ExcludeMissing
+ verified: JsonField = JsonMissing.of(),
@JsonProperty("viewport")
@ExcludeMissing
viewport: JsonField = JsonMissing.of(),
) : this(
advancedStealth,
blockAds,
+ captchaImageSelector,
+ captchaInputSelector,
context,
extensionId,
fingerprint,
logSession,
+ os,
recordSession,
solveCaptchas,
+ verified,
viewport,
mutableMapOf(),
)
@@ -3679,6 +3814,20 @@ private constructor(
*/
fun blockAds(): Optional = blockAds.getOptional("blockAds")
+ /**
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun captchaImageSelector(): Optional =
+ captchaImageSelector.getOptional("captchaImageSelector")
+
+ /**
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun captchaInputSelector(): Optional =
+ captchaInputSelector.getOptional("captchaInputSelector")
+
/**
* @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
@@ -3703,6 +3852,12 @@ private constructor(
*/
fun logSession(): Optional = logSession.getOptional("logSession")
+ /**
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun os(): Optional = os.getOptional("os")
+
/**
* @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
@@ -3715,6 +3870,12 @@ private constructor(
*/
fun solveCaptchas(): Optional = solveCaptchas.getOptional("solveCaptchas")
+ /**
+ * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun verified(): Optional = verified.getOptional("verified")
+
/**
* @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
@@ -3739,6 +3900,26 @@ private constructor(
*/
@JsonProperty("blockAds") @ExcludeMissing fun _blockAds(): JsonField = blockAds
+ /**
+ * Returns the raw JSON value of [captchaImageSelector].
+ *
+ * Unlike [captchaImageSelector], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("captchaImageSelector")
+ @ExcludeMissing
+ fun _captchaImageSelector(): JsonField = captchaImageSelector
+
+ /**
+ * Returns the raw JSON value of [captchaInputSelector].
+ *
+ * Unlike [captchaInputSelector], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("captchaInputSelector")
+ @ExcludeMissing
+ fun _captchaInputSelector(): JsonField = captchaInputSelector
+
/**
* Returns the raw JSON value of [context].
*
@@ -3776,6 +3957,13 @@ private constructor(
@ExcludeMissing
fun _logSession(): JsonField = logSession
+ /**
+ * Returns the raw JSON value of [os].
+ *
+ * Unlike [os], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("os") @ExcludeMissing fun _os(): JsonField = os
+
/**
* Returns the raw JSON value of [recordSession].
*
@@ -3796,6 +3984,14 @@ private constructor(
@ExcludeMissing
fun _solveCaptchas(): JsonField = solveCaptchas
+ /**
+ * Returns the raw JSON value of [verified].
+ *
+ * Unlike [verified], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("verified") @ExcludeMissing fun _verified(): JsonField = verified
+
/**
* Returns the raw JSON value of [viewport].
*
@@ -3829,12 +4025,16 @@ private constructor(
private var advancedStealth: JsonField = JsonMissing.of()
private var blockAds: JsonField = JsonMissing.of()
+ private var captchaImageSelector: JsonField = JsonMissing.of()
+ private var captchaInputSelector: JsonField = JsonMissing.of()
private var context: JsonField = JsonMissing.of()
private var extensionId: JsonField = JsonMissing.of()
private var fingerprint: JsonField = JsonMissing.of()
private var logSession: JsonField = JsonMissing.of()
+ private var os: JsonField = JsonMissing.of()
private var recordSession: JsonField = JsonMissing.of()
private var solveCaptchas: JsonField = JsonMissing.of()
+ private var verified: JsonField = JsonMissing.of()
private var viewport: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@@ -3842,12 +4042,16 @@ private constructor(
internal fun from(browserSettings: BrowserSettings) = apply {
advancedStealth = browserSettings.advancedStealth
blockAds = browserSettings.blockAds
+ captchaImageSelector = browserSettings.captchaImageSelector
+ captchaInputSelector = browserSettings.captchaInputSelector
context = browserSettings.context
extensionId = browserSettings.extensionId
fingerprint = browserSettings.fingerprint
logSession = browserSettings.logSession
+ os = browserSettings.os
recordSession = browserSettings.recordSession
solveCaptchas = browserSettings.solveCaptchas
+ verified = browserSettings.verified
viewport = browserSettings.viewport
additionalProperties = browserSettings.additionalProperties.toMutableMap()
}
@@ -3877,6 +4081,34 @@ private constructor(
*/
fun blockAds(blockAds: JsonField) = apply { this.blockAds = blockAds }
+ fun captchaImageSelector(captchaImageSelector: String) =
+ captchaImageSelector(JsonField.of(captchaImageSelector))
+
+ /**
+ * Sets [Builder.captchaImageSelector] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.captchaImageSelector] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun captchaImageSelector(captchaImageSelector: JsonField) = apply {
+ this.captchaImageSelector = captchaImageSelector
+ }
+
+ fun captchaInputSelector(captchaInputSelector: String) =
+ captchaInputSelector(JsonField.of(captchaInputSelector))
+
+ /**
+ * Sets [Builder.captchaInputSelector] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.captchaInputSelector] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun captchaInputSelector(captchaInputSelector: JsonField) = apply {
+ this.captchaInputSelector = captchaInputSelector
+ }
+
fun context(context: Context) = context(JsonField.of(context))
/**
@@ -3927,6 +4159,17 @@ private constructor(
this.logSession = logSession
}
+ fun os(os: Os) = os(JsonField.of(os))
+
+ /**
+ * Sets [Builder.os] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.os] with a well-typed [Os] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun os(os: JsonField) = apply { this.os = os }
+
fun recordSession(recordSession: Boolean) =
recordSession(JsonField.of(recordSession))
@@ -3955,6 +4198,17 @@ private constructor(
this.solveCaptchas = solveCaptchas
}
+ fun verified(verified: Boolean) = verified(JsonField.of(verified))
+
+ /**
+ * Sets [Builder.verified] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.verified] with a well-typed [Boolean] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun verified(verified: JsonField) = apply { this.verified = verified }
+
fun viewport(viewport: Viewport) = viewport(JsonField.of(viewport))
/**
@@ -3997,12 +4251,16 @@ private constructor(
BrowserSettings(
advancedStealth,
blockAds,
+ captchaImageSelector,
+ captchaInputSelector,
context,
extensionId,
fingerprint,
logSession,
+ os,
recordSession,
solveCaptchas,
+ verified,
viewport,
additionalProperties.toMutableMap(),
)
@@ -4010,6 +4268,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): BrowserSettings = apply {
if (validated) {
return@apply
@@ -4017,12 +4285,16 @@ private constructor(
advancedStealth()
blockAds()
+ captchaImageSelector()
+ captchaInputSelector()
context().ifPresent { it.validate() }
extensionId()
fingerprint().ifPresent { it.validate() }
logSession()
+ os().ifPresent { it.validate() }
recordSession()
solveCaptchas()
+ verified()
viewport().ifPresent { it.validate() }
validated = true
}
@@ -4045,12 +4317,16 @@ private constructor(
internal fun validity(): Int =
(if (advancedStealth.asKnown().isPresent) 1 else 0) +
(if (blockAds.asKnown().isPresent) 1 else 0) +
+ (if (captchaImageSelector.asKnown().isPresent) 1 else 0) +
+ (if (captchaInputSelector.asKnown().isPresent) 1 else 0) +
(context.asKnown().getOrNull()?.validity() ?: 0) +
(if (extensionId.asKnown().isPresent) 1 else 0) +
(fingerprint.asKnown().getOrNull()?.validity() ?: 0) +
(if (logSession.asKnown().isPresent) 1 else 0) +
+ (os.asKnown().getOrNull()?.validity() ?: 0) +
(if (recordSession.asKnown().isPresent) 1 else 0) +
(if (solveCaptchas.asKnown().isPresent) 1 else 0) +
+ (if (verified.asKnown().isPresent) 1 else 0) +
(viewport.asKnown().getOrNull()?.validity() ?: 0)
class Context
@@ -4204,6 +4480,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Context = apply {
if (validated) {
return@apply
@@ -4599,6 +4885,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Fingerprint = apply {
if (validated) {
return@apply
@@ -4744,6 +5040,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): Browser = apply {
if (validated) {
return@apply
@@ -4878,6 +5184,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): Device = apply {
if (validated) {
return@apply
@@ -5015,6 +5331,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): HttpVersion = apply {
if (validated) {
return@apply
@@ -5172,6 +5498,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): OperatingSystem = apply {
if (validated) {
return@apply
@@ -5429,6 +5765,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): Screen = apply {
if (validated) {
return@apply
@@ -5518,6 +5864,163 @@ private constructor(
"Fingerprint{browsers=$browsers, devices=$devices, httpVersion=$httpVersion, locales=$locales, operatingSystems=$operatingSystems, screen=$screen, additionalProperties=$additionalProperties}"
}
+ class Os @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 WINDOWS = of("windows")
+
+ @JvmField val MAC = of("mac")
+
+ @JvmField val LINUX = of("linux")
+
+ @JvmField val MOBILE = of("mobile")
+
+ @JvmField val TABLET = of("tablet")
+
+ @JvmStatic fun of(value: String) = Os(JsonField.of(value))
+ }
+
+ /** An enum containing [Os]'s known values. */
+ enum class Known {
+ WINDOWS,
+ MAC,
+ LINUX,
+ MOBILE,
+ TABLET,
+ }
+
+ /**
+ * An enum containing [Os]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Os] 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 {
+ WINDOWS,
+ MAC,
+ LINUX,
+ MOBILE,
+ TABLET,
+ /**
+ * An enum member indicating that [Os] 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) {
+ WINDOWS -> Value.WINDOWS
+ MAC -> Value.MAC
+ LINUX -> Value.LINUX
+ MOBILE -> Value.MOBILE
+ TABLET -> Value.TABLET
+ 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) {
+ WINDOWS -> Known.WINDOWS
+ MAC -> Known.MAC
+ LINUX -> Known.LINUX
+ MOBILE -> Known.MOBILE
+ TABLET -> Known.TABLET
+ else -> throw StagehandInvalidDataException("Unknown Os: $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
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
+ fun validate(): Os = 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 Os && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
class Viewport
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
@@ -5651,6 +6154,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Viewport = apply {
if (validated) {
return@apply
@@ -5709,12 +6222,16 @@ private constructor(
return other is BrowserSettings &&
advancedStealth == other.advancedStealth &&
blockAds == other.blockAds &&
+ captchaImageSelector == other.captchaImageSelector &&
+ captchaInputSelector == other.captchaInputSelector &&
context == other.context &&
extensionId == other.extensionId &&
fingerprint == other.fingerprint &&
logSession == other.logSession &&
+ os == other.os &&
recordSession == other.recordSession &&
solveCaptchas == other.solveCaptchas &&
+ verified == other.verified &&
viewport == other.viewport &&
additionalProperties == other.additionalProperties
}
@@ -5723,12 +6240,16 @@ private constructor(
Objects.hash(
advancedStealth,
blockAds,
+ captchaImageSelector,
+ captchaInputSelector,
context,
extensionId,
fingerprint,
logSession,
+ os,
recordSession,
solveCaptchas,
+ verified,
viewport,
additionalProperties,
)
@@ -5737,7 +6258,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "BrowserSettings{advancedStealth=$advancedStealth, blockAds=$blockAds, context=$context, extensionId=$extensionId, fingerprint=$fingerprint, logSession=$logSession, recordSession=$recordSession, solveCaptchas=$solveCaptchas, viewport=$viewport, additionalProperties=$additionalProperties}"
+ "BrowserSettings{advancedStealth=$advancedStealth, blockAds=$blockAds, captchaImageSelector=$captchaImageSelector, captchaInputSelector=$captchaInputSelector, context=$context, extensionId=$extensionId, fingerprint=$fingerprint, logSession=$logSession, os=$os, recordSession=$recordSession, solveCaptchas=$solveCaptchas, verified=$verified, viewport=$viewport, additionalProperties=$additionalProperties}"
}
@JsonDeserialize(using = Proxies.Deserializer::class)
@@ -5765,6 +6286,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API,
+ * unless [visitor] overrides [Visitor.unknown]. To handle variants not known to this
+ * version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = proxies.accept(new Proxies.Visitor>() {
+ * @Override
+ * public Optional visitBool(Boolean bool) {
+ * return Optional.of(bool.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
bool != null -> visitor.visitBool(bool)
@@ -5774,6 +6325,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Proxies = apply {
if (validated) {
return@apply
@@ -5942,6 +6503,36 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given
+ * [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the
+ * API, unless [visitor] overrides [Visitor.unknown]. To handle variants not known
+ * to this version of the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = proxyConfig.accept(new ProxyConfig.Visitor>() {
+ * @Override
+ * public Optional visitBrowserbase(Browserbase browserbase) {
+ * return Optional.of(browserbase.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in
+ * [visitor] and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
browserbase != null -> visitor.visitBrowserbase(browserbase)
@@ -5951,6 +6542,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): ProxyConfig = apply {
if (validated) {
return@apply
@@ -6272,6 +6873,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): Browserbase = apply {
if (validated) {
return@apply
@@ -6503,6 +7114,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their
+ * expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): Geolocation = apply {
if (validated) {
return@apply
@@ -6841,6 +7462,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected
+ * types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for
+ * existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object
+ * doesn't match its expected type.
+ */
fun validate(): External = apply {
if (validated) {
return@apply
@@ -7018,6 +7649,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): Region = apply {
if (validated) {
return@apply
@@ -7117,6 +7758,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): UserMetadata = apply {
if (validated) {
return@apply
@@ -7287,6 +7938,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Verbose = apply {
if (validated) {
return@apply
@@ -7419,6 +8079,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): XStreamResponse = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartResponse.kt
index e342e19..423a237 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartResponse.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartResponse.kt
@@ -162,6 +162,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): SessionStartResponse = apply {
if (validated) {
return@apply
@@ -379,6 +387,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/StreamEvent.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/StreamEvent.kt
index 4584374..3c0b838 100644
--- a/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/StreamEvent.kt
+++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/StreamEvent.kt
@@ -225,6 +225,14 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): StreamEvent = apply {
if (validated) {
return@apply
@@ -282,6 +290,35 @@ private constructor(
fun _json(): Optional = Optional.ofNullable(_json)
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of
+ * the SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.browserbase.api.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = data.accept(new Data.Visitor>() {
+ * @Override
+ * public Optional visitStreamEventSystemDataOutput(StreamEventSystemDataOutput streamEventSystemDataOutput) {
+ * return Optional.of(streamEventSystemDataOutput.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws StagehandInvalidDataException if [Visitor.unknown] is not overridden in [visitor]
+ * and the current variant is unknown.
+ */
fun accept(visitor: Visitor): T =
when {
streamEventSystemDataOutput != null ->
@@ -293,6 +330,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Data = apply {
if (validated) {
return@apply
@@ -627,6 +673,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): StreamEventSystemDataOutput = apply {
if (validated) {
return@apply
@@ -768,6 +824,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't
+ * match its expected type.
+ */
fun validate(): Status = apply {
if (validated) {
return@apply
@@ -982,6 +1048,16 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match
+ * its expected type.
+ */
fun validate(): StreamEventLogDataOutput = apply {
if (validated) {
return@apply
@@ -1127,6 +1203,15 @@ private constructor(
private var validated: Boolean = false
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws StagehandInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
fun validate(): Type = apply {
if (validated) {
return@apply
diff --git a/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ClientOptionsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ClientOptionsTest.kt
index 1bd88a6..8d3e935 100644
--- a/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ClientOptionsTest.kt
+++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ClientOptionsTest.kt
@@ -47,6 +47,40 @@ internal class ClientOptionsTest {
.containsExactly("another My Browserbase API Key")
}
+ @Test
+ fun fromEnv_prefersStagehandApiUrl() {
+ val env =
+ mapOf(
+ "STAGEHAND_API_URL" to "https://example.com/from-api-env",
+ "STAGEHAND_BASE_URL" to "https://example.com/from-base-env",
+ )
+ val clientOptions =
+ ClientOptions.builder()
+ .httpClient(httpClient)
+ .browserbaseApiKey("My Browserbase API Key")
+ .browserbaseProjectId("My Browserbase Project ID")
+ .modelApiKey("My Model API Key")
+ .fromEnv(env::get)
+ .build()
+
+ assertThat(clientOptions.baseUrl()).isEqualTo("https://example.com/from-api-env")
+ }
+
+ @Test
+ fun fromEnv_usesLegacyStagehandBaseUrl() {
+ val env = mapOf("STAGEHAND_BASE_URL" to "https://example.com/from-base-env")
+ val clientOptions =
+ ClientOptions.builder()
+ .httpClient(httpClient)
+ .browserbaseApiKey("My Browserbase API Key")
+ .browserbaseProjectId("My Browserbase Project ID")
+ .modelApiKey("My Model API Key")
+ .fromEnv(env::get)
+ .build()
+
+ assertThat(clientOptions.baseUrl()).isEqualTo("https://example.com/from-base-env")
+ }
+
@Test
fun toBuilder_whenOriginalClientOptionsGarbageCollected_doesNotCloseOriginalClient() {
var clientOptions =
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 7ebe44e..0a8dffc 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
@@ -67,6 +67,8 @@ internal class SessionStartParamsTest {
SessionStartParams.BrowserbaseSessionCreateParams.BrowserSettings.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams.BrowserSettings
.Context
@@ -124,8 +126,13 @@ internal class SessionStartParamsTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams.BrowserSettings.Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams.BrowserSettings
.Viewport
@@ -219,6 +226,8 @@ internal class SessionStartParamsTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -278,8 +287,15 @@ internal class SessionStartParamsTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -387,6 +403,8 @@ internal class SessionStartParamsTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -446,8 +464,15 @@ internal class SessionStartParamsTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -539,6 +564,8 @@ internal class SessionStartParamsTest {
SessionStartParams.BrowserbaseSessionCreateParams.BrowserSettings.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams.BrowserSettings
.Context
@@ -596,8 +623,13 @@ internal class SessionStartParamsTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams.BrowserSettings.Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams.BrowserSettings
.Viewport
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 a3bc8a0..6941c36 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
@@ -136,6 +136,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -200,8 +202,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -322,6 +331,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -386,8 +397,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -508,6 +526,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -572,8 +592,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -694,6 +721,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -758,8 +787,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -880,6 +916,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -944,8 +982,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1066,6 +1111,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1130,8 +1177,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1252,6 +1306,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1316,8 +1372,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1438,6 +1501,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1502,8 +1567,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1624,6 +1696,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1688,8 +1762,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1810,6 +1891,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1874,8 +1957,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -1996,6 +2086,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2060,8 +2152,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2182,6 +2281,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2246,8 +2347,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2368,6 +2476,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2432,8 +2542,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2554,6 +2671,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2618,8 +2737,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2740,6 +2866,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2804,8 +2932,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2926,6 +3061,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -2990,8 +3127,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -3110,6 +3254,8 @@ internal class ErrorHandlingTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -3174,8 +3320,15 @@ internal class ErrorHandlingTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
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 f423bd2..392cc05 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
@@ -104,6 +104,8 @@ internal class ServiceParamsTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -163,8 +165,15 @@ internal class ServiceParamsTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
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 3635e44..a21bd07 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
@@ -640,6 +640,8 @@ internal class SessionServiceAsyncTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -699,8 +701,15 @@ internal class SessionServiceAsyncTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
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 15ae6c4..7923bb5 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
@@ -633,6 +633,8 @@ internal class SessionServiceTest {
.builder()
.advancedStealth(true)
.blockAds(true)
+ .captchaImageSelector("captchaImageSelector")
+ .captchaInputSelector("captchaInputSelector")
.context(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings
@@ -692,8 +694,15 @@ internal class SessionServiceTest {
.build()
)
.logSession(true)
+ .os(
+ SessionStartParams.BrowserbaseSessionCreateParams
+ .BrowserSettings
+ .Os
+ .WINDOWS
+ )
.recordSession(true)
.solveCaptchas(true)
+ .verified(true)
.viewport(
SessionStartParams.BrowserbaseSessionCreateParams
.BrowserSettings