@@ -39,7 +39,45 @@ def with_streaming_response(self) -> HardwareResourceWithStreamingResponse:
3939 """
4040 return HardwareResourceWithStreamingResponse (self )
4141
42- def retrieve (
42+ def list (
43+ self ,
44+ * ,
45+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
46+ # The extra values given here take precedence over values defined on the client or passed to this method.
47+ extra_headers : Headers | None = None ,
48+ extra_query : Query | None = None ,
49+ extra_body : Body | None = None ,
50+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
51+ ) -> HardwareListResponse :
52+ """
53+ Example cURL request:
54+
55+ ```console
56+ curl -s \\
57+ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \\
58+ https://api.replicate.com/v1/hardware
59+ ```
60+
61+ The response will be a JSON array of hardware objects:
62+
63+ ```json
64+ [
65+ { "name": "CPU", "sku": "cpu" },
66+ { "name": "Nvidia T4 GPU", "sku": "gpu-t4" },
67+ { "name": "Nvidia A40 GPU", "sku": "gpu-a40-small" },
68+ { "name": "Nvidia A40 (Large) GPU", "sku": "gpu-a40-large" }
69+ ]
70+ ```
71+ """
72+ return self ._get (
73+ "/hardware" ,
74+ options = make_request_options (
75+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
76+ ),
77+ cast_to = HardwareListResponse ,
78+ )
79+
80+ def retrieve_collections (
4381 self ,
4482 collection_slug : str ,
4583 * ,
@@ -91,7 +129,28 @@ def retrieve(
91129 cast_to = NoneType ,
92130 )
93131
94- def list (
132+
133+ class AsyncHardwareResource (AsyncAPIResource ):
134+ @cached_property
135+ def with_raw_response (self ) -> AsyncHardwareResourceWithRawResponse :
136+ """
137+ This property can be used as a prefix for any HTTP method call to return
138+ the raw response object instead of the parsed content.
139+
140+ For more information, see https://www.github.com/zeke/replicate-client-python-prod-for-fun#accessing-raw-response-data-eg-headers
141+ """
142+ return AsyncHardwareResourceWithRawResponse (self )
143+
144+ @cached_property
145+ def with_streaming_response (self ) -> AsyncHardwareResourceWithStreamingResponse :
146+ """
147+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
148+
149+ For more information, see https://www.github.com/zeke/replicate-client-python-prod-for-fun#with_streaming_response
150+ """
151+ return AsyncHardwareResourceWithStreamingResponse (self )
152+
153+ async def list (
95154 self ,
96155 * ,
97156 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -121,36 +180,15 @@ def list(
121180 ]
122181 ```
123182 """
124- return self ._get (
183+ return await self ._get (
125184 "/hardware" ,
126185 options = make_request_options (
127186 extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
128187 ),
129188 cast_to = HardwareListResponse ,
130189 )
131190
132-
133- class AsyncHardwareResource (AsyncAPIResource ):
134- @cached_property
135- def with_raw_response (self ) -> AsyncHardwareResourceWithRawResponse :
136- """
137- This property can be used as a prefix for any HTTP method call to return
138- the raw response object instead of the parsed content.
139-
140- For more information, see https://www.github.com/zeke/replicate-client-python-prod-for-fun#accessing-raw-response-data-eg-headers
141- """
142- return AsyncHardwareResourceWithRawResponse (self )
143-
144- @cached_property
145- def with_streaming_response (self ) -> AsyncHardwareResourceWithStreamingResponse :
146- """
147- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
148-
149- For more information, see https://www.github.com/zeke/replicate-client-python-prod-for-fun#with_streaming_response
150- """
151- return AsyncHardwareResourceWithStreamingResponse (self )
152-
153- async def retrieve (
191+ async def retrieve_collections (
154192 self ,
155193 collection_slug : str ,
156194 * ,
@@ -202,88 +240,50 @@ async def retrieve(
202240 cast_to = NoneType ,
203241 )
204242
205- async def list (
206- self ,
207- * ,
208- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
209- # The extra values given here take precedence over values defined on the client or passed to this method.
210- extra_headers : Headers | None = None ,
211- extra_query : Query | None = None ,
212- extra_body : Body | None = None ,
213- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
214- ) -> HardwareListResponse :
215- """
216- Example cURL request:
217-
218- ```console
219- curl -s \\
220- -H "Authorization: Bearer $REPLICATE_API_TOKEN" \\
221- https://api.replicate.com/v1/hardware
222- ```
223-
224- The response will be a JSON array of hardware objects:
225-
226- ```json
227- [
228- { "name": "CPU", "sku": "cpu" },
229- { "name": "Nvidia T4 GPU", "sku": "gpu-t4" },
230- { "name": "Nvidia A40 GPU", "sku": "gpu-a40-small" },
231- { "name": "Nvidia A40 (Large) GPU", "sku": "gpu-a40-large" }
232- ]
233- ```
234- """
235- return await self ._get (
236- "/hardware" ,
237- options = make_request_options (
238- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
239- ),
240- cast_to = HardwareListResponse ,
241- )
242-
243243
244244class HardwareResourceWithRawResponse :
245245 def __init__ (self , hardware : HardwareResource ) -> None :
246246 self ._hardware = hardware
247247
248- self .retrieve = to_raw_response_wrapper (
249- hardware .retrieve ,
250- )
251248 self .list = to_raw_response_wrapper (
252249 hardware .list ,
253250 )
251+ self .retrieve_collections = to_raw_response_wrapper (
252+ hardware .retrieve_collections ,
253+ )
254254
255255
256256class AsyncHardwareResourceWithRawResponse :
257257 def __init__ (self , hardware : AsyncHardwareResource ) -> None :
258258 self ._hardware = hardware
259259
260- self .retrieve = async_to_raw_response_wrapper (
261- hardware .retrieve ,
262- )
263260 self .list = async_to_raw_response_wrapper (
264261 hardware .list ,
265262 )
263+ self .retrieve_collections = async_to_raw_response_wrapper (
264+ hardware .retrieve_collections ,
265+ )
266266
267267
268268class HardwareResourceWithStreamingResponse :
269269 def __init__ (self , hardware : HardwareResource ) -> None :
270270 self ._hardware = hardware
271271
272- self .retrieve = to_streamed_response_wrapper (
273- hardware .retrieve ,
274- )
275272 self .list = to_streamed_response_wrapper (
276273 hardware .list ,
277274 )
275+ self .retrieve_collections = to_streamed_response_wrapper (
276+ hardware .retrieve_collections ,
277+ )
278278
279279
280280class AsyncHardwareResourceWithStreamingResponse :
281281 def __init__ (self , hardware : AsyncHardwareResource ) -> None :
282282 self ._hardware = hardware
283283
284- self .retrieve = async_to_streamed_response_wrapper (
285- hardware .retrieve ,
286- )
287284 self .list = async_to_streamed_response_wrapper (
288285 hardware .list ,
289286 )
287+ self .retrieve_collections = async_to_streamed_response_wrapper (
288+ hardware .retrieve_collections ,
289+ )
0 commit comments