@onkernel/sdk 0.19.2 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +9 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +9 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/browser-pools.d.mts +438 -0
  12. package/resources/browser-pools.d.mts.map +1 -0
  13. package/resources/browser-pools.d.ts +438 -0
  14. package/resources/browser-pools.d.ts.map +1 -0
  15. package/resources/browser-pools.js +125 -0
  16. package/resources/browser-pools.js.map +1 -0
  17. package/resources/browser-pools.mjs +121 -0
  18. package/resources/browser-pools.mjs.map +1 -0
  19. package/resources/browsers/browsers.d.mts +79 -201
  20. package/resources/browsers/browsers.d.mts.map +1 -1
  21. package/resources/browsers/browsers.d.ts +79 -201
  22. package/resources/browsers/browsers.d.ts.map +1 -1
  23. package/resources/browsers/browsers.js +9 -4
  24. package/resources/browsers/browsers.js.map +1 -1
  25. package/resources/browsers/browsers.mjs +9 -4
  26. package/resources/browsers/browsers.mjs.map +1 -1
  27. package/resources/browsers/index.d.mts +1 -1
  28. package/resources/browsers/index.d.mts.map +1 -1
  29. package/resources/browsers/index.d.ts +1 -1
  30. package/resources/browsers/index.d.ts.map +1 -1
  31. package/resources/browsers/index.js.map +1 -1
  32. package/resources/browsers/index.mjs.map +1 -1
  33. package/resources/index.d.mts +2 -1
  34. package/resources/index.d.mts.map +1 -1
  35. package/resources/index.d.ts +2 -1
  36. package/resources/index.d.ts.map +1 -1
  37. package/resources/index.js +3 -1
  38. package/resources/index.js.map +1 -1
  39. package/resources/index.mjs +1 -0
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/shared.d.mts +61 -0
  42. package/resources/shared.d.mts.map +1 -1
  43. package/resources/shared.d.ts +61 -0
  44. package/resources/shared.d.ts.map +1 -1
  45. package/src/client.ts +41 -1
  46. package/src/resources/browser-pools.ts +560 -0
  47. package/src/resources/browsers/browsers.ts +95 -225
  48. package/src/resources/browsers/index.ts +2 -0
  49. package/src/resources/index.ts +17 -0
  50. package/src/resources/shared.ts +69 -0
  51. package/src/version.ts +1 -1
  52. package/version.d.mts +1 -1
  53. package/version.d.ts +1 -1
  54. package/version.js +1 -1
  55. package/version.mjs +1 -1
