Skip to content

Commit 4700262

Browse files
feat: [STG-1808] Deprecate Browserbase project ID
1 parent ab25ab1 commit 4700262

6 files changed

Lines changed: 62 additions & 18 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-7182c741edd5e22cda9bd855d31ca7e60a97a409222bb887edf87b9ce15dd493.yml
3-
openapi_spec_hash: 174581867a9191c491b22855b64c4f19
4-
config_hash: a962ae71493deb11a1c903256fb25386
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase/stagehand-f10429ab9f004c9a7f9f362d7fa82915e0dc04b1ba08a7bc9fd442ed5854cc77.yml
3+
openapi_spec_hash: 818f2e6e7eb5eb6f21f346b0b9828dce
4+
config_hash: 1fb12ae9b478488bc1e56bfbdc210b01

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ See this table for the available options:
295295
| Setter | System property | Environment variable | Required | Default value |
296296
| ---------------------- | -------------------------------- | ------------------------ | -------- | ----------------------------------------- |
297297
| `browserbaseApiKey` | `stagehand.browserbaseApiKey` | `BROWSERBASE_API_KEY` | true | - |
298-
| `browserbaseProjectId` | `stagehand.browserbaseProjectId` | `BROWSERBASE_PROJECT_ID` | true | - |
298+
| `browserbaseProjectId` | `stagehand.browserbaseProjectId` | `BROWSERBASE_PROJECT_ID` | false | - |
299299
| `modelApiKey` | `stagehand.modelApiKey` | `MODEL_API_KEY` | true | - |
300300
| `baseUrl` | `stagehand.baseUrl` | `STAGEHAND_API_URL` | true | `"https://api.stagehand.browserbase.com"` |
301301

stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClient.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,21 @@ class StagehandOkHttpClient private constructor() {
295295
clientOptions.browserbaseApiKey(browserbaseApiKey)
296296
}
297297

