|
22 | 22 | FsResourceWithStreamingResponse, |
23 | 23 | AsyncFsResourceWithStreamingResponse, |
24 | 24 | ) |
25 | | -from ...types import browser_create_params, browser_delete_params, browser_load_extensions_params |
| 25 | +from ...types import ( |
| 26 | + browser_list_params, |
| 27 | + browser_create_params, |
| 28 | + browser_delete_params, |
| 29 | + browser_load_extensions_params, |
| 30 | +) |
26 | 31 | from .process import ( |
27 | 32 | ProcessResource, |
28 | 33 | AsyncProcessResource, |
|
65 | 70 | async_to_raw_response_wrapper, |
66 | 71 | async_to_streamed_response_wrapper, |
67 | 72 | ) |
68 | | -from ..._base_client import make_request_options |
| 73 | +from ...pagination import SyncOffsetPagination, AsyncOffsetPagination |
| 74 | +from ..._base_client import AsyncPaginator, make_request_options |
69 | 75 | from ...types.browser_list_response import BrowserListResponse |
70 | 76 | from ...types.browser_create_response import BrowserCreateResponse |
71 | 77 | from ...types.browser_persistence_param import BrowserPersistenceParam |
@@ -247,20 +253,55 @@ def retrieve( |
247 | 253 | def list( |
248 | 254 | self, |
249 | 255 | *, |
| 256 | + include_deleted: bool | Omit = omit, |
| 257 | + limit: int | Omit = omit, |
| 258 | + offset: int | Omit = omit, |
250 | 259 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
251 | 260 | # The extra values given here take precedence over values defined on the client or passed to this method. |
252 | 261 | extra_headers: Headers | None = None, |
253 | 262 | extra_query: Query | None = None, |
254 | 263 | extra_body: Body | None = None, |
255 | 264 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
256 | | - ) -> BrowserListResponse: |
257 | | - """List active browser sessions""" |
258 | | - return self._get( |
| 265 | + ) -> SyncOffsetPagination[BrowserListResponse]: |
| 266 | + """List all browser sessions with pagination support. |
| 267 | +
|
| 268 | + Use include_deleted=true to |
| 269 | + include soft-deleted sessions in the results. |
| 270 | +
|
| 271 | + Args: |
| 272 | + include_deleted: When true, includes soft-deleted browser sessions in the results alongside |
| 273 | + active sessions. |
| 274 | +
|
| 275 | + limit: Maximum number of results to return. Defaults to 20, maximum 100. |
| 276 | +
|
| 277 | + offset: Number of results to skip. Defaults to 0. |
| 278 | +
|
| 279 | + extra_headers: Send extra headers |
| 280 | +
|
| 281 | + extra_query: Add additional query parameters to the request |
| 282 | +
|
| 283 | + extra_body: Add additional JSON properties to the request |
| 284 | +
|
| 285 | + timeout: Override the client-level default timeout for this request, in seconds |
| 286 | + """ |
| 287 | + return self._get_api_list( |
259 | 288 | "/browsers", |
| 289 | + page=SyncOffsetPagination[BrowserListResponse], |
260 | 290 | options=make_request_options( |
261 | | - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 291 | + extra_headers=extra_headers, |
| 292 | + extra_query=extra_query, |
| 293 | + extra_body=extra_body, |
| 294 | + timeout=timeout, |
| 295 | + query=maybe_transform( |
| 296 | + { |
| 297 | + "include_deleted": include_deleted, |
| 298 | + "limit": limit, |
| 299 | + "offset": offset, |
| 300 | + }, |
| 301 | + browser_list_params.BrowserListParams, |
| 302 | + ), |
262 | 303 | ), |
263 | | - cast_to=BrowserListResponse, |
| 304 | + model=BrowserListResponse, |
264 | 305 | ) |
265 | 306 |
|
266 | 307 | def delete( |
@@ -552,23 +593,58 @@ async def retrieve( |
552 | 593 | cast_to=BrowserRetrieveResponse, |
553 | 594 | ) |
554 | 595 |
|
555 | | - async def list( |
| 596 | + def list( |
556 | 597 | self, |
557 | 598 | *, |
| 599 | + include_deleted: bool | Omit = omit, |
| 600 | + limit: int | Omit = omit, |
| 601 | + offset: int | Omit = omit, |
558 | 602 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
559 | 603 | # The extra values given here take precedence over values defined on the client or passed to this method. |
560 | 604 | extra_headers: Headers | None = None, |
561 | 605 | extra_query: Query | None = None, |
562 | 606 | extra_body: Body | None = None, |
563 | 607 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
564 | | - ) -> BrowserListResponse: |
565 | | - """List active browser sessions""" |
566 | | - return await self._get( |
| 608 | + ) -> AsyncPaginator[BrowserListResponse, AsyncOffsetPagination[BrowserListResponse]]: |
| 609 | + """List all browser sessions with pagination support. |
| 610 | +
|
| 611 | + Use include_deleted=true to |
| 612 | + include soft-deleted sessions in the results. |
| 613 | +
|
| 614 | + Args: |
| 615 | + include_deleted: When true, includes soft-deleted browser sessions in the results alongside |
| 616 | + active sessions. |
| 617 | +
|
| 618 | + limit: Maximum number of results to return. Defaults to 20, maximum 100. |
| 619 | +
|
| 620 | + offset: Number of results to skip. Defaults to 0. |
| 621 | +
|
| 622 | + extra_headers: Send extra headers |
| 623 | +
|
| 624 | + extra_query: Add additional query parameters to the request |
| 625 | +
|
| 626 | + extra_body: Add additional JSON properties to the request |
| 627 | +
|
| 628 | + timeout: Override the client-level default timeout for this request, in seconds |
| 629 | + """ |
| 630 | + return self._get_api_list( |
567 | 631 | "/browsers", |
| 632 | + page=AsyncOffsetPagination[BrowserListResponse], |
568 | 633 | options=make_request_options( |
569 | | - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 634 | + extra_headers=extra_headers, |
| 635 | + extra_query=extra_query, |
| 636 | + extra_body=extra_body, |
| 637 | + timeout=timeout, |
| 638 | + query=maybe_transform( |
| 639 | + { |
| 640 | + "include_deleted": include_deleted, |
| 641 | + "limit": limit, |
| 642 | + "offset": offset, |
| 643 | + }, |
| 644 | + browser_list_params.BrowserListParams, |
| 645 | + ), |
570 | 646 | ), |
571 | | - cast_to=BrowserListResponse, |
| 647 | + model=BrowserListResponse, |
572 | 648 | ) |
573 | 649 |
|
574 | 650 | async def delete( |
|
0 commit comments