|
6 | 6 |
|
7 | 7 | import httpx |
8 | 8 |
|
9 | | -from ..types import proxy_check_params, proxy_create_params |
| 9 | +from ..types import proxy_list_params, proxy_check_params, proxy_create_params |
10 | 10 | from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given |
11 | 11 | from .._utils import path_template, maybe_transform, async_maybe_transform |
12 | 12 | from .._compat import cached_property |
|
17 | 17 | async_to_raw_response_wrapper, |
18 | 18 | async_to_streamed_response_wrapper, |
19 | 19 | ) |
20 | | -from .._base_client import make_request_options |
| 20 | +from ..pagination import SyncOffsetPagination, AsyncOffsetPagination |
| 21 | +from .._base_client import AsyncPaginator, make_request_options |
21 | 22 | from ..types.proxy_list_response import ProxyListResponse |
22 | 23 | from ..types.proxy_check_response import ProxyCheckResponse |
23 | 24 | from ..types.proxy_create_response import ProxyCreateResponse |
@@ -140,20 +141,48 @@ def retrieve( |
140 | 141 | def list( |
141 | 142 | self, |
142 | 143 | *, |
| 144 | + limit: int | Omit = omit, |
| 145 | + offset: int | Omit = omit, |
143 | 146 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
144 | 147 | # The extra values given here take precedence over values defined on the client or passed to this method. |
145 | 148 | extra_headers: Headers | None = None, |
146 | 149 | extra_query: Query | None = None, |
147 | 150 | extra_body: Body | None = None, |
148 | 151 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
149 | | - ) -> ProxyListResponse: |
150 | | - """List proxies owned by the caller's organization.""" |
151 | | - return self._get( |
| 152 | + ) -> SyncOffsetPagination[ProxyListResponse]: |
| 153 | + """ |
| 154 | + List proxies owned by the caller's organization. |
| 155 | +
|
| 156 | + Args: |
| 157 | + limit: Limit the number of proxies to return. |
| 158 | +
|
| 159 | + offset: Offset the number of proxies to return. |
| 160 | +
|
| 161 | + extra_headers: Send extra headers |
| 162 | +
|
| 163 | + extra_query: Add additional query parameters to the request |
| 164 | +
|
| 165 | + extra_body: Add additional JSON properties to the request |
| 166 | +
|
| 167 | + timeout: Override the client-level default timeout for this request, in seconds |
| 168 | + """ |
| 169 | + return self._get_api_list( |
152 | 170 | "/proxies", |
| 171 | + page=SyncOffsetPagination[ProxyListResponse], |
153 | 172 | options=make_request_options( |
154 | | - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 173 | + extra_headers=extra_headers, |
| 174 | + extra_query=extra_query, |
| 175 | + extra_body=extra_body, |
| 176 | + timeout=timeout, |
| 177 | + query=maybe_transform( |
| 178 | + { |
| 179 | + "limit": limit, |
| 180 | + "offset": offset, |
| 181 | + }, |
| 182 | + proxy_list_params.ProxyListParams, |
| 183 | + ), |
155 | 184 | ), |
156 | | - cast_to=ProxyListResponse, |
| 185 | + model=ProxyListResponse, |
157 | 186 | ) |
158 | 187 |
|
159 | 188 | def delete( |
@@ -357,23 +386,51 @@ async def retrieve( |
357 | 386 | cast_to=ProxyRetrieveResponse, |
358 | 387 | ) |
359 | 388 |
|
360 | | - async def list( |
| 389 | + def list( |
361 | 390 | self, |
362 | 391 | *, |
| 392 | + limit: int | Omit = omit, |
| 393 | + offset: int | Omit = omit, |
363 | 394 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
364 | 395 | # The extra values given here take precedence over values defined on the client or passed to this method. |
365 | 396 | extra_headers: Headers | None = None, |
366 | 397 | extra_query: Query | None = None, |
367 | 398 | extra_body: Body | None = None, |
368 | 399 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
369 | | - ) -> ProxyListResponse: |
370 | | - """List proxies owned by the caller's organization.""" |
371 | | - return await self._get( |
| 400 | + ) -> AsyncPaginator[ProxyListResponse, AsyncOffsetPagination[ProxyListResponse]]: |
| 401 | + """ |
| 402 | + List proxies owned by the caller's organization. |
| 403 | +
|
| 404 | + Args: |
| 405 | + limit: Limit the number of proxies to return. |
| 406 | +
|
| 407 | + offset: Offset the number of proxies to return. |
| 408 | +
|
| 409 | + extra_headers: Send extra headers |
| 410 | +
|
| 411 | + extra_query: Add additional query parameters to the request |
| 412 | +
|
| 413 | + extra_body: Add additional JSON properties to the request |
| 414 | +
|
| 415 | + timeout: Override the client-level default timeout for this request, in seconds |
| 416 | + """ |
| 417 | + return self._get_api_list( |
372 | 418 | "/proxies", |
| 419 | + page=AsyncOffsetPagination[ProxyListResponse], |
373 | 420 | options=make_request_options( |
374 | | - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 421 | + extra_headers=extra_headers, |
| 422 | + extra_query=extra_query, |
| 423 | + extra_body=extra_body, |
| 424 | + timeout=timeout, |
| 425 | + query=maybe_transform( |
| 426 | + { |
| 427 | + "limit": limit, |
| 428 | + "offset": offset, |
| 429 | + }, |
| 430 | + proxy_list_params.ProxyListParams, |
| 431 | + ), |
375 | 432 | ), |
376 | | - cast_to=ProxyListResponse, |
| 433 | + model=ProxyListResponse, |
377 | 434 | ) |
378 | 435 |
|
379 | 436 | async def delete( |
|
0 commit comments