From 415408b61e4ca89f15e05f0e7f5377b048d036ca Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 22:23:18 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- api.md | 3 +- src/index.ts | 2 + src/resources/index.ts | 1 + src/resources/sessions/index.ts | 1 + src/resources/sessions/sessions.ts | 75 +++++++++++++++++++++++++++++- 6 files changed, 81 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index be077766..86eb81b9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 diff --git a/api.md b/api.md index efcf2db2..37226d30 100644 --- a/api.md +++ b/api.md @@ -45,12 +45,13 @@ Types: - Session - SessionLiveURLs - SessionCreateResponse +- SessionRetrieveResponse - SessionListResponse Methods: - client.sessions.create({ ...params }) -> SessionCreateResponse -- client.sessions.retrieve(id) -> Session +- client.sessions.retrieve(id) -> SessionRetrieveResponse - client.sessions.update(id, { ...params }) -> Session - client.sessions.list({ ...params }) -> SessionListResponse - client.sessions.debug(id) -> SessionLiveURLs diff --git a/src/index.ts b/src/index.ts index dd493aae..594b6a09 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,6 +21,7 @@ import { SessionListParams, SessionListResponse, SessionLiveURLs, + SessionRetrieveResponse, SessionUpdateParams, Sessions, } from './resources/sessions/sessions'; @@ -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, diff --git a/src/resources/index.ts b/src/resources/index.ts index e74c370f..96c5a425 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -14,6 +14,7 @@ export { type Session, type SessionLiveURLs, type SessionCreateResponse, + type SessionRetrieveResponse, type SessionListResponse, type SessionCreateParams, type SessionUpdateParams, diff --git a/src/resources/sessions/index.ts b/src/resources/sessions/index.ts index 727df9c4..9c9a61ea 100644 --- a/src/resources/sessions/index.ts +++ b/src/resources/sessions/index.ts @@ -8,6 +8,7 @@ export { type Session, type SessionLiveURLs, type SessionCreateResponse, + type SessionRetrieveResponse, type SessionListResponse, type SessionCreateParams, type SessionUpdateParams, diff --git a/src/resources/sessions/sessions.ts b/src/resources/sessions/sessions.ts index 272dd656..db0b7c2f 100644 --- a/src/resources/sessions/sessions.ts +++ b/src/resources/sessions/sessions.ts @@ -28,7 +28,7 @@ export class Sessions extends APIResource { /** * Session */ - retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise { + retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/v1/sessions/${id}`, options); } @@ -217,6 +217,78 @@ export interface SessionCreateResponse { userMetadata?: Record; } +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; +} + export type SessionListResponse = Array; export interface SessionCreateParams { @@ -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,