22
33from __future__ import annotations
44
5- from typing import Type , Iterable , cast
5+ from typing import Any , Type , Iterable , cast
66
77import httpx
88
2020from ....pagination import SyncCursorPagination , AsyncCursorPagination
2121from ...._base_client import AsyncPaginator , make_request_options
2222from ....types .rules .lists import item_list_params , item_create_params , item_delete_params , item_update_params
23+ from ....types .rules .lists .item_get_response import ItemGetResponse
24+ from ....types .rules .lists .item_list_response import ItemListResponse
2325from ....types .rules .lists .item_create_response import ItemCreateResponse
2426from ....types .rules .lists .item_delete_response import ItemDeleteResponse
2527from ....types .rules .lists .item_update_response import ItemUpdateResponse
@@ -161,7 +163,7 @@ def list(
161163 extra_query : Query | None = None ,
162164 extra_body : Body | None = None ,
163165 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
164- ) -> SyncCursorPagination [object ]:
166+ ) -> SyncCursorPagination [ItemListResponse ]:
165167 """
166168 Fetches all the items in the list.
167169
@@ -197,7 +199,7 @@ def list(
197199 raise ValueError (f"Expected a non-empty value for `list_id` but received { list_id !r} " )
198200 return self ._get_api_list (
199201 f"/accounts/{ account_id } /rules/lists/{ list_id } /items" ,
200- page = SyncCursorPagination [object ],
202+ page = SyncCursorPagination [ItemListResponse ],
201203 options = make_request_options (
202204 extra_headers = extra_headers ,
203205 extra_query = extra_query ,
@@ -212,7 +214,7 @@ def list(
212214 item_list_params .ItemListParams ,
213215 ),
214216 ),
215- model = object ,
217+ model = cast ( Any , ItemListResponse ), # Union types cannot be passed in as arguments in the type system
216218 )
217219
218220 def delete (
@@ -277,7 +279,7 @@ def get(
277279 extra_query : Query | None = None ,
278280 extra_body : Body | None = None ,
279281 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
280- ) -> object :
282+ ) -> ItemGetResponse :
281283 """
282284 Fetches a list item in the list.
283285
@@ -302,16 +304,21 @@ def get(
302304 raise ValueError (f"Expected a non-empty value for `list_id` but received { list_id !r} " )
303305 if not item_id :
304306 raise ValueError (f"Expected a non-empty value for `item_id` but received { item_id !r} " )
305- return self ._get (
306- f"/accounts/{ account_id } /rules/lists/{ list_id } /items/{ item_id } " ,
307- options = make_request_options (
308- extra_headers = extra_headers ,
309- extra_query = extra_query ,
310- extra_body = extra_body ,
311- timeout = timeout ,
312- post_parser = ResultWrapper [object ]._unwrapper ,
307+ return cast (
308+ ItemGetResponse ,
309+ self ._get (
310+ f"/accounts/{ account_id } /rules/lists/{ list_id } /items/{ item_id } " ,
311+ options = make_request_options (
312+ extra_headers = extra_headers ,
313+ extra_query = extra_query ,
314+ extra_body = extra_body ,
315+ timeout = timeout ,
316+ post_parser = ResultWrapper [ItemGetResponse ]._unwrapper ,
317+ ),
318+ cast_to = cast (
319+ Any , ResultWrapper [ItemGetResponse ]
320+ ), # Union types cannot be passed in as arguments in the type system
313321 ),
314- cast_to = cast (Type [object ], ResultWrapper [object ]),
315322 )
316323
317324
@@ -449,7 +456,7 @@ def list(
449456 extra_query : Query | None = None ,
450457 extra_body : Body | None = None ,
451458 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
452- ) -> AsyncPaginator [object , AsyncCursorPagination [object ]]:
459+ ) -> AsyncPaginator [ItemListResponse , AsyncCursorPagination [ItemListResponse ]]:
453460 """
454461 Fetches all the items in the list.
455462
@@ -485,7 +492,7 @@ def list(
485492 raise ValueError (f"Expected a non-empty value for `list_id` but received { list_id !r} " )
486493 return self ._get_api_list (
487494 f"/accounts/{ account_id } /rules/lists/{ list_id } /items" ,
488- page = AsyncCursorPagination [object ],
495+ page = AsyncCursorPagination [ItemListResponse ],
489496 options = make_request_options (
490497 extra_headers = extra_headers ,
491498 extra_query = extra_query ,
@@ -500,7 +507,7 @@ def list(
500507 item_list_params .ItemListParams ,
501508 ),
502509 ),
503- model = object ,
510+ model = cast ( Any , ItemListResponse ), # Union types cannot be passed in as arguments in the type system
504511 )
505512
506513 async def delete (
@@ -565,7 +572,7 @@ async def get(
565572 extra_query : Query | None = None ,
566573 extra_body : Body | None = None ,
567574 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
568- ) -> object :
575+ ) -> ItemGetResponse :
569576 """
570577 Fetches a list item in the list.
571578
@@ -590,16 +597,21 @@ async def get(
590597 raise ValueError (f"Expected a non-empty value for `list_id` but received { list_id !r} " )
591598 if not item_id :
592599 raise ValueError (f"Expected a non-empty value for `item_id` but received { item_id !r} " )
593- return await self ._get (
594- f"/accounts/{ account_id } /rules/lists/{ list_id } /items/{ item_id } " ,
595- options = make_request_options (
596- extra_headers = extra_headers ,
597- extra_query = extra_query ,
598- extra_body = extra_body ,
599- timeout = timeout ,
600- post_parser = ResultWrapper [object ]._unwrapper ,
600+ return cast (
601+ ItemGetResponse ,
602+ await self ._get (
603+ f"/accounts/{ account_id } /rules/lists/{ list_id } /items/{ item_id } " ,
604+ options = make_request_options (
605+ extra_headers = extra_headers ,
606+ extra_query = extra_query ,
607+ extra_body = extra_body ,
608+ timeout = timeout ,
609+ post_parser = ResultWrapper [ItemGetResponse ]._unwrapper ,
610+ ),
611+ cast_to = cast (
612+ Any , ResultWrapper [ItemGetResponse ]
613+ ), # Union types cannot be passed in as arguments in the type system
601614 ),
602- cast_to = cast (Type [object ], ResultWrapper [object ]),
603615 )
604616
605617
0 commit comments