44
55import httpx
66
7- from .._types import NOT_GIVEN , Body , Query , Headers , NoneType , NotGiven
7+ from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
88from .._compat import cached_property
99from .._resource import SyncAPIResource , AsyncAPIResource
1010from .._response import (
1313 async_to_raw_response_wrapper ,
1414 async_to_streamed_response_wrapper ,
1515)
16- from .._base_client import make_request_options
16+ from ..pagination import SyncCursorURLPage , AsyncCursorURLPage
17+ from .._base_client import AsyncPaginator , make_request_options
18+ from ..types .collection_get_response import CollectionGetResponse
19+ from ..types .collection_list_response import CollectionListResponse
1720
1821__all__ = ["CollectionsResource" , "AsyncCollectionsResource" ]
1922
@@ -47,7 +50,7 @@ def list(
4750 extra_query : Query | None = None ,
4851 extra_body : Body | None = None ,
4952 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
50- ) -> None :
53+ ) -> SyncCursorURLPage [ CollectionListResponse ] :
5154 """
5255 Example cURL request:
5356
@@ -73,13 +76,13 @@ def list(
7376 }
7477 ```
7578 """
76- extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
77- return self ._get (
79+ return self ._get_api_list (
7880 "/collections" ,
81+ page = SyncCursorURLPage [CollectionListResponse ],
7982 options = make_request_options (
8083 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
8184 ),
82- cast_to = NoneType ,
85+ model = CollectionListResponse ,
8386 )
8487
8588 def get (
@@ -92,7 +95,7 @@ def get(
9295 extra_query : Query | None = None ,
9396 extra_body : Body | None = None ,
9497 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
95- ) -> None :
98+ ) -> CollectionGetResponse :
9699 """
97100 Example cURL request:
98101
@@ -125,13 +128,12 @@ def get(
125128 """
126129 if not collection_slug :
127130 raise ValueError (f"Expected a non-empty value for `collection_slug` but received { collection_slug !r} " )
128- extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
129131 return self ._get (
130132 f"/collections/{ collection_slug } " ,
131133 options = make_request_options (
132134 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
133135 ),
134- cast_to = NoneType ,
136+ cast_to = CollectionGetResponse ,
135137 )
136138
137139
@@ -155,7 +157,7 @@ def with_streaming_response(self) -> AsyncCollectionsResourceWithStreamingRespon
155157 """
156158 return AsyncCollectionsResourceWithStreamingResponse (self )
157159
158- async def list (
160+ def list (
159161 self ,
160162 * ,
161163 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -164,7 +166,7 @@ async def list(
164166 extra_query : Query | None = None ,
165167 extra_body : Body | None = None ,
166168 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
167- ) -> None :
169+ ) -> AsyncPaginator [ CollectionListResponse , AsyncCursorURLPage [ CollectionListResponse ]] :
168170 """
169171 Example cURL request:
170172
@@ -190,13 +192,13 @@ async def list(
190192 }
191193 ```
192194 """
193- extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
194- return await self ._get (
195+ return self ._get_api_list (
195196 "/collections" ,
197+ page = AsyncCursorURLPage [CollectionListResponse ],
196198 options = make_request_options (
197199 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
198200 ),
199- cast_to = NoneType ,
201+ model = CollectionListResponse ,
200202 )
201203
202204 async def get (
@@ -209,7 +211,7 @@ async def get(
209211 extra_query : Query | None = None ,
210212 extra_body : Body | None = None ,
211213 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
212- ) -> None :
214+ ) -> CollectionGetResponse :
213215 """
214216 Example cURL request:
215217
@@ -242,13 +244,12 @@ async def get(
242244 """
243245 if not collection_slug :
244246 raise ValueError (f"Expected a non-empty value for `collection_slug` but received { collection_slug !r} " )
245- extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
246247 return await self ._get (
247248 f"/collections/{ collection_slug } " ,
248249 options = make_request_options (
249250 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
250251 ),
251- cast_to = NoneType ,
252+ cast_to = CollectionGetResponse ,
252253 )
253254
254255
0 commit comments