22
33from __future__ import annotations
44
5- from typing import Optional
6-
75import httpx
86
97from ..types import brand_list_params
10- from .._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
8+ from .._types import Body , Query , Headers , NotGiven , not_given
119from .._utils import maybe_transform , async_maybe_transform
1210from .._compat import cached_property
1311from .._resource import SyncAPIResource , AsyncAPIResource
1917)
2018from ..types .brand import Brand
2119from .._base_client import make_request_options
22- from ..types .brand_list_response import BrandListResponse
2320
2421__all__ = ["BrandsResource" , "AsyncBrandsResource" ]
2522
@@ -44,54 +41,19 @@ def with_streaming_response(self) -> BrandsResourceWithStreamingResponse:
4441 """
4542 return BrandsResourceWithStreamingResponse (self )
4643
47- def retrieve (
48- self ,
49- brand_id : str ,
50- * ,
51- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
52- # The extra values given here take precedence over values defined on the client or passed to this method.
53- extra_headers : Headers | None = None ,
54- extra_query : Query | None = None ,
55- extra_body : Body | None = None ,
56- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
57- ) -> Brand :
58- """
59- Get detailed information for a specific brand by its ID.
60-
61- Args:
62- extra_headers: Send extra headers
63-
64- extra_query: Add additional query parameters to the request
65-
66- extra_body: Add additional JSON properties to the request
67-
68- timeout: Override the client-level default timeout for this request, in seconds
69- """
70- if not brand_id :
71- raise ValueError (f"Expected a non-empty value for `brand_id` but received { brand_id !r} " )
72- return self ._get (
73- f"/v0/brands/{ brand_id } " ,
74- options = make_request_options (
75- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
76- ),
77- cast_to = Brand ,
78- )
79-
8044 def list (
8145 self ,
8246 * ,
83- page : int | Omit = omit ,
84- query : Optional [str ] | Omit = omit ,
85- size : int | Omit = omit ,
47+ query : str ,
8648 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
8749 # The extra values given here take precedence over values defined on the client or passed to this method.
8850 extra_headers : Headers | None = None ,
8951 extra_query : Query | None = None ,
9052 extra_body : Body | None = None ,
9153 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
92- ) -> BrandListResponse :
54+ ) -> Brand :
9355 """
94- Get all brands that the vendor currently sells .
56+ Find a brand by name .
9557
9658 Args:
9759 extra_headers: Send extra headers
@@ -109,16 +71,9 @@ def list(
10971 extra_query = extra_query ,
11072 extra_body = extra_body ,
11173 timeout = timeout ,
112- query = maybe_transform (
113- {
114- "page" : page ,
115- "query" : query ,
116- "size" : size ,
117- },
118- brand_list_params .BrandListParams ,
119- ),
74+ query = maybe_transform ({"query" : query }, brand_list_params .BrandListParams ),
12075 ),
121- cast_to = BrandListResponse ,
76+ cast_to = Brand ,
12277 )
12378
12479
@@ -142,54 +97,19 @@ def with_streaming_response(self) -> AsyncBrandsResourceWithStreamingResponse:
14297 """
14398 return AsyncBrandsResourceWithStreamingResponse (self )
14499
145- async def retrieve (
146- self ,
147- brand_id : str ,
148- * ,
149- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
150- # The extra values given here take precedence over values defined on the client or passed to this method.
151- extra_headers : Headers | None = None ,
152- extra_query : Query | None = None ,
153- extra_body : Body | None = None ,
154- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
155- ) -> Brand :
156- """
157- Get detailed information for a specific brand by its ID.
158-
159- Args:
160- extra_headers: Send extra headers
161-
162- extra_query: Add additional query parameters to the request
163-
164- extra_body: Add additional JSON properties to the request
165-
166- timeout: Override the client-level default timeout for this request, in seconds
167- """
168- if not brand_id :
169- raise ValueError (f"Expected a non-empty value for `brand_id` but received { brand_id !r} " )
170- return await self ._get (
171- f"/v0/brands/{ brand_id } " ,
172- options = make_request_options (
173- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
174- ),
175- cast_to = Brand ,
176- )
177-
178100 async def list (
179101 self ,
180102 * ,
181- page : int | Omit = omit ,
182- query : Optional [str ] | Omit = omit ,
183- size : int | Omit = omit ,
103+ query : str ,
184104 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
185105 # The extra values given here take precedence over values defined on the client or passed to this method.
186106 extra_headers : Headers | None = None ,
187107 extra_query : Query | None = None ,
188108 extra_body : Body | None = None ,
189109 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
190- ) -> BrandListResponse :
110+ ) -> Brand :
191111 """
192- Get all brands that the vendor currently sells .
112+ Find a brand by name .
193113
194114 Args:
195115 extra_headers: Send extra headers
@@ -207,26 +127,16 @@ async def list(
207127 extra_query = extra_query ,
208128 extra_body = extra_body ,
209129 timeout = timeout ,
210- query = await async_maybe_transform (
211- {
212- "page" : page ,
213- "query" : query ,
214- "size" : size ,
215- },
216- brand_list_params .BrandListParams ,
217- ),
130+ query = await async_maybe_transform ({"query" : query }, brand_list_params .BrandListParams ),
218131 ),
219- cast_to = BrandListResponse ,
132+ cast_to = Brand ,
220133 )
221134
222135
223136class BrandsResourceWithRawResponse :
224137 def __init__ (self , brands : BrandsResource ) -> None :
225138 self ._brands = brands
226139
227- self .retrieve = to_raw_response_wrapper (
228- brands .retrieve ,
229- )
230140 self .list = to_raw_response_wrapper (
231141 brands .list ,
232142 )
@@ -236,9 +146,6 @@ class AsyncBrandsResourceWithRawResponse:
236146 def __init__ (self , brands : AsyncBrandsResource ) -> None :
237147 self ._brands = brands
238148
239- self .retrieve = async_to_raw_response_wrapper (
240- brands .retrieve ,
241- )
242149 self .list = async_to_raw_response_wrapper (
243150 brands .list ,
244151 )
@@ -248,9 +155,6 @@ class BrandsResourceWithStreamingResponse:
248155 def __init__ (self , brands : BrandsResource ) -> None :
249156 self ._brands = brands
250157
251- self .retrieve = to_streamed_response_wrapper (
252- brands .retrieve ,
253- )
254158 self .list = to_streamed_response_wrapper (
255159 brands .list ,
256160 )
@@ -260,9 +164,6 @@ class AsyncBrandsResourceWithStreamingResponse:
260164 def __init__ (self , brands : AsyncBrandsResource ) -> None :
261165 self ._brands = brands
262166
263- self .retrieve = async_to_streamed_response_wrapper (
264- brands .retrieve ,
265- )
266167 self .list = async_to_streamed_response_wrapper (
267168 brands .list ,
268169 )
0 commit comments