44
55import httpx
66
7- from .._types import NOT_GIVEN , Body , Query , Headers , NotGiven
7+ from .._types import NOT_GIVEN , Body , Query , Headers , NoneType , NotGiven
88from .._compat import cached_property
99from .._resource import SyncAPIResource , AsyncAPIResource
1010from .._response import (
@@ -39,6 +39,58 @@ def with_streaming_response(self) -> HardwareResourceWithStreamingResponse:
3939 """
4040 return HardwareResourceWithStreamingResponse (self )
4141
42+ def retrieve (
43+ self ,
44+ collection_slug : str ,
45+ * ,
46+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
47+ # The extra values given here take precedence over values defined on the client or passed to this method.
48+ extra_headers : Headers | None = None ,
49+ extra_query : Query | None = None ,
50+ extra_body : Body | None = None ,
51+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
52+ ) -> None :
53+ """
54+ Example cURL request:
55+
56+ ```console
57+ curl -s \\
58+ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \\
59+ https://api.replicate.com/v1/collections/super-resolution
60+ ```
61+
62+ The response will be a collection object with a nested list of the models in
63+ that collection:
64+
65+ ```json
66+ {
67+ "name": "Super resolution",
68+ "slug": "super-resolution",
69+ "description": "Upscaling models that create high-quality images from low-quality images.",
70+ "models": [...]
71+ }
72+ ```
73+
74+ Args:
75+ extra_headers: Send extra headers
76+
77+ extra_query: Add additional query parameters to the request
78+
79+ extra_body: Add additional JSON properties to the request
80+
81+ timeout: Override the client-level default timeout for this request, in seconds
82+ """
83+ if not collection_slug :
84+ raise ValueError (f"Expected a non-empty value for `collection_slug` but received { collection_slug !r} " )
85+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
86+ return self ._get (
87+ f"/collections/{ collection_slug } " ,
88+ options = make_request_options (
89+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
90+ ),
91+ cast_to = NoneType ,
92+ )
93+
4294 def list (
4395 self ,
4496 * ,
@@ -98,6 +150,58 @@ def with_streaming_response(self) -> AsyncHardwareResourceWithStreamingResponse:
98150 """
99151 return AsyncHardwareResourceWithStreamingResponse (self )
100152
153+ async def retrieve (
154+ self ,
155+ collection_slug : str ,
156+ * ,
157+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
158+ # The extra values given here take precedence over values defined on the client or passed to this method.
159+ extra_headers : Headers | None = None ,
160+ extra_query : Query | None = None ,
161+ extra_body : Body | None = None ,
162+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
163+ ) -> None :
164+ """
165+ Example cURL request:
166+
167+ ```console
168+ curl -s \\
169+ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \\
170+ https://api.replicate.com/v1/collections/super-resolution
171+ ```
172+
173+ The response will be a collection object with a nested list of the models in
174+ that collection:
175+
176+ ```json
177+ {
178+ "name": "Super resolution",
179+ "slug": "super-resolution",
180+ "description": "Upscaling models that create high-quality images from low-quality images.",
181+ "models": [...]
182+ }
183+ ```
184+
185+ Args:
186+ extra_headers: Send extra headers
187+
188+ extra_query: Add additional query parameters to the request
189+
190+ extra_body: Add additional JSON properties to the request
191+
192+ timeout: Override the client-level default timeout for this request, in seconds
193+ """
194+ if not collection_slug :
195+ raise ValueError (f"Expected a non-empty value for `collection_slug` but received { collection_slug !r} " )
196+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
197+ return await self ._get (
198+ f"/collections/{ collection_slug } " ,
199+ options = make_request_options (
200+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
201+ ),
202+ cast_to = NoneType ,
203+ )
204+
101205 async def list (
102206 self ,
103207 * ,
@@ -141,6 +245,9 @@ class HardwareResourceWithRawResponse:
141245 def __init__ (self , hardware : HardwareResource ) -> None :
142246 self ._hardware = hardware
143247
248+ self .retrieve = to_raw_response_wrapper (
249+ hardware .retrieve ,
250+ )
144251 self .list = to_raw_response_wrapper (
145252 hardware .list ,
146253 )
@@ -150,6 +257,9 @@ class AsyncHardwareResourceWithRawResponse:
150257 def __init__ (self , hardware : AsyncHardwareResource ) -> None :
151258 self ._hardware = hardware
152259
260+ self .retrieve = async_to_raw_response_wrapper (
261+ hardware .retrieve ,
262+ )
153263 self .list = async_to_raw_response_wrapper (
154264 hardware .list ,
155265 )
@@ -159,6 +269,9 @@ class HardwareResourceWithStreamingResponse:
159269 def __init__ (self , hardware : HardwareResource ) -> None :
160270 self ._hardware = hardware
161271
272+ self .retrieve = to_streamed_response_wrapper (
273+ hardware .retrieve ,
274+ )
162275 self .list = to_streamed_response_wrapper (
163276 hardware .list ,
164277 )
@@ -168,6 +281,9 @@ class AsyncHardwareResourceWithStreamingResponse:
168281 def __init__ (self , hardware : AsyncHardwareResource ) -> None :
169282 self ._hardware = hardware
170283
284+ self .retrieve = async_to_streamed_response_wrapper (
285+ hardware .retrieve ,
286+ )
171287 self .list = async_to_streamed_response_wrapper (
172288 hardware .list ,
173289 )
0 commit comments