diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml new file mode 100644 index 0000000..6a27d98 --- /dev/null +++ b/.github/workflows/publish-sonatype.yml @@ -0,0 +1,41 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to Sonatype in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/browserbase/stagehand-java/actions/workflows/publish-sonatype.yml +name: Publish Sonatype +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: | + 8 + 21 + cache: gradle + + - name: Set up Gradle + uses: gradle/gradle-build-action@v2 + + - name: Publish to Sonatype + run: |- + export -- GPG_SIGNING_KEY_ID + printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" + GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" + ./gradlew publish --no-configuration-cache + env: + SONATYPE_USERNAME: ${{ secrets.STAGEHAND_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.STAGEHAND_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} + GPG_SIGNING_KEY: ${{ secrets.STAGEHAND_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }} + GPG_SIGNING_PASSWORD: ${{ secrets.STAGEHAND_SONATYPE_GPG_SIGNING_PASSWORD || secrets.GPG_SIGNING_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 0000000..a6e0235 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,24 @@ +name: Release Doctor +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'browserbase/stagehand-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + SONATYPE_USERNAME: ${{ secrets.STAGEHAND_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.STAGEHAND_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} + GPG_SIGNING_KEY: ${{ secrets.STAGEHAND_SONATYPE_GPG_SIGNING_KEY || secrets.GPG_SIGNING_KEY }} + GPG_SIGNING_PASSWORD: ${{ secrets.STAGEHAND_SONATYPE_GPG_SIGNING_PASSWORD || secrets.GPG_SIGNING_PASSWORD }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..3d2ac0b --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index acffb05..d9fd06e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 7 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-0c12f985340be2a9287e8e01ff8733f7f2d02e019149d1ae95f1a8f8798c6690.yml -openapi_spec_hash: efb79934e1dc63763dd4e8493b825273 -config_hash: 5f3345d1d825e49f896f3b0e493e6938 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-2c88c6d890406ff8a5f1bca692264fb9af4bc4fe64df0986e06d3386fc6d6fcb.yml +openapi_spec_hash: dc6ea17f8152708dc0a390c7f86b1a5d +config_hash: a17b6052ac65237b7b8e145f4f692d3c diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1edbced --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# Changelog + +## 0.1.0 (2025-12-16) + +Full Changelog: [v0.0.1...v0.1.0](https://github.com/browserbase/stagehand-java/compare/v0.0.1...v0.1.0) + +### Features + +* **api:** manual updates ([143d677](https://github.com/browserbase/stagehand-java/commit/143d677a548f9b67f6d1960588d3d79e9c7647fe)) +* **api:** manual updates ([f2d0690](https://github.com/browserbase/stagehand-java/commit/f2d0690f93415cafad61334d8eeb8c90d9ae2e43)) +* **api:** manual updates ([48825ea](https://github.com/browserbase/stagehand-java/commit/48825eac78b9dd280020359253465ec0ab9d7405)) +* **api:** manual updates ([daa8c1c](https://github.com/browserbase/stagehand-java/commit/daa8c1cbe7c3e67400d8661cbd511f47b61de91f)) +* **api:** manual updates ([5d55cd0](https://github.com/browserbase/stagehand-java/commit/5d55cd0023694ed48862fa1737cce1cc67ec6a3f)) +* **api:** manual updates ([2262f19](https://github.com/browserbase/stagehand-java/commit/2262f19462ce4e79f80df49c7652e3144c11c9c6)) +* **api:** manual updates ([afa389f](https://github.com/browserbase/stagehand-java/commit/afa389f483845081daf43d102094e902c847efa5)) +* **api:** manual updates ([5787da6](https://github.com/browserbase/stagehand-java/commit/5787da654a785904d9629e20baa9dc90739a35a5)) +* **api:** manual updates ([40e95ed](https://github.com/browserbase/stagehand-java/commit/40e95ede73876583760706e7315f3621af2f8433)) +* **api:** manual updates ([c6de1b7](https://github.com/browserbase/stagehand-java/commit/c6de1b76dc1deb1355c2e119740d4f494679e1ed)) +* **api:** manual updates ([df9be74](https://github.com/browserbase/stagehand-java/commit/df9be74e9177579935e429d40c1c2574fd7f45e5)) +* **api:** tweak branding and fix some config fields ([051317b](https://github.com/browserbase/stagehand-java/commit/051317bb6932ec86f0a990e181ffdce23c674785)) + + +### Chores + +* configure new SDK language ([7dcaca9](https://github.com/browserbase/stagehand-java/commit/7dcaca9445c9adcf6b88d7fc6393e974dae2b56e)) diff --git a/README.md b/README.md index 02a29e4..54118d3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,44 @@ # Stagehand Java API Library -[![Maven Central](https://img.shields.io/maven-central/v/com.stagehand.api/stagehand-java)](https://central.sonatype.com/artifact/com.stagehand.api/stagehand-java/0.0.1) -[![javadoc](https://javadoc.io/badge2/com.stagehand.api/stagehand-java/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.stagehand.api/stagehand-java/0.0.1) + -The Stagehand Java SDK provides convenient access to the [Stagehand REST API](https://browserbase.com) from applications written in Java. +[![Maven Central](https://img.shields.io/maven-central/v/com.browserbase.api/stagehand-java)](https://central.sonatype.com/artifact/com.browserbase.api/stagehand-java/0.1.0) +[![javadoc](https://javadoc.io/badge2/com.browserbase.api/stagehand-java/0.1.0/javadoc.svg)](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.1.0) + + + +The Stagehand Java SDK provides convenient access to the [Stagehand REST API](https://docs.stagehand.dev) from applications written in Java. It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found on [browserbase.com](https://browserbase.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.stagehand.api/stagehand-java/0.0.1). + + +The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.browserbase.api/stagehand-java/0.1.0). + + ## Installation + + ### Gradle ```kotlin -implementation("com.stagehand.api:stagehand-java:0.0.1") +implementation("com.browserbase.api:stagehand-java:0.1.0") ``` ### Maven ```xml - com.stagehand.api + com.browserbase.api stagehand-java - 0.0.1 + 0.1.0 ``` + + ## Requirements This library requires Java 8 or later. @@ -34,19 +46,20 @@ This library requires Java 8 or later. ## Usage ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; -import com.stagehand.api.models.sessions.SessionStartParams; -import com.stagehand.api.models.sessions.SessionStartResponse; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.models.sessions.SessionActParams; +import com.browserbase.api.models.sessions.SessionActResponse; -// Configures using the `stagehand.apiKey` and `stagehand.baseUrl` system properties -// Or configures using the `STAGEHAND_API_KEY` and `STAGEHAND_BASE_URL` environment variables +// 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 StagehandClient client = StagehandOkHttpClient.fromEnv(); -SessionStartParams params = SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) +SessionActParams params = SessionActParams.builder() + .sessionId("00000000-your-session-id-000000000000") + .input("click the first link on the page") .build(); -SessionStartResponse response = client.sessions().start(params); +SessionActResponse response = client.sessions().act(params); ``` ## Client configuration @@ -54,45 +67,49 @@ SessionStartResponse response = client.sessions().start(params); Configure the client using system properties or environment variables: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; -// Configures using the `stagehand.apiKey` and `stagehand.baseUrl` system properties -// Or configures using the `STAGEHAND_API_KEY` and `STAGEHAND_BASE_URL` environment variables +// 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 StagehandClient client = StagehandOkHttpClient.fromEnv(); ``` Or manually: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; StagehandClient client = StagehandOkHttpClient.builder() - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build(); ``` Or using a combination of the two approaches: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; StagehandClient client = StagehandOkHttpClient.builder() - // Configures using the `stagehand.apiKey` and `stagehand.baseUrl` system properties - // Or configures using the `STAGEHAND_API_KEY` and `STAGEHAND_BASE_URL` environment variables + // 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 .fromEnv() - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") .build(); ``` See this table for the available options: -| Setter | System property | Environment variable | Required | Default value | -| --------- | ------------------- | -------------------- | -------- | ---------------------------- | -| `apiKey` | `stagehand.apiKey` | `STAGEHAND_API_KEY` | false | - | -| `baseUrl` | `stagehand.baseUrl` | `STAGEHAND_BASE_URL` | true | `"http://localhost:3000/v1"` | +| Setter | System property | Environment variable | Required | Default value | +| ---------------------- | -------------------------------- | ------------------------ | -------- | -------------------------------------------- | +| `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/v1"` | System properties take precedence over environment variables. @@ -105,7 +122,7 @@ System properties take precedence over environment variables. To temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service: ```java -import com.stagehand.api.client.StagehandClient; +import com.browserbase.api.client.StagehandClient; StagehandClient clientWithOptions = client.withOptions(optionsBuilder -> { optionsBuilder.baseUrl("https://example.com"); @@ -119,7 +136,7 @@ The `withOptions()` method does not affect the original client or service. To send a request to the Stagehand API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class. -For example, `client.sessions().start(...)` should be called with an instance of `SessionStartParams`, and it will return an instance of `SessionStartResponse`. +For example, `client.sessions().act(...)` should be called with an instance of `SessionActParams`, and it will return an instance of `SessionActResponse`. ## Immutability @@ -134,39 +151,41 @@ Because each class is immutable, builder modification will _never_ affect alread The default client is synchronous. To switch to asynchronous execution, call the `async()` method: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; -import com.stagehand.api.models.sessions.SessionStartParams; -import com.stagehand.api.models.sessions.SessionStartResponse; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.models.sessions.SessionActParams; +import com.browserbase.api.models.sessions.SessionActResponse; import java.util.concurrent.CompletableFuture; -// Configures using the `stagehand.apiKey` and `stagehand.baseUrl` system properties -// Or configures using the `STAGEHAND_API_KEY` and `STAGEHAND_BASE_URL` environment variables +// 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 StagehandClient client = StagehandOkHttpClient.fromEnv(); -SessionStartParams params = SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) +SessionActParams params = SessionActParams.builder() + .sessionId("00000000-your-session-id-000000000000") + .input("click the first link on the page") .build(); -CompletableFuture response = client.async().sessions().start(params); +CompletableFuture response = client.async().sessions().act(params); ``` Or create an asynchronous client from the beginning: ```java -import com.stagehand.api.client.StagehandClientAsync; -import com.stagehand.api.client.okhttp.StagehandOkHttpClientAsync; -import com.stagehand.api.models.sessions.SessionStartParams; -import com.stagehand.api.models.sessions.SessionStartResponse; +import com.browserbase.api.client.StagehandClientAsync; +import com.browserbase.api.client.okhttp.StagehandOkHttpClientAsync; +import com.browserbase.api.models.sessions.SessionActParams; +import com.browserbase.api.models.sessions.SessionActResponse; import java.util.concurrent.CompletableFuture; -// Configures using the `stagehand.apiKey` and `stagehand.baseUrl` system properties -// Or configures using the `STAGEHAND_API_KEY` and `STAGEHAND_BASE_URL` environment variables +// 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 StagehandClientAsync client = StagehandOkHttpClientAsync.fromEnv(); -SessionStartParams params = SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) +SessionActParams params = SessionActParams.builder() + .sessionId("00000000-your-session-id-000000000000") + .input("click the first link on the page") .build(); -CompletableFuture response = client.sessions().start(params); +CompletableFuture response = client.sessions().act(params); ``` The asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s. @@ -178,13 +197,14 @@ The SDK defines methods that deserialize responses into instances of Java classe To access this data, prefix any HTTP method call on a client or service with `withRawResponse()`: ```java -import com.stagehand.api.core.http.Headers; -import com.stagehand.api.core.http.HttpResponseFor; -import com.stagehand.api.models.sessions.SessionStartParams; -import com.stagehand.api.models.sessions.SessionStartResponse; +import com.browserbase.api.core.http.Headers; +import com.browserbase.api.core.http.HttpResponseFor; +import com.browserbase.api.models.sessions.SessionStartParams; +import com.browserbase.api.models.sessions.SessionStartResponse; SessionStartParams params = SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) + .browserbaseApiKey("") + .browserbaseProjectId("") .build(); HttpResponseFor response = client.sessions().withRawResponse().start(params); @@ -195,7 +215,7 @@ Headers headers = response.headers(); You can still deserialize the response into an instance of a Java class if needed: ```java -import com.stagehand.api.models.sessions.SessionStartResponse; +import com.browserbase.api.models.sessions.SessionStartResponse; SessionStartResponse parsedResponse = response.parse(); ``` @@ -204,26 +224,26 @@ SessionStartResponse parsedResponse = response.parse(); The SDK throws custom unchecked exception types: -- [`StagehandServiceException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code: +- [`StagehandServiceException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code: - | Status | Exception | - | ------ | -------------------------------------------------------------------------------------------------------------------------------- | - | 400 | [`BadRequestException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/BadRequestException.kt) | - | 401 | [`UnauthorizedException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnauthorizedException.kt) | - | 403 | [`PermissionDeniedException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/PermissionDeniedException.kt) | - | 404 | [`NotFoundException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/NotFoundException.kt) | - | 422 | [`UnprocessableEntityException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnprocessableEntityException.kt) | - | 429 | [`RateLimitException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/RateLimitException.kt) | - | 5xx | [`InternalServerException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/InternalServerException.kt) | - | others | [`UnexpectedStatusCodeException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnexpectedStatusCodeException.kt) | + | Status | Exception | + | ------ | ---------------------------------------------------------------------------------------------------------------------------------- | + | 400 | [`BadRequestException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/BadRequestException.kt) | + | 401 | [`UnauthorizedException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnauthorizedException.kt) | + | 403 | [`PermissionDeniedException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/PermissionDeniedException.kt) | + | 404 | [`NotFoundException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/NotFoundException.kt) | + | 422 | [`UnprocessableEntityException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnprocessableEntityException.kt) | + | 429 | [`RateLimitException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/RateLimitException.kt) | + | 5xx | [`InternalServerException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt) | + | others | [`UnexpectedStatusCodeException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt) | -- [`StagehandIoException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandIoException.kt): I/O networking errors. +- [`StagehandIoException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandIoException.kt): I/O networking errors. -- [`StagehandRetryableException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandRetryableException.kt): Generic error indicating a failure that could be retried by the client. +- [`StagehandRetryableException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandRetryableException.kt): Generic error indicating a failure that could be retried by the client. -- [`StagehandInvalidDataException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that's supposed to be required, but the API unexpectedly omitted it from the response. +- [`StagehandInvalidDataException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that's supposed to be required, but the API unexpectedly omitted it from the response. -- [`StagehandException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class. +- [`StagehandException`](stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class. ## Logging @@ -253,7 +273,7 @@ The SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON seri The SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config). -If the SDK threw an exception, but you're _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`StagehandOkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClient.kt) or [`StagehandOkHttpClientAsync`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClientAsync.kt). +If the SDK threw an exception, but you're _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`StagehandOkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt) or [`StagehandOkHttpClientAsync`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt). > [!CAUTION] > We make no guarantee that the SDK works correctly when the Jackson version check is disabled. @@ -277,8 +297,8 @@ The API may also explicitly instruct the SDK to retry or not retry a request. To set a custom number of retries, configure the client using the `maxRetries` method: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; StagehandClient client = StagehandOkHttpClient.builder() .fromEnv() @@ -293,7 +313,7 @@ Requests time out after 1 minute by default. To set a custom timeout, configure the method call using the `timeout` method: ```java -import com.stagehand.api.models.sessions.SessionStartResponse; +import com.browserbase.api.models.sessions.SessionStartResponse; SessionStartResponse response = client.sessions().start( params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build() @@ -303,8 +323,8 @@ SessionStartResponse response = client.sessions().start( Or configure the default for all method calls at the client level: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; import java.time.Duration; StagehandClient client = StagehandOkHttpClient.builder() @@ -318,8 +338,8 @@ StagehandClient client = StagehandOkHttpClient.builder() To route requests through a proxy, configure the client using the `proxy` method: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; import java.net.InetSocketAddress; import java.net.Proxy; @@ -342,8 +362,8 @@ StagehandClient client = StagehandOkHttpClient.builder() To configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; StagehandClient client = StagehandOkHttpClient.builder() .fromEnv() @@ -354,20 +374,6 @@ StagehandClient client = StagehandOkHttpClient.builder() .build(); ``` -### Environments - -The SDK sends requests to the production by default. To send requests to a different environment, configure the client like so: - -```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; - -StagehandClient client = StagehandOkHttpClient.builder() - .fromEnv() - .environment1() - .build(); -``` - ### Custom HTTP client The SDK consists of three artifacts: @@ -375,10 +381,10 @@ The SDK consists of three artifacts: - `stagehand-java-core` - Contains core SDK logic - Does not depend on [OkHttp](https://square.github.io/okhttp) - - Exposes [`StagehandClient`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClient.kt), [`StagehandClientAsync`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsync.kt), [`StagehandClientImpl`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientImpl.kt), and [`StagehandClientAsyncImpl`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsyncImpl.kt), all of which can work with any HTTP client + - Exposes [`StagehandClient`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClient.kt), [`StagehandClientAsync`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsync.kt), [`StagehandClientImpl`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientImpl.kt), and [`StagehandClientAsyncImpl`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsyncImpl.kt), all of which can work with any HTTP client - `stagehand-java-client-okhttp` - Depends on [OkHttp](https://square.github.io/okhttp) - - Exposes [`StagehandOkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClient.kt) and [`StagehandOkHttpClientAsync`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClientAsync.kt), which provide a way to construct [`StagehandClientImpl`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientImpl.kt) and [`StagehandClientAsyncImpl`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsyncImpl.kt), respectively, using OkHttp + - Exposes [`StagehandOkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt) and [`StagehandOkHttpClientAsync`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt), which provide a way to construct [`StagehandClientImpl`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientImpl.kt) and [`StagehandClientAsyncImpl`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsyncImpl.kt), respectively, using OkHttp - `stagehand-java` - Depends on and exposes the APIs of both `stagehand-java-core` and `stagehand-java-client-okhttp` - Does not have its own logic @@ -393,16 +399,16 @@ This structure allows replacing the SDK's default HTTP client without pulling in To use a customized `OkHttpClient`: 1. Replace your [`stagehand-java` dependency](#installation) with `stagehand-java-core` -2. Copy `stagehand-java-client-okhttp`'s [`OkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/OkHttpClient.kt) class into your code and customize it -3. Construct [`StagehandClientImpl`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientImpl.kt) or [`StagehandClientAsyncImpl`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsyncImpl.kt), similarly to [`StagehandOkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClient.kt) or [`StagehandOkHttpClientAsync`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClientAsync.kt), using your customized client +2. Copy `stagehand-java-client-okhttp`'s [`OkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/OkHttpClient.kt) class into your code and customize it +3. Construct [`StagehandClientImpl`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientImpl.kt) or [`StagehandClientAsyncImpl`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsyncImpl.kt), similarly to [`StagehandOkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt) or [`StagehandOkHttpClientAsync`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt), using your customized client ### Completely custom HTTP client To use a completely custom HTTP client: 1. Replace your [`stagehand-java` dependency](#installation) with `stagehand-java-core` -2. Write a class that implements the [`HttpClient`](stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpClient.kt) interface -3. Construct [`StagehandClientImpl`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientImpl.kt) or [`StagehandClientAsyncImpl`](stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsyncImpl.kt), similarly to [`StagehandOkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClient.kt) or [`StagehandOkHttpClientAsync`](stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClientAsync.kt), using your new client class +2. Write a class that implements the [`HttpClient`](stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpClient.kt) interface +3. Construct [`StagehandClientImpl`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientImpl.kt) or [`StagehandClientAsyncImpl`](stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsyncImpl.kt), similarly to [`StagehandOkHttpClient`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt) or [`StagehandOkHttpClientAsync`](stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt), using your new client class ## Undocumented API functionality @@ -413,10 +419,10 @@ The SDK is typed for convenient usage of the documented API. However, it also su To set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class: ```java -import com.stagehand.api.core.JsonValue; -import com.stagehand.api.models.sessions.SessionStartParams; +import com.browserbase.api.core.JsonValue; +import com.browserbase.api.models.sessions.SessionActParams; -SessionStartParams params = SessionStartParams.builder() +SessionActParams params = SessionActParams.builder() .putAdditionalHeader("Secret-Header", "42") .putAdditionalQueryParam("secret_query_param", "42") .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) @@ -428,11 +434,11 @@ These can be accessed on the built object later using the `_additionalHeaders()` To set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class: ```java -import com.stagehand.api.core.JsonValue; -import com.stagehand.api.models.sessions.SessionStartParams; +import com.browserbase.api.core.JsonValue; +import com.browserbase.api.models.sessions.SessionActParams; -SessionStartParams params = SessionStartParams.builder() - .localBrowserLaunchOptions(SessionStartParams.LocalBrowserLaunchOptions.builder() +SessionActParams params = SessionActParams.builder() + .options(SessionActParams.Options.builder() .putAdditionalProperty("secretProperty", JsonValue.from("42")) .build()) .build(); @@ -440,21 +446,21 @@ SessionStartParams params = SessionStartParams.builder() These properties can be accessed on the nested built object later using the `_additionalProperties()` method. -To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Values.kt) object to its setter: +To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Values.kt) object to its setter: ```java -import com.stagehand.api.core.JsonValue; -import com.stagehand.api.models.sessions.SessionStartParams; +import com.browserbase.api.core.JsonValue; +import com.browserbase.api.models.sessions.SessionActParams; -SessionStartParams params = SessionStartParams.builder() - .env(JsonValue.from(42)) +SessionActParams params = SessionActParams.builder() + .input(JsonValue.from(42)) .build(); ``` -The most straightforward way to create a [`JsonValue`](stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Values.kt) is using its `from(...)` method: +The most straightforward way to create a [`JsonValue`](stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Values.kt) is using its `from(...)` method: ```java -import com.stagehand.api.core.JsonValue; +import com.browserbase.api.core.JsonValue; import java.util.List; import java.util.Map; @@ -492,14 +498,15 @@ JsonValue complexValue = JsonValue.from(Map.of( Normally a `Builder` class's `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset. -To forcibly omit a required parameter or property, pass [`JsonMissing`](stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Values.kt): +To forcibly omit a required parameter or property, pass [`JsonMissing`](stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Values.kt): ```java -import com.stagehand.api.core.JsonMissing; -import com.stagehand.api.models.sessions.SessionStartParams; +import com.browserbase.api.core.JsonMissing; +import com.browserbase.api.models.sessions.SessionActParams; -SessionStartParams params = SessionStartParams.builder() - .env(JsonMissing.of()) +SessionActParams params = SessionActParams.builder() + .input("click the sign in button") + .sessionId(JsonMissing.of()) .build(); ``` @@ -508,10 +515,10 @@ SessionStartParams params = SessionStartParams.builder() To access undocumented response properties, call the `_additionalProperties()` method: ```java -import com.stagehand.api.core.JsonValue; +import com.browserbase.api.core.JsonValue; import java.util.Map; -Map additionalProperties = client.sessions().start(params)._additionalProperties(); +Map additionalProperties = client.sessions().act(params)._additionalProperties(); JsonValue secretPropertyValue = additionalProperties.get("secretProperty"); String result = secretPropertyValue.accept(new JsonValue.Visitor<>() { @@ -538,23 +545,23 @@ String result = secretPropertyValue.accept(new JsonValue.Visitor<>() { To access a property's raw JSON value, which may be undocumented, call its `_` prefixed method: ```java -import com.stagehand.api.core.JsonField; -import com.stagehand.api.models.sessions.SessionStartParams; +import com.browserbase.api.core.JsonField; +import com.browserbase.api.models.sessions.SessionActParams; import java.util.Optional; -JsonField env = client.sessions().start(params)._env(); +JsonField input = client.sessions().act(params)._input(); -if (env.isMissing()) { +if (input.isMissing()) { // The property is absent from the JSON response -} else if (env.isNull()) { +} else if (input.isNull()) { // The property was set to literal null } else { // Check if value was provided as a string // Other methods include `asNumber()`, `asBoolean()`, etc. - Optional jsonString = env.asString(); + Optional jsonString = input.asString(); // Try to deserialize into a custom type - MyClass myObject = env.asUnknown().orElseThrow().convert(MyClass.class); + MyClass myObject = input.asUnknown().orElseThrow().convert(MyClass.class); } ``` @@ -562,22 +569,22 @@ if (env.isMissing()) { In rare cases, the API may return a response that doesn't match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else. -By default, the SDK will not throw an exception in this case. It will throw [`StagehandInvalidDataException`](stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandInvalidDataException.kt) only if you directly access the property. +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()`: ```java -import com.stagehand.api.models.sessions.SessionStartResponse; +import com.browserbase.api.models.sessions.SessionActResponse; -SessionStartResponse response = client.sessions().start(params).validate(); +SessionActResponse response = client.sessions().act(params).validate(); ``` Or configure the method call to validate the response using the `responseValidation` method: ```java -import com.stagehand.api.models.sessions.SessionStartResponse; +import com.browserbase.api.models.sessions.SessionActResponse; -SessionStartResponse response = client.sessions().start( +SessionActResponse response = client.sessions().act( params, RequestOptions.builder().responseValidation(true).build() ); ``` @@ -585,8 +592,8 @@ SessionStartResponse response = client.sessions().start( Or configure the default for all method calls at the client level: ```java -import com.stagehand.api.client.StagehandClient; -import com.stagehand.api.client.okhttp.StagehandOkHttpClient; +import com.browserbase.api.client.StagehandClient; +import com.browserbase.api.client.okhttp.StagehandOkHttpClient; StagehandClient client = StagehandOkHttpClient.builder() .fromEnv() @@ -632,4 +639,4 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/stagehand-java/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/browserbase/stagehand-java/issues) with questions, bugs, or suggestions. diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..3a6a7b4 --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${SONATYPE_USERNAME}" ]; then + errors+=("The SONATYPE_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +if [ -z "${SONATYPE_PASSWORD}" ]; then + errors+=("The SONATYPE_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +if [ -z "${GPG_SIGNING_KEY}" ]; then + errors+=("The GPG_SIGNING_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +if [ -z "${GPG_SIGNING_PASSWORD}" ]; then + errors+=("The GPG_SIGNING_PASSWORD secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/browserbase-java-example/build.gradle.kts b/browserbase-java-example/build.gradle.kts new file mode 100644 index 0000000..61df3c5 --- /dev/null +++ b/browserbase-java-example/build.gradle.kts @@ -0,0 +1,28 @@ +plugins { + id("browserbase.java") + application +} + +repositories { + mavenCentral() +} + +dependencies { + implementation(project(":browserbase-java")) +} + +tasks.withType().configureEach { + // Allow using more modern APIs, like `List.of` and `Map.of`, in examples. + options.release.set(9) +} + +application { + // Use `./gradlew :browserbase-java-example:run` to run `Main` + // Use `./gradlew :browserbase-java-example:run -Pexample=Something` to run `SomethingExample` + mainClass = "com.stagehand.api.example.${ + if (project.hasProperty("example")) + "${project.property("example")}Example" + else + "Main" + }" +} diff --git a/browserbase-java-lib/.keep b/browserbase-java-lib/.keep new file mode 100644 index 0000000..5e2c99f --- /dev/null +++ b/browserbase-java-lib/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store custom files to expand the SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index cca6e8a..a32fb45 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,8 +8,8 @@ repositories { } allprojects { - group = "com.stagehand.api" - version = "0.0.1" + group = "com.browserbase.api" + version = "0.1.0" // x-release-please-version } subprojects { diff --git a/buildSrc/src/main/kotlin/stagehand.publish.gradle.kts b/buildSrc/src/main/kotlin/stagehand.publish.gradle.kts index df771cd..7b0ce3f 100644 --- a/buildSrc/src/main/kotlin/stagehand.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/stagehand.publish.gradle.kts @@ -9,9 +9,9 @@ configure { from(components["java"]) pom { - name.set("Stagehand P2P Server API") - description.set("HTTP API for remote Stagehand browser automation. This API allows clients to\nconnect to a Stagehand server and execute browser automation tasks remotely.\n\nAll endpoints except /sessions/start require an active session ID. Responses are\nstreamed using Server-Sent Events (SSE) when the `x-stream-response: true`\nheader is provided.") - url.set("https://browserbase.com") + name.set("Stagehand API") + description.set("Stagehand SDK for AI browser automation [ALPHA]. This API allows clients to\nexecute browser automation tasks remotely on the Browserbase cloud.\n\nAll endpoints except /sessions/start require an active session ID. Responses are\nstreamed using Server-Sent Events (SSE) when the `x-stream-response: true`\nheader is provided.\n\nThis SDK is currently ALPHA software and is not production ready! Please try it\nand give us your feedback, stay tuned for upcoming release announcements!") + url.set("https://docs.stagehand.dev") licenses { license { @@ -26,9 +26,9 @@ configure { } scm { - connection.set("scm:git:git://github.com/stainless-sdks/stagehand-java.git") - developerConnection.set("scm:git:git://github.com/stainless-sdks/stagehand-java.git") - url.set("https://github.com/stainless-sdks/stagehand-java") + connection.set("scm:git:git://github.com/browserbase/stagehand-java.git") + developerConnection.set("scm:git:git://github.com/browserbase/stagehand-java.git") + url.set("https://github.com/browserbase/stagehand-java") } versionMapping { diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..8f98719 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "simple", + "extra-files": [ + "README.md", + "build.gradle.kts" + ] +} \ No newline at end of file diff --git a/stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/OkHttpClient.kt b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/OkHttpClient.kt similarity index 92% rename from stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/OkHttpClient.kt rename to stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/OkHttpClient.kt index 7db7941..c03dd12 100644 --- a/stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/OkHttpClient.kt +++ b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/OkHttpClient.kt @@ -1,14 +1,14 @@ -package com.stagehand.api.client.okhttp - -import com.stagehand.api.core.RequestOptions -import com.stagehand.api.core.Timeout -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.HttpClient -import com.stagehand.api.core.http.HttpMethod -import com.stagehand.api.core.http.HttpRequest -import com.stagehand.api.core.http.HttpRequestBody -import com.stagehand.api.core.http.HttpResponse -import com.stagehand.api.errors.StagehandIoException +package com.browserbase.api.client.okhttp + +import com.browserbase.api.core.RequestOptions +import com.browserbase.api.core.Timeout +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.HttpClient +import com.browserbase.api.core.http.HttpMethod +import com.browserbase.api.core.http.HttpRequest +import com.browserbase.api.core.http.HttpRequestBody +import com.browserbase.api.core.http.HttpResponse +import com.browserbase.api.errors.StagehandIoException import java.io.IOException import java.io.InputStream import java.net.Proxy @@ -91,7 +91,11 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien } if (logLevel != null) { clientBuilder.addNetworkInterceptor( - HttpLoggingInterceptor().setLevel(logLevel).apply { redactHeader("Authorization") } + HttpLoggingInterceptor().setLevel(logLevel).apply { + redactHeader("x-bb-api-key") + redactHeader("x-bb-project-id") + redactHeader("x-model-api-key") + } ) } diff --git a/stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClient.kt b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt similarity index 89% rename from stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClient.kt rename to stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt index 4b6805e..8955635 100644 --- a/stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClient.kt +++ b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.client.okhttp - +package com.browserbase.api.client.okhttp + +import com.browserbase.api.client.StagehandClient +import com.browserbase.api.client.StagehandClientImpl +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.core.Sleeper +import com.browserbase.api.core.Timeout +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.HttpClient +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.databind.json.JsonMapper -import com.stagehand.api.client.StagehandClient -import com.stagehand.api.client.StagehandClientImpl -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.core.Sleeper -import com.stagehand.api.core.Timeout -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.HttpClient -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.core.jsonMapper import java.net.Proxy import java.time.Clock import java.time.Duration @@ -116,7 +116,7 @@ class StagehandOkHttpClient private constructor() { /** * The Jackson JSON mapper to use for serializing and deserializing JSON. * - * Defaults to [com.stagehand.api.core.jsonMapper]. The default is usually sufficient and + * Defaults to [com.browserbase.api.core.jsonMapper]. The default is usually sufficient and * rarely needs to be overridden. */ fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } @@ -144,19 +144,13 @@ class StagehandOkHttpClient private constructor() { /** * The base URL to use for every request. * - * Defaults to the production environment: `http://localhost:3000/v1`. - * - * The following other environments, with dedicated builder methods, are available: - * - environment_1: `https://api.stagehand.browserbase.com/v1` + * Defaults to the production environment: `https://api.stagehand.browserbase.com/v1`. */ fun baseUrl(baseUrl: String?) = apply { clientOptions.baseUrl(baseUrl) } /** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */ fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull()) - /** Sets [baseUrl] to `https://api.stagehand.browserbase.com/v1`. */ - fun environment1() = apply { clientOptions.environment1() } - /** * Whether to call `validate` on every response before returning it. * @@ -201,10 +195,18 @@ class StagehandOkHttpClient private constructor() { */ fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } - fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + /** Your [Browserbase API Key](https://www.browserbase.com/settings) */ + fun browserbaseApiKey(browserbaseApiKey: String) = apply { + clientOptions.browserbaseApiKey(browserbaseApiKey) + } + + /** Your [Browserbase Project ID](https://www.browserbase.com/settings) */ + fun browserbaseProjectId(browserbaseProjectId: String) = apply { + clientOptions.browserbaseProjectId(browserbaseProjectId) + } - /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ - fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) + /** Your LLM provider API key (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) */ + fun modelApiKey(modelApiKey: String) = apply { clientOptions.modelApiKey(modelApiKey) } fun headers(headers: Headers) = apply { clientOptions.headers(headers) } diff --git a/stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClientAsync.kt b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt similarity index 89% rename from stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClientAsync.kt rename to stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt index e7a4c24..2cb208d 100644 --- a/stagehand-java-client-okhttp/src/main/kotlin/com/stagehand/api/client/okhttp/StagehandOkHttpClientAsync.kt +++ b/stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.client.okhttp - +package com.browserbase.api.client.okhttp + +import com.browserbase.api.client.StagehandClientAsync +import com.browserbase.api.client.StagehandClientAsyncImpl +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.core.Sleeper +import com.browserbase.api.core.Timeout +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.HttpClient +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.databind.json.JsonMapper -import com.stagehand.api.client.StagehandClientAsync -import com.stagehand.api.client.StagehandClientAsyncImpl -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.core.Sleeper -import com.stagehand.api.core.Timeout -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.HttpClient -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.core.jsonMapper import java.net.Proxy import java.time.Clock import java.time.Duration @@ -116,7 +116,7 @@ class StagehandOkHttpClientAsync private constructor() { /** * The Jackson JSON mapper to use for serializing and deserializing JSON. * - * Defaults to [com.stagehand.api.core.jsonMapper]. The default is usually sufficient and + * Defaults to [com.browserbase.api.core.jsonMapper]. The default is usually sufficient and * rarely needs to be overridden. */ fun jsonMapper(jsonMapper: JsonMapper) = apply { clientOptions.jsonMapper(jsonMapper) } @@ -144,19 +144,13 @@ class StagehandOkHttpClientAsync private constructor() { /** * The base URL to use for every request. * - * Defaults to the production environment: `http://localhost:3000/v1`. - * - * The following other environments, with dedicated builder methods, are available: - * - environment_1: `https://api.stagehand.browserbase.com/v1` + * Defaults to the production environment: `https://api.stagehand.browserbase.com/v1`. */ fun baseUrl(baseUrl: String?) = apply { clientOptions.baseUrl(baseUrl) } /** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */ fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull()) - /** Sets [baseUrl] to `https://api.stagehand.browserbase.com/v1`. */ - fun environment1() = apply { clientOptions.environment1() } - /** * Whether to call `validate` on every response before returning it. * @@ -201,10 +195,18 @@ class StagehandOkHttpClientAsync private constructor() { */ fun maxRetries(maxRetries: Int) = apply { clientOptions.maxRetries(maxRetries) } - fun apiKey(apiKey: String?) = apply { clientOptions.apiKey(apiKey) } + /** Your [Browserbase API Key](https://www.browserbase.com/settings) */ + fun browserbaseApiKey(browserbaseApiKey: String) = apply { + clientOptions.browserbaseApiKey(browserbaseApiKey) + } + + /** Your [Browserbase Project ID](https://www.browserbase.com/settings) */ + fun browserbaseProjectId(browserbaseProjectId: String) = apply { + clientOptions.browserbaseProjectId(browserbaseProjectId) + } - /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ - fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) + /** Your LLM provider API key (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) */ + fun modelApiKey(modelApiKey: String) = apply { clientOptions.modelApiKey(modelApiKey) } fun headers(headers: Headers) = apply { clientOptions.headers(headers) } diff --git a/stagehand-java-client-okhttp/src/test/kotlin/com/stagehand/api/client/okhttp/OkHttpClientTest.kt b/stagehand-java-client-okhttp/src/test/kotlin/com/browserbase/api/client/okhttp/OkHttpClientTest.kt similarity index 90% rename from stagehand-java-client-okhttp/src/test/kotlin/com/stagehand/api/client/okhttp/OkHttpClientTest.kt rename to stagehand-java-client-okhttp/src/test/kotlin/com/browserbase/api/client/okhttp/OkHttpClientTest.kt index 950e323..3a39e9e 100644 --- a/stagehand-java-client-okhttp/src/test/kotlin/com/stagehand/api/client/okhttp/OkHttpClientTest.kt +++ b/stagehand-java-client-okhttp/src/test/kotlin/com/browserbase/api/client/okhttp/OkHttpClientTest.kt @@ -1,10 +1,10 @@ -package com.stagehand.api.client.okhttp +package com.browserbase.api.client.okhttp +import com.browserbase.api.core.http.HttpMethod +import com.browserbase.api.core.http.HttpRequest import com.github.tomakehurst.wiremock.client.WireMock.* import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest -import com.stagehand.api.core.http.HttpMethod -import com.stagehand.api.core.http.HttpRequest import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClient.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClient.kt similarity index 94% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClient.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClient.kt index bd37148..a5c8c6c 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClient.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClient.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.client +package com.browserbase.api.client -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.services.blocking.SessionService +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.services.blocking.SessionService import java.util.function.Consumer /** diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsync.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsync.kt similarity index 94% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsync.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsync.kt index 078550d..27fd2a9 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsync.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsync.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.client +package com.browserbase.api.client -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.services.async.SessionServiceAsync +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.services.async.SessionServiceAsync import java.util.function.Consumer /** diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsyncImpl.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsyncImpl.kt similarity index 88% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsyncImpl.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsyncImpl.kt index 60cbec7..2a0b813 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientAsyncImpl.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientAsyncImpl.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.client +package com.browserbase.api.client -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.core.getPackageVersion -import com.stagehand.api.services.async.SessionServiceAsync -import com.stagehand.api.services.async.SessionServiceAsyncImpl +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.core.getPackageVersion +import com.browserbase.api.services.async.SessionServiceAsync +import com.browserbase.api.services.async.SessionServiceAsyncImpl import java.util.function.Consumer class StagehandClientAsyncImpl(private val clientOptions: ClientOptions) : StagehandClientAsync { diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientImpl.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientImpl.kt similarity index 88% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientImpl.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientImpl.kt index 39ff1e2..8ea5907 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/client/StagehandClientImpl.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/client/StagehandClientImpl.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.client +package com.browserbase.api.client -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.core.getPackageVersion -import com.stagehand.api.services.blocking.SessionService -import com.stagehand.api.services.blocking.SessionServiceImpl +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.core.getPackageVersion +import com.browserbase.api.services.blocking.SessionService +import com.browserbase.api.services.blocking.SessionServiceImpl import java.util.function.Consumer class StagehandClientImpl(private val clientOptions: ClientOptions) : StagehandClient { diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/BaseDeserializer.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/BaseDeserializer.kt similarity index 97% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/BaseDeserializer.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/BaseDeserializer.kt index 98c91bd..dc07be5 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/BaseDeserializer.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/BaseDeserializer.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.core.ObjectCodec diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/BaseSerializer.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/BaseSerializer.kt similarity index 84% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/BaseSerializer.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/BaseSerializer.kt index 929a990..9142bfe 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/BaseSerializer.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/BaseSerializer.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import com.fasterxml.jackson.databind.ser.std.StdSerializer import kotlin.reflect.KClass diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Check.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Check.kt similarity index 96% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Check.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Check.kt index e61fae8..0eb0c57 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Check.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Check.kt @@ -1,6 +1,6 @@ @file:JvmName("Check") -package com.stagehand.api.core +package com.browserbase.api.core import com.fasterxml.jackson.core.Version import com.fasterxml.jackson.core.util.VersionUtil @@ -77,7 +77,7 @@ This can happen if you are either: Double-check that you are depending on compatible Jackson versions. -See https://www.github.com/stainless-sdks/stagehand-java#jackson for more information. +See https://www.github.com/browserbase/stagehand-java#jackson for more information. """ .trimIndent() } diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/ClientOptions.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt similarity index 77% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/ClientOptions.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt index 50b2df9..8692cb0 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/ClientOptions.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.core +package com.browserbase.api.core +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.HttpClient +import com.browserbase.api.core.http.PhantomReachableClosingHttpClient +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.core.http.RetryingHttpClient import com.fasterxml.jackson.databind.json.JsonMapper -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.HttpClient -import com.stagehand.api.core.http.PhantomReachableClosingHttpClient -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.core.http.RetryingHttpClient import java.time.Clock import java.time.Duration import java.util.Optional @@ -36,8 +36,8 @@ private constructor( /** * The Jackson JSON mapper to use for serializing and deserializing JSON. * - * Defaults to [com.stagehand.api.core.jsonMapper]. The default is usually sufficient and rarely - * needs to be overridden. + * Defaults to [com.browserbase.api.core.jsonMapper]. The default is usually sufficient and + * rarely needs to be overridden. */ @get:JvmName("jsonMapper") val jsonMapper: JsonMapper, /** @@ -93,7 +93,12 @@ private constructor( * Defaults to 2. */ @get:JvmName("maxRetries") val maxRetries: Int, - private val apiKey: String?, + /** Your [Browserbase API Key](https://www.browserbase.com/settings) */ + @get:JvmName("browserbaseApiKey") val browserbaseApiKey: String, + /** Your [Browserbase Project ID](https://www.browserbase.com/settings) */ + @get:JvmName("browserbaseProjectId") val browserbaseProjectId: String, + /** Your LLM provider API key (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) */ + @get:JvmName("modelApiKey") val modelApiKey: String, ) { init { @@ -105,22 +110,15 @@ private constructor( /** * The base URL to use for every request. * - * Defaults to the production environment: `http://localhost:3000/v1`. - * - * The following other environments, with dedicated builder methods, are available: - * - environment_1: `https://api.stagehand.browserbase.com/v1` + * Defaults to the production environment: `https://api.stagehand.browserbase.com/v1`. */ fun baseUrl(): String = baseUrl ?: PRODUCTION_URL - fun apiKey(): Optional = Optional.ofNullable(apiKey) - fun toBuilder() = Builder().from(this) companion object { - const val PRODUCTION_URL = "http://localhost:3000/v1" - - const val ENVIRONMENT_1_URL = "https://api.stagehand.browserbase.com/v1" + const val PRODUCTION_URL = "https://api.stagehand.browserbase.com/v1" /** * Returns a mutable builder for constructing an instance of [ClientOptions]. @@ -128,6 +126,9 @@ private constructor( * The following fields are required: * ```java * .httpClient() + * .browserbaseApiKey() + * .browserbaseProjectId() + * .modelApiKey() * ``` */ @JvmStatic fun builder() = Builder() @@ -154,7 +155,9 @@ private constructor( private var responseValidation: Boolean = false private var timeout: Timeout = Timeout.default() private var maxRetries: Int = 2 - private var apiKey: String? = null + private var browserbaseApiKey: String? = null + private var browserbaseProjectId: String? = null + private var modelApiKey: String? = null @JvmSynthetic internal fun from(clientOptions: ClientOptions) = apply { @@ -169,7 +172,9 @@ private constructor( responseValidation = clientOptions.responseValidation timeout = clientOptions.timeout maxRetries = clientOptions.maxRetries - apiKey = clientOptions.apiKey + browserbaseApiKey = clientOptions.browserbaseApiKey + browserbaseProjectId = clientOptions.browserbaseProjectId + modelApiKey = clientOptions.modelApiKey } /** @@ -197,7 +202,7 @@ private constructor( /** * The Jackson JSON mapper to use for serializing and deserializing JSON. * - * Defaults to [com.stagehand.api.core.jsonMapper]. The default is usually sufficient and + * Defaults to [com.browserbase.api.core.jsonMapper]. The default is usually sufficient and * rarely needs to be overridden. */ fun jsonMapper(jsonMapper: JsonMapper) = apply { this.jsonMapper = jsonMapper } @@ -225,19 +230,13 @@ private constructor( /** * The base URL to use for every request. * - * Defaults to the production environment: `http://localhost:3000/v1`. - * - * The following other environments, with dedicated builder methods, are available: - * - environment_1: `https://api.stagehand.browserbase.com/v1` + * Defaults to the production environment: `https://api.stagehand.browserbase.com/v1`. */ fun baseUrl(baseUrl: String?) = apply { this.baseUrl = baseUrl } /** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */ fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull()) - /** Sets [baseUrl] to `https://api.stagehand.browserbase.com/v1`. */ - fun environment1() = baseUrl(ENVIRONMENT_1_URL) - /** * Whether to call `validate` on every response before returning it. * @@ -282,10 +281,18 @@ private constructor( */ fun maxRetries(maxRetries: Int) = apply { this.maxRetries = maxRetries } - fun apiKey(apiKey: String?) = apply { this.apiKey = apiKey } + /** Your [Browserbase API Key](https://www.browserbase.com/settings) */ + fun browserbaseApiKey(browserbaseApiKey: String) = apply { + this.browserbaseApiKey = browserbaseApiKey + } + + /** Your [Browserbase Project ID](https://www.browserbase.com/settings) */ + fun browserbaseProjectId(browserbaseProjectId: String) = apply { + this.browserbaseProjectId = browserbaseProjectId + } - /** Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */ - fun apiKey(apiKey: Optional) = apiKey(apiKey.getOrNull()) + /** Your LLM provider API key (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) */ + fun modelApiKey(modelApiKey: String) = apply { this.modelApiKey = modelApiKey } fun headers(headers: Headers) = apply { this.headers.clear() @@ -374,10 +381,12 @@ private constructor( * * See this table for the available options: * - * |Setter |System property |Environment variable|Required|Default value | - * |---------|-------------------|--------------------|--------|----------------------------| - * |`apiKey` |`stagehand.apiKey` |`STAGEHAND_API_KEY` |false |- | - * |`baseUrl`|`stagehand.baseUrl`|`STAGEHAND_BASE_URL`|true |`"http://localhost:3000/v1"`| + * |Setter |System property |Environment variable |Required|Default value | + * |----------------------|--------------------------------|------------------------|--------|--------------------------------------------| + * |`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/v1"`| * * System properties take precedence over environment variables. */ @@ -385,8 +394,14 @@ private constructor( (System.getProperty("stagehand.baseUrl") ?: System.getenv("STAGEHAND_BASE_URL"))?.let { baseUrl(it) } - (System.getProperty("stagehand.apiKey") ?: System.getenv("STAGEHAND_API_KEY"))?.let { - apiKey(it) + (System.getProperty("stagehand.browserbaseApiKey") + ?: System.getenv("BROWSERBASE_API_KEY")) + ?.let { browserbaseApiKey(it) } + (System.getProperty("stagehand.browserbaseProjectId") + ?: System.getenv("BROWSERBASE_PROJECT_ID")) + ?.let { browserbaseProjectId(it) } + (System.getProperty("stagehand.modelApiKey") ?: System.getenv("MODEL_API_KEY"))?.let { + modelApiKey(it) } } @@ -398,6 +413,9 @@ private constructor( * The following fields are required: * ```java * .httpClient() + * .browserbaseApiKey() + * .browserbaseProjectId() + * .modelApiKey() * ``` * * @throws IllegalStateException if any required field is unset. @@ -405,6 +423,9 @@ private constructor( fun build(): ClientOptions { val httpClient = checkRequired("httpClient", httpClient) val sleeper = sleeper ?: PhantomReachableSleeper(DefaultSleeper()) + val browserbaseApiKey = checkRequired("browserbaseApiKey", browserbaseApiKey) + val browserbaseProjectId = checkRequired("browserbaseProjectId", browserbaseProjectId) + val modelApiKey = checkRequired("modelApiKey", modelApiKey) val headers = Headers.builder() val queryParams = QueryParams.builder() @@ -415,9 +436,19 @@ private constructor( headers.put("X-Stainless-Package-Version", getPackageVersion()) headers.put("X-Stainless-Runtime", "JRE") headers.put("X-Stainless-Runtime-Version", getJavaVersion()) - apiKey?.let { + browserbaseApiKey.let { + if (!it.isEmpty()) { + headers.put("x-bb-api-key", it) + } + } + browserbaseProjectId.let { + if (!it.isEmpty()) { + headers.put("x-bb-project-id", it) + } + } + modelApiKey.let { if (!it.isEmpty()) { - headers.put("Authorization", "Bearer $it") + headers.put("x-model-api-key", it) } } headers.replaceAll(this.headers.build()) @@ -441,7 +472,9 @@ private constructor( responseValidation, timeout, maxRetries, - apiKey, + browserbaseApiKey, + browserbaseProjectId, + modelApiKey, ) } } diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/DefaultSleeper.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/DefaultSleeper.kt similarity index 95% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/DefaultSleeper.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/DefaultSleeper.kt index 039a60c..7ea0449 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/DefaultSleeper.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/DefaultSleeper.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import java.time.Duration import java.util.Timer diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/ObjectMappers.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ObjectMappers.kt similarity index 99% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/ObjectMappers.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ObjectMappers.kt index 29d99af..9ed574e 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/ObjectMappers.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ObjectMappers.kt @@ -1,6 +1,6 @@ @file:JvmName("ObjectMappers") -package com.stagehand.api.core +package com.browserbase.api.core import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.core.JsonGenerator diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Params.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Params.kt similarity index 75% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Params.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Params.kt index 7f5a2f1..74e0357 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Params.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Params.kt @@ -1,7 +1,7 @@ -package com.stagehand.api.core +package com.browserbase.api.core -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.QueryParams +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.QueryParams /** An interface representing parameters passed to a service method. */ interface Params { diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachable.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachable.kt similarity index 95% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachable.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachable.kt index 48c4eb3..12cba3f 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachable.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachable.kt @@ -1,8 +1,8 @@ @file:JvmName("PhantomReachable") -package com.stagehand.api.core +package com.browserbase.api.core -import com.stagehand.api.errors.StagehandException +import com.browserbase.api.errors.StagehandException import java.lang.reflect.InvocationTargetException /** diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachableExecutorService.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachableExecutorService.kt similarity index 98% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachableExecutorService.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachableExecutorService.kt index cc3cebb..7fb24a5 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachableExecutorService.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachableExecutorService.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import java.util.concurrent.Callable import java.util.concurrent.ExecutorService diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachableSleeper.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachableSleeper.kt similarity index 95% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachableSleeper.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachableSleeper.kt index 8d82484..172760d 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PhantomReachableSleeper.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PhantomReachableSleeper.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import java.time.Duration import java.util.concurrent.CompletableFuture diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PrepareRequest.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PrepareRequest.kt similarity index 90% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PrepareRequest.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PrepareRequest.kt index 0da40de..89ffa2d 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/PrepareRequest.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/PrepareRequest.kt @@ -1,8 +1,8 @@ @file:JvmName("PrepareRequest") -package com.stagehand.api.core +package com.browserbase.api.core -import com.stagehand.api.core.http.HttpRequest +import com.browserbase.api.core.http.HttpRequest import java.util.concurrent.CompletableFuture @JvmSynthetic diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Properties.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Properties.kt similarity index 92% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Properties.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Properties.kt index f2e9de2..c14d552 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Properties.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Properties.kt @@ -1,8 +1,8 @@ @file:JvmName("Properties") -package com.stagehand.api.core +package com.browserbase.api.core -import com.stagehand.api.client.StagehandClient +import com.browserbase.api.client.StagehandClient fun getOsArch(): String { val osArch = System.getProperty("os.arch") diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/RequestOptions.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/RequestOptions.kt similarity index 97% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/RequestOptions.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/RequestOptions.kt index 10fb92a..9674a09 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/RequestOptions.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/RequestOptions.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import java.time.Duration diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Sleeper.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Sleeper.kt similarity index 94% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Sleeper.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Sleeper.kt index bccd778..7c5e93a 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Sleeper.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Sleeper.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import java.time.Duration import java.util.concurrent.CompletableFuture diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Timeout.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Timeout.kt similarity index 99% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Timeout.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Timeout.kt index 23d9885..d5618ce 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Timeout.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Timeout.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.core +package com.browserbase.api.core import java.time.Duration import java.util.Objects diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Utils.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Utils.kt similarity index 97% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Utils.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Utils.kt index 7e8118b..c24f648 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Utils.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Utils.kt @@ -1,8 +1,8 @@ @file:JvmName("Utils") -package com.stagehand.api.core +package com.browserbase.api.core -import com.stagehand.api.errors.StagehandInvalidDataException +import com.browserbase.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.SortedMap import java.util.concurrent.CompletableFuture diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Values.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Values.kt similarity index 99% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Values.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Values.kt index 8410d97..db0102a 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/Values.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/Values.kt @@ -1,5 +1,6 @@ -package com.stagehand.api.core +package com.browserbase.api.core +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JacksonAnnotationsInside import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonInclude @@ -24,7 +25,6 @@ import com.fasterxml.jackson.databind.node.JsonNodeType.OBJECT import com.fasterxml.jackson.databind.node.JsonNodeType.POJO import com.fasterxml.jackson.databind.node.JsonNodeType.STRING import com.fasterxml.jackson.databind.ser.std.NullSerializer -import com.stagehand.api.errors.StagehandInvalidDataException import java.io.InputStream import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/ErrorHandler.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/ErrorHandler.kt similarity index 80% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/ErrorHandler.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/ErrorHandler.kt index 08b3c7f..bd5fff6 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/ErrorHandler.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/ErrorHandler.kt @@ -2,21 +2,21 @@ @file:JvmName("ErrorHandler") -package com.stagehand.api.core.handlers +package com.browserbase.api.core.handlers +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.http.HttpResponse +import com.browserbase.api.core.http.HttpResponse.Handler +import com.browserbase.api.errors.BadRequestException +import com.browserbase.api.errors.InternalServerException +import com.browserbase.api.errors.NotFoundException +import com.browserbase.api.errors.PermissionDeniedException +import com.browserbase.api.errors.RateLimitException +import com.browserbase.api.errors.UnauthorizedException +import com.browserbase.api.errors.UnexpectedStatusCodeException +import com.browserbase.api.errors.UnprocessableEntityException import com.fasterxml.jackson.databind.json.JsonMapper -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.http.HttpResponse -import com.stagehand.api.core.http.HttpResponse.Handler -import com.stagehand.api.errors.BadRequestException -import com.stagehand.api.errors.InternalServerException -import com.stagehand.api.errors.NotFoundException -import com.stagehand.api.errors.PermissionDeniedException -import com.stagehand.api.errors.RateLimitException -import com.stagehand.api.errors.UnauthorizedException -import com.stagehand.api.errors.UnexpectedStatusCodeException -import com.stagehand.api.errors.UnprocessableEntityException @JvmSynthetic internal fun errorBodyHandler(jsonMapper: JsonMapper): Handler { diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/JsonHandler.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/JsonHandler.kt similarity index 72% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/JsonHandler.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/JsonHandler.kt index dc8d9e5..28b3462 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/JsonHandler.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/JsonHandler.kt @@ -1,12 +1,12 @@ @file:JvmName("JsonHandler") -package com.stagehand.api.core.handlers +package com.browserbase.api.core.handlers +import com.browserbase.api.core.http.HttpResponse +import com.browserbase.api.core.http.HttpResponse.Handler +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.http.HttpResponse -import com.stagehand.api.core.http.HttpResponse.Handler -import com.stagehand.api.errors.StagehandInvalidDataException @JvmSynthetic internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler = diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/StringHandler.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/StringHandler.kt similarity index 66% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/StringHandler.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/StringHandler.kt index 9f7fb80..044de72 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/handlers/StringHandler.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/handlers/StringHandler.kt @@ -1,9 +1,9 @@ @file:JvmName("StringHandler") -package com.stagehand.api.core.handlers +package com.browserbase.api.core.handlers -import com.stagehand.api.core.http.HttpResponse -import com.stagehand.api.core.http.HttpResponse.Handler +import com.browserbase.api.core.http.HttpResponse +import com.browserbase.api.core.http.HttpResponse.Handler @JvmSynthetic internal fun stringHandler(): Handler = StringHandlerInternal diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/AsyncStreamResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/AsyncStreamResponse.kt similarity index 98% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/AsyncStreamResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/AsyncStreamResponse.kt index 23948e6..ccc5d24 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/AsyncStreamResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/AsyncStreamResponse.kt @@ -1,6 +1,6 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http -import com.stagehand.api.core.http.AsyncStreamResponse.Handler +import com.browserbase.api.core.http.AsyncStreamResponse.Handler import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/Headers.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/Headers.kt similarity index 87% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/Headers.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/Headers.kt index a6bfeb9..edb40c4 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/Headers.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/Headers.kt @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.core.http - -import com.stagehand.api.core.JsonArray -import com.stagehand.api.core.JsonBoolean -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonNull -import com.stagehand.api.core.JsonNumber -import com.stagehand.api.core.JsonObject -import com.stagehand.api.core.JsonString -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.toImmutable +package com.browserbase.api.core.http + +import com.browserbase.api.core.JsonArray +import com.browserbase.api.core.JsonBoolean +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonNull +import com.browserbase.api.core.JsonNumber +import com.browserbase.api.core.JsonObject +import com.browserbase.api.core.JsonString +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.toImmutable import java.util.TreeMap class Headers diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpClient.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpClient.kt similarity index 89% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpClient.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpClient.kt index 45d1240..d5a84ec 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpClient.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpClient.kt @@ -1,6 +1,6 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http -import com.stagehand.api.core.RequestOptions +import com.browserbase.api.core.RequestOptions import java.lang.AutoCloseable import java.util.concurrent.CompletableFuture diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpMethod.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpMethod.kt similarity index 76% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpMethod.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpMethod.kt index 243d075..fa2868d 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpMethod.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpMethod.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http enum class HttpMethod { GET, diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequest.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequest.kt similarity index 97% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequest.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequest.kt index e262cfa..f42f44a 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequest.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequest.kt @@ -1,7 +1,7 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.toImmutable +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.toImmutable class HttpRequest private constructor( diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequestBodies.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequestBodies.kt similarity index 97% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequestBodies.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequestBodies.kt index 98811cc..499197e 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequestBodies.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequestBodies.kt @@ -2,13 +2,13 @@ @file:JvmName("HttpRequestBodies") -package com.stagehand.api.core.http +package com.browserbase.api.core.http +import com.browserbase.api.core.MultipartField +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.node.JsonNodeType -import com.stagehand.api.core.MultipartField -import com.stagehand.api.errors.StagehandInvalidDataException import java.io.InputStream import java.io.OutputStream import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequestBody.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequestBody.kt similarity index 94% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequestBody.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequestBody.kt index 2b3f90a..57c20f4 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpRequestBody.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpRequestBody.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http import java.io.OutputStream import java.lang.AutoCloseable diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpResponse.kt similarity index 91% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpResponse.kt index 0fa2e44..045efac 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.core.http +package com.browserbase.api.core.http import java.io.InputStream diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpResponseFor.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpResponseFor.kt similarity index 93% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpResponseFor.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpResponseFor.kt index 82b8717..91ba762 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/HttpResponseFor.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/HttpResponseFor.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http import java.io.InputStream diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt similarity index 91% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt index 11f2997..13f1198 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingAsyncStreamResponse.kt @@ -1,7 +1,7 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http -import com.stagehand.api.core.closeWhenPhantomReachable -import com.stagehand.api.core.http.AsyncStreamResponse.Handler +import com.browserbase.api.core.closeWhenPhantomReachable +import com.browserbase.api.core.http.AsyncStreamResponse.Handler import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingHttpClient.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingHttpClient.kt similarity index 84% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingHttpClient.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingHttpClient.kt index 52da985..54e1c00 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingHttpClient.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingHttpClient.kt @@ -1,7 +1,7 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http -import com.stagehand.api.core.RequestOptions -import com.stagehand.api.core.closeWhenPhantomReachable +import com.browserbase.api.core.RequestOptions +import com.browserbase.api.core.closeWhenPhantomReachable import java.util.concurrent.CompletableFuture /** diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingStreamResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingStreamResponse.kt similarity index 85% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingStreamResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingStreamResponse.kt index b2f75a4..b977aab 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/PhantomReachableClosingStreamResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/PhantomReachableClosingStreamResponse.kt @@ -1,6 +1,6 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http -import com.stagehand.api.core.closeWhenPhantomReachable +import com.browserbase.api.core.closeWhenPhantomReachable import java.util.stream.Stream /** diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/QueryParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/QueryParams.kt similarity index 90% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/QueryParams.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/QueryParams.kt index 114b89b..e394ad0 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/QueryParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/QueryParams.kt @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.core.http - -import com.stagehand.api.core.JsonArray -import com.stagehand.api.core.JsonBoolean -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonNull -import com.stagehand.api.core.JsonNumber -import com.stagehand.api.core.JsonObject -import com.stagehand.api.core.JsonString -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.toImmutable +package com.browserbase.api.core.http + +import com.browserbase.api.core.JsonArray +import com.browserbase.api.core.JsonBoolean +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonNull +import com.browserbase.api.core.JsonNumber +import com.browserbase.api.core.JsonObject +import com.browserbase.api.core.JsonString +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.toImmutable class QueryParams private constructor( diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/RetryingHttpClient.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/RetryingHttpClient.kt similarity index 96% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/RetryingHttpClient.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/RetryingHttpClient.kt index c23a398..7e1a7aa 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/RetryingHttpClient.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/RetryingHttpClient.kt @@ -1,11 +1,11 @@ -package com.stagehand.api.core.http - -import com.stagehand.api.core.DefaultSleeper -import com.stagehand.api.core.RequestOptions -import com.stagehand.api.core.Sleeper -import com.stagehand.api.core.checkRequired -import com.stagehand.api.errors.StagehandIoException -import com.stagehand.api.errors.StagehandRetryableException +package com.browserbase.api.core.http + +import com.browserbase.api.core.DefaultSleeper +import com.browserbase.api.core.RequestOptions +import com.browserbase.api.core.Sleeper +import com.browserbase.api.core.checkRequired +import com.browserbase.api.errors.StagehandIoException +import com.browserbase.api.errors.StagehandRetryableException import java.io.IOException import java.time.Clock import java.time.Duration diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/StreamResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/StreamResponse.kt similarity index 92% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/StreamResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/StreamResponse.kt index ace181d..603e8bb 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/core/http/StreamResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/core/http/StreamResponse.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http import java.util.stream.Stream diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/BadRequestException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/BadRequestException.kt similarity index 93% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/BadRequestException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/BadRequestException.kt index 3e34a60..c56095d 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/BadRequestException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/BadRequestException.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/InternalServerException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt similarity index 94% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/InternalServerException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt index e44477e..c2b0d58 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/InternalServerException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/InternalServerException.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/NotFoundException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/NotFoundException.kt similarity index 92% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/NotFoundException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/NotFoundException.kt index 55d282f..b8dcbd2 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/NotFoundException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/NotFoundException.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/PermissionDeniedException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/PermissionDeniedException.kt similarity index 93% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/PermissionDeniedException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/PermissionDeniedException.kt index f79f40a..4c37a8a 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/PermissionDeniedException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/PermissionDeniedException.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/RateLimitException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/RateLimitException.kt similarity index 93% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/RateLimitException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/RateLimitException.kt index 1119740..b72ef4f 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/RateLimitException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/RateLimitException.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandException.kt similarity index 80% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandException.kt index 0d0087f..214a6a8 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandException.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.errors +package com.browserbase.api.errors open class StagehandException @JvmOverloads diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandInvalidDataException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandInvalidDataException.kt similarity index 81% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandInvalidDataException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandInvalidDataException.kt index 3d7fb03..87fe2d4 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandInvalidDataException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandInvalidDataException.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.errors +package com.browserbase.api.errors class StagehandInvalidDataException @JvmOverloads diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandIoException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandIoException.kt similarity index 80% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandIoException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandIoException.kt index 4080af1..216ae66 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandIoException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandIoException.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.errors +package com.browserbase.api.errors class StagehandIoException @JvmOverloads diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandRetryableException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandRetryableException.kt similarity index 93% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandRetryableException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandRetryableException.kt index 252b6c6..18b8aca 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandRetryableException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandRetryableException.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.errors +package com.browserbase.api.errors /** * Exception that indicates a transient error that can be retried. diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandServiceException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandServiceException.kt similarity index 72% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandServiceException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandServiceException.kt index af4ad3b..71ce4fa 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/StagehandServiceException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/StagehandServiceException.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.http.Headers abstract class StagehandServiceException protected constructor(message: String, cause: Throwable? = null) : diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnauthorizedException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnauthorizedException.kt similarity index 93% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnauthorizedException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnauthorizedException.kt index d3fa413..23ed90e 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnauthorizedException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnauthorizedException.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnexpectedStatusCodeException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt similarity index 94% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnexpectedStatusCodeException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt index 042ec74..c375faa 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnexpectedStatusCodeException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnexpectedStatusCodeException.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnprocessableEntityException.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnprocessableEntityException.kt similarity index 93% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnprocessableEntityException.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnprocessableEntityException.kt index eb3482b..a162609 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/errors/UnprocessableEntityException.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/errors/UnprocessableEntityException.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.errors +package com.browserbase.api.errors -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/Action.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/Action.kt similarity index 96% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/Action.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/Action.kt index 3d159b8..d30a40b 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/Action.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/Action.kt @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkKnown +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.toImmutable +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkKnown -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.toImmutable -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/ModelConfig.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt similarity index 97% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/ModelConfig.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt index 577bfbd..e08ebfa 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/ModelConfig.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/ModelConfig.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.Enum +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.Enum -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionActParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt similarity index 98% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionActParams.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt index 8631b64..34cae33 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionActParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt @@ -1,7 +1,22 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.BaseDeserializer +import com.browserbase.api.core.BaseSerializer +import com.browserbase.api.core.Enum +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.Params +import com.browserbase.api.core.allMaxBy +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.getOrThrow +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.core.toImmutable +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -13,21 +28,6 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.BaseDeserializer -import com.stagehand.api.core.BaseSerializer -import com.stagehand.api.core.Enum -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.Params -import com.stagehand.api.core.allMaxBy -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.getOrThrow -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.core.toImmutable -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionActResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActResponse.kt similarity index 95% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionActResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActResponse.kt index dca978d..69dfcab 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionActResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActResponse.kt @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkKnown +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.toImmutable +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkKnown -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.toImmutable -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionEndParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndParams.kt similarity index 97% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionEndParams.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndParams.kt index c559008..a3bb3fe 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionEndParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndParams.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.Params -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.core.toImmutable +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.Params +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.core.toImmutable import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionEndResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndResponse.kt similarity index 94% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionEndResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndResponse.kt index 3a162e7..feba7d7 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionEndResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionEndResponse.kt @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentParams.kt similarity index 98% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentParams.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentParams.kt index 5d77b26..d2c5c47 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentParams.kt @@ -1,7 +1,21 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.BaseDeserializer +import com.browserbase.api.core.BaseSerializer +import com.browserbase.api.core.Enum +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.Params +import com.browserbase.api.core.allMaxBy +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.getOrThrow +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -13,20 +27,6 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.BaseDeserializer -import com.stagehand.api.core.BaseSerializer -import com.stagehand.api.core.Enum -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.Params -import com.stagehand.api.core.allMaxBy -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.getOrThrow -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentResponse.kt similarity index 95% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentResponse.kt index 6fdda9d..08afed9 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentResponse.kt @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkKnown +import com.browserbase.api.core.toImmutable +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkKnown -import com.stagehand.api.core.toImmutable -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExtractParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractParams.kt similarity index 98% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExtractParams.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractParams.kt index 7d0c9a4..3833673 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExtractParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractParams.kt @@ -1,21 +1,21 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.Enum +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.Params +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.core.toImmutable +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.Enum -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.Params -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.core.toImmutable -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExtractResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractResponse.kt similarity index 85% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExtractResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractResponse.kt index 3126a4c..6816259 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionExtractResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExtractResponse.kt @@ -1,7 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.BaseDeserializer +import com.browserbase.api.core.BaseSerializer +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.allMaxBy +import com.browserbase.api.core.getOrThrow +import com.browserbase.api.core.toImmutable +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator @@ -13,16 +23,6 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.BaseDeserializer -import com.stagehand.api.core.BaseSerializer -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.allMaxBy -import com.stagehand.api.core.getOrThrow -import com.stagehand.api.core.toImmutable -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional @@ -33,7 +33,7 @@ import java.util.Optional class SessionExtractResponse private constructor( private val extraction: Extraction? = null, - private val unionMember1: UnionMember1? = null, + private val custom: Custom? = null, private val _json: JsonValue? = null, ) { @@ -41,24 +41,24 @@ private constructor( fun extraction(): Optional = Optional.ofNullable(extraction) /** Structured data matching provided schema */ - fun unionMember1(): Optional = Optional.ofNullable(unionMember1) + fun custom(): Optional = Optional.ofNullable(custom) fun isExtraction(): Boolean = extraction != null - fun isUnionMember1(): Boolean = unionMember1 != null + fun isCustom(): Boolean = custom != null /** Default extraction result */ fun asExtraction(): Extraction = extraction.getOrThrow("extraction") /** Structured data matching provided schema */ - fun asUnionMember1(): UnionMember1 = unionMember1.getOrThrow("unionMember1") + fun asCustom(): Custom = custom.getOrThrow("custom") fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = when { extraction != null -> visitor.visitExtraction(extraction) - unionMember1 != null -> visitor.visitUnionMember1(unionMember1) + custom != null -> visitor.visitCustom(custom) else -> visitor.unknown(_json) } @@ -75,8 +75,8 @@ private constructor( extraction.validate() } - override fun visitUnionMember1(unionMember1: UnionMember1) { - unionMember1.validate() + override fun visitCustom(custom: Custom) { + custom.validate() } } ) @@ -102,7 +102,7 @@ private constructor( object : Visitor { override fun visitExtraction(extraction: Extraction) = extraction.validity() - override fun visitUnionMember1(unionMember1: UnionMember1) = unionMember1.validity() + override fun visitCustom(custom: Custom) = custom.validity() override fun unknown(json: JsonValue?) = 0 } @@ -115,15 +115,15 @@ private constructor( return other is SessionExtractResponse && extraction == other.extraction && - unionMember1 == other.unionMember1 + custom == other.custom } - override fun hashCode(): Int = Objects.hash(extraction, unionMember1) + override fun hashCode(): Int = Objects.hash(extraction, custom) override fun toString(): String = when { extraction != null -> "SessionExtractResponse{extraction=$extraction}" - unionMember1 != null -> "SessionExtractResponse{unionMember1=$unionMember1}" + custom != null -> "SessionExtractResponse{custom=$custom}" _json != null -> "SessionExtractResponse{_unknown=$_json}" else -> throw IllegalStateException("Invalid SessionExtractResponse") } @@ -135,9 +135,7 @@ private constructor( fun ofExtraction(extraction: Extraction) = SessionExtractResponse(extraction = extraction) /** Structured data matching provided schema */ - @JvmStatic - fun ofUnionMember1(unionMember1: UnionMember1) = - SessionExtractResponse(unionMember1 = unionMember1) + @JvmStatic fun ofCustom(custom: Custom) = SessionExtractResponse(custom = custom) } /** @@ -150,7 +148,7 @@ private constructor( fun visitExtraction(extraction: Extraction): T /** Structured data matching provided schema */ - fun visitUnionMember1(unionMember1: UnionMember1): T + fun visitCustom(custom: Custom): T /** * Maps an unknown variant of [SessionExtractResponse] to a value of type [T]. @@ -178,8 +176,8 @@ private constructor( tryDeserialize(node, jacksonTypeRef())?.let { SessionExtractResponse(extraction = it, _json = json) }, - tryDeserialize(node, jacksonTypeRef())?.let { - SessionExtractResponse(unionMember1 = it, _json = json) + tryDeserialize(node, jacksonTypeRef())?.let { + SessionExtractResponse(custom = it, _json = json) }, ) .filterNotNull() @@ -207,7 +205,7 @@ private constructor( ) { when { value.extraction != null -> generator.writeObject(value.extraction) - value.unionMember1 != null -> generator.writeObject(value.unionMember1) + value.custom != null -> generator.writeObject(value.custom) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid SessionExtractResponse") } @@ -358,7 +356,7 @@ private constructor( } /** Structured data matching provided schema */ - class UnionMember1 + class Custom @JsonCreator private constructor( @com.fasterxml.jackson.annotation.JsonValue @@ -373,18 +371,18 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [UnionMember1]. */ + /** Returns a mutable builder for constructing an instance of [Custom]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [UnionMember1]. */ + /** A builder for [Custom]. */ class Builder internal constructor() { private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(unionMember1: UnionMember1) = apply { - additionalProperties = unionMember1.additionalProperties.toMutableMap() + internal fun from(custom: Custom) = apply { + additionalProperties = custom.additionalProperties.toMutableMap() } fun additionalProperties(additionalProperties: Map) = apply { @@ -407,16 +405,16 @@ private constructor( } /** - * Returns an immutable instance of [UnionMember1]. + * Returns an immutable instance of [Custom]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): UnionMember1 = UnionMember1(additionalProperties.toImmutable()) + fun build(): Custom = Custom(additionalProperties.toImmutable()) } private var validated: Boolean = false - fun validate(): UnionMember1 = apply { + fun validate(): Custom = apply { if (validated) { return@apply } @@ -447,13 +445,13 @@ private constructor( return true } - return other is UnionMember1 && additionalProperties == other.additionalProperties + return other is Custom && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash(additionalProperties) } override fun hashCode(): Int = hashCode - override fun toString() = "UnionMember1{additionalProperties=$additionalProperties}" + override fun toString() = "Custom{additionalProperties=$additionalProperties}" } } diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionNavigateParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateParams.kt similarity index 98% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionNavigateParams.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateParams.kt index 634a032..e57efd3 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionNavigateParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateParams.kt @@ -1,21 +1,21 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.Enum +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.Params +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.Enum -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.Params -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionNavigateResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponse.kt similarity index 96% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionNavigateResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponse.kt index b6a5d86..50422bd 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionNavigateResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponse.kt @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionObserveParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveParams.kt similarity index 98% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionObserveParams.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveParams.kt index e3d18de..0d67973 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionObserveParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionObserveParams.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.Enum +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.Params +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.Enum -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.Params -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionStartParams.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartParams.kt similarity index 55% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionStartParams.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartParams.kt index 4b7050c..cda3e99 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionStartParams.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartParams.kt @@ -1,25 +1,23 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.Params +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.http.QueryParams +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.Enum -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.Params -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.http.QueryParams -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional -import kotlin.jvm.optionals.getOrNull /** * Initializes a new Stagehand session with a browser instance. Returns a session ID that must be @@ -33,20 +31,20 @@ private constructor( ) : Params { /** - * Environment to run the browser in + * API key for Browserbase Cloud * * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun env(): Env = body.env() + fun browserbaseApiKey(): String = body.browserbaseApiKey() /** - * API key for Browserbase (required when env=BROWSERBASE) + * Project ID for Browserbase * - * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun apiKey(): Optional = body.apiKey() + fun browserbaseProjectId(): String = body.browserbaseProjectId() /** * Timeout in ms to wait for DOM to settle @@ -57,30 +55,13 @@ private constructor( fun domSettleTimeout(): Optional = body.domSettleTimeout() /** - * Options for local browser launch - * - * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun localBrowserLaunchOptions(): Optional = - body.localBrowserLaunchOptions() - - /** - * AI model to use for actions + * AI model to use for actions (must be prefixed with provider/) * * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ fun model(): Optional = body.model() - /** - * Project ID for Browserbase (required when env=BROWSERBASE) - * - * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun projectId(): Optional = body.projectId() - /** * Enable self-healing for failed actions * @@ -106,18 +87,20 @@ private constructor( fun verbose(): Optional = body.verbose() /** - * Returns the raw JSON value of [env]. + * Returns the raw JSON value of [browserbaseApiKey]. * - * Unlike [env], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [browserbaseApiKey], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun _env(): JsonField = body._env() + fun _browserbaseApiKey(): JsonField = body._browserbaseApiKey() /** - * Returns the raw JSON value of [apiKey]. + * Returns the raw JSON value of [browserbaseProjectId]. * - * Unlike [apiKey], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [browserbaseProjectId], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun _apiKey(): JsonField = body._apiKey() + fun _browserbaseProjectId(): JsonField = body._browserbaseProjectId() /** * Returns the raw JSON value of [domSettleTimeout]. @@ -127,15 +110,6 @@ private constructor( */ fun _domSettleTimeout(): JsonField = body._domSettleTimeout() - /** - * Returns the raw JSON value of [localBrowserLaunchOptions]. - * - * Unlike [localBrowserLaunchOptions], this method doesn't throw if the JSON field has an - * unexpected type. - */ - fun _localBrowserLaunchOptions(): JsonField = - body._localBrowserLaunchOptions() - /** * Returns the raw JSON value of [model]. * @@ -143,13 +117,6 @@ private constructor( */ fun _model(): JsonField = body._model() - /** - * Returns the raw JSON value of [projectId]. - * - * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _projectId(): JsonField = body._projectId() - /** * Returns the raw JSON value of [selfHeal]. * @@ -188,7 +155,8 @@ private constructor( * * The following fields are required: * ```java - * .env() + * .browserbaseApiKey() + * .browserbaseProjectId() * ``` */ @JvmStatic fun builder() = Builder() @@ -213,36 +181,46 @@ private constructor( * * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: - * - [env] - * - [apiKey] + * - [browserbaseApiKey] + * - [browserbaseProjectId] * - [domSettleTimeout] - * - [localBrowserLaunchOptions] * - [model] + * - [selfHeal] * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } - /** Environment to run the browser in */ - fun env(env: Env) = apply { body.env(env) } + /** API key for Browserbase Cloud */ + fun browserbaseApiKey(browserbaseApiKey: String) = apply { + body.browserbaseApiKey(browserbaseApiKey) + } /** - * Sets [Builder.env] to an arbitrary JSON value. + * Sets [Builder.browserbaseApiKey] to an arbitrary JSON value. * - * You should usually call [Builder.env] with a well-typed [Env] value instead. This method - * is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.browserbaseApiKey] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun env(env: JsonField) = apply { body.env(env) } + fun browserbaseApiKey(browserbaseApiKey: JsonField) = apply { + body.browserbaseApiKey(browserbaseApiKey) + } - /** API key for Browserbase (required when env=BROWSERBASE) */ - fun apiKey(apiKey: String) = apply { body.apiKey(apiKey) } + /** Project ID for Browserbase */ + fun browserbaseProjectId(browserbaseProjectId: String) = apply { + body.browserbaseProjectId(browserbaseProjectId) + } /** - * Sets [Builder.apiKey] to an arbitrary JSON value. + * Sets [Builder.browserbaseProjectId] to an arbitrary JSON value. * - * You should usually call [Builder.apiKey] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.browserbaseProjectId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun apiKey(apiKey: JsonField) = apply { body.apiKey(apiKey) } + fun browserbaseProjectId(browserbaseProjectId: JsonField) = apply { + body.browserbaseProjectId(browserbaseProjectId) + } /** Timeout in ms to wait for DOM to settle */ fun domSettleTimeout(domSettleTimeout: Long) = apply { @@ -260,24 +238,7 @@ private constructor( body.domSettleTimeout(domSettleTimeout) } - /** Options for local browser launch */ - fun localBrowserLaunchOptions(localBrowserLaunchOptions: LocalBrowserLaunchOptions) = - apply { - body.localBrowserLaunchOptions(localBrowserLaunchOptions) - } - - /** - * Sets [Builder.localBrowserLaunchOptions] to an arbitrary JSON value. - * - * You should usually call [Builder.localBrowserLaunchOptions] with a well-typed - * [LocalBrowserLaunchOptions] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun localBrowserLaunchOptions( - localBrowserLaunchOptions: JsonField - ) = apply { body.localBrowserLaunchOptions(localBrowserLaunchOptions) } - - /** AI model to use for actions */ + /** AI model to use for actions (must be prefixed with provider/) */ fun model(model: String) = apply { body.model(model) } /** @@ -288,18 +249,6 @@ private constructor( */ fun model(model: JsonField) = apply { body.model(model) } - /** Project ID for Browserbase (required when env=BROWSERBASE) */ - fun projectId(projectId: String) = apply { body.projectId(projectId) } - - /** - * Sets [Builder.projectId] to an arbitrary JSON value. - * - * You should usually call [Builder.projectId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun projectId(projectId: JsonField) = apply { body.projectId(projectId) } - /** Enable self-healing for failed actions */ fun selfHeal(selfHeal: Boolean) = apply { body.selfHeal(selfHeal) } @@ -461,7 +410,8 @@ private constructor( * * The following fields are required: * ```java - * .env() + * .browserbaseApiKey() + * .browserbaseProjectId() * ``` * * @throws IllegalStateException if any required field is unset. @@ -483,12 +433,10 @@ private constructor( class Body @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val env: JsonField, - private val apiKey: JsonField, + private val browserbaseApiKey: JsonField, + private val browserbaseProjectId: JsonField, private val domSettleTimeout: JsonField, - private val localBrowserLaunchOptions: JsonField, private val model: JsonField, - private val projectId: JsonField, private val selfHeal: JsonField, private val systemPrompt: JsonField, private val verbose: JsonField, @@ -497,18 +445,16 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("env") @ExcludeMissing env: JsonField = JsonMissing.of(), - @JsonProperty("apiKey") @ExcludeMissing apiKey: JsonField = JsonMissing.of(), + @JsonProperty("BROWSERBASE_API_KEY") + @ExcludeMissing + browserbaseApiKey: JsonField = JsonMissing.of(), + @JsonProperty("BROWSERBASE_PROJECT_ID") + @ExcludeMissing + browserbaseProjectId: JsonField = JsonMissing.of(), @JsonProperty("domSettleTimeout") @ExcludeMissing domSettleTimeout: JsonField = JsonMissing.of(), - @JsonProperty("localBrowserLaunchOptions") - @ExcludeMissing - localBrowserLaunchOptions: JsonField = JsonMissing.of(), @JsonProperty("model") @ExcludeMissing model: JsonField = JsonMissing.of(), - @JsonProperty("projectId") - @ExcludeMissing - projectId: JsonField = JsonMissing.of(), @JsonProperty("selfHeal") @ExcludeMissing selfHeal: JsonField = JsonMissing.of(), @@ -517,12 +463,10 @@ private constructor( systemPrompt: JsonField = JsonMissing.of(), @JsonProperty("verbose") @ExcludeMissing verbose: JsonField = JsonMissing.of(), ) : this( - env, - apiKey, + browserbaseApiKey, + browserbaseProjectId, domSettleTimeout, - localBrowserLaunchOptions, model, - projectId, selfHeal, systemPrompt, verbose, @@ -530,20 +474,21 @@ private constructor( ) /** - * Environment to run the browser in + * API key for Browserbase Cloud * * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun env(): Env = env.getRequired("env") + fun browserbaseApiKey(): String = browserbaseApiKey.getRequired("BROWSERBASE_API_KEY") /** - * API key for Browserbase (required when env=BROWSERBASE) + * Project ID for Browserbase * - * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * @throws StagehandInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun apiKey(): Optional = apiKey.getOptional("apiKey") + fun browserbaseProjectId(): String = + browserbaseProjectId.getRequired("BROWSERBASE_PROJECT_ID") /** * Timeout in ms to wait for DOM to settle @@ -554,30 +499,13 @@ private constructor( fun domSettleTimeout(): Optional = domSettleTimeout.getOptional("domSettleTimeout") /** - * Options for local browser launch - * - * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun localBrowserLaunchOptions(): Optional = - localBrowserLaunchOptions.getOptional("localBrowserLaunchOptions") - - /** - * AI model to use for actions + * AI model to use for actions (must be prefixed with provider/) * * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ fun model(): Optional = model.getOptional("model") - /** - * Project ID for Browserbase (required when env=BROWSERBASE) - * - * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun projectId(): Optional = projectId.getOptional("projectId") - /** * Enable self-healing for failed actions * @@ -603,18 +531,24 @@ private constructor( fun verbose(): Optional = verbose.getOptional("verbose") /** - * Returns the raw JSON value of [env]. + * Returns the raw JSON value of [browserbaseApiKey]. * - * Unlike [env], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [browserbaseApiKey], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("env") @ExcludeMissing fun _env(): JsonField = env + @JsonProperty("BROWSERBASE_API_KEY") + @ExcludeMissing + fun _browserbaseApiKey(): JsonField = browserbaseApiKey /** - * Returns the raw JSON value of [apiKey]. + * Returns the raw JSON value of [browserbaseProjectId]. * - * Unlike [apiKey], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [browserbaseProjectId], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("apiKey") @ExcludeMissing fun _apiKey(): JsonField = apiKey + @JsonProperty("BROWSERBASE_PROJECT_ID") + @ExcludeMissing + fun _browserbaseProjectId(): JsonField = browserbaseProjectId /** * Returns the raw JSON value of [domSettleTimeout]. @@ -626,17 +560,6 @@ private constructor( @ExcludeMissing fun _domSettleTimeout(): JsonField = domSettleTimeout - /** - * Returns the raw JSON value of [localBrowserLaunchOptions]. - * - * Unlike [localBrowserLaunchOptions], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("localBrowserLaunchOptions") - @ExcludeMissing - fun _localBrowserLaunchOptions(): JsonField = - localBrowserLaunchOptions - /** * Returns the raw JSON value of [model]. * @@ -644,13 +567,6 @@ private constructor( */ @JsonProperty("model") @ExcludeMissing fun _model(): JsonField = model - /** - * Returns the raw JSON value of [projectId]. - * - * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField = projectId - /** * Returns the raw JSON value of [selfHeal]. * @@ -694,7 +610,8 @@ private constructor( * * The following fields are required: * ```java - * .env() + * .browserbaseApiKey() + * .browserbaseProjectId() * ``` */ @JvmStatic fun builder() = Builder() @@ -703,13 +620,10 @@ private constructor( /** A builder for [Body]. */ class Builder internal constructor() { - private var env: JsonField? = null - private var apiKey: JsonField = JsonMissing.of() + private var browserbaseApiKey: JsonField? = null + private var browserbaseProjectId: JsonField? = null private var domSettleTimeout: JsonField = JsonMissing.of() - private var localBrowserLaunchOptions: JsonField = - JsonMissing.of() private var model: JsonField = JsonMissing.of() - private var projectId: JsonField = JsonMissing.of() private var selfHeal: JsonField = JsonMissing.of() private var systemPrompt: JsonField = JsonMissing.of() private var verbose: JsonField = JsonMissing.of() @@ -717,41 +631,45 @@ private constructor( @JvmSynthetic internal fun from(body: Body) = apply { - env = body.env - apiKey = body.apiKey + browserbaseApiKey = body.browserbaseApiKey + browserbaseProjectId = body.browserbaseProjectId domSettleTimeout = body.domSettleTimeout - localBrowserLaunchOptions = body.localBrowserLaunchOptions model = body.model - projectId = body.projectId selfHeal = body.selfHeal systemPrompt = body.systemPrompt verbose = body.verbose additionalProperties = body.additionalProperties.toMutableMap() } - /** Environment to run the browser in */ - fun env(env: Env) = env(JsonField.of(env)) + /** API key for Browserbase Cloud */ + fun browserbaseApiKey(browserbaseApiKey: String) = + browserbaseApiKey(JsonField.of(browserbaseApiKey)) /** - * Sets [Builder.env] to an arbitrary JSON value. + * Sets [Builder.browserbaseApiKey] to an arbitrary JSON value. * - * You should usually call [Builder.env] with a well-typed [Env] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.browserbaseApiKey] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun env(env: JsonField) = apply { this.env = env } + fun browserbaseApiKey(browserbaseApiKey: JsonField) = apply { + this.browserbaseApiKey = browserbaseApiKey + } - /** API key for Browserbase (required when env=BROWSERBASE) */ - fun apiKey(apiKey: String) = apiKey(JsonField.of(apiKey)) + /** Project ID for Browserbase */ + fun browserbaseProjectId(browserbaseProjectId: String) = + browserbaseProjectId(JsonField.of(browserbaseProjectId)) /** - * Sets [Builder.apiKey] to an arbitrary JSON value. + * Sets [Builder.browserbaseProjectId] to an arbitrary JSON value. * - * You should usually call [Builder.apiKey] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.browserbaseProjectId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun apiKey(apiKey: JsonField) = apply { this.apiKey = apiKey } + fun browserbaseProjectId(browserbaseProjectId: JsonField) = apply { + this.browserbaseProjectId = browserbaseProjectId + } /** Timeout in ms to wait for DOM to settle */ fun domSettleTimeout(domSettleTimeout: Long) = @@ -768,22 +686,7 @@ private constructor( this.domSettleTimeout = domSettleTimeout } - /** Options for local browser launch */ - fun localBrowserLaunchOptions(localBrowserLaunchOptions: LocalBrowserLaunchOptions) = - localBrowserLaunchOptions(JsonField.of(localBrowserLaunchOptions)) - - /** - * Sets [Builder.localBrowserLaunchOptions] to an arbitrary JSON value. - * - * You should usually call [Builder.localBrowserLaunchOptions] with a well-typed - * [LocalBrowserLaunchOptions] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun localBrowserLaunchOptions( - localBrowserLaunchOptions: JsonField - ) = apply { this.localBrowserLaunchOptions = localBrowserLaunchOptions } - - /** AI model to use for actions */ + /** AI model to use for actions (must be prefixed with provider/) */ fun model(model: String) = model(JsonField.of(model)) /** @@ -795,18 +698,6 @@ private constructor( */ fun model(model: JsonField) = apply { this.model = model } - /** Project ID for Browserbase (required when env=BROWSERBASE) */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** - * Sets [Builder.projectId] to an arbitrary JSON value. - * - * You should usually call [Builder.projectId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } - /** Enable self-healing for failed actions */ fun selfHeal(selfHeal: Boolean) = selfHeal(JsonField.of(selfHeal)) @@ -871,19 +762,18 @@ private constructor( * * The following fields are required: * ```java - * .env() + * .browserbaseApiKey() + * .browserbaseProjectId() * ``` * * @throws IllegalStateException if any required field is unset. */ fun build(): Body = Body( - checkRequired("env", env), - apiKey, + checkRequired("browserbaseApiKey", browserbaseApiKey), + checkRequired("browserbaseProjectId", browserbaseProjectId), domSettleTimeout, - localBrowserLaunchOptions, model, - projectId, selfHeal, systemPrompt, verbose, @@ -898,12 +788,10 @@ private constructor( return@apply } - env().validate() - apiKey() + browserbaseApiKey() + browserbaseProjectId() domSettleTimeout() - localBrowserLaunchOptions().ifPresent { it.validate() } model() - projectId() selfHeal() systemPrompt() verbose() @@ -926,12 +814,10 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (env.asKnown().getOrNull()?.validity() ?: 0) + - (if (apiKey.asKnown().isPresent) 1 else 0) + + (if (browserbaseApiKey.asKnown().isPresent) 1 else 0) + + (if (browserbaseProjectId.asKnown().isPresent) 1 else 0) + (if (domSettleTimeout.asKnown().isPresent) 1 else 0) + - (localBrowserLaunchOptions.asKnown().getOrNull()?.validity() ?: 0) + (if (model.asKnown().isPresent) 1 else 0) + - (if (projectId.asKnown().isPresent) 1 else 0) + (if (selfHeal.asKnown().isPresent) 1 else 0) + (if (systemPrompt.asKnown().isPresent) 1 else 0) + (if (verbose.asKnown().isPresent) 1 else 0) @@ -942,12 +828,10 @@ private constructor( } return other is Body && - env == other.env && - apiKey == other.apiKey && + browserbaseApiKey == other.browserbaseApiKey && + browserbaseProjectId == other.browserbaseProjectId && domSettleTimeout == other.domSettleTimeout && - localBrowserLaunchOptions == other.localBrowserLaunchOptions && model == other.model && - projectId == other.projectId && selfHeal == other.selfHeal && systemPrompt == other.systemPrompt && verbose == other.verbose && @@ -956,12 +840,10 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( - env, - apiKey, + browserbaseApiKey, + browserbaseProjectId, domSettleTimeout, - localBrowserLaunchOptions, model, - projectId, selfHeal, systemPrompt, verbose, @@ -972,280 +854,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Body{env=$env, apiKey=$apiKey, domSettleTimeout=$domSettleTimeout, localBrowserLaunchOptions=$localBrowserLaunchOptions, model=$model, projectId=$projectId, selfHeal=$selfHeal, systemPrompt=$systemPrompt, verbose=$verbose, additionalProperties=$additionalProperties}" - } - - /** Environment to run the browser in */ - class Env @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 LOCAL = of("LOCAL") - - @JvmField val BROWSERBASE = of("BROWSERBASE") - - @JvmStatic fun of(value: String) = Env(JsonField.of(value)) - } - - /** An enum containing [Env]'s known values. */ - enum class Known { - LOCAL, - BROWSERBASE, - } - - /** - * An enum containing [Env]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Env] 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 { - LOCAL, - BROWSERBASE, - /** An enum member indicating that [Env] 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) { - LOCAL -> Value.LOCAL - BROWSERBASE -> Value.BROWSERBASE - 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) { - LOCAL -> Known.LOCAL - BROWSERBASE -> Known.BROWSERBASE - else -> throw StagehandInvalidDataException("Unknown Env: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws StagehandInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - StagehandInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Env = 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 Env && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Options for local browser launch */ - class LocalBrowserLaunchOptions - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val headless: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("headless") - @ExcludeMissing - headless: JsonField = JsonMissing.of() - ) : this(headless, mutableMapOf()) - - /** - * @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun headless(): Optional = headless.getOptional("headless") - - /** - * Returns the raw JSON value of [headless]. - * - * Unlike [headless], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("headless") @ExcludeMissing fun _headless(): JsonField = headless - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [LocalBrowserLaunchOptions]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LocalBrowserLaunchOptions]. */ - class Builder internal constructor() { - - private var headless: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(localBrowserLaunchOptions: LocalBrowserLaunchOptions) = apply { - headless = localBrowserLaunchOptions.headless - additionalProperties = localBrowserLaunchOptions.additionalProperties.toMutableMap() - } - - fun headless(headless: Boolean) = headless(JsonField.of(headless)) - - /** - * Sets [Builder.headless] to an arbitrary JSON value. - * - * You should usually call [Builder.headless] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun headless(headless: JsonField) = apply { this.headless = headless } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LocalBrowserLaunchOptions]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): LocalBrowserLaunchOptions = - LocalBrowserLaunchOptions(headless, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): LocalBrowserLaunchOptions = apply { - if (validated) { - return@apply - } - - headless() - 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 (headless.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LocalBrowserLaunchOptions && - headless == other.headless && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(headless, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LocalBrowserLaunchOptions{headless=$headless, additionalProperties=$additionalProperties}" + "Body{browserbaseApiKey=$browserbaseApiKey, browserbaseProjectId=$browserbaseProjectId, domSettleTimeout=$domSettleTimeout, model=$model, selfHeal=$selfHeal, systemPrompt=$systemPrompt, verbose=$verbose, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionStartResponse.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartResponse.kt similarity index 95% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionStartResponse.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartResponse.kt index b8bc8da..2e71372 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/models/sessions/SessionStartResponse.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartResponse.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions - +package com.browserbase.api.models.sessions + +import com.browserbase.api.core.ExcludeMissing +import com.browserbase.api.core.JsonField +import com.browserbase.api.core.JsonMissing +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.checkRequired +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.stagehand.api.core.ExcludeMissing -import com.stagehand.api.core.JsonField -import com.stagehand.api.core.JsonMissing -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.checkRequired -import com.stagehand.api.errors.StagehandInvalidDataException import java.util.Collections import java.util.Objects diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/services/async/SessionServiceAsync.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/services/async/SessionServiceAsync.kt similarity index 94% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/services/async/SessionServiceAsync.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/services/async/SessionServiceAsync.kt index 12589d9..5c78924 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/services/async/SessionServiceAsync.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/services/async/SessionServiceAsync.kt @@ -1,24 +1,24 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.services.async - -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.core.RequestOptions -import com.stagehand.api.core.http.HttpResponseFor -import com.stagehand.api.models.sessions.Action -import com.stagehand.api.models.sessions.SessionActParams -import com.stagehand.api.models.sessions.SessionActResponse -import com.stagehand.api.models.sessions.SessionEndParams -import com.stagehand.api.models.sessions.SessionEndResponse -import com.stagehand.api.models.sessions.SessionExecuteAgentParams -import com.stagehand.api.models.sessions.SessionExecuteAgentResponse -import com.stagehand.api.models.sessions.SessionExtractParams -import com.stagehand.api.models.sessions.SessionExtractResponse -import com.stagehand.api.models.sessions.SessionNavigateParams -import com.stagehand.api.models.sessions.SessionNavigateResponse -import com.stagehand.api.models.sessions.SessionObserveParams -import com.stagehand.api.models.sessions.SessionStartParams -import com.stagehand.api.models.sessions.SessionStartResponse +package com.browserbase.api.services.async + +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.core.RequestOptions +import com.browserbase.api.core.http.HttpResponseFor +import com.browserbase.api.models.sessions.Action +import com.browserbase.api.models.sessions.SessionActParams +import com.browserbase.api.models.sessions.SessionActResponse +import com.browserbase.api.models.sessions.SessionEndParams +import com.browserbase.api.models.sessions.SessionEndResponse +import com.browserbase.api.models.sessions.SessionExecuteAgentParams +import com.browserbase.api.models.sessions.SessionExecuteAgentResponse +import com.browserbase.api.models.sessions.SessionExtractParams +import com.browserbase.api.models.sessions.SessionExtractResponse +import com.browserbase.api.models.sessions.SessionNavigateParams +import com.browserbase.api.models.sessions.SessionNavigateResponse +import com.browserbase.api.models.sessions.SessionObserveParams +import com.browserbase.api.models.sessions.SessionStartParams +import com.browserbase.api.models.sessions.SessionStartResponse import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.function.Consumer diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/services/async/SessionServiceAsyncImpl.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/services/async/SessionServiceAsyncImpl.kt similarity index 89% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/services/async/SessionServiceAsyncImpl.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/services/async/SessionServiceAsyncImpl.kt index a103a22..baa7114 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/services/async/SessionServiceAsyncImpl.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/services/async/SessionServiceAsyncImpl.kt @@ -1,35 +1,35 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.services.async +package com.browserbase.api.services.async -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.core.RequestOptions -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.handlers.errorBodyHandler -import com.stagehand.api.core.handlers.errorHandler -import com.stagehand.api.core.handlers.jsonHandler -import com.stagehand.api.core.http.HttpMethod -import com.stagehand.api.core.http.HttpRequest -import com.stagehand.api.core.http.HttpResponse -import com.stagehand.api.core.http.HttpResponse.Handler -import com.stagehand.api.core.http.HttpResponseFor -import com.stagehand.api.core.http.json -import com.stagehand.api.core.http.parseable -import com.stagehand.api.core.prepareAsync -import com.stagehand.api.models.sessions.Action -import com.stagehand.api.models.sessions.SessionActParams -import com.stagehand.api.models.sessions.SessionActResponse -import com.stagehand.api.models.sessions.SessionEndParams -import com.stagehand.api.models.sessions.SessionEndResponse -import com.stagehand.api.models.sessions.SessionExecuteAgentParams -import com.stagehand.api.models.sessions.SessionExecuteAgentResponse -import com.stagehand.api.models.sessions.SessionExtractParams -import com.stagehand.api.models.sessions.SessionExtractResponse -import com.stagehand.api.models.sessions.SessionNavigateParams -import com.stagehand.api.models.sessions.SessionNavigateResponse -import com.stagehand.api.models.sessions.SessionObserveParams -import com.stagehand.api.models.sessions.SessionStartParams -import com.stagehand.api.models.sessions.SessionStartResponse +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.core.RequestOptions +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.handlers.errorBodyHandler +import com.browserbase.api.core.handlers.errorHandler +import com.browserbase.api.core.handlers.jsonHandler +import com.browserbase.api.core.http.HttpMethod +import com.browserbase.api.core.http.HttpRequest +import com.browserbase.api.core.http.HttpResponse +import com.browserbase.api.core.http.HttpResponse.Handler +import com.browserbase.api.core.http.HttpResponseFor +import com.browserbase.api.core.http.json +import com.browserbase.api.core.http.parseable +import com.browserbase.api.core.prepareAsync +import com.browserbase.api.models.sessions.Action +import com.browserbase.api.models.sessions.SessionActParams +import com.browserbase.api.models.sessions.SessionActResponse +import com.browserbase.api.models.sessions.SessionEndParams +import com.browserbase.api.models.sessions.SessionEndResponse +import com.browserbase.api.models.sessions.SessionExecuteAgentParams +import com.browserbase.api.models.sessions.SessionExecuteAgentResponse +import com.browserbase.api.models.sessions.SessionExtractParams +import com.browserbase.api.models.sessions.SessionExtractResponse +import com.browserbase.api.models.sessions.SessionNavigateParams +import com.browserbase.api.models.sessions.SessionNavigateResponse +import com.browserbase.api.models.sessions.SessionObserveParams +import com.browserbase.api.models.sessions.SessionStartParams +import com.browserbase.api.models.sessions.SessionStartResponse import java.util.Optional import java.util.concurrent.CompletableFuture import java.util.function.Consumer diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/services/blocking/SessionService.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/services/blocking/SessionService.kt similarity index 93% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/services/blocking/SessionService.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/services/blocking/SessionService.kt index b605953..aac24dc 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/services/blocking/SessionService.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/services/blocking/SessionService.kt @@ -1,25 +1,25 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.services.blocking - +package com.browserbase.api.services.blocking + +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.core.RequestOptions +import com.browserbase.api.core.http.HttpResponseFor +import com.browserbase.api.models.sessions.Action +import com.browserbase.api.models.sessions.SessionActParams +import com.browserbase.api.models.sessions.SessionActResponse +import com.browserbase.api.models.sessions.SessionEndParams +import com.browserbase.api.models.sessions.SessionEndResponse +import com.browserbase.api.models.sessions.SessionExecuteAgentParams +import com.browserbase.api.models.sessions.SessionExecuteAgentResponse +import com.browserbase.api.models.sessions.SessionExtractParams +import com.browserbase.api.models.sessions.SessionExtractResponse +import com.browserbase.api.models.sessions.SessionNavigateParams +import com.browserbase.api.models.sessions.SessionNavigateResponse +import com.browserbase.api.models.sessions.SessionObserveParams +import com.browserbase.api.models.sessions.SessionStartParams +import com.browserbase.api.models.sessions.SessionStartResponse import com.google.errorprone.annotations.MustBeClosed -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.core.RequestOptions -import com.stagehand.api.core.http.HttpResponseFor -import com.stagehand.api.models.sessions.Action -import com.stagehand.api.models.sessions.SessionActParams -import com.stagehand.api.models.sessions.SessionActResponse -import com.stagehand.api.models.sessions.SessionEndParams -import com.stagehand.api.models.sessions.SessionEndResponse -import com.stagehand.api.models.sessions.SessionExecuteAgentParams -import com.stagehand.api.models.sessions.SessionExecuteAgentResponse -import com.stagehand.api.models.sessions.SessionExtractParams -import com.stagehand.api.models.sessions.SessionExtractResponse -import com.stagehand.api.models.sessions.SessionNavigateParams -import com.stagehand.api.models.sessions.SessionNavigateResponse -import com.stagehand.api.models.sessions.SessionObserveParams -import com.stagehand.api.models.sessions.SessionStartParams -import com.stagehand.api.models.sessions.SessionStartResponse import java.util.Optional import java.util.function.Consumer diff --git a/stagehand-java-core/src/main/kotlin/com/stagehand/api/services/blocking/SessionServiceImpl.kt b/stagehand-java-core/src/main/kotlin/com/browserbase/api/services/blocking/SessionServiceImpl.kt similarity index 88% rename from stagehand-java-core/src/main/kotlin/com/stagehand/api/services/blocking/SessionServiceImpl.kt rename to stagehand-java-core/src/main/kotlin/com/browserbase/api/services/blocking/SessionServiceImpl.kt index f154a4a..6c09595 100644 --- a/stagehand-java-core/src/main/kotlin/com/stagehand/api/services/blocking/SessionServiceImpl.kt +++ b/stagehand-java-core/src/main/kotlin/com/browserbase/api/services/blocking/SessionServiceImpl.kt @@ -1,35 +1,35 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.services.blocking +package com.browserbase.api.services.blocking -import com.stagehand.api.core.ClientOptions -import com.stagehand.api.core.RequestOptions -import com.stagehand.api.core.checkRequired -import com.stagehand.api.core.handlers.errorBodyHandler -import com.stagehand.api.core.handlers.errorHandler -import com.stagehand.api.core.handlers.jsonHandler -import com.stagehand.api.core.http.HttpMethod -import com.stagehand.api.core.http.HttpRequest -import com.stagehand.api.core.http.HttpResponse -import com.stagehand.api.core.http.HttpResponse.Handler -import com.stagehand.api.core.http.HttpResponseFor -import com.stagehand.api.core.http.json -import com.stagehand.api.core.http.parseable -import com.stagehand.api.core.prepare -import com.stagehand.api.models.sessions.Action -import com.stagehand.api.models.sessions.SessionActParams -import com.stagehand.api.models.sessions.SessionActResponse -import com.stagehand.api.models.sessions.SessionEndParams -import com.stagehand.api.models.sessions.SessionEndResponse -import com.stagehand.api.models.sessions.SessionExecuteAgentParams -import com.stagehand.api.models.sessions.SessionExecuteAgentResponse -import com.stagehand.api.models.sessions.SessionExtractParams -import com.stagehand.api.models.sessions.SessionExtractResponse -import com.stagehand.api.models.sessions.SessionNavigateParams -import com.stagehand.api.models.sessions.SessionNavigateResponse -import com.stagehand.api.models.sessions.SessionObserveParams -import com.stagehand.api.models.sessions.SessionStartParams -import com.stagehand.api.models.sessions.SessionStartResponse +import com.browserbase.api.core.ClientOptions +import com.browserbase.api.core.RequestOptions +import com.browserbase.api.core.checkRequired +import com.browserbase.api.core.handlers.errorBodyHandler +import com.browserbase.api.core.handlers.errorHandler +import com.browserbase.api.core.handlers.jsonHandler +import com.browserbase.api.core.http.HttpMethod +import com.browserbase.api.core.http.HttpRequest +import com.browserbase.api.core.http.HttpResponse +import com.browserbase.api.core.http.HttpResponse.Handler +import com.browserbase.api.core.http.HttpResponseFor +import com.browserbase.api.core.http.json +import com.browserbase.api.core.http.parseable +import com.browserbase.api.core.prepare +import com.browserbase.api.models.sessions.Action +import com.browserbase.api.models.sessions.SessionActParams +import com.browserbase.api.models.sessions.SessionActResponse +import com.browserbase.api.models.sessions.SessionEndParams +import com.browserbase.api.models.sessions.SessionEndResponse +import com.browserbase.api.models.sessions.SessionExecuteAgentParams +import com.browserbase.api.models.sessions.SessionExecuteAgentResponse +import com.browserbase.api.models.sessions.SessionExtractParams +import com.browserbase.api.models.sessions.SessionExtractResponse +import com.browserbase.api.models.sessions.SessionNavigateParams +import com.browserbase.api.models.sessions.SessionNavigateResponse +import com.browserbase.api.models.sessions.SessionObserveParams +import com.browserbase.api.models.sessions.SessionStartParams +import com.browserbase.api.models.sessions.SessionStartResponse import java.util.Optional import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull diff --git a/stagehand-java-core/src/main/resources/META-INF/proguard/stagehand-java-core.pro b/stagehand-java-core/src/main/resources/META-INF/proguard/stagehand-java-core.pro index 246b6fe..474257e 100644 --- a/stagehand-java-core/src/main/resources/META-INF/proguard/stagehand-java-core.pro +++ b/stagehand-java-core/src/main/resources/META-INF/proguard/stagehand-java-core.pro @@ -22,11 +22,11 @@ -keep class * extends com.fasterxml.jackson.core.type.TypeReference { *; } # Jackson uses reflection to access our class serializers and deserializers. --keep @com.fasterxml.jackson.databind.annotation.JsonSerialize class com.stagehand.api.** { *; } --keep @com.fasterxml.jackson.databind.annotation.JsonDeserialize class com.stagehand.api.** { *; } +-keep @com.fasterxml.jackson.databind.annotation.JsonSerialize class com.browserbase.api.** { *; } +-keep @com.fasterxml.jackson.databind.annotation.JsonDeserialize class com.browserbase.api.** { *; } # Jackson uses reflection to serialize and deserialize our classes based on their constructors and annotated members. --keepclassmembers class com.stagehand.api.** { +-keepclassmembers class com.browserbase.api.** { (...); @com.fasterxml.jackson.annotation.* *; } \ No newline at end of file diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/TestServerExtension.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/TestServerExtension.kt similarity index 98% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/TestServerExtension.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/TestServerExtension.kt index 47f81ce..d83abd1 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/TestServerExtension.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/TestServerExtension.kt @@ -1,4 +1,4 @@ -package com.stagehand.api +package com.browserbase.api import java.lang.RuntimeException import java.net.URL diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ClientOptionsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ClientOptionsTest.kt similarity index 73% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ClientOptionsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ClientOptionsTest.kt index 153fd8f..75d56e8 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ClientOptionsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ClientOptionsTest.kt @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.core +package com.browserbase.api.core -import com.stagehand.api.core.http.HttpClient +import com.browserbase.api.core.http.HttpClient import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -19,7 +19,12 @@ internal class ClientOptionsTest { @Test fun toBuilder_whenOriginalClientOptionsGarbageCollected_doesNotCloseOriginalClient() { var clientOptions = - ClientOptions.builder().httpClient(httpClient).apiKey("My API Key").build() + ClientOptions.builder() + .httpClient(httpClient) + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") + .build() verify(httpClient, never()).close() // Overwrite the `clientOptions` variable so that the original `ClientOptions` is GC'd. diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ObjectMappersTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ObjectMappersTest.kt similarity index 99% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ObjectMappersTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ObjectMappersTest.kt index d4a23d2..d405053 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ObjectMappersTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ObjectMappersTest.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.exc.MismatchedInputException diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/PhantomReachableTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/PhantomReachableTest.kt similarity index 95% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/PhantomReachableTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/PhantomReachableTest.kt index f5cf23d..b1d98ae 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/PhantomReachableTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/PhantomReachableTest.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/UtilsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/UtilsTest.kt similarity index 97% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/UtilsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/UtilsTest.kt index b452f98..163e1a2 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/UtilsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/UtilsTest.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ValuesTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ValuesTest.kt similarity index 99% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ValuesTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ValuesTest.kt index 4d5b67c..d098377 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/ValuesTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/ValuesTest.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core +package com.browserbase.api.core import java.util.Optional import org.assertj.core.api.Assertions.assertThat diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/AsyncStreamResponseTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/AsyncStreamResponseTest.kt similarity index 99% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/AsyncStreamResponseTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/AsyncStreamResponseTest.kt index f30d55c..c5d8e71 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/AsyncStreamResponseTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/AsyncStreamResponseTest.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http import java.util.* import java.util.concurrent.CompletableFuture diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/HeadersTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/HeadersTest.kt similarity index 99% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/HeadersTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/HeadersTest.kt index dae2b71..81b7261 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/HeadersTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/HeadersTest.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.params.ParameterizedTest diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/QueryParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/QueryParamsTest.kt similarity index 99% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/QueryParamsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/QueryParamsTest.kt index 1210beb..8d98e38 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/QueryParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/QueryParamsTest.kt @@ -1,4 +1,4 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.params.ParameterizedTest diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/RetryingHttpClientTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/RetryingHttpClientTest.kt similarity index 98% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/RetryingHttpClientTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/RetryingHttpClientTest.kt index 380321a..b3fbe9b 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/core/http/RetryingHttpClientTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/core/http/RetryingHttpClientTest.kt @@ -1,13 +1,13 @@ -package com.stagehand.api.core.http +package com.browserbase.api.core.http +import com.browserbase.api.client.okhttp.OkHttpClient +import com.browserbase.api.core.RequestOptions +import com.browserbase.api.core.Sleeper +import com.browserbase.api.errors.StagehandRetryableException import com.github.tomakehurst.wiremock.client.WireMock.* import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.github.tomakehurst.wiremock.stubbing.Scenario -import com.stagehand.api.client.okhttp.OkHttpClient -import com.stagehand.api.core.RequestOptions -import com.stagehand.api.core.Sleeper -import com.stagehand.api.errors.StagehandRetryableException import java.io.InputStream import java.time.Duration import java.util.concurrent.CompletableFuture diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/ActionTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ActionTest.kt similarity index 94% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/ActionTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ActionTest.kt index 6928e9f..fcd120c 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/ActionTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ActionTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/ModelConfigTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ModelConfigTest.kt similarity index 94% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/ModelConfigTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ModelConfigTest.kt index a1f75ab..0430aec 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/ModelConfigTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/ModelConfigTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionActParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActParamsTest.kt similarity index 97% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionActParamsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActParamsTest.kt index 921e718..fbcca00 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionActParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActParamsTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.http.Headers import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionActResponseTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActResponseTest.kt similarity index 96% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionActResponseTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActResponseTest.kt index 7723433..7f4d8c8 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionActResponseTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionActResponseTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionEndParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndParamsTest.kt similarity index 93% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionEndParamsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndParamsTest.kt index 914b7d4..ab839e5 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionEndParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionEndResponseTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndResponseTest.kt similarity index 91% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionEndResponseTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndResponseTest.kt index a5119d5..b52414c 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionEndResponseTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionEndResponseTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentParamsTest.kt similarity index 98% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentParamsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentParamsTest.kt index 532b194..6d0d59b 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentParamsTest.kt @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.http.Headers import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentResponseTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentResponseTest.kt similarity index 91% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentResponseTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentResponseTest.kt index 9da3901..3fb7223 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExecuteAgentResponseTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExecuteAgentResponseTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.jsonMapper import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExtractParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractParamsTest.kt similarity index 97% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExtractParamsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractParamsTest.kt index 67cdf9e..7df72a7 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExtractParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractParamsTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.http.Headers import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExtractResponseTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractResponseTest.kt similarity index 80% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExtractResponseTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractResponseTest.kt index 22f62ea..42022d5 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionExtractResponseTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionExtractResponseTest.kt @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.jsonMapper +import com.browserbase.api.errors.StagehandInvalidDataException import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.jsonMapper -import com.stagehand.api.errors.StagehandInvalidDataException import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -22,7 +22,7 @@ internal class SessionExtractResponseTest { val sessionExtractResponse = SessionExtractResponse.ofExtraction(extraction) assertThat(sessionExtractResponse.extraction()).contains(extraction) - assertThat(sessionExtractResponse.unionMember1()).isEmpty + assertThat(sessionExtractResponse.custom()).isEmpty } @Test @@ -43,24 +43,24 @@ internal class SessionExtractResponseTest { } @Test - fun ofUnionMember1() { - val unionMember1 = - SessionExtractResponse.UnionMember1.builder() + fun ofCustom() { + val custom = + SessionExtractResponse.Custom.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() - val sessionExtractResponse = SessionExtractResponse.ofUnionMember1(unionMember1) + val sessionExtractResponse = SessionExtractResponse.ofCustom(custom) assertThat(sessionExtractResponse.extraction()).isEmpty - assertThat(sessionExtractResponse.unionMember1()).contains(unionMember1) + assertThat(sessionExtractResponse.custom()).contains(custom) } @Test - fun ofUnionMember1Roundtrip() { + fun ofCustomRoundtrip() { val jsonMapper = jsonMapper() val sessionExtractResponse = - SessionExtractResponse.ofUnionMember1( - SessionExtractResponse.UnionMember1.builder() + SessionExtractResponse.ofCustom( + SessionExtractResponse.Custom.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionNavigateParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateParamsTest.kt similarity index 97% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionNavigateParamsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateParamsTest.kt index 6550c8e..fe762db 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionNavigateParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateParamsTest.kt @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.http.Headers import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionNavigateResponseTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponseTest.kt similarity index 92% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionNavigateResponseTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponseTest.kt index 2ba7257..1385964 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionNavigateResponseTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionNavigateResponseTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionObserveParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionObserveParamsTest.kt similarity index 98% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionObserveParamsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionObserveParamsTest.kt index 6a3347f..a8ab677 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionObserveParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionObserveParamsTest.kt @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions -import com.stagehand.api.core.http.Headers +import com.browserbase.api.core.http.Headers import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionStartParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartParamsTest.kt similarity index 51% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionStartParamsTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartParamsTest.kt index 9c70b5b..9454bf3 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionStartParamsTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -10,14 +10,10 @@ internal class SessionStartParamsTest { @Test fun create() { SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder().headless(true).build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -28,14 +24,10 @@ internal class SessionStartParamsTest { fun body() { val params = SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder().headless(true).build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -43,13 +35,10 @@ internal class SessionStartParamsTest { val body = params._body() - assertThat(body.env()).isEqualTo(SessionStartParams.Env.LOCAL) - assertThat(body.apiKey()).contains("apiKey") + assertThat(body.browserbaseApiKey()).isEqualTo("BROWSERBASE_API_KEY") + assertThat(body.browserbaseProjectId()).isEqualTo("BROWSERBASE_PROJECT_ID") assertThat(body.domSettleTimeout()).contains(0L) - assertThat(body.localBrowserLaunchOptions()) - .contains(SessionStartParams.LocalBrowserLaunchOptions.builder().headless(true).build()) assertThat(body.model()).contains("openai/gpt-4o") - assertThat(body.projectId()).contains("projectId") assertThat(body.selfHeal()).contains(true) assertThat(body.systemPrompt()).contains("systemPrompt") assertThat(body.verbose()).contains(1L) @@ -57,10 +46,15 @@ internal class SessionStartParamsTest { @Test fun bodyWithoutOptionalFields() { - val params = SessionStartParams.builder().env(SessionStartParams.Env.LOCAL).build() + val params = + SessionStartParams.builder() + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") + .build() val body = params._body() - assertThat(body.env()).isEqualTo(SessionStartParams.Env.LOCAL) + assertThat(body.browserbaseApiKey()).isEqualTo("BROWSERBASE_API_KEY") + assertThat(body.browserbaseProjectId()).isEqualTo("BROWSERBASE_PROJECT_ID") } } diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionStartResponseTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartResponseTest.kt similarity index 93% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionStartResponseTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartResponseTest.kt index 0ddd138..714c73d 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/models/sessions/SessionStartResponseTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/models/sessions/SessionStartResponseTest.kt @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.models.sessions +package com.browserbase.api.models.sessions +import com.browserbase.api.core.jsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.core.jsonMapper import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/ErrorHandlingTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ErrorHandlingTest.kt similarity index 69% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/services/ErrorHandlingTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ErrorHandlingTest.kt index f35e2ad..509b889 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/ErrorHandlingTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ErrorHandlingTest.kt @@ -1,28 +1,28 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.services - +package com.browserbase.api.services + +import com.browserbase.api.client.StagehandClient +import com.browserbase.api.client.okhttp.StagehandOkHttpClient +import com.browserbase.api.core.JsonValue +import com.browserbase.api.core.http.Headers +import com.browserbase.api.core.jsonMapper +import com.browserbase.api.errors.BadRequestException +import com.browserbase.api.errors.InternalServerException +import com.browserbase.api.errors.NotFoundException +import com.browserbase.api.errors.PermissionDeniedException +import com.browserbase.api.errors.RateLimitException +import com.browserbase.api.errors.StagehandException +import com.browserbase.api.errors.UnauthorizedException +import com.browserbase.api.errors.UnexpectedStatusCodeException +import com.browserbase.api.errors.UnprocessableEntityException +import com.browserbase.api.models.sessions.SessionStartParams import com.github.tomakehurst.wiremock.client.WireMock.anyUrl import com.github.tomakehurst.wiremock.client.WireMock.post import com.github.tomakehurst.wiremock.client.WireMock.status import com.github.tomakehurst.wiremock.client.WireMock.stubFor import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo import com.github.tomakehurst.wiremock.junit5.WireMockTest -import com.stagehand.api.client.StagehandClient -import com.stagehand.api.client.okhttp.StagehandOkHttpClient -import com.stagehand.api.core.JsonValue -import com.stagehand.api.core.http.Headers -import com.stagehand.api.core.jsonMapper -import com.stagehand.api.errors.BadRequestException -import com.stagehand.api.errors.InternalServerException -import com.stagehand.api.errors.NotFoundException -import com.stagehand.api.errors.PermissionDeniedException -import com.stagehand.api.errors.RateLimitException -import com.stagehand.api.errors.StagehandException -import com.stagehand.api.errors.UnauthorizedException -import com.stagehand.api.errors.UnexpectedStatusCodeException -import com.stagehand.api.errors.UnprocessableEntityException -import com.stagehand.api.models.sessions.SessionStartParams import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.entry import org.junit.jupiter.api.BeforeEach @@ -54,7 +54,9 @@ internal class ErrorHandlingTest { client = StagehandOkHttpClient.builder() .baseUrl(wmRuntimeInfo.httpBaseUrl) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() } @@ -72,16 +74,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -108,16 +104,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -144,16 +134,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -180,16 +164,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -216,16 +194,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -252,16 +224,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -288,16 +254,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -324,16 +284,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -360,16 +314,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -396,16 +344,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -432,16 +374,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -468,16 +404,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -504,16 +434,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -540,16 +464,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -576,16 +494,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -612,16 +524,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) @@ -646,16 +552,10 @@ internal class ErrorHandlingTest { assertThrows { sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) 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 new file mode 100644 index 0000000..aa39440 --- /dev/null +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/ServiceParamsTest.kt @@ -0,0 +1,115 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.browserbase.api.services + +import com.browserbase.api.client.StagehandClient +import com.browserbase.api.client.okhttp.StagehandOkHttpClient +import com.browserbase.api.core.JsonValue +import com.browserbase.api.models.sessions.ModelConfig +import com.browserbase.api.models.sessions.SessionActParams +import com.browserbase.api.models.sessions.SessionStartParams +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl +import com.github.tomakehurst.wiremock.client.WireMock.equalTo +import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath +import com.github.tomakehurst.wiremock.client.WireMock.ok +import com.github.tomakehurst.wiremock.client.WireMock.post +import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor +import com.github.tomakehurst.wiremock.client.WireMock.stubFor +import com.github.tomakehurst.wiremock.client.WireMock.verify +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo +import com.github.tomakehurst.wiremock.junit5.WireMockTest +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.parallel.ResourceLock + +@WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") +internal class ServiceParamsTest { + + private lateinit var client: StagehandClient + + @BeforeEach + fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { + client = + StagehandOkHttpClient.builder() + .baseUrl(wmRuntimeInfo.httpBaseUrl) + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") + .build() + } + + @Disabled("Prism tests are disabled") + @Test + fun start() { + val sessionService = client.sessions() + stubFor(post(anyUrl()).willReturn(ok("{}"))) + + sessionService.start( + SessionStartParams.builder() + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") + .domSettleTimeout(0L) + .model("openai/gpt-4o") + .selfHeal(true) + .systemPrompt("systemPrompt") + .verbose(1L) + .putAdditionalHeader("Secret-Header", "42") + .putAdditionalQueryParam("secret_query_param", "42") + .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) + .build() + ) + + verify( + postRequestedFor(anyUrl()) + .withHeader("Secret-Header", equalTo("42")) + .withQueryParam("secret_query_param", equalTo("42")) + .withRequestBody(matchingJsonPath("$.secretProperty", equalTo("42"))) + ) + } + + @Disabled("Prism tests are disabled") + @Test + fun act() { + val sessionService = client.sessions() + stubFor(post(anyUrl()).willReturn(ok("{}"))) + + sessionService.act( + SessionActParams.builder() + .sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .xStreamResponse(SessionActParams.XStreamResponse.TRUE) + .input("click the sign in button") + .frameId("frameId") + .options( + SessionActParams.Options.builder() + .model( + ModelConfig.builder() + .apiKey("apiKey") + .baseUrl("https://example.com") + .model("model") + .provider(ModelConfig.Provider.OPENAI) + .build() + ) + .timeout(0L) + .variables( + SessionActParams.Options.Variables.builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .build() + ) + .putAdditionalHeader("Secret-Header", "42") + .putAdditionalQueryParam("secret_query_param", "42") + .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) + .build() + ) + + verify( + postRequestedFor(anyUrl()) + .withHeader("Secret-Header", equalTo("42")) + .withQueryParam("secret_query_param", equalTo("42")) + .withRequestBody(matchingJsonPath("$.secretProperty", equalTo("42"))) + ) + } +} diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/async/SessionServiceAsyncTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/async/SessionServiceAsyncTest.kt similarity index 81% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/services/async/SessionServiceAsyncTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/services/async/SessionServiceAsyncTest.kt index 49b568d..d041842 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/async/SessionServiceAsyncTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/async/SessionServiceAsyncTest.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.services.async +package com.browserbase.api.services.async -import com.stagehand.api.TestServerExtension -import com.stagehand.api.client.okhttp.StagehandOkHttpClientAsync -import com.stagehand.api.core.JsonValue -import com.stagehand.api.models.sessions.ModelConfig -import com.stagehand.api.models.sessions.SessionActParams -import com.stagehand.api.models.sessions.SessionExecuteAgentParams -import com.stagehand.api.models.sessions.SessionExtractParams -import com.stagehand.api.models.sessions.SessionNavigateParams -import com.stagehand.api.models.sessions.SessionObserveParams -import com.stagehand.api.models.sessions.SessionStartParams +import com.browserbase.api.TestServerExtension +import com.browserbase.api.client.okhttp.StagehandOkHttpClientAsync +import com.browserbase.api.core.JsonValue +import com.browserbase.api.models.sessions.ModelConfig +import com.browserbase.api.models.sessions.SessionActParams +import com.browserbase.api.models.sessions.SessionExecuteAgentParams +import com.browserbase.api.models.sessions.SessionExtractParams +import com.browserbase.api.models.sessions.SessionNavigateParams +import com.browserbase.api.models.sessions.SessionObserveParams +import com.browserbase.api.models.sessions.SessionStartParams import kotlin.jvm.optionals.getOrNull import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -26,7 +26,9 @@ internal class SessionServiceAsyncTest { val client = StagehandOkHttpClientAsync.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionServiceAsync = client.sessions() @@ -68,7 +70,9 @@ internal class SessionServiceAsyncTest { val client = StagehandOkHttpClientAsync.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionServiceAsync = client.sessions() @@ -84,7 +88,9 @@ internal class SessionServiceAsyncTest { val client = StagehandOkHttpClientAsync.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionServiceAsync = client.sessions() @@ -122,7 +128,9 @@ internal class SessionServiceAsyncTest { val client = StagehandOkHttpClientAsync.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionServiceAsync = client.sessions() @@ -165,7 +173,9 @@ internal class SessionServiceAsyncTest { val client = StagehandOkHttpClientAsync.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionServiceAsync = client.sessions() @@ -195,7 +205,9 @@ internal class SessionServiceAsyncTest { val client = StagehandOkHttpClientAsync.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionServiceAsync = client.sessions() @@ -233,23 +245,19 @@ internal class SessionServiceAsyncTest { val client = StagehandOkHttpClientAsync.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionServiceAsync = client.sessions() val responseFuture = sessionServiceAsync.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/blocking/SessionServiceTest.kt b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/blocking/SessionServiceTest.kt similarity index 80% rename from stagehand-java-core/src/test/kotlin/com/stagehand/api/services/blocking/SessionServiceTest.kt rename to stagehand-java-core/src/test/kotlin/com/browserbase/api/services/blocking/SessionServiceTest.kt index 8b92fe7..10177a3 100644 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/blocking/SessionServiceTest.kt +++ b/stagehand-java-core/src/test/kotlin/com/browserbase/api/services/blocking/SessionServiceTest.kt @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.services.blocking - -import com.stagehand.api.TestServerExtension -import com.stagehand.api.client.okhttp.StagehandOkHttpClient -import com.stagehand.api.core.JsonValue -import com.stagehand.api.models.sessions.ModelConfig -import com.stagehand.api.models.sessions.SessionActParams -import com.stagehand.api.models.sessions.SessionExecuteAgentParams -import com.stagehand.api.models.sessions.SessionExtractParams -import com.stagehand.api.models.sessions.SessionNavigateParams -import com.stagehand.api.models.sessions.SessionObserveParams -import com.stagehand.api.models.sessions.SessionStartParams +package com.browserbase.api.services.blocking + +import com.browserbase.api.TestServerExtension +import com.browserbase.api.client.okhttp.StagehandOkHttpClient +import com.browserbase.api.core.JsonValue +import com.browserbase.api.models.sessions.ModelConfig +import com.browserbase.api.models.sessions.SessionActParams +import com.browserbase.api.models.sessions.SessionExecuteAgentParams +import com.browserbase.api.models.sessions.SessionExtractParams +import com.browserbase.api.models.sessions.SessionNavigateParams +import com.browserbase.api.models.sessions.SessionObserveParams +import com.browserbase.api.models.sessions.SessionStartParams import kotlin.jvm.optionals.getOrNull import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -26,7 +26,9 @@ internal class SessionServiceTest { val client = StagehandOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionService = client.sessions() @@ -67,7 +69,9 @@ internal class SessionServiceTest { val client = StagehandOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionService = client.sessions() @@ -82,7 +86,9 @@ internal class SessionServiceTest { val client = StagehandOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionService = client.sessions() @@ -119,7 +125,9 @@ internal class SessionServiceTest { val client = StagehandOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionService = client.sessions() @@ -161,7 +169,9 @@ internal class SessionServiceTest { val client = StagehandOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionService = client.sessions() @@ -190,7 +200,9 @@ internal class SessionServiceTest { val client = StagehandOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionService = client.sessions() @@ -227,23 +239,19 @@ internal class SessionServiceTest { val client = StagehandOkHttpClient.builder() .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") .build() val sessionService = client.sessions() val response = sessionService.start( SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") + .browserbaseApiKey("BROWSERBASE_API_KEY") + .browserbaseProjectId("BROWSERBASE_PROJECT_ID") .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder() - .headless(true) - .build() - ) .model("openai/gpt-4o") - .projectId("projectId") .selfHeal(true) .systemPrompt("systemPrompt") .verbose(1L) diff --git a/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/ServiceParamsTest.kt b/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/ServiceParamsTest.kt deleted file mode 100644 index 801d8ff..0000000 --- a/stagehand-java-core/src/test/kotlin/com/stagehand/api/services/ServiceParamsTest.kt +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.stagehand.api.services - -import com.github.tomakehurst.wiremock.client.WireMock.anyUrl -import com.github.tomakehurst.wiremock.client.WireMock.equalTo -import com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath -import com.github.tomakehurst.wiremock.client.WireMock.ok -import com.github.tomakehurst.wiremock.client.WireMock.post -import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor -import com.github.tomakehurst.wiremock.client.WireMock.stubFor -import com.github.tomakehurst.wiremock.client.WireMock.verify -import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo -import com.github.tomakehurst.wiremock.junit5.WireMockTest -import com.stagehand.api.client.StagehandClient -import com.stagehand.api.client.okhttp.StagehandOkHttpClient -import com.stagehand.api.core.JsonValue -import com.stagehand.api.models.sessions.SessionStartParams -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.parallel.ResourceLock - -@WireMockTest -@ResourceLock("https://github.com/wiremock/wiremock/issues/169") -internal class ServiceParamsTest { - - private lateinit var client: StagehandClient - - @BeforeEach - fun beforeEach(wmRuntimeInfo: WireMockRuntimeInfo) { - client = - StagehandOkHttpClient.builder() - .baseUrl(wmRuntimeInfo.httpBaseUrl) - .apiKey("My API Key") - .build() - } - - @Disabled("Prism tests are disabled") - @Test - fun start() { - val sessionService = client.sessions() - stubFor(post(anyUrl()).willReturn(ok("{}"))) - - sessionService.start( - SessionStartParams.builder() - .env(SessionStartParams.Env.LOCAL) - .apiKey("apiKey") - .domSettleTimeout(0L) - .localBrowserLaunchOptions( - SessionStartParams.LocalBrowserLaunchOptions.builder().headless(true).build() - ) - .model("openai/gpt-4o") - .projectId("projectId") - .selfHeal(true) - .systemPrompt("systemPrompt") - .verbose(1L) - .putAdditionalHeader("Secret-Header", "42") - .putAdditionalQueryParam("secret_query_param", "42") - .putAdditionalBodyProperty("secretProperty", JsonValue.from("42")) - .build() - ) - - verify( - postRequestedFor(anyUrl()) - .withHeader("Secret-Header", equalTo("42")) - .withQueryParam("secret_query_param", equalTo("42")) - .withRequestBody(matchingJsonPath("$.secretProperty", equalTo("42"))) - ) - } -} diff --git a/stagehand-java-proguard-test/build.gradle.kts b/stagehand-java-proguard-test/build.gradle.kts index a4cde75..9641bb2 100644 --- a/stagehand-java-proguard-test/build.gradle.kts +++ b/stagehand-java-proguard-test/build.gradle.kts @@ -59,7 +59,7 @@ val testProGuard by tasks.registering(JavaExec::class) { dependsOn(proguardJar) notCompatibleWithConfigurationCache("ProGuard") - mainClass.set("com.stagehand.api.proguard.ProGuardCompatibilityTest") + mainClass.set("com.browserbase.api.proguard.ProGuardCompatibilityTest") classpath = files(proguardJarPath) } @@ -89,7 +89,7 @@ val testR8 by tasks.registering(JavaExec::class) { dependsOn(r8Jar) notCompatibleWithConfigurationCache("R8") - mainClass.set("com.stagehand.api.proguard.ProGuardCompatibilityTest") + mainClass.set("com.browserbase.api.proguard.ProGuardCompatibilityTest") classpath = files(r8JarPath) } diff --git a/stagehand-java-proguard-test/src/test/kotlin/com/stagehand/api/proguard/ProGuardCompatibilityTest.kt b/stagehand-java-proguard-test/src/test/kotlin/com/browserbase/api/proguard/ProGuardCompatibilityTest.kt similarity index 83% rename from stagehand-java-proguard-test/src/test/kotlin/com/stagehand/api/proguard/ProGuardCompatibilityTest.kt rename to stagehand-java-proguard-test/src/test/kotlin/com/browserbase/api/proguard/ProGuardCompatibilityTest.kt index 13ad08e..3960aa2 100644 --- a/stagehand-java-proguard-test/src/test/kotlin/com/stagehand/api/proguard/ProGuardCompatibilityTest.kt +++ b/stagehand-java-proguard-test/src/test/kotlin/com/browserbase/api/proguard/ProGuardCompatibilityTest.kt @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. -package com.stagehand.api.proguard +package com.browserbase.api.proguard +import com.browserbase.api.client.okhttp.StagehandOkHttpClient +import com.browserbase.api.core.jsonMapper +import com.browserbase.api.models.sessions.Action +import com.browserbase.api.models.sessions.SessionExtractResponse import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.stagehand.api.client.okhttp.StagehandOkHttpClient -import com.stagehand.api.core.jsonMapper -import com.stagehand.api.models.sessions.Action -import com.stagehand.api.models.sessions.SessionExtractResponse import kotlin.reflect.full.memberFunctions import kotlin.reflect.jvm.javaMethod import org.assertj.core.api.Assertions.assertThat @@ -45,7 +45,12 @@ internal class ProGuardCompatibilityTest { @Test fun client() { - val client = StagehandOkHttpClient.builder().apiKey("My API Key").build() + val client = + StagehandOkHttpClient.builder() + .browserbaseApiKey("My Browserbase API Key") + .browserbaseProjectId("My Browserbase Project ID") + .modelApiKey("My Model API Key") + .build() assertThat(client).isNotNull() assertThat(client.sessions()).isNotNull() diff --git a/stagehand-java-proguard-test/test.pro b/stagehand-java-proguard-test/test.pro index 3db213a..47be604 100644 --- a/stagehand-java-proguard-test/test.pro +++ b/stagehand-java-proguard-test/test.pro @@ -1,5 +1,5 @@ # Specify the entrypoint where ProGuard starts to determine what's reachable. --keep class com.stagehand.api.proguard.** { *; } +-keep class com.browserbase.api.proguard.** { *; } # For the testing framework. -keep class org.junit.** { *; }