@@ -0,0 +1,438 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as Shared from "./shared.js";
3
+ import * as BrowsersAPI from "./browsers/browsers.js";
4
+ import { APIPromise } from "../core/api-promise.js";
5
+ import { RequestOptions } from "../internal/request-options.js";
6
+ export declare class BrowserPools extends APIResource {
7
+ /**
8
+ * Create a new browser pool with the specified configuration and size.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const browserPool = await client.browserPools.create({
13
+ * size: 10,
14
+ * });
15
+ * ```
16
+ */
17
+ create(body: BrowserPoolCreateParams, options?: RequestOptions): APIPromise<BrowserPool>;
18
+ /**
19
+ * Retrieve details for a single browser pool by its ID or name.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const browserPool = await client.browserPools.retrieve(
24
+ * 'id_or_name',
25
+ * );
26
+ * ```
27
+ */
28
+ retrieve(idOrName: string, options?: RequestOptions): APIPromise<BrowserPool>;
29
+ /**
30
+ * Updates the configuration used to create browsers in the pool.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const browserPool = await client.browserPools.update(
35
+ * 'id_or_name',
36
+ * { size: 10 },
37
+ * );
38
+ * ```
39
+ */
40
+ update(idOrName: string, body: BrowserPoolUpdateParams, options?: RequestOptions): APIPromise<BrowserPool>;
41
+ /**
42
+ * List browser pools owned by the caller's organization.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const browserPools = await client.browserPools.list();
47
+ * ```
48
+ */
49
+ list(options?: RequestOptions): APIPromise<BrowserPoolListResponse>;
50
+ /**
51
+ * Delete a browser pool and all browsers in it. By default, deletion is blocked if
52
+ * browsers are currently leased. Use force=true to terminate leased browsers.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * await client.browserPools.delete('id_or_name');
57
+ * ```
58
+ */
59
+ delete(idOrName: string, body?: BrowserPoolDeleteParams | null | undefined, options?: RequestOptions): APIPromise<void>;
60
+ /**
61
+ * Long-polling endpoint to acquire a browser from the pool. Returns immediately
62
+ * when a browser is available, or returns 204 No Content when the poll times out.
63
+ * The client should retry the request to continue waiting for a browser. The
64
+ * acquired browser will use the pool's timeout_seconds for its idle timeout.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const response = await client.browserPools.acquire(
69
+ * 'id_or_name',
70
+ * );
71
+ * ```
72
+ */
73
+ acquire(idOrName: string, body: BrowserPoolAcquireParams, options?: RequestOptions): APIPromise<BrowserPoolAcquireResponse>;
74
+ /**
75
+ * Destroys all idle browsers in the pool; leased browsers are not affected.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * await client.browserPools.flush('id_or_name');
80
+ * ```
81
+ */
82
+ flush(idOrName: string, options?: RequestOptions): APIPromise<void>;
83
+ /**
84
+ * Release a browser back to the pool, optionally recreating the browser instance.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * await client.browserPools.release('id_or_name', {
89
+ * session_id: 'ts8iy3sg25ibheguyni2lg9t',
90
+ * });
91
+ * ```
92
+ */
93
+ release(idOrName: string, body: BrowserPoolReleaseParams, options?: RequestOptions): APIPromise<void>;
94
+ }
95
+ /**
96
+ * A browser pool containing multiple identically configured browsers.
97
+ */
98
+ export interface BrowserPool {
99
+ /**
100
+ * Unique identifier for the browser pool
101
+ */
102
+ id: string;
103
+ /**
104
+ * Number of browsers currently acquired from the pool
105
+ */
106
+ acquired_count: number;
107
+ /**
108
+ * Number of browsers currently available in the pool
109
+ */
110
+ available_count: number;
111
+ /**
112
+ * Configuration used to create all browsers in this pool
113
+ */
114
+ browser_pool_config: BrowserPoolRequest;
115
+ /**
116
+ * Timestamp when the browser pool was created
117
+ */
118
+ created_at: string;
119
+ /**
120
+ * Browser pool name, if set
121
+ */
122
+ name?: string;
123
+ }
124
+ /**
125
+ * Request body for acquiring a browser from the pool.
126
+ */
127
+ export interface BrowserPoolAcquireRequest {
128
+ /**
129
+ * Maximum number of seconds to wait for a browser to be available. Defaults to the
130
+ * calculated time it would take to fill the pool at the currently configured fill
131
+ * rate.
132
+ */
133
+ acquire_timeout_seconds?: number;
134
+ }
135
+ /**
136
+ * Request body for releasing a browser back to the pool.
137
+ */
138
+ export interface BrowserPoolReleaseRequest {
139
+ /**
140
+ * Browser session ID to release back to the pool
141
+ */
142
+ session_id: string;
143
+ /**
144
+ * Whether to reuse the browser instance or destroy it and create a new one.
145
+ * Defaults to true.
146
+ */
147
+ reuse?: boolean;
148
+ }
149
+ /**
150
+ * Parameters for creating a browser pool. All browsers in the pool will be created
151
+ * with the same configuration.
152
+ */
153
+ export interface BrowserPoolRequest {
154
+ /**
155
+ * Number of browsers to create in the pool
156
+ */
157
+ size: number;
158
+ /**
159
+ * List of browser extensions to load into the session. Provide each by id or name.
160
+ */
161
+ extensions?: Array<Shared.BrowserExtension>;
162
+ /**
163
+ * Percentage of the pool to fill per minute. Defaults to 10%.
164
+ */
165
+ fill_rate_per_minute?: number;
166
+ /**
167
+ * If true, launches the browser using a headless image. Defaults to false.
168
+ */
169
+ headless?: boolean;
170
+ /**
171
+ * If true, launches the browser in kiosk mode to hide address bar and tabs in live
172
+ * view.
173
+ */
174
+ kiosk_mode?: boolean;
175
+ /**
176
+ * Optional name for the browser pool. Must be unique within the organization.
177
+ */
178
+ name?: string;
179
+ /**
180
+ * Profile selection for the browser session. Provide either id or name. If
181
+ * specified, the matching profile will be loaded into the browser session.
182
+ * Profiles must be created beforehand.
183
+ */
184
+ profile?: Shared.BrowserProfile;
185
+ /**
186
+ * Optional proxy to associate to the browser session. Must reference a proxy
187
+ * belonging to the caller's org.
188
+ */
189
+ proxy_id?: string;
190
+ /**
191
+ * If true, launches the browser in stealth mode to reduce detection by anti-bot
192
+ * mechanisms.
193
+ */
194
+ stealth?: boolean;
195
+ /**
196
+ * Default idle timeout in seconds for browsers acquired from this pool before they
197
+ * are destroyed. Defaults to 600 seconds if not specified
198
+ */
199
+ timeout_seconds?: number;
200
+ /**
201
+ * Initial browser window size in pixels with optional refresh rate. If omitted,
202
+ * image defaults apply (commonly 1024x768@60). Only specific viewport
203
+ * configurations are supported. The server will reject unsupported combinations.
204
+ * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
205
+ * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
206
+ * be automatically determined from the width and height if they match a supported
207
+ * configuration exactly. Note: Higher resolutions may affect the responsiveness of
208
+ * live view browser
209
+ */
210
+ viewport?: Shared.BrowserViewport;
211
+ }
212
+ /**
213
+ * Parameters for updating a browser pool. All browsers in the pool will be created
214
+ * with the same configuration.
215
+ */
216
+ export interface BrowserPoolUpdateRequest extends BrowserPoolRequest {
217
+ /**
218
+ * Whether to discard all idle browsers and rebuild the pool immediately. Defaults
219
+ * to true.
220
+ */
221
+ discard_all_idle?: boolean;
222
+ }
223
+ export type BrowserPoolListResponse = Array<BrowserPool>;
224
+ export interface BrowserPoolAcquireResponse {
225
+ /**
226
+ * Websocket URL for Chrome DevTools Protocol connections to the browser session
227
+ */
228
+ cdp_ws_url: string;
229
+ /**
230
+ * When the browser session was created.
231
+ */
232
+ created_at: string;
233
+ /**
234
+ * Whether the browser session is running in headless mode.
235
+ */
236
+ headless: boolean;
237
+ /**
238
+ * Unique identifier for the browser session
239
+ */
240
+ session_id: string;
241
+ /**
242
+ * Whether the browser session is running in stealth mode.
243
+ */
244
+ stealth: boolean;
245
+ /**
246
+ * The number of seconds of inactivity before the browser session is terminated.
247
+ */
248
+ timeout_seconds: number;
249
+ /**
250
+ * Remote URL for live viewing the browser session. Only available for non-headless
251
+ * browsers.
252
+ */
253
+ browser_live_view_url?: string;
254
+ /**
255
+ * When the browser session was soft-deleted. Only present for deleted sessions.
256
+ */
257
+ deleted_at?: string;
258
+ /**
259
+ * Whether the browser session is running in kiosk mode.
260
+ */
261
+ kiosk_mode?: boolean;
262
+ /**
263
+ * Optional persistence configuration for the browser session.
264
+ */
265
+ persistence?: BrowsersAPI.BrowserPersistence;
266
+ /**
267
+ * Browser profile metadata.
268
+ */
269
+ profile?: BrowsersAPI.Profile;
270
+ /**
271
+ * ID of the proxy associated with this browser session, if any.
272
+ */
273
+ proxy_id?: string;
274
+ /**
275
+ * Initial browser window size in pixels with optional refresh rate. If omitted,
276
+ * image defaults apply (commonly 1024x768@60). Only specific viewport
277
+ * configurations are supported. The server will reject unsupported combinations.
278
+ * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
279
+ * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
280
+ * be automatically determined from the width and height if they match a supported
281
+ * configuration exactly. Note: Higher resolutions may affect the responsiveness of
282
+ * live view browser
283
+ */
284
+ viewport?: Shared.BrowserViewport;
285
+ }
286
+ export interface BrowserPoolCreateParams {
287
+ /**
288
+ * Number of browsers to create in the pool
289
+ */
290
+ size: number;
291
+ /**
292
+ * List of browser extensions to load into the session. Provide each by id or name.
293
+ */
294
+ extensions?: Array<Shared.BrowserExtension>;
295
+ /**
296
+ * Percentage of the pool to fill per minute. Defaults to 10%.
297
+ */
298
+ fill_rate_per_minute?: number;
299
+ /**
300
+ * If true, launches the browser using a headless image. Defaults to false.
301
+ */
302
+ headless?: boolean;
303
+ /**
304
+ * If true, launches the browser in kiosk mode to hide address bar and tabs in live
305
+ * view.
306
+ */
307
+ kiosk_mode?: boolean;
308
+ /**
309
+ * Optional name for the browser pool. Must be unique within the organization.
310
+ */
311
+ name?: string;
312
+ /**
313
+ * Profile selection for the browser session. Provide either id or name. If
314
+ * specified, the matching profile will be loaded into the browser session.
315
+ * Profiles must be created beforehand.
316
+ */
317
+ profile?: Shared.BrowserProfile;
318
+ /**
319
+ * Optional proxy to associate to the browser session. Must reference a proxy
320
+ * belonging to the caller's org.
321
+ */
322
+ proxy_id?: string;
323
+ /**
324
+ * If true, launches the browser in stealth mode to reduce detection by anti-bot
325
+ * mechanisms.
326
+ */
327
+ stealth?: boolean;
328
+ /**
329
+ * Default idle timeout in seconds for browsers acquired from this pool before they
330
+ * are destroyed. Defaults to 600 seconds if not specified
331
+ */
332
+ timeout_seconds?: number;
333
+ /**
334
+ * Initial browser window size in pixels with optional refresh rate. If omitted,
335
+ * image defaults apply (commonly 1024x768@60). Only specific viewport
336
+ * configurations are supported. The server will reject unsupported combinations.
337
+ * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
338
+ * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
339
+ * be automatically determined from the width and height if they match a supported
340
+ * configuration exactly. Note: Higher resolutions may affect the responsiveness of
341
+ * live view browser
342
+ */
343
+ viewport?: Shared.BrowserViewport;
344
+ }
345
+ export interface BrowserPoolUpdateParams {
346
+ /**
347
+ * Number of browsers to create in the pool
348
+ */
349
+ size: number;
350
+ /**
351
+ * Whether to discard all idle browsers and rebuild the pool immediately. Defaults
352
+ * to true.
353
+ */
354
+ discard_all_idle?: boolean;
355
+ /**
356
+ * List of browser extensions to load into the session. Provide each by id or name.
357
+ */
358
+ extensions?: Array<Shared.BrowserExtension>;
359
+ /**
360
+ * Percentage of the pool to fill per minute. Defaults to 10%.
361
+ */
362
+ fill_rate_per_minute?: number;
363
+ /**
364
+ * If true, launches the browser using a headless image. Defaults to false.
365
+ */
366
+ headless?: boolean;
367
+ /**
368
+ * If true, launches the browser in kiosk mode to hide address bar and tabs in live
369
+ * view.
370
+ */
371
+ kiosk_mode?: boolean;
372
+ /**
373
+ * Optional name for the browser pool. Must be unique within the organization.
374
+ */
375
+ name?: string;
376
+ /**
377
+ * Profile selection for the browser session. Provide either id or name. If
378
+ * specified, the matching profile will be loaded into the browser session.
379
+ * Profiles must be created beforehand.
380
+ */
381
+ profile?: Shared.BrowserProfile;
382
+ /**
383
+ * Optional proxy to associate to the browser session. Must reference a proxy
384
+ * belonging to the caller's org.
385
+ */
386
+ proxy_id?: string;
387
+ /**
388
+ * If true, launches the browser in stealth mode to reduce detection by anti-bot
389
+ * mechanisms.
390
+ */
391
+ stealth?: boolean;
392
+ /**
393
+ * Default idle timeout in seconds for browsers acquired from this pool before they
394
+ * are destroyed. Defaults to 600 seconds if not specified
395
+ */
396
+ timeout_seconds?: number;
397
+ /**
398
+ * Initial browser window size in pixels with optional refresh rate. If omitted,
399
+ * image defaults apply (commonly 1024x768@60). Only specific viewport
400
+ * configurations are supported. The server will reject unsupported combinations.
401
+ * Supported resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25,
402
+ * 1440x900@25, 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will
403
+ * be automatically determined from the width and height if they match a supported
404
+ * configuration exactly. Note: Higher resolutions may affect the responsiveness of
405
+ * live view browser
406
+ */
407
+ viewport?: Shared.BrowserViewport;
408
+ }
409
+ export interface BrowserPoolDeleteParams {
410
+ /**
411
+ * If true, force delete even if browsers are currently leased. Leased browsers
412
+ * will be terminated.
413
+ */
414
+ force?: boolean;
415
+ }
416
+ export interface BrowserPoolAcquireParams {
417
+ /**
418
+ * Maximum number of seconds to wait for a browser to be available. Defaults to the
419
+ * calculated time it would take to fill the pool at the currently configured fill
420
+ * rate.
421
+ */
422
+ acquire_timeout_seconds?: number;
423
+ }
424
+ export interface BrowserPoolReleaseParams {
425
+ /**
426
+ * Browser session ID to release back to the pool
427
+ */
428
+ session_id: string;
429
+ /**
430
+ * Whether to reuse the browser instance or destroy it and create a new one.
431
+ * Defaults to true.
432
+ */
433
+ reuse?: boolean;
434
+ }
435
+ export declare namespace BrowserPools {
436
+ export { type BrowserPool as BrowserPool, type BrowserPoolAcquireRequest as BrowserPoolAcquireRequest, type BrowserPoolReleaseRequest as BrowserPoolReleaseRequest, type BrowserPoolRequest as BrowserPoolRequest, type BrowserPoolUpdateRequest as BrowserPoolUpdateRequest, type BrowserPoolListResponse as BrowserPoolListResponse, type BrowserPoolAcquireResponse as BrowserPoolAcquireResponse, type BrowserPoolCreateParams as BrowserPoolCreateParams, type BrowserPoolUpdateParams as BrowserPoolUpdateParams, type BrowserPoolDeleteParams as BrowserPoolDeleteParams, type BrowserPoolAcquireParams as BrowserPoolAcquireParams, type BrowserPoolReleaseParams as BrowserPoolReleaseParams, };
437
+ }
438
+ //# sourceMappingURL=browser-pools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-pools.d.ts","sourceRoot":"","sources":["../src/resources/browser-pools.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;IAIxF;;;;;;;;;OASG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;IAI7E;;;;;;;;;;OAUG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;IAI1G;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;IAInE;;;;;;;;OAQG;IACH,MAAM,CACJ,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,uBAAuB,GAAG,IAAI,GAAG,SAAc,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,IAAI,CAAC;IAQnB;;;;;;;;;;;;OAYG;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IAEzB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.BrowserPools = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const headers_1 = require("../internal/headers.js");
7
+ const path_1 = require("../internal/utils/path.js");
8
+ class BrowserPools extends resource_1.APIResource {
9
+ /**
10
+ * Create a new browser pool with the specified configuration and size.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const browserPool = await client.browserPools.create({
15
+ * size: 10,
16
+ * });
17
+ * ```
18
+ */
19
+ create(body, options) {
20
+ return this._client.post('/browser_pools', { body, ...options });
21
+ }
22
+ /**
23
+ * Retrieve details for a single browser pool by its ID or name.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const browserPool = await client.browserPools.retrieve(
28
+ * 'id_or_name',
29
+ * );
30
+ * ```
31
+ */
32
+ retrieve(idOrName, options) {
33
+ return this._client.get((0, path_1.path) `/browser_pools/${idOrName}`, options);
34
+ }
35
+ /**
36
+ * Updates the configuration used to create browsers in the pool.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const browserPool = await client.browserPools.update(
41
+ * 'id_or_name',
42
+ * { size: 10 },
43
+ * );
44
+ * ```
45
+ */
46
+ update(idOrName, body, options) {
47
+ return this._client.patch((0, path_1.path) `/browser_pools/${idOrName}`, { body, ...options });
48
+ }
49
+ /**
50
+ * List browser pools owned by the caller's organization.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const browserPools = await client.browserPools.list();
55
+ * ```
56
+ */
57
+ list(options) {
58
+ return this._client.get('/browser_pools', options);
59
+ }
60
+ /**
61
+ * Delete a browser pool and all browsers in it. By default, deletion is blocked if
62
+ * browsers are currently leased. Use force=true to terminate leased browsers.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * await client.browserPools.delete('id_or_name');
67
+ * ```
68
+ */
69
+ delete(idOrName, body = {}, options) {
70
+ return this._client.delete((0, path_1.path) `/browser_pools/${idOrName}`, {
71
+ body,
72
+ ...options,
73
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
74
+ });
75
+ }
76
+ /**
77
+ * Long-polling endpoint to acquire a browser from the pool. Returns immediately
78
+ * when a browser is available, or returns 204 No Content when the poll times out.
79
+ * The client should retry the request to continue waiting for a browser. The
80
+ * acquired browser will use the pool's timeout_seconds for its idle timeout.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * const response = await client.browserPools.acquire(
85
+ * 'id_or_name',
86
+ * );
87
+ * ```
88
+ */
89
+ acquire(idOrName, body, options) {
90
+ return this._client.post((0, path_1.path) `/browser_pools/${idOrName}/acquire`, { body, ...options });
91
+ }
92
+ /**
93
+ * Destroys all idle browsers in the pool; leased browsers are not affected.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * await client.browserPools.flush('id_or_name');
98
+ * ```
99
+ */
100
+ flush(idOrName, options) {
101
+ return this._client.post((0, path_1.path) `/browser_pools/${idOrName}/flush`, {
102
+ ...options,
103
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
104
+ });
105
+ }
106
+ /**
107
+ * Release a browser back to the pool, optionally recreating the browser instance.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * await client.browserPools.release('id_or_name', {
112
+ * session_id: 'ts8iy3sg25ibheguyni2lg9t',
113
+ * });
114
+ * ```
115
+ */
116
+ release(idOrName, body, options) {
117
+ return this._client.post((0, path_1.path) `/browser_pools/${idOrName}/release`, {
118
+ body,
119
+ ...options,
120
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
121
+ });
122
+ }
123
+ }
124
+ exports.BrowserPools = BrowserPools;
125
+ //# sourceMappingURL=browser-pools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-pools.js","sourceRoot":"","sources":["../src/resources/browser-pools.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;;;;;;;;OASG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,kBAAkB,QAAQ,EA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,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,OAAO,CAAC,QAAgB,EAAE,IAA8B,EAAE,OAAwB;QAChF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,kBAAkB,QAAQ,UAAU,EAAE;YACjE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAlID,oCAkIC"}
@@ -0,0 +1,121 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { buildHeaders } from "../internal/headers.mjs";
4
+ import { path } from "../internal/utils/path.mjs";
5
+ export class BrowserPools extends APIResource {
6
+ /**
7
+ * Create a new browser pool with the specified configuration and size.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const browserPool = await client.browserPools.create({
12
+ * size: 10,
13
+ * });
14
+ * ```
15
+ */
16
+ create(body, options) {
17
+ return this._client.post('/browser_pools', { body, ...options });
18
+ }
19
+ /**
20
+ * Retrieve details for a single browser pool by its ID or name.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const browserPool = await client.browserPools.retrieve(
25
+ * 'id_or_name',
26
+ * );
27
+ * ```
28
+ */
29
+ retrieve(idOrName, options) {
30
+ return this._client.get(path `/browser_pools/${idOrName}`, options);
31
+ }
32
+ /**
33
+ * Updates the configuration used to create browsers in the pool.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const browserPool = await client.browserPools.update(
38
+ * 'id_or_name',
39
+ * { size: 10 },
40
+ * );
41
+ * ```
42
+ */
43
+ update(idOrName, body, options) {
44
+ return this._client.patch(path `/browser_pools/${idOrName}`, { body, ...options });
45
+ }
46
+ /**
47
+ * List browser pools owned by the caller's organization.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const browserPools = await client.browserPools.list();
52
+ * ```
53
+ */
54
+ list(options) {
55
+ return this._client.get('/browser_pools', options);
56
+ }
57
+ /**
58
+ * Delete a browser pool and all browsers in it. By default, deletion is blocked if
59
+ * browsers are currently leased. Use force=true to terminate leased browsers.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * await client.browserPools.delete('id_or_name');
64
+ * ```
65
+ */
66
+ delete(idOrName, body = {}, options) {
67
+ return this._client.delete(path `/browser_pools/${idOrName}`, {
68
+ body,
69
+ ...options,
70
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
71
+ });
72
+ }
73
+ /**
74
+ * Long-polling endpoint to acquire a browser from the pool. Returns immediately
75
+ * when a browser is available, or returns 204 No Content when the poll times out.
76
+ * The client should retry the request to continue waiting for a browser. The
77
+ * acquired browser will use the pool's timeout_seconds for its idle timeout.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const response = await client.browserPools.acquire(
82
+ * 'id_or_name',
83
+ * );
84
+ * ```
85
+ */
86
+ acquire(idOrName, body, options) {
87
+ return this._client.post(path `/browser_pools/${idOrName}/acquire`, { body, ...options });
88
+ }
89
+ /**
90
+ * Destroys all idle browsers in the pool; leased browsers are not affected.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * await client.browserPools.flush('id_or_name');
95
+ * ```
96
+ */
97
+ flush(idOrName, options) {
98
+ return this._client.post(path `/browser_pools/${idOrName}/flush`, {
99
+ ...options,
100
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
101
+ });
102
+ }
103
+ /**
104
+ * Release a browser back to the pool, optionally recreating the browser instance.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * await client.browserPools.release('id_or_name', {
109
+ * session_id: 'ts8iy3sg25ibheguyni2lg9t',
110
+ * });
111
+ * ```
112
+ */
113
+ release(idOrName, body, options) {
114
+ return this._client.post(path `/browser_pools/${idOrName}/release`, {
115
+ body,
116
+ ...options,
117
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
118
+ });
119
+ }
120
+ }
121
+ //# sourceMappingURL=browser-pools.mjs.map