Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
chore: update api url (#23)
Browse files Browse the repository at this point in the history
Co-authored-by: Max Beatty <[email protected]>
  • Loading branch information
kamath and maxbeatty authored Oct 29, 2024
1 parent 3d85156 commit d432a5c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
1 change: 1 addition & 0 deletions .changeset/eee3da6b3491b3d8d8eada4b938d6cd858aa9670.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update the base URL to point to api.browserbase.com instead of www.
5 changes: 5 additions & 0 deletions .changeset/four-hornets-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@browserbasehq/sdk": minor
---

chore: update api url
37 changes: 18 additions & 19 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ export type CreateSessionOptions = {
// duration in seconds. Minimum 60 (1 minute), maximum 21600 (6 hours)
timeout?: number
proxies?:
| boolean
| Array<
| {
type: 'browserbase'
geolocation?: { country: string; state?: string; city?: string }
domainPattern?: string
}
| {
type: 'external'
server: string
domainPattern?: string
username?: string
password?: string
}
>
| boolean
| Array<
| {
type: 'browserbase'
geolocation?: { country: string; state?: string; city?: string }
domainPattern?: string
}
| {
type: 'external'
server: string
domainPattern?: string
username?: string
password?: string
}
>
}

export type Session = {
Expand Down Expand Up @@ -141,15 +141,14 @@ export default class Browserbase {
constructor(options: ClientOptions = {}) {
this.apiKey = options.apiKey || process.env.BROWSERBASE_API_KEY!
this.projectId = options.projectId || process.env.BROWSERBASE_PROJECT_ID!
this.baseAPIURL = options.baseURL || 'https://www.browserbase.com'
this.baseAPIURL = options.baseURL || 'https://api.browserbase.com'
this.baseConnectURL =
options.baseConnectURL || 'wss://connect.browserbase.com'
}

getConnectURL({ sessionId, proxy = false }: ConnectOptions = {}): string {
return `${this.baseConnectURL}?apiKey=${this.apiKey}${
sessionId ? `&sessionId=${sessionId}` : ''
}${proxy ? `&enableProxy=true` : ''}`
return `${this.baseConnectURL}?apiKey=${this.apiKey}${sessionId ? `&sessionId=${sessionId}` : ''
}${proxy ? `&enableProxy=true` : ''}`
}

async listSessions(): Promise<Session[]> {
Expand Down

0 comments on commit d432a5c

Please sign in to comment.