Skip to content

feat(api): api update #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025
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 .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-396a2b9092f645c5a9e46a1f3be8c2e45ca9ae079e1d39761eb0a73f56e24b15.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-a42637317cf43a3f4dacf3b88ac09b86e41d4dc44c51140aa92cef99b5d0c02a.yml
3 changes: 2 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ Types:
- <code><a href="./src/resources/sessions/sessions.ts">Session</a></code>
- <code><a href="./src/resources/sessions/sessions.ts">SessionLiveURLs</a></code>
- <code><a href="./src/resources/sessions/sessions.ts">SessionCreateResponse</a></code>
- <code><a href="./src/resources/sessions/sessions.ts">SessionRetrieveResponse</a></code>
- <code><a href="./src/resources/sessions/sessions.ts">SessionListResponse</a></code>

Methods:

- <code title="post /v1/sessions">client.sessions.<a href="./src/resources/sessions/sessions.ts">create</a>({ ...params }) -> SessionCreateResponse</code>
- <code title="get /v1/sessions/{id}">client.sessions.<a href="./src/resources/sessions/sessions.ts">retrieve</a>(id) -> Session</code>
- <code title="get /v1/sessions/{id}">client.sessions.<a href="./src/resources/sessions/sessions.ts">retrieve</a>(id) -> SessionRetrieveResponse</code>
- <code title="post /v1/sessions/{id}">client.sessions.<a href="./src/resources/sessions/sessions.ts">update</a>(id, { ...params }) -> Session</code>
- <code title="get /v1/sessions">client.sessions.<a href="./src/resources/sessions/sessions.ts">list</a>({ ...params }) -> SessionListResponse</code>
- <code title="get /v1/sessions/{id}/debug">client.sessions.<a href="./src/resources/sessions/sessions.ts">debug</a>(id) -> SessionLiveURLs</code>
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
SessionListParams,
SessionListResponse,
SessionLiveURLs,
SessionRetrieveResponse,
SessionUpdateParams,
Sessions,
} from './resources/sessions/sessions';
Expand Down Expand Up @@ -212,6 +213,7 @@ export declare namespace Browserbase {
type Session as Session,
type SessionLiveURLs as SessionLiveURLs,
type SessionCreateResponse as SessionCreateResponse,
type SessionRetrieveResponse as SessionRetrieveResponse,
type SessionListResponse as SessionListResponse,
type SessionCreateParams as SessionCreateParams,
type SessionUpdateParams as SessionUpdateParams,
Expand Down
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export {
type Session,
type SessionLiveURLs,
type SessionCreateResponse,
type SessionRetrieveResponse,
type SessionListResponse,
type SessionCreateParams,
type SessionUpdateParams,
Expand Down
1 change: 1 addition & 0 deletions src/resources/sessions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export {
type Session,
type SessionLiveURLs,
type SessionCreateResponse,
type SessionRetrieveResponse,
type SessionListResponse,
type SessionCreateParams,
type SessionUpdateParams,
Expand Down
75 changes: 74 additions & 1 deletion src/resources/sessions/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class Sessions extends APIResource {
/**
* Session
*/
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Session> {
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<SessionRetrieveResponse> {
return this._client.get(`/v1/sessions/${id}`, options);
}

Expand Down Expand Up @@ -217,6 +217,78 @@ export interface SessionCreateResponse {
userMetadata?: Record<string, unknown>;
}

export interface SessionRetrieveResponse {
id: string;

createdAt: string;

expiresAt: string;

/**
* Indicates if the Session was created to be kept alive upon disconnections
*/
keepAlive: boolean;

/**
* The Project ID linked to the Session.
*/
projectId: string;

/**
* Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)
*/
proxyBytes: number;

/**
* The region where the Session is running.
*/
region: 'us-west-2' | 'us-east-1' | 'eu-central-1' | 'ap-southeast-1';

startedAt: string;

status: 'RUNNING' | 'ERROR' | 'TIMED_OUT' | 'COMPLETED';

updatedAt: string;

/**
* CPU used by the Session
*/
avgCpuUsage?: number;

/**
* WebSocket URL to connect to the Session.
*/
connectUrl?: string;

/**
* Optional. The Context linked to the Session.
*/
contextId?: string;

endedAt?: string;

/**
* Memory used by the Session
*/
memoryUsage?: number;

/**
* HTTP URL to connect to the Session.
*/
seleniumRemoteUrl?: string;

/**
* Signing key to use when connecting to the Session via HTTP.
*/
signingKey?: string;

/**
* Arbitrary user metadata to attach to the session. To learn more about user
* metadata, see [User Metadata](/features/sessions#user-metadata).
*/
userMetadata?: Record<string, unknown>;
}

export type SessionListResponse = Array<Session>;

export interface SessionCreateParams {
Expand Down Expand Up @@ -473,6 +545,7 @@ export declare namespace Sessions {
type Session as Session,
type SessionLiveURLs as SessionLiveURLs,
type SessionCreateResponse as SessionCreateResponse,
type SessionRetrieveResponse as SessionRetrieveResponse,
type SessionListResponse as SessionListResponse,
type SessionCreateParams as SessionCreateParams,
type SessionUpdateParams as SessionUpdateParams,
Expand Down