Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.1"
".": "0.1.0-alpha.2"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 18
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-60444f8b1aa1aa8dbec1e9f11e929c2b7ac27470764ef5f1796134fc27f3381c.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-9f93c744538f57747ea1385817e21b40c318b65ebc155dca8950268beb280bc9.yml
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.1.0-alpha.2 (2024-10-28)

Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/browserbase/sdk-node/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

### Features

* **api:** update via SDK Studio ([#16](https://github.com/browserbase/sdk-node/issues/16)) ([a96a86c](https://github.com/browserbase/sdk-node/commit/a96a86c2e7c5025cacd7edd89f88b914de3596e3))
* **api:** update via SDK Studio ([#17](https://github.com/browserbase/sdk-node/issues/17)) ([52cf741](https://github.com/browserbase/sdk-node/commit/52cf741bc4c5712f2fe15ee6eaa48e4c3643ec58))

## 0.1.0-alpha.1 (2024-10-28)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/browserbase/sdk-node/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
Expand Down
44 changes: 23 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ const client = new Browserbase({
});

async function main() {
const context = await client.contexts.create({ projectId: 'projectId' });
const session = await client.sessions.create({ projectId: 'your_project_id', proxies: true });

console.log(context.id);
console.log(session.id);
}

main();
Expand All @@ -51,8 +51,8 @@ const client = new Browserbase({
});

async function main() {
const params: Browserbase.ContextCreateParams = { projectId: 'projectId' };
const context: Browserbase.ContextCreateResponse = await client.contexts.create(params);
const params: Browserbase.SessionCreateParams = { projectId: 'your_project_id', proxies: true };
const session: Browserbase.SessionCreateResponse = await client.sessions.create(params);
}

main();
Expand All @@ -69,15 +69,17 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const context = await client.contexts.create({ projectId: 'projectId' }).catch(async (err) => {
if (err instanceof Browserbase.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
const session = await client.sessions
.create({ projectId: 'your_project_id', proxies: true })
.catch(async (err) => {
if (err instanceof Browserbase.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
}

main();
Expand Down Expand Up @@ -112,7 +114,7 @@ const client = new Browserbase({
});

// Or, configure per-request:
await client.contexts.create({ projectId: 'projectId' }, {
await client.sessions.create({ projectId: 'your_project_id', proxies: true }, {
maxRetries: 5,
});
```
Expand All @@ -129,7 +131,7 @@ const client = new Browserbase({
});

// Override per-request:
await client.contexts.create({ projectId: 'projectId' }, {
await client.sessions.create({ projectId: 'your_project_id', proxies: true }, {
timeout: 5 * 1000,
});
```
Expand All @@ -150,15 +152,15 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
```ts
const client = new Browserbase();

const response = await client.contexts.create({ projectId: 'projectId' }).asResponse();
const response = await client.sessions.create({ projectId: 'your_project_id', proxies: true }).asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: context, response: raw } = await client.contexts
.create({ projectId: 'projectId' })
const { data: session, response: raw } = await client.sessions
.create({ projectId: 'your_project_id', proxies: true })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(context.id);
console.log(session.id);
```

### Making custom/undocumented requests
Expand Down Expand Up @@ -262,8 +264,8 @@ const client = new Browserbase({
});

// Override per-request:
await client.contexts.create(
{ projectId: 'projectId' },
await client.sessions.create(
{ projectId: 'your_project_id', proxies: true },
{
httpAgent: new http.Agent({ keepAlive: false }),
},
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ or products provided by Browserbase please follow the respective company's secur

### Browserbase Terms and Policies

Please contact dev-feedback@browserbase.com for any questions or concerns regarding security of our services.
Please contact support@browserbase.com for any questions or concerns regarding security of our services.

---

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "browserbase",
"version": "0.1.0-alpha.1",
"version": "0.1.0-alpha.2",
"description": "The official TypeScript library for the Browserbase API",
"author": "Browserbase <dev-feedback@browserbase.com>",
"author": "Browserbase <support@browserbase.com>",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"type": "commonjs",
"repository": "github:browserbase/sdk-node",
"license": "Apache-2.0",
"packageManager": "[email protected]",
"files": [
"*"
"**/*"
],
"private": false,
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class Browserbase extends Core.APIClient {
* API Client for interfacing with the Browserbase API.
*
* @param {string | undefined} [opts.apiKey=process.env['BROWSERBASE_API_KEY'] ?? undefined]
* @param {string} [opts.baseURL=process.env['BROWSERBASE_BASE_URL'] ?? https://api.dev.browserbase.com] - Override the default base URL for the API.
* @param {string} [opts.baseURL=process.env['BROWSERBASE_BASE_URL'] ?? https://api.browserbase.com] - Override the default base URL for the API.
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
Expand All @@ -103,7 +103,7 @@ export class Browserbase extends Core.APIClient {
const options: ClientOptions = {
apiKey,
...opts,
baseURL: baseURL || `https://api.dev.browserbase.com`,
baseURL: baseURL || `https://api.browserbase.com`,
};

super({
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.1.0-alpha.1'; // x-release-please-version
export const VERSION = '0.1.0-alpha.2'; // x-release-please-version
4 changes: 2 additions & 2 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ describe('instantiate client', () => {
test('empty env variable', () => {
process.env['BROWSERBASE_BASE_URL'] = ''; // empty
const client = new Browserbase({ apiKey: 'My API Key' });
expect(client.baseURL).toEqual('https://api.dev.browserbase.com');
expect(client.baseURL).toEqual('https://api.browserbase.com');
});

test('blank env variable', () => {
process.env['BROWSERBASE_BASE_URL'] = ' '; // blank
const client = new Browserbase({ apiKey: 'My API Key' });
expect(client.baseURL).toEqual('https://api.dev.browserbase.com');
expect(client.baseURL).toEqual('https://api.browserbase.com');
});
});

Expand Down
Loading