|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -from typing import Any, Type, Iterable, cast |
| 5 | +from typing import Type, Iterable, cast |
6 | 6 |
|
7 | 7 | import httpx |
8 | 8 |
|
@@ -219,7 +219,7 @@ def list( |
219 | 219 | item_list_params.ItemListParams, |
220 | 220 | ), |
221 | 221 | ), |
222 | | - model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system |
| 222 | + model=ItemListResponse, |
223 | 223 | ) |
224 | 224 |
|
225 | 225 | def delete( |
@@ -308,21 +308,16 @@ def get( |
308 | 308 | raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") |
309 | 309 | if not item_id: |
310 | 310 | raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") |
311 | | - return cast( |
312 | | - ItemGetResponse, |
313 | | - self._get( |
314 | | - f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", |
315 | | - options=make_request_options( |
316 | | - extra_headers=extra_headers, |
317 | | - extra_query=extra_query, |
318 | | - extra_body=extra_body, |
319 | | - timeout=timeout, |
320 | | - post_parser=ResultWrapper[ItemGetResponse]._unwrapper, |
321 | | - ), |
322 | | - cast_to=cast( |
323 | | - Any, ResultWrapper[ItemGetResponse] |
324 | | - ), # Union types cannot be passed in as arguments in the type system |
| 311 | + return self._get( |
| 312 | + f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", |
| 313 | + options=make_request_options( |
| 314 | + extra_headers=extra_headers, |
| 315 | + extra_query=extra_query, |
| 316 | + extra_body=extra_body, |
| 317 | + timeout=timeout, |
| 318 | + post_parser=ResultWrapper[ItemGetResponse]._unwrapper, |
325 | 319 | ), |
| 320 | + cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]), |
326 | 321 | ) |
327 | 322 |
|
328 | 323 |
|
@@ -513,7 +508,7 @@ def list( |
513 | 508 | item_list_params.ItemListParams, |
514 | 509 | ), |
515 | 510 | ), |
516 | | - model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system |
| 511 | + model=ItemListResponse, |
517 | 512 | ) |
518 | 513 |
|
519 | 514 | async def delete( |
@@ -602,21 +597,16 @@ async def get( |
602 | 597 | raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") |
603 | 598 | if not item_id: |
604 | 599 | raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") |
605 | | - return cast( |
606 | | - ItemGetResponse, |
607 | | - await self._get( |
608 | | - f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", |
609 | | - options=make_request_options( |
610 | | - extra_headers=extra_headers, |
611 | | - extra_query=extra_query, |
612 | | - extra_body=extra_body, |
613 | | - timeout=timeout, |
614 | | - post_parser=ResultWrapper[ItemGetResponse]._unwrapper, |
615 | | - ), |
616 | | - cast_to=cast( |
617 | | - Any, ResultWrapper[ItemGetResponse] |
618 | | - ), # Union types cannot be passed in as arguments in the type system |
| 600 | + return await self._get( |
| 601 | + f"/accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}", |
| 602 | + options=make_request_options( |
| 603 | + extra_headers=extra_headers, |
| 604 | + extra_query=extra_query, |
| 605 | + extra_body=extra_body, |
| 606 | + timeout=timeout, |
| 607 | + post_parser=ResultWrapper[ItemGetResponse]._unwrapper, |
619 | 608 | ), |
| 609 | + cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]), |
620 | 610 | ) |
621 | 611 |
|
622 | 612 |
|
|
0 commit comments