@@ -5,6 +5,7 @@ import * as Shared from './shared';
55import * as BrowsersAPI from './browsers/browsers' ;
66import * as TelemetryAPI from './browsers/telemetry' ;
77import { APIPromise } from '../core/api-promise' ;
8+ import { OffsetPagination , type OffsetPaginationParams , PagePromise } from '../core/pagination' ;
89import { buildHeaders } from '../internal/headers' ;
910import { RequestOptions } from '../internal/request-options' ;
1011import { path } from '../internal/utils/path' ;
@@ -60,11 +61,17 @@ export class BrowserPools extends APIResource {
6061 *
6162 * @example
6263 * ```ts
63- * const browserPools = await client.browserPools.list();
64+ * // Automatically fetches more pages as needed.
65+ * for await (const browserPool of client.browserPools.list()) {
66+ * // ...
67+ * }
6468 * ```
6569 */
66- list ( options ?: RequestOptions ) : APIPromise < BrowserPoolListResponse > {
67- return this . _client . get ( '/browser_pools' , options ) ;
70+ list (
71+ query : BrowserPoolListParams | null | undefined = { } ,
72+ options ?: RequestOptions ,
73+ ) : PagePromise < BrowserPoolsOffsetPagination , BrowserPool > {
74+ return this . _client . getAPIList ( '/browser_pools' , OffsetPagination < BrowserPool > , { query, ...options } ) ;
6875 }
6976
7077 /**
@@ -143,6 +150,8 @@ export class BrowserPools extends APIResource {
143150 }
144151}
145152
153+ export type BrowserPoolsOffsetPagination = OffsetPagination < BrowserPool > ;
154+
146155/**
147156 * A browser pool containing multiple identically configured browsers.
148157 */
@@ -276,8 +285,6 @@ export namespace BrowserPool {
276285 }
277286}
278287
279- export type BrowserPoolListResponse = Array < BrowserPool > ;
280-
281288export interface BrowserPoolAcquireResponse {
282289 /**
283290 * Websocket URL for Chrome DevTools Protocol connections to the browser session
@@ -591,6 +598,8 @@ export interface BrowserPoolUpdateParams {
591598 viewport ?: Shared . BrowserViewport ;
592599}
593600
601+ export interface BrowserPoolListParams extends OffsetPaginationParams { }
602+
594603export interface BrowserPoolDeleteParams {
595604 /**
596605 * If true, force delete even if browsers are currently leased. Leased browsers
@@ -624,10 +633,11 @@ export interface BrowserPoolReleaseParams {
624633export declare namespace BrowserPools {
625634 export {
626635 type BrowserPool as BrowserPool ,
627- type BrowserPoolListResponse as BrowserPoolListResponse ,
628636 type BrowserPoolAcquireResponse as BrowserPoolAcquireResponse ,
637+ type BrowserPoolsOffsetPagination as BrowserPoolsOffsetPagination ,
629638 type BrowserPoolCreateParams as BrowserPoolCreateParams ,
630639 type BrowserPoolUpdateParams as BrowserPoolUpdateParams ,
640+ type BrowserPoolListParams as BrowserPoolListParams ,
631641 type BrowserPoolDeleteParams as BrowserPoolDeleteParams ,
632642 type BrowserPoolAcquireParams as BrowserPoolAcquireParams ,
633643 type BrowserPoolReleaseParams as BrowserPoolReleaseParams ,
0 commit comments