298-
/** Your [Browserbase Project ID](https://www.browserbase.com/settings) */
299-
fun browserbaseProjectId(browserbaseProjectId: String) = apply {
298+
/**
299+
* Deprecated. Browserbase API keys are now project-scoped, so this value is no longer
300+
* required.
301+
*/
302+
fun browserbaseProjectId(browserbaseProjectId: String?) = apply {
300303
clientOptions.browserbaseProjectId(browserbaseProjectId)
301304
}
302305

306+
/**
307+
* Alias for calling [Builder.browserbaseProjectId] with
308+
* `browserbaseProjectId.orElse(null)`.
309+
*/
310+
fun browserbaseProjectId(browserbaseProjectId: Optional<String>) =
311+
browserbaseProjectId(browserbaseProjectId.getOrNull())
312+
303313
/** Your LLM provider API key (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) */
304314
fun modelApiKey(modelApiKey: String) = apply { clientOptions.modelApiKey(modelApiKey) }
305315

stagehand-java-client-okhttp/src/main/kotlin/com/browserbase/api/client/okhttp/StagehandOkHttpClientAsync.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,21 @@ class StagehandOkHttpClientAsync private constructor() {
295295
clientOptions.browserbaseApiKey(browserbaseApiKey)
296296
}
297297

298-
/** Your [Browserbase Project ID](https://www.browserbase.com/settings) */
299-
fun browserbaseProjectId(browserbaseProjectId: String) = apply {
298+
/**
299+
* Deprecated. Browserbase API keys are now project-scoped, so this value is no longer
300+
* required.
301+
*/
302+
fun browserbaseProjectId(browserbaseProjectId: String?) = apply {
300303
clientOptions.browserbaseProjectId(browserbaseProjectId)
301304
}
302305

306+
/**
307+
* Alias for calling [Builder.browserbaseProjectId] with
308+
* `browserbaseProjectId.orElse(null)`.
309+
*/
310+
fun browserbaseProjectId(browserbaseProjectId: Optional<String>) =
311+
browserbaseProjectId(browserbaseProjectId.getOrNull())
312+
303313
/** Your LLM provider API key (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) */
304314
fun modelApiKey(modelApiKey: String) = apply { clientOptions.modelApiKey(modelApiKey) }
305315

stagehand-java-core/src/main/kotlin/com/browserbase/api/core/ClientOptions.kt

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ private constructor(
112112
@get:JvmName("maxRetries") val maxRetries: Int,
113113
/** Your [Browserbase API Key](https://www.browserbase.com/settings) */
114114
@get:JvmName("browserbaseApiKey") val browserbaseApiKey: String,
115-
/** Your [Browserbase Project ID](https://www.browserbase.com/settings) */
116-
@get:JvmName("browserbaseProjectId") val browserbaseProjectId: String,
115+
private val browserbaseProjectId: String?,
117116
/** Your LLM provider API key (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) */
118117
@get:JvmName("modelApiKey") val modelApiKey: String,
119118
) {
@@ -131,6 +130,11 @@ private constructor(
131130
*/
132131
fun baseUrl(): String = baseUrl ?: PRODUCTION_URL
133132

133+
/**
134+
* Deprecated. Browserbase API keys are now project-scoped, so this value is no longer required.
135+
*/
136+
fun browserbaseProjectId(): Optional<String> = Optional.ofNullable(browserbaseProjectId)
137+
134138
fun toBuilder() = Builder().from(this)
135139

136140
companion object {
@@ -144,7 +148,6 @@ private constructor(
144148
* ```java
145149
* .httpClient()
146150
* .browserbaseApiKey()
147-
* .browserbaseProjectId()
148151
* .modelApiKey()
149152
* ```
150153
*/
@@ -322,11 +325,21 @@ private constructor(
322325
this.browserbaseApiKey = browserbaseApiKey
323326
}
324327

325-
/** Your [Browserbase Project ID](https://www.browserbase.com/settings) */
326-
fun browserbaseProjectId(browserbaseProjectId: String) = apply {
328+
/**
329+
* Deprecated. Browserbase API keys are now project-scoped, so this value is no longer
330+
* required.
331+
*/
332+
fun browserbaseProjectId(browserbaseProjectId: String?) = apply {
327333
this.browserbaseProjectId = browserbaseProjectId
328334
}
329335

336+
/**
337+
* Alias for calling [Builder.browserbaseProjectId] with
338+
* `browserbaseProjectId.orElse(null)`.
339+
*/
340+
fun browserbaseProjectId(browserbaseProjectId: Optional<String>) =
341+
browserbaseProjectId(browserbaseProjectId.getOrNull())
342+
330343
/** Your LLM provider API key (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) */
331344
fun modelApiKey(modelApiKey: String) = apply { this.modelApiKey = modelApiKey }
332345

@@ -420,7 +433,7 @@ private constructor(
420433
* |Setter |System property |Environment variable |Required|Default value |
421434
* |----------------------|--------------------------------|------------------------|--------|-----------------------------------------|
422435
* |`browserbaseApiKey` |`stagehand.browserbaseApiKey` |`BROWSERBASE_API_KEY` |true |- |
423-
* |`browserbaseProjectId`|`stagehand.browserbaseProjectId`|`BROWSERBASE_PROJECT_ID`|true |- |
436+
* |`browserbaseProjectId`|`stagehand.browserbaseProjectId`|`BROWSERBASE_PROJECT_ID`|false |- |
424437
* |`modelApiKey` |`stagehand.modelApiKey` |`MODEL_API_KEY` |true |- |
425438
* |`baseUrl` |`stagehand.baseUrl` |`STAGEHAND_API_URL` |true |`"https://api.stagehand.browserbase.com"`|
426439
*
@@ -460,7 +473,6 @@ private constructor(
460473
* ```java
461474
* .httpClient()
462475
* .browserbaseApiKey()
463-
* .browserbaseProjectId()
464476
* .modelApiKey()
465477
* ```
466478
*
@@ -488,7 +500,6 @@ private constructor(
488500
)
489501
val sleeper = sleeper ?: PhantomReachableSleeper(DefaultSleeper())
490502
val browserbaseApiKey = checkRequired("browserbaseApiKey", browserbaseApiKey)
491-
val browserbaseProjectId = checkRequired("browserbaseProjectId", browserbaseProjectId)
492503
val modelApiKey = checkRequired("modelApiKey", modelApiKey)
493504

494505
val headers = Headers.builder()
@@ -509,7 +520,7 @@ private constructor(
509520
headers.replace("x-bb-api-key", it)
510521
}
511522
}
512-
browserbaseProjectId.let {
523+
browserbaseProjectId?.let {
513524
if (!it.isEmpty()) {
514525
headers.replace("x-bb-project-id", it)
515526
}

stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionStartParams.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3392,9 +3392,13 @@ private constructor(
33923392
fun keepAlive(): Optional<Boolean> = keepAlive.getOptional("keepAlive")
33933393

33943394
/**
3395+
* Deprecated. Browserbase API keys are now project-scoped, so this field is no longer
3396+
* required.
3397+
*
33953398
* @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
33963399
* the server responded with an unexpected value).
33973400
*/
3401+
@Deprecated("deprecated")
33983402
fun projectId(): Optional<String> = projectId.getOptional("projectId")
33993403

34003404
/**
@@ -3452,7 +3456,10 @@ private constructor(
34523456
*
34533457
* Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type.
34543458
*/
3455-
@JsonProperty("projectId") @ExcludeMissing fun _projectId(): JsonField<String> = projectId
3459+
@Deprecated("deprecated")
3460+
@JsonProperty("projectId")
3461+
@ExcludeMissing
3462+
fun _projectId(): JsonField<String> = projectId
34563463

34573464
/**
34583465
* Returns the raw JSON value of [proxies].
@@ -3572,6 +3579,11 @@ private constructor(
35723579
*/
35733580
fun keepAlive(keepAlive: JsonField<Boolean>) = apply { this.keepAlive = keepAlive }
35743581

3582+
/**
3583+
* Deprecated. Browserbase API keys are now project-scoped, so this field is no longer
3584+
* required.
3585+
*/
3586+
@Deprecated("deprecated")
35753587
fun projectId(projectId: String) = projectId(JsonField.of(projectId))
35763588

35773589
/**
@@ -3581,6 +3593,7 @@ private constructor(
35813593
* This method is primarily for setting the field to an undocumented or not yet
35823594
* supported value.
35833595
*/
3596+
@Deprecated("deprecated")
35843597
fun projectId(projectId: JsonField<String>) = apply { this.projectId = projectId }
35853598

35863599
fun proxies(proxies: Proxies) = proxies(JsonField.of(proxies))

0 commit comments

Comments
 (0)