66
77import httpx
88
9- from ..types import collection_list_params , collection_create_params
9+ from ..types import collection_list_params
1010from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
11- from .._utils import maybe_transform , async_maybe_transform
11+ from .._utils import maybe_transform
1212from .._compat import cached_property
1313from .._resource import SyncAPIResource , AsyncAPIResource
1414from .._response import (
1919)
2020from ..pagination import SyncCursorPage , AsyncCursorPage
2121from .._base_client import AsyncPaginator , make_request_options
22- from ..types .collection import Collection
2322from ..types .collection_list_response import CollectionListResponse
2423
2524__all__ = ["CollectionsResource" , "AsyncCollectionsResource" ]
@@ -45,52 +44,6 @@ def with_streaming_response(self) -> CollectionsResourceWithStreamingResponse:
4544 """
4645 return CollectionsResourceWithStreamingResponse (self )
4746
48- def create (
49- self ,
50- * ,
51- name : str ,
52- owner : Optional [str ] | NotGiven = NOT_GIVEN ,
53- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54- # The extra values given here take precedence over values defined on the client or passed to this method.
55- extra_headers : Headers | None = None ,
56- extra_query : Query | None = None ,
57- extra_body : Body | None = None ,
58- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
59- ) -> Collection :
60- """This endpoint allows you to paginate through all documents in the index.
61-
62- You can
63- filter the documents by title, date, metadata, etc.
64-
65- Args:
66- name: The name of the collection.
67-
68- owner: The owner of the collection. If the request is made using a user token, this
69- will be set to the user ID.
70-
71- extra_headers: Send extra headers
72-
73- extra_query: Add additional query parameters to the request
74-
75- extra_body: Add additional JSON properties to the request
76-
77- timeout: Override the client-level default timeout for this request, in seconds
78- """
79- return self ._post (
80- "/collections/add" ,
81- body = maybe_transform (
82- {
83- "name" : name ,
84- "owner" : owner ,
85- },
86- collection_create_params .CollectionCreateParams ,
87- ),
88- options = make_request_options (
89- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
90- ),
91- cast_to = Collection ,
92- )
93-
9447 def list (
9548 self ,
9649 * ,
@@ -103,8 +56,10 @@ def list(
10356 extra_body : Body | None = None ,
10457 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
10558 ) -> SyncCursorPage [CollectionListResponse ]:
106- """
107- Lists all collections the user has access to.
59+ """This endpoint allows you to paginate through all documents in the index.
60+
61+ You can
62+ filter the documents by title, date, metadata, etc.
10863
10964 Args:
11065 extra_headers: Send extra headers
@@ -134,39 +89,6 @@ def list(
13489 model = CollectionListResponse ,
13590 )
13691
137- def get (
138- self ,
139- name : str ,
140- * ,
141- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
142- # The extra values given here take precedence over values defined on the client or passed to this method.
143- extra_headers : Headers | None = None ,
144- extra_query : Query | None = None ,
145- extra_body : Body | None = None ,
146- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
147- ) -> Collection :
148- """
149- Retrieves a collection by name.
150-
151- Args:
152- extra_headers: Send extra headers
153-
154- extra_query: Add additional query parameters to the request
155-
156- extra_body: Add additional JSON properties to the request
157-
158- timeout: Override the client-level default timeout for this request, in seconds
159- """
160- if not name :
161- raise ValueError (f"Expected a non-empty value for `name` but received { name !r} " )
162- return self ._get (
163- f"/collections/get/{ name } " ,
164- options = make_request_options (
165- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
166- ),
167- cast_to = Collection ,
168- )
169-
17092
17193class AsyncCollectionsResource (AsyncAPIResource ):
17294 @cached_property
@@ -188,52 +110,6 @@ def with_streaming_response(self) -> AsyncCollectionsResourceWithStreamingRespon
188110 """
189111 return AsyncCollectionsResourceWithStreamingResponse (self )
190112
191- async def create (
192- self ,
193- * ,
194- name : str ,
195- owner : Optional [str ] | NotGiven = NOT_GIVEN ,
196- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
197- # The extra values given here take precedence over values defined on the client or passed to this method.
198- extra_headers : Headers | None = None ,
199- extra_query : Query | None = None ,
200- extra_body : Body | None = None ,
201- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
202- ) -> Collection :
203- """This endpoint allows you to paginate through all documents in the index.
204-
205- You can
206- filter the documents by title, date, metadata, etc.
207-
208- Args:
209- name: The name of the collection.
210-
211- owner: The owner of the collection. If the request is made using a user token, this
212- will be set to the user ID.
213-
214- extra_headers: Send extra headers
215-
216- extra_query: Add additional query parameters to the request
217-
218- extra_body: Add additional JSON properties to the request
219-
220- timeout: Override the client-level default timeout for this request, in seconds
221- """
222- return await self ._post (
223- "/collections/add" ,
224- body = await async_maybe_transform (
225- {
226- "name" : name ,
227- "owner" : owner ,
228- },
229- collection_create_params .CollectionCreateParams ,
230- ),
231- options = make_request_options (
232- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
233- ),
234- cast_to = Collection ,
235- )
236-
237113 def list (
238114 self ,
239115 * ,
@@ -246,8 +122,10 @@ def list(
246122 extra_body : Body | None = None ,
247123 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
248124 ) -> AsyncPaginator [CollectionListResponse , AsyncCursorPage [CollectionListResponse ]]:
249- """
250- Lists all collections the user has access to.
125+ """This endpoint allows you to paginate through all documents in the index.
126+
127+ You can
128+ filter the documents by title, date, metadata, etc.
251129
252130 Args:
253131 extra_headers: Send extra headers
@@ -277,95 +155,38 @@ def list(
277155 model = CollectionListResponse ,
278156 )
279157
280- async def get (
281- self ,
282- name : str ,
283- * ,
284- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
285- # The extra values given here take precedence over values defined on the client or passed to this method.
286- extra_headers : Headers | None = None ,
287- extra_query : Query | None = None ,
288- extra_body : Body | None = None ,
289- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
290- ) -> Collection :
291- """
292- Retrieves a collection by name.
293-
294- Args:
295- extra_headers: Send extra headers
296-
297- extra_query: Add additional query parameters to the request
298-
299- extra_body: Add additional JSON properties to the request
300-
301- timeout: Override the client-level default timeout for this request, in seconds
302- """
303- if not name :
304- raise ValueError (f"Expected a non-empty value for `name` but received { name !r} " )
305- return await self ._get (
306- f"/collections/get/{ name } " ,
307- options = make_request_options (
308- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
309- ),
310- cast_to = Collection ,
311- )
312-
313158
314159class CollectionsResourceWithRawResponse :
315160 def __init__ (self , collections : CollectionsResource ) -> None :
316161 self ._collections = collections
317162
318- self .create = to_raw_response_wrapper (
319- collections .create ,
320- )
321163 self .list = to_raw_response_wrapper (
322164 collections .list ,
323165 )
324- self .get = to_raw_response_wrapper (
325- collections .get ,
326- )
327166
328167
329168class AsyncCollectionsResourceWithRawResponse :
330169 def __init__ (self , collections : AsyncCollectionsResource ) -> None :
331170 self ._collections = collections
332171
333- self .create = async_to_raw_response_wrapper (
334- collections .create ,
335- )
336172 self .list = async_to_raw_response_wrapper (
337173 collections .list ,
338174 )
339- self .get = async_to_raw_response_wrapper (
340- collections .get ,
341- )
342175
343176
344177class CollectionsResourceWithStreamingResponse :
345178 def __init__ (self , collections : CollectionsResource ) -> None :
346179 self ._collections = collections
347180
348- self .create = to_streamed_response_wrapper (
349- collections .create ,
350- )
351181 self .list = to_streamed_response_wrapper (
352182 collections .list ,
353183 )
354- self .get = to_streamed_response_wrapper (
355- collections .get ,
356- )
357184
358185
359186class AsyncCollectionsResourceWithStreamingResponse :
360187 def __init__ (self , collections : AsyncCollectionsResource ) -> None :
361188 self ._collections = collections
362189
363- self .create = async_to_streamed_response_wrapper (
364- collections .create ,
365- )
366190 self .list = async_to_streamed_response_wrapper (
367191 collections .list ,
368192 )
369- self .get = async_to_streamed_response_wrapper (
370- collections .get ,
371- )
0 commit comments