|
4 | 4 |
|
5 | 5 | import httpx |
6 | 6 |
|
7 | | -from ..types import profile_create_params |
| 7 | +from ..types import profile_list_params, profile_create_params |
8 | 8 | from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given |
9 | 9 | from .._utils import maybe_transform, async_maybe_transform |
10 | 10 | from .._compat import cached_property |
|
23 | 23 | async_to_custom_raw_response_wrapper, |
24 | 24 | async_to_custom_streamed_response_wrapper, |
25 | 25 | ) |
26 | | -from .._base_client import make_request_options |
| 26 | +from ..pagination import SyncOffsetPagination, AsyncOffsetPagination |
| 27 | +from .._base_client import AsyncPaginator, make_request_options |
27 | 28 | from ..types.profile import Profile |
28 | | -from ..types.profile_list_response import ProfileListResponse |
29 | 29 |
|
30 | 30 | __all__ = ["ProfilesResource", "AsyncProfilesResource"] |
31 | 31 |
|
@@ -121,20 +121,52 @@ def retrieve( |
121 | 121 | def list( |
122 | 122 | self, |
123 | 123 | *, |
| 124 | + limit: int | Omit = omit, |
| 125 | + offset: int | Omit = omit, |
| 126 | + query: str | Omit = omit, |
124 | 127 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
125 | 128 | # The extra values given here take precedence over values defined on the client or passed to this method. |
126 | 129 | extra_headers: Headers | None = None, |
127 | 130 | extra_query: Query | None = None, |
128 | 131 | extra_body: Body | None = None, |
129 | 132 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
130 | | - ) -> ProfileListResponse: |
131 | | - """List profiles with optional filtering and pagination.""" |
132 | | - return self._get( |
| 133 | + ) -> SyncOffsetPagination[Profile]: |
| 134 | + """ |
| 135 | + List profiles with optional filtering and pagination. |
| 136 | +
|
| 137 | + Args: |
| 138 | + limit: Limit the number of profiles to return. |
| 139 | +
|
| 140 | + offset: Offset the number of profiles to return. |
| 141 | +
|
| 142 | + query: Search profiles by name or ID. |
| 143 | +
|
| 144 | + extra_headers: Send extra headers |
| 145 | +
|
| 146 | + extra_query: Add additional query parameters to the request |
| 147 | +
|
| 148 | + extra_body: Add additional JSON properties to the request |
| 149 | +
|
| 150 | + timeout: Override the client-level default timeout for this request, in seconds |
| 151 | + """ |
| 152 | + return self._get_api_list( |
133 | 153 | "/profiles", |
| 154 | + page=SyncOffsetPagination[Profile], |
134 | 155 | options=make_request_options( |
135 | | - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 156 | + extra_headers=extra_headers, |
| 157 | + extra_query=extra_query, |
| 158 | + extra_body=extra_body, |
| 159 | + timeout=timeout, |
| 160 | + query=maybe_transform( |
| 161 | + { |
| 162 | + "limit": limit, |
| 163 | + "offset": offset, |
| 164 | + "query": query, |
| 165 | + }, |
| 166 | + profile_list_params.ProfileListParams, |
| 167 | + ), |
136 | 168 | ), |
137 | | - cast_to=ProfileListResponse, |
| 169 | + model=Profile, |
138 | 170 | ) |
139 | 171 |
|
140 | 172 | def delete( |
@@ -296,23 +328,55 @@ async def retrieve( |
296 | 328 | cast_to=Profile, |
297 | 329 | ) |
298 | 330 |
|
299 | | - async def list( |
| 331 | + def list( |
300 | 332 | self, |
301 | 333 | *, |
| 334 | + limit: int | Omit = omit, |
| 335 | + offset: int | Omit = omit, |
| 336 | + query: str | Omit = omit, |
302 | 337 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
303 | 338 | # The extra values given here take precedence over values defined on the client or passed to this method. |
304 | 339 | extra_headers: Headers | None = None, |
305 | 340 | extra_query: Query | None = None, |
306 | 341 | extra_body: Body | None = None, |
307 | 342 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
308 | | - ) -> ProfileListResponse: |
309 | | - """List profiles with optional filtering and pagination.""" |
310 | | - return await self._get( |
| 343 | + ) -> AsyncPaginator[Profile, AsyncOffsetPagination[Profile]]: |
| 344 | + """ |
| 345 | + List profiles with optional filtering and pagination. |
| 346 | +
|
| 347 | + Args: |
| 348 | + limit: Limit the number of profiles to return. |
| 349 | +
|
| 350 | + offset: Offset the number of profiles to return. |
| 351 | +
|
| 352 | + query: Search profiles by name or ID. |
| 353 | +
|
| 354 | + extra_headers: Send extra headers |
| 355 | +
|
| 356 | + extra_query: Add additional query parameters to the request |
| 357 | +
|
| 358 | + extra_body: Add additional JSON properties to the request |
| 359 | +
|
| 360 | + timeout: Override the client-level default timeout for this request, in seconds |
| 361 | + """ |
| 362 | + return self._get_api_list( |
311 | 363 | "/profiles", |
| 364 | + page=AsyncOffsetPagination[Profile], |
312 | 365 | options=make_request_options( |
313 | | - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 366 | + extra_headers=extra_headers, |
| 367 | + extra_query=extra_query, |
| 368 | + extra_body=extra_body, |
| 369 | + timeout=timeout, |
| 370 | + query=maybe_transform( |
| 371 | + { |
| 372 | + "limit": limit, |
| 373 | + "offset": offset, |
| 374 | + "query": query, |
| 375 | + }, |
| 376 | + profile_list_params.ProfileListParams, |
| 377 | + ), |
314 | 378 | ), |
315 | | - cast_to=ProfileListResponse, |
| 379 | + model=Profile, |
316 | 380 | ) |
317 | 381 |
|
318 | 382 | async def delete( |
|
0 commit comments