33package com.stagehand.api.client.okhttp
44
55import com.fasterxml.jackson.databind.json.JsonMapper
6- import com.stagehand.api.client.StagehandClientAsync
7- import com.stagehand.api.client.StagehandClientAsyncImpl
6+ import com.stagehand.api.client.BrowserbaseClientAsync
7+ import com.stagehand.api.client.BrowserbaseClientAsyncImpl
88import com.stagehand.api.core.ClientOptions
99import com.stagehand.api.core.Sleeper
1010import com.stagehand.api.core.Timeout
@@ -22,25 +22,25 @@ import javax.net.ssl.X509TrustManager
2222import kotlin.jvm.optionals.getOrNull
2323
2424/* *
25- * A class that allows building an instance of [StagehandClientAsync ] with [OkHttpClient] as the
25+ * A class that allows building an instance of [BrowserbaseClientAsync ] with [OkHttpClient] as the
2626 * underlying [HttpClient].
2727 */
28- class StagehandOkHttpClientAsync private constructor() {
28+ class BrowserbaseOkHttpClientAsync private constructor() {
2929
3030 companion object {
3131
32- /* * Returns a mutable builder for constructing an instance of [StagehandClientAsync ]. */
32+ /* * Returns a mutable builder for constructing an instance of [BrowserbaseClientAsync ]. */
3333 @JvmStatic fun builder () = Builder ()
3434
3535 /* *
3636 * Returns a client configured using system properties and environment variables.
3737 *
3838 * @see ClientOptions.Builder.fromEnv
3939 */
40- @JvmStatic fun fromEnv (): StagehandClientAsync = builder().fromEnv().build()
40+ @JvmStatic fun fromEnv (): BrowserbaseClientAsync = builder().fromEnv().build()
4141 }
4242
43- /* * A builder for [StagehandOkHttpClientAsync ]. */
43+ /* * A builder for [BrowserbaseOkHttpClientAsync ]. */
4444 class Builder internal constructor() {
4545
4646 private var clientOptions: ClientOptions .Builder = ClientOptions .builder()
@@ -144,18 +144,22 @@ class StagehandOkHttpClientAsync private constructor() {
144144 /* *
145145 * The base URL to use for every request.
146146 *
147- * Defaults to the production environment: `http ://localhost:3000 /v1`.
147+ * Defaults to the production environment: `https ://api.stagehand.browserbase.com /v1`.
148148 *
149149 * The following other environments, with dedicated builder methods, are available:
150- * - environment_1: `https://api.stagehand.browserbase.com/v1`
150+ * - dev: `https://api.stagehand.dev.browserbase.com/v1`
151+ * - local: `http://localhost:5000/v1`
151152 */
152153 fun baseUrl (baseUrl : String? ) = apply { clientOptions.baseUrl(baseUrl) }
153154
154155 /* * Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
155156 fun baseUrl (baseUrl : Optional <String >) = baseUrl(baseUrl.getOrNull())
156157
157- /* * Sets [baseUrl] to `https://api.stagehand.browserbase.com/v1`. */
158- fun environment1 () = apply { clientOptions.environment1() }
158+ /* * Sets [baseUrl] to `https://api.stagehand.dev.browserbase.com/v1`. */
159+ fun dev () = apply { clientOptions.dev() }
160+
161+ /* * Sets [baseUrl] to `http://localhost:5000/v1`. */
162+ fun local () = apply { clientOptions.local() }
159163
160164 /* *
161165 * Whether to call `validate` on every response before returning it.
@@ -201,10 +205,7 @@ class StagehandOkHttpClientAsync private constructor() {
201205 */
202206 fun maxRetries (maxRetries : Int ) = apply { clientOptions.maxRetries(maxRetries) }
203207
204- fun apiKey (apiKey : String? ) = apply { clientOptions.apiKey(apiKey) }
205-
206- /* * Alias for calling [Builder.apiKey] with `apiKey.orElse(null)`. */
207- fun apiKey (apiKey : Optional <String >) = apiKey(apiKey.getOrNull())
208+ fun apiKey (apiKey : String ) = apply { clientOptions.apiKey(apiKey) }
208209
209210 fun headers (headers : Headers ) = apply { clientOptions.headers(headers) }
210211
@@ -294,12 +295,12 @@ class StagehandOkHttpClientAsync private constructor() {
294295 fun fromEnv () = apply { clientOptions.fromEnv() }
295296
296297 /* *
297- * Returns an immutable instance of [StagehandClientAsync ].
298+ * Returns an immutable instance of [BrowserbaseClientAsync ].
298299 *
299300 * Further updates to this [Builder] will not mutate the returned instance.
300301 */
301- fun build (): StagehandClientAsync =
302- StagehandClientAsyncImpl (
302+ fun build (): BrowserbaseClientAsync =
303+ BrowserbaseClientAsyncImpl (
303304 clientOptions
304305 .httpClient(
305306 OkHttpClient .builder()
0 commit comments