Skip to content

Commit a17fadc

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): update via SDK Studio (#9)
1 parent 2d845ff commit a17fadc

File tree

7 files changed

+83
-77
lines changed

7 files changed

+83
-77
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 18
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-0069ed71133ac7b0add07abd8562396c4b8e3c9a212e14a7586782eeed2ff373.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-0d0ad7d4de2fa0b930b8d72fe6539ab248c7ed684b2e12b327b3bc0a466f9cde.yml

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ Types:
4444

4545
- <code><a href="./src/resources/sessions/sessions.ts">Session</a></code>
4646
- <code><a href="./src/resources/sessions/sessions.ts">SessionLiveURLs</a></code>
47+
- <code><a href="./src/resources/sessions/sessions.ts">SessionCreateResponse</a></code>
4748
- <code><a href="./src/resources/sessions/sessions.ts">SessionListResponse</a></code>
4849

4950
Methods:
5051

51-
- <code title="post /v1/sessions">client.sessions.<a href="./src/resources/sessions/sessions.ts">create</a>({ ...params }) -> Session</code>
52+
- <code title="post /v1/sessions">client.sessions.<a href="./src/resources/sessions/sessions.ts">create</a>({ ...params }) -> SessionCreateResponse</code>
5253
- <code title="get /v1/sessions/{id}">client.sessions.<a href="./src/resources/sessions/sessions.ts">retrieve</a>(id) -> Session</code>
5354
- <code title="post /v1/sessions/{id}">client.sessions.<a href="./src/resources/sessions/sessions.ts">update</a>(id, { ...params }) -> Session</code>
5455
- <code title="get /v1/sessions">client.sessions.<a href="./src/resources/sessions/sessions.ts">list</a>({ ...params }) -> SessionListResponse</code>

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export namespace Browserbase {
200200
export import Sessions = API.Sessions;
201201
export import Session = API.Session;
202202
export import SessionLiveURLs = API.SessionLiveURLs;
203+
export import SessionCreateResponse = API.SessionCreateResponse;
203204
export import SessionListResponse = API.SessionListResponse;
204205
export import SessionCreateParams = API.SessionCreateParams;
205206
export import SessionUpdateParams = API.SessionUpdateParams;

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export { Project, ProjectUsage, ProjectListResponse, Projects } from './projects
1212
export {
1313
Session,
1414
SessionLiveURLs,
15+
SessionCreateResponse,
1516
SessionListResponse,
1617
SessionCreateParams,
1718
SessionUpdateParams,

src/resources/sessions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export { Downloads } from './downloads';
44
export {
55
Session,
66
SessionLiveURLs,
7+
SessionCreateResponse,
78
SessionListResponse,
89
SessionCreateParams,
910
SessionUpdateParams,

src/resources/sessions/sessions.ts

Lines changed: 75 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class Sessions extends APIResource {
1818
/**
1919
* Create a Session
2020
*/
21-
create(body: SessionCreateParams, options?: Core.RequestOptions): Core.APIPromise<Session> {
21+
create(body: SessionCreateParams, options?: Core.RequestOptions): Core.APIPromise<SessionCreateResponse> {
2222
return this._client.post('/v1/sessions', { body, ...options });
2323
}
2424

@@ -93,6 +93,72 @@ export namespace SessionLiveURLs {
9393
}
9494
}
9595

96+
export interface SessionCreateResponse {
97+
id: string;
98+
99+
/**
100+
* WebSocket URL to connect to the Session.
101+
*/
102+
connectUrl: string;
103+
104+
createdAt: string;
105+
106+
expiresAt: string;
107+
108+
/**
109+
* Indicates if the Session was created to be kept alive upon disconnections
110+
*/
111+
keepAlive: boolean;
112+
113+
/**
114+
* The Project ID linked to the Session.
115+
*/
116+
projectId: string;
117+
118+
/**
119+
* Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)
120+
*/
121+
proxyBytes: number;
122+
123+
/**
124+
* The region where the Session is running.
125+
*/
126+
region: 'us-west-2' | 'us-east-1' | 'eu-central-1' | 'ap-southeast-1';
127+
128+
/**
129+
* HTTP URL to connect to the Session.
130+
*/
131+
seleniumRemoteUrl: string;
132+
133+
/**
134+
* Signing key to use when connecting to the Session via HTTP.
135+
*/
136+
signingKey: string;
137+
138+
startedAt: string;
139+
140+
status: 'RUNNING' | 'ERROR' | 'TIMED_OUT' | 'COMPLETED';
141+
142+
updatedAt: string;
143+
144+
/**
145+
* CPU used by the Session
146+
*/
147+
avgCpuUsage?: number;
148+
149+
/**
150+
* Optional. The Context linked to the Session.
151+
*/
152+
contextId?: string;
153+
154+
endedAt?: string;
155+
156+
/**
157+
* Memory used by the Session
158+
*/
159+
memoryUsage?: number;
160+
}
161+
96162
export type SessionListResponse = Array<Session>;
97163

98164
export interface SessionCreateParams {
@@ -120,9 +186,12 @@ export interface SessionCreateParams {
120186
* Proxy configuration. Can be true for default proxy, or an array of proxy
121187
* configurations.
122188
*/
123-
proxies?:
124-
| boolean
125-
| Array<SessionCreateParams.BrowserbaseProxyConfig | SessionCreateParams.ExternalProxyConfig>;
189+
proxies?: unknown;
190+
191+
/**
192+
* The region where the Session should run.
193+
*/
194+
region?: 'us-west-2' | 'us-east-1' | 'eu-central-1' | 'ap-southeast-1';
126195

127196
/**
128197
* Duration in seconds after which the session will automatically end. Defaults to
@@ -180,7 +249,7 @@ export namespace SessionCreateParams {
180249
/**
181250
* Whether or not to persist the context after browsing. Defaults to `false`.
182251
*/
183-
persist: boolean;
252+
persist?: boolean;
184253
}
185254

186255
/**
@@ -227,75 +296,6 @@ export namespace SessionCreateParams {
227296
width?: number;
228297
}
229298
}
230-
231-
export interface BrowserbaseProxyConfig {
232-
/**
233-
* Type of proxy. Always use 'browserbase' for the Browserbase managed proxy
234-
* network.
235-
*/
236-
type: 'browserbase';
237-
238-
/**
239-
* Domain pattern for which this proxy should be used. If omitted, defaults to all
240-
* domains. Optional.
241-
*/
242-
domainPattern?: string;
243-
244-
/**
245-
* Configuration for geolocation
246-
*/
247-
geolocation?: BrowserbaseProxyConfig.Geolocation;
248-
}
249-
250-
export namespace BrowserbaseProxyConfig {
251-
/**
252-
* Configuration for geolocation
253-
*/
254-
export interface Geolocation {
255-
/**
256-
* Country code in ISO 3166-1 alpha-2 format
257-
*/
258-
country: string;
259-
260-
/**
261-
* Name of the city. Use spaces for multi-word city names. Optional.
262-
*/
263-
city?: string;
264-
265-
/**
266-
* US state code (2 characters). Must also specify US as the country. Optional.
267-
*/
268-
state?: string;
269-
}
270-
}
271-
272-
export interface ExternalProxyConfig {
273-
/**
274-
* Server URL for external proxy. Required.
275-
*/
276-
server: string;
277-
278-
/**
279-
* Type of proxy. Always 'external' for this config.
280-
*/
281-
type: 'external';
282-
283-
/**
284-
* Domain pattern for which this proxy should be used. If omitted, defaults to all
285-
* domains. Optional.
286-
*/
287-
domainPattern?: string;
288-
289-
/**
290-
* Password for external proxy authentication. Optional.
291-
*/
292-
password?: string;
293-
294-
/**
295-
* Username for external proxy authentication. Optional.
296-
*/
297-
username?: string;
298-
}
299299
}
300300

301301
export interface SessionUpdateParams {
@@ -319,6 +319,7 @@ export interface SessionListParams {
319319
export namespace Sessions {
320320
export import Session = SessionsAPI.Session;
321321
export import SessionLiveURLs = SessionsAPI.SessionLiveURLs;
322+
export import SessionCreateResponse = SessionsAPI.SessionCreateResponse;
322323
export import SessionListResponse = SessionsAPI.SessionListResponse;
323324
export import SessionCreateParams = SessionsAPI.SessionCreateParams;
324325
export import SessionUpdateParams = SessionsAPI.SessionUpdateParams;

tests/api-resources/sessions/sessions.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ describe('resource sessions', () => {
4242
},
4343
extensionId: 'extensionId',
4444
keepAlive: true,
45-
proxies: true,
45+
proxies: {},
46+
region: 'us-west-2',
4647
timeout: 60,
4748
});
4849
});

0 commit comments

Comments
 (0)