paid-python 1.0.0a0__py3-none-any.whl → 1.0.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paid/__init__.py +61 -122
- paid/client.py +16 -22
- paid/contacts/client.py +415 -133
- paid/contacts/raw_client.py +1046 -118
- paid/core/client_wrapper.py +8 -10
- paid/customers/__init__.py +0 -3
- paid/customers/client.py +392 -1112
- paid/customers/raw_client.py +656 -1054
- paid/environment.py +1 -1
- paid/errors/bad_request_error.py +2 -2
- paid/errors/forbidden_error.py +2 -2
- paid/errors/internal_server_error.py +2 -2
- paid/errors/not_found_error.py +2 -2
- paid/invoices/client.py +369 -0
- paid/{plans → invoices}/raw_client.py +310 -201
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +279 -471
- paid/orders/raw_client.py +551 -538
- paid/products/__init__.py +0 -3
- paid/products/client.py +129 -265
- paid/products/raw_client.py +563 -233
- paid/signals/client.py +130 -0
- paid/signals/raw_client.py +190 -0
- paid/tracing/autoinstrumentation.py +12 -6
- paid/tracing/context_manager.py +2 -6
- paid/tracing/distributed_tracing.py +3 -3
- paid/tracing/signal.py +3 -3
- paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
- paid/types/__init__.py +58 -110
- paid/types/attribution.py +8 -0
- paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
- paid/types/contact.py +12 -20
- paid/types/{address.py → contact_billing_address.py} +6 -7
- paid/types/{traces_response.py → contact_list_response.py} +5 -9
- paid/types/customer.py +15 -22
- paid/types/customer_attribution.py +8 -0
- paid/types/customer_billing_address.py +26 -0
- paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
- paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
- paid/types/customer_creation_state.py +5 -0
- paid/types/customer_list_response.py +22 -0
- paid/types/empty_response.py +17 -0
- paid/types/{error.py → error_response.py} +4 -7
- paid/types/invoice.py +33 -51
- paid/types/invoice_line.py +42 -0
- paid/types/invoice_line_payment_status.py +7 -0
- paid/types/invoice_lines_response.py +22 -0
- paid/types/invoice_list_response.py +22 -0
- paid/types/invoice_payment_status.py +5 -0
- paid/types/invoice_source.py +5 -0
- paid/types/invoice_status.py +3 -1
- paid/types/invoice_tax_status.py +7 -0
- paid/types/order.py +30 -29
- paid/types/order_creation_state.py +5 -0
- paid/types/order_line.py +6 -24
- paid/types/order_lines_response.py +22 -0
- paid/types/order_list_response.py +22 -0
- paid/types/pagination.py +24 -0
- paid/types/product.py +4 -29
- paid/types/{tier.py → product_by_external_id.py} +5 -4
- paid/types/{cost_amount.py → product_by_id.py} +5 -12
- paid/types/product_list_response.py +22 -0
- paid/types/signal.py +8 -34
- paid/types/{agent_update.py → update_contact_request.py} +10 -9
- paid/types/update_customer_request.py +38 -0
- paid/types/{product_update.py → update_product_request.py} +2 -12
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/METADATA +22 -8
- paid_python-1.0.0a1.dist-info/RECORD +110 -0
- paid/agents/client.py +0 -880
- paid/agents/raw_client.py +0 -785
- paid/customers/types/__init__.py +0 -8
- paid/customers/types/customers_check_entitlement_request_view.py +0 -5
- paid/customers/types/customers_check_entitlement_response.py +0 -22
- paid/orders/lines/client.py +0 -144
- paid/orders/lines/raw_client.py +0 -129
- paid/plans/__init__.py +0 -4
- paid/plans/client.py +0 -403
- paid/products/types/__init__.py +0 -7
- paid/products/types/product_create_type.py +0 -5
- paid/traces/__init__.py +0 -4
- paid/traces/client.py +0 -218
- paid/traces/raw_client.py +0 -226
- paid/types/agent.py +0 -31
- paid/types/agent_price_point.py +0 -27
- paid/types/agent_price_point_tiers.py +0 -23
- paid/types/api_error.py +0 -29
- paid/types/billing_frequency.py +0 -5
- paid/types/cancel_renewal_response.py +0 -49
- paid/types/charge_type.py +0 -5
- paid/types/contact_create_for_customer.py +0 -37
- paid/types/cost_trace.py +0 -55
- paid/types/cost_traces_response.py +0 -26
- paid/types/creation_source.py +0 -5
- paid/types/creation_state.py +0 -5
- paid/types/customer_update.py +0 -40
- paid/types/entitlement_usage.py +0 -48
- paid/types/order_line_attribute.py +0 -27
- paid/types/order_line_attribute_create_one.py +0 -5
- paid/types/order_line_attribute_pricing.py +0 -33
- paid/types/order_line_create.py +0 -72
- paid/types/pagination_meta.py +0 -84
- paid/types/payment_method.py +0 -58
- paid/types/payment_method_card.py +0 -49
- paid/types/payment_method_type.py +0 -5
- paid/types/payment_method_us_bank_account.py +0 -36
- paid/types/payment_method_us_bank_account_account_type.py +0 -5
- paid/types/plan.py +0 -81
- paid/types/plan_group.py +0 -60
- paid/types/plan_plan_products_item.py +0 -41
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
- paid/types/plan_with_features.py +0 -69
- paid/types/plan_with_features_features_item.py +0 -34
- paid/types/price_point.py +0 -25
- paid/types/pricing.py +0 -31
- paid/types/pricing_model_type.py +0 -7
- paid/types/product_type.py +0 -5
- paid/types/product_update_type.py +0 -5
- paid/types/proration_attribute_update.py +0 -44
- paid/types/proration_detail.py +0 -49
- paid/types/proration_upgrade_response.py +0 -73
- paid/types/salutation.py +0 -5
- paid/types/signal_v_2.py +0 -56
- paid/types/tax_exempt_status.py +0 -5
- paid/types/trace.py +0 -69
- paid/types/usage_pagination_meta.py +0 -43
- paid/types/usage_summaries_response.py +0 -26
- paid/types/usage_summary.py +0 -121
- paid/usage/__init__.py +0 -7
- paid/usage/client.py +0 -321
- paid/usage/raw_client.py +0 -387
- paid/usage/types/__init__.py +0 -7
- paid/usage/types/usage_check_usage_response.py +0 -53
- paid_python-1.0.0a0.dist-info/RECORD +0 -152
- /paid/{agents → invoices}/__init__.py +0 -0
- /paid/{orders/lines → signals}/__init__.py +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/LICENSE +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/WHEEL +0 -0
paid/products/raw_client.py
CHANGED
|
@@ -9,11 +9,13 @@ from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
10
10
|
from ..core.pydantic_utilities import parse_obj_as
|
|
11
11
|
from ..core.request_options import RequestOptions
|
|
12
|
-
from ..
|
|
13
|
-
from ..
|
|
12
|
+
from ..errors.bad_request_error import BadRequestError
|
|
13
|
+
from ..errors.forbidden_error import ForbiddenError
|
|
14
|
+
from ..errors.internal_server_error import InternalServerError
|
|
15
|
+
from ..errors.not_found_error import NotFoundError
|
|
16
|
+
from ..types.error_response import ErrorResponse
|
|
14
17
|
from ..types.product import Product
|
|
15
|
-
from ..types.
|
|
16
|
-
from .types.product_create_type import ProductCreateType
|
|
18
|
+
from ..types.product_list_response import ProductListResponse
|
|
17
19
|
|
|
18
20
|
# this is used as the default value for optional parameters
|
|
19
21
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -23,65 +25,113 @@ class RawProductsClient:
|
|
|
23
25
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
24
26
|
self._client_wrapper = client_wrapper
|
|
25
27
|
|
|
26
|
-
def
|
|
28
|
+
def list_products(
|
|
29
|
+
self,
|
|
30
|
+
*,
|
|
31
|
+
limit: typing.Optional[int] = None,
|
|
32
|
+
offset: typing.Optional[int] = None,
|
|
33
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
34
|
+
) -> HttpResponse[ProductListResponse]:
|
|
27
35
|
"""
|
|
36
|
+
Get a list of products for the organization
|
|
37
|
+
|
|
28
38
|
Parameters
|
|
29
39
|
----------
|
|
40
|
+
limit : typing.Optional[int]
|
|
41
|
+
|
|
42
|
+
offset : typing.Optional[int]
|
|
43
|
+
|
|
30
44
|
request_options : typing.Optional[RequestOptions]
|
|
31
45
|
Request-specific configuration.
|
|
32
46
|
|
|
33
47
|
Returns
|
|
34
48
|
-------
|
|
35
|
-
HttpResponse[
|
|
36
|
-
|
|
49
|
+
HttpResponse[ProductListResponse]
|
|
50
|
+
200
|
|
37
51
|
"""
|
|
38
52
|
_response = self._client_wrapper.httpx_client.request(
|
|
39
|
-
"products",
|
|
53
|
+
"products/",
|
|
40
54
|
method="GET",
|
|
55
|
+
params={
|
|
56
|
+
"limit": limit,
|
|
57
|
+
"offset": offset,
|
|
58
|
+
},
|
|
41
59
|
request_options=request_options,
|
|
42
60
|
)
|
|
43
61
|
try:
|
|
44
62
|
if 200 <= _response.status_code < 300:
|
|
45
63
|
_data = typing.cast(
|
|
46
|
-
|
|
64
|
+
ProductListResponse,
|
|
47
65
|
parse_obj_as(
|
|
48
|
-
type_=
|
|
66
|
+
type_=ProductListResponse, # type: ignore
|
|
49
67
|
object_=_response.json(),
|
|
50
68
|
),
|
|
51
69
|
)
|
|
52
70
|
return HttpResponse(response=_response, data=_data)
|
|
71
|
+
if _response.status_code == 400:
|
|
72
|
+
raise BadRequestError(
|
|
73
|
+
headers=dict(_response.headers),
|
|
74
|
+
body=typing.cast(
|
|
75
|
+
ErrorResponse,
|
|
76
|
+
parse_obj_as(
|
|
77
|
+
type_=ErrorResponse, # type: ignore
|
|
78
|
+
object_=_response.json(),
|
|
79
|
+
),
|
|
80
|
+
),
|
|
81
|
+
)
|
|
82
|
+
if _response.status_code == 403:
|
|
83
|
+
raise ForbiddenError(
|
|
84
|
+
headers=dict(_response.headers),
|
|
85
|
+
body=typing.cast(
|
|
86
|
+
ErrorResponse,
|
|
87
|
+
parse_obj_as(
|
|
88
|
+
type_=ErrorResponse, # type: ignore
|
|
89
|
+
object_=_response.json(),
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
if _response.status_code == 500:
|
|
94
|
+
raise InternalServerError(
|
|
95
|
+
headers=dict(_response.headers),
|
|
96
|
+
body=typing.cast(
|
|
97
|
+
ErrorResponse,
|
|
98
|
+
parse_obj_as(
|
|
99
|
+
type_=ErrorResponse, # type: ignore
|
|
100
|
+
object_=_response.json(),
|
|
101
|
+
),
|
|
102
|
+
),
|
|
103
|
+
)
|
|
53
104
|
_response_json = _response.json()
|
|
54
105
|
except JSONDecodeError:
|
|
55
106
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
56
107
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
57
108
|
|
|
58
|
-
def
|
|
109
|
+
def create_a_new_product(
|
|
59
110
|
self,
|
|
60
111
|
*,
|
|
61
112
|
name: str,
|
|
62
113
|
description: typing.Optional[str] = OMIT,
|
|
63
|
-
external_id: typing.Optional[str] = OMIT,
|
|
64
|
-
type: typing.Optional[ProductCreateType] = OMIT,
|
|
65
114
|
active: typing.Optional[bool] = OMIT,
|
|
66
115
|
product_code: typing.Optional[str] = OMIT,
|
|
116
|
+
external_id: typing.Optional[str] = OMIT,
|
|
67
117
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
68
118
|
request_options: typing.Optional[RequestOptions] = None,
|
|
69
119
|
) -> HttpResponse[Product]:
|
|
70
120
|
"""
|
|
121
|
+
Creates a new product for the organization
|
|
122
|
+
|
|
71
123
|
Parameters
|
|
72
124
|
----------
|
|
73
125
|
name : str
|
|
74
126
|
|
|
75
127
|
description : typing.Optional[str]
|
|
76
128
|
|
|
77
|
-
external_id : typing.Optional[str]
|
|
78
|
-
|
|
79
|
-
type : typing.Optional[ProductCreateType]
|
|
80
|
-
|
|
81
129
|
active : typing.Optional[bool]
|
|
82
130
|
|
|
83
131
|
product_code : typing.Optional[str]
|
|
84
132
|
|
|
133
|
+
external_id : typing.Optional[str]
|
|
134
|
+
|
|
85
135
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
86
136
|
|
|
87
137
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -90,18 +140,17 @@ class RawProductsClient:
|
|
|
90
140
|
Returns
|
|
91
141
|
-------
|
|
92
142
|
HttpResponse[Product]
|
|
93
|
-
|
|
143
|
+
201
|
|
94
144
|
"""
|
|
95
145
|
_response = self._client_wrapper.httpx_client.request(
|
|
96
|
-
"products",
|
|
146
|
+
"products/",
|
|
97
147
|
method="POST",
|
|
98
148
|
json={
|
|
99
149
|
"name": name,
|
|
100
150
|
"description": description,
|
|
101
|
-
"externalId": external_id,
|
|
102
|
-
"type": type,
|
|
103
151
|
"active": active,
|
|
104
152
|
"productCode": product_code,
|
|
153
|
+
"externalId": external_id,
|
|
105
154
|
"metadata": metadata,
|
|
106
155
|
},
|
|
107
156
|
headers={
|
|
@@ -120,16 +169,51 @@ class RawProductsClient:
|
|
|
120
169
|
),
|
|
121
170
|
)
|
|
122
171
|
return HttpResponse(response=_response, data=_data)
|
|
172
|
+
if _response.status_code == 400:
|
|
173
|
+
raise BadRequestError(
|
|
174
|
+
headers=dict(_response.headers),
|
|
175
|
+
body=typing.cast(
|
|
176
|
+
ErrorResponse,
|
|
177
|
+
parse_obj_as(
|
|
178
|
+
type_=ErrorResponse, # type: ignore
|
|
179
|
+
object_=_response.json(),
|
|
180
|
+
),
|
|
181
|
+
),
|
|
182
|
+
)
|
|
183
|
+
if _response.status_code == 403:
|
|
184
|
+
raise ForbiddenError(
|
|
185
|
+
headers=dict(_response.headers),
|
|
186
|
+
body=typing.cast(
|
|
187
|
+
ErrorResponse,
|
|
188
|
+
parse_obj_as(
|
|
189
|
+
type_=ErrorResponse, # type: ignore
|
|
190
|
+
object_=_response.json(),
|
|
191
|
+
),
|
|
192
|
+
),
|
|
193
|
+
)
|
|
194
|
+
if _response.status_code == 500:
|
|
195
|
+
raise InternalServerError(
|
|
196
|
+
headers=dict(_response.headers),
|
|
197
|
+
body=typing.cast(
|
|
198
|
+
ErrorResponse,
|
|
199
|
+
parse_obj_as(
|
|
200
|
+
type_=ErrorResponse, # type: ignore
|
|
201
|
+
object_=_response.json(),
|
|
202
|
+
),
|
|
203
|
+
),
|
|
204
|
+
)
|
|
123
205
|
_response_json = _response.json()
|
|
124
206
|
except JSONDecodeError:
|
|
125
207
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
126
208
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
127
209
|
|
|
128
|
-
def
|
|
210
|
+
def get_product(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Product]:
|
|
129
211
|
"""
|
|
212
|
+
Get a product by its ID
|
|
213
|
+
|
|
130
214
|
Parameters
|
|
131
215
|
----------
|
|
132
|
-
|
|
216
|
+
id : str
|
|
133
217
|
|
|
134
218
|
request_options : typing.Optional[RequestOptions]
|
|
135
219
|
Request-specific configuration.
|
|
@@ -137,10 +221,10 @@ class RawProductsClient:
|
|
|
137
221
|
Returns
|
|
138
222
|
-------
|
|
139
223
|
HttpResponse[Product]
|
|
140
|
-
|
|
224
|
+
200
|
|
141
225
|
"""
|
|
142
226
|
_response = self._client_wrapper.httpx_client.request(
|
|
143
|
-
f"products/{jsonable_encoder(
|
|
227
|
+
f"products/{jsonable_encoder(id)}",
|
|
144
228
|
method="GET",
|
|
145
229
|
request_options=request_options,
|
|
146
230
|
)
|
|
@@ -154,44 +238,72 @@ class RawProductsClient:
|
|
|
154
238
|
),
|
|
155
239
|
)
|
|
156
240
|
return HttpResponse(response=_response, data=_data)
|
|
241
|
+
if _response.status_code == 403:
|
|
242
|
+
raise ForbiddenError(
|
|
243
|
+
headers=dict(_response.headers),
|
|
244
|
+
body=typing.cast(
|
|
245
|
+
ErrorResponse,
|
|
246
|
+
parse_obj_as(
|
|
247
|
+
type_=ErrorResponse, # type: ignore
|
|
248
|
+
object_=_response.json(),
|
|
249
|
+
),
|
|
250
|
+
),
|
|
251
|
+
)
|
|
252
|
+
if _response.status_code == 404:
|
|
253
|
+
raise NotFoundError(
|
|
254
|
+
headers=dict(_response.headers),
|
|
255
|
+
body=typing.cast(
|
|
256
|
+
ErrorResponse,
|
|
257
|
+
parse_obj_as(
|
|
258
|
+
type_=ErrorResponse, # type: ignore
|
|
259
|
+
object_=_response.json(),
|
|
260
|
+
),
|
|
261
|
+
),
|
|
262
|
+
)
|
|
263
|
+
if _response.status_code == 500:
|
|
264
|
+
raise InternalServerError(
|
|
265
|
+
headers=dict(_response.headers),
|
|
266
|
+
body=typing.cast(
|
|
267
|
+
ErrorResponse,
|
|
268
|
+
parse_obj_as(
|
|
269
|
+
type_=ErrorResponse, # type: ignore
|
|
270
|
+
object_=_response.json(),
|
|
271
|
+
),
|
|
272
|
+
),
|
|
273
|
+
)
|
|
157
274
|
_response_json = _response.json()
|
|
158
275
|
except JSONDecodeError:
|
|
159
276
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
160
277
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
161
278
|
|
|
162
|
-
def
|
|
279
|
+
def update_product(
|
|
163
280
|
self,
|
|
164
|
-
|
|
281
|
+
id: str,
|
|
165
282
|
*,
|
|
166
283
|
name: typing.Optional[str] = OMIT,
|
|
167
284
|
description: typing.Optional[str] = OMIT,
|
|
168
|
-
external_id: typing.Optional[str] = OMIT,
|
|
169
|
-
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
170
285
|
active: typing.Optional[bool] = OMIT,
|
|
171
286
|
product_code: typing.Optional[str] = OMIT,
|
|
172
|
-
|
|
287
|
+
external_id: typing.Optional[str] = OMIT,
|
|
173
288
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
174
289
|
request_options: typing.Optional[RequestOptions] = None,
|
|
175
290
|
) -> HttpResponse[Product]:
|
|
176
291
|
"""
|
|
292
|
+
Update a product by its ID
|
|
293
|
+
|
|
177
294
|
Parameters
|
|
178
295
|
----------
|
|
179
|
-
|
|
296
|
+
id : str
|
|
180
297
|
|
|
181
298
|
name : typing.Optional[str]
|
|
182
299
|
|
|
183
300
|
description : typing.Optional[str]
|
|
184
301
|
|
|
185
|
-
external_id : typing.Optional[str]
|
|
186
|
-
|
|
187
|
-
type : typing.Optional[ProductUpdateType]
|
|
188
|
-
|
|
189
302
|
active : typing.Optional[bool]
|
|
190
303
|
|
|
191
304
|
product_code : typing.Optional[str]
|
|
192
305
|
|
|
193
|
-
|
|
194
|
-
Pricing attributes for this product
|
|
306
|
+
external_id : typing.Optional[str]
|
|
195
307
|
|
|
196
308
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
197
309
|
|
|
@@ -201,21 +313,17 @@ class RawProductsClient:
|
|
|
201
313
|
Returns
|
|
202
314
|
-------
|
|
203
315
|
HttpResponse[Product]
|
|
204
|
-
|
|
316
|
+
200
|
|
205
317
|
"""
|
|
206
318
|
_response = self._client_wrapper.httpx_client.request(
|
|
207
|
-
f"products/{jsonable_encoder(
|
|
319
|
+
f"products/{jsonable_encoder(id)}",
|
|
208
320
|
method="PUT",
|
|
209
321
|
json={
|
|
210
322
|
"name": name,
|
|
211
323
|
"description": description,
|
|
212
|
-
"externalId": external_id,
|
|
213
|
-
"type": type,
|
|
214
324
|
"active": active,
|
|
215
325
|
"productCode": product_code,
|
|
216
|
-
"
|
|
217
|
-
object_=product_attribute, annotation=typing.Sequence[AgentAttribute], direction="write"
|
|
218
|
-
),
|
|
326
|
+
"externalId": external_id,
|
|
219
327
|
"metadata": metadata,
|
|
220
328
|
},
|
|
221
329
|
headers={
|
|
@@ -234,41 +342,61 @@ class RawProductsClient:
|
|
|
234
342
|
),
|
|
235
343
|
)
|
|
236
344
|
return HttpResponse(response=_response, data=_data)
|
|
345
|
+
if _response.status_code == 400:
|
|
346
|
+
raise BadRequestError(
|
|
347
|
+
headers=dict(_response.headers),
|
|
348
|
+
body=typing.cast(
|
|
349
|
+
ErrorResponse,
|
|
350
|
+
parse_obj_as(
|
|
351
|
+
type_=ErrorResponse, # type: ignore
|
|
352
|
+
object_=_response.json(),
|
|
353
|
+
),
|
|
354
|
+
),
|
|
355
|
+
)
|
|
356
|
+
if _response.status_code == 403:
|
|
357
|
+
raise ForbiddenError(
|
|
358
|
+
headers=dict(_response.headers),
|
|
359
|
+
body=typing.cast(
|
|
360
|
+
ErrorResponse,
|
|
361
|
+
parse_obj_as(
|
|
362
|
+
type_=ErrorResponse, # type: ignore
|
|
363
|
+
object_=_response.json(),
|
|
364
|
+
),
|
|
365
|
+
),
|
|
366
|
+
)
|
|
367
|
+
if _response.status_code == 404:
|
|
368
|
+
raise NotFoundError(
|
|
369
|
+
headers=dict(_response.headers),
|
|
370
|
+
body=typing.cast(
|
|
371
|
+
ErrorResponse,
|
|
372
|
+
parse_obj_as(
|
|
373
|
+
type_=ErrorResponse, # type: ignore
|
|
374
|
+
object_=_response.json(),
|
|
375
|
+
),
|
|
376
|
+
),
|
|
377
|
+
)
|
|
378
|
+
if _response.status_code == 500:
|
|
379
|
+
raise InternalServerError(
|
|
380
|
+
headers=dict(_response.headers),
|
|
381
|
+
body=typing.cast(
|
|
382
|
+
ErrorResponse,
|
|
383
|
+
parse_obj_as(
|
|
384
|
+
type_=ErrorResponse, # type: ignore
|
|
385
|
+
object_=_response.json(),
|
|
386
|
+
),
|
|
387
|
+
),
|
|
388
|
+
)
|
|
237
389
|
_response_json = _response.json()
|
|
238
390
|
except JSONDecodeError:
|
|
239
391
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
240
392
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
241
393
|
|
|
242
|
-
def
|
|
243
|
-
"""
|
|
244
|
-
Parameters
|
|
245
|
-
----------
|
|
246
|
-
product_id : str
|
|
247
|
-
|
|
248
|
-
request_options : typing.Optional[RequestOptions]
|
|
249
|
-
Request-specific configuration.
|
|
250
|
-
|
|
251
|
-
Returns
|
|
252
|
-
-------
|
|
253
|
-
HttpResponse[None]
|
|
254
|
-
"""
|
|
255
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
256
|
-
f"products/{jsonable_encoder(product_id)}",
|
|
257
|
-
method="DELETE",
|
|
258
|
-
request_options=request_options,
|
|
259
|
-
)
|
|
260
|
-
try:
|
|
261
|
-
if 200 <= _response.status_code < 300:
|
|
262
|
-
return HttpResponse(response=_response, data=None)
|
|
263
|
-
_response_json = _response.json()
|
|
264
|
-
except JSONDecodeError:
|
|
265
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
266
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
267
|
-
|
|
268
|
-
def get_by_external_id(
|
|
394
|
+
def get_product_by_external_id(
|
|
269
395
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
270
396
|
) -> HttpResponse[Product]:
|
|
271
397
|
"""
|
|
398
|
+
Get a product by its externalId
|
|
399
|
+
|
|
272
400
|
Parameters
|
|
273
401
|
----------
|
|
274
402
|
external_id : str
|
|
@@ -279,7 +407,7 @@ class RawProductsClient:
|
|
|
279
407
|
Returns
|
|
280
408
|
-------
|
|
281
409
|
HttpResponse[Product]
|
|
282
|
-
|
|
410
|
+
200
|
|
283
411
|
"""
|
|
284
412
|
_response = self._client_wrapper.httpx_client.request(
|
|
285
413
|
f"products/external/{jsonable_encoder(external_id)}",
|
|
@@ -296,26 +424,59 @@ class RawProductsClient:
|
|
|
296
424
|
),
|
|
297
425
|
)
|
|
298
426
|
return HttpResponse(response=_response, data=_data)
|
|
427
|
+
if _response.status_code == 403:
|
|
428
|
+
raise ForbiddenError(
|
|
429
|
+
headers=dict(_response.headers),
|
|
430
|
+
body=typing.cast(
|
|
431
|
+
ErrorResponse,
|
|
432
|
+
parse_obj_as(
|
|
433
|
+
type_=ErrorResponse, # type: ignore
|
|
434
|
+
object_=_response.json(),
|
|
435
|
+
),
|
|
436
|
+
),
|
|
437
|
+
)
|
|
438
|
+
if _response.status_code == 404:
|
|
439
|
+
raise NotFoundError(
|
|
440
|
+
headers=dict(_response.headers),
|
|
441
|
+
body=typing.cast(
|
|
442
|
+
ErrorResponse,
|
|
443
|
+
parse_obj_as(
|
|
444
|
+
type_=ErrorResponse, # type: ignore
|
|
445
|
+
object_=_response.json(),
|
|
446
|
+
),
|
|
447
|
+
),
|
|
448
|
+
)
|
|
449
|
+
if _response.status_code == 500:
|
|
450
|
+
raise InternalServerError(
|
|
451
|
+
headers=dict(_response.headers),
|
|
452
|
+
body=typing.cast(
|
|
453
|
+
ErrorResponse,
|
|
454
|
+
parse_obj_as(
|
|
455
|
+
type_=ErrorResponse, # type: ignore
|
|
456
|
+
object_=_response.json(),
|
|
457
|
+
),
|
|
458
|
+
),
|
|
459
|
+
)
|
|
299
460
|
_response_json = _response.json()
|
|
300
461
|
except JSONDecodeError:
|
|
301
462
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
302
463
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
303
464
|
|
|
304
|
-
def
|
|
465
|
+
def update_product_by_external_id(
|
|
305
466
|
self,
|
|
306
467
|
external_id_: str,
|
|
307
468
|
*,
|
|
308
469
|
name: typing.Optional[str] = OMIT,
|
|
309
470
|
description: typing.Optional[str] = OMIT,
|
|
310
|
-
external_id: typing.Optional[str] = OMIT,
|
|
311
|
-
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
312
471
|
active: typing.Optional[bool] = OMIT,
|
|
313
472
|
product_code: typing.Optional[str] = OMIT,
|
|
314
|
-
|
|
473
|
+
external_id: typing.Optional[str] = OMIT,
|
|
315
474
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
316
475
|
request_options: typing.Optional[RequestOptions] = None,
|
|
317
476
|
) -> HttpResponse[Product]:
|
|
318
477
|
"""
|
|
478
|
+
Update a product by its externalId
|
|
479
|
+
|
|
319
480
|
Parameters
|
|
320
481
|
----------
|
|
321
482
|
external_id_ : str
|
|
@@ -324,16 +485,11 @@ class RawProductsClient:
|
|
|
324
485
|
|
|
325
486
|
description : typing.Optional[str]
|
|
326
487
|
|
|
327
|
-
external_id : typing.Optional[str]
|
|
328
|
-
|
|
329
|
-
type : typing.Optional[ProductUpdateType]
|
|
330
|
-
|
|
331
488
|
active : typing.Optional[bool]
|
|
332
489
|
|
|
333
490
|
product_code : typing.Optional[str]
|
|
334
491
|
|
|
335
|
-
|
|
336
|
-
Pricing attributes for this product
|
|
492
|
+
external_id : typing.Optional[str]
|
|
337
493
|
|
|
338
494
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
339
495
|
|
|
@@ -343,7 +499,7 @@ class RawProductsClient:
|
|
|
343
499
|
Returns
|
|
344
500
|
-------
|
|
345
501
|
HttpResponse[Product]
|
|
346
|
-
|
|
502
|
+
200
|
|
347
503
|
"""
|
|
348
504
|
_response = self._client_wrapper.httpx_client.request(
|
|
349
505
|
f"products/external/{jsonable_encoder(external_id_)}",
|
|
@@ -351,13 +507,9 @@ class RawProductsClient:
|
|
|
351
507
|
json={
|
|
352
508
|
"name": name,
|
|
353
509
|
"description": description,
|
|
354
|
-
"externalId": external_id,
|
|
355
|
-
"type": type,
|
|
356
510
|
"active": active,
|
|
357
511
|
"productCode": product_code,
|
|
358
|
-
"
|
|
359
|
-
object_=product_attribute, annotation=typing.Sequence[AgentAttribute], direction="write"
|
|
360
|
-
),
|
|
512
|
+
"externalId": external_id,
|
|
361
513
|
"metadata": metadata,
|
|
362
514
|
},
|
|
363
515
|
headers={
|
|
@@ -376,34 +528,50 @@ class RawProductsClient:
|
|
|
376
528
|
),
|
|
377
529
|
)
|
|
378
530
|
return HttpResponse(response=_response, data=_data)
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
531
|
+
if _response.status_code == 400:
|
|
532
|
+
raise BadRequestError(
|
|
533
|
+
headers=dict(_response.headers),
|
|
534
|
+
body=typing.cast(
|
|
535
|
+
ErrorResponse,
|
|
536
|
+
parse_obj_as(
|
|
537
|
+
type_=ErrorResponse, # type: ignore
|
|
538
|
+
object_=_response.json(),
|
|
539
|
+
),
|
|
540
|
+
),
|
|
541
|
+
)
|
|
542
|
+
if _response.status_code == 403:
|
|
543
|
+
raise ForbiddenError(
|
|
544
|
+
headers=dict(_response.headers),
|
|
545
|
+
body=typing.cast(
|
|
546
|
+
ErrorResponse,
|
|
547
|
+
parse_obj_as(
|
|
548
|
+
type_=ErrorResponse, # type: ignore
|
|
549
|
+
object_=_response.json(),
|
|
550
|
+
),
|
|
551
|
+
),
|
|
552
|
+
)
|
|
553
|
+
if _response.status_code == 404:
|
|
554
|
+
raise NotFoundError(
|
|
555
|
+
headers=dict(_response.headers),
|
|
556
|
+
body=typing.cast(
|
|
557
|
+
ErrorResponse,
|
|
558
|
+
parse_obj_as(
|
|
559
|
+
type_=ErrorResponse, # type: ignore
|
|
560
|
+
object_=_response.json(),
|
|
561
|
+
),
|
|
562
|
+
),
|
|
563
|
+
)
|
|
564
|
+
if _response.status_code == 500:
|
|
565
|
+
raise InternalServerError(
|
|
566
|
+
headers=dict(_response.headers),
|
|
567
|
+
body=typing.cast(
|
|
568
|
+
ErrorResponse,
|
|
569
|
+
parse_obj_as(
|
|
570
|
+
type_=ErrorResponse, # type: ignore
|
|
571
|
+
object_=_response.json(),
|
|
572
|
+
),
|
|
573
|
+
),
|
|
574
|
+
)
|
|
407
575
|
_response_json = _response.json()
|
|
408
576
|
except JSONDecodeError:
|
|
409
577
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -414,67 +582,113 @@ class AsyncRawProductsClient:
|
|
|
414
582
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
415
583
|
self._client_wrapper = client_wrapper
|
|
416
584
|
|
|
417
|
-
async def
|
|
418
|
-
self,
|
|
419
|
-
|
|
585
|
+
async def list_products(
|
|
586
|
+
self,
|
|
587
|
+
*,
|
|
588
|
+
limit: typing.Optional[int] = None,
|
|
589
|
+
offset: typing.Optional[int] = None,
|
|
590
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
591
|
+
) -> AsyncHttpResponse[ProductListResponse]:
|
|
420
592
|
"""
|
|
593
|
+
Get a list of products for the organization
|
|
594
|
+
|
|
421
595
|
Parameters
|
|
422
596
|
----------
|
|
597
|
+
limit : typing.Optional[int]
|
|
598
|
+
|
|
599
|
+
offset : typing.Optional[int]
|
|
600
|
+
|
|
423
601
|
request_options : typing.Optional[RequestOptions]
|
|
424
602
|
Request-specific configuration.
|
|
425
603
|
|
|
426
604
|
Returns
|
|
427
605
|
-------
|
|
428
|
-
AsyncHttpResponse[
|
|
429
|
-
|
|
606
|
+
AsyncHttpResponse[ProductListResponse]
|
|
607
|
+
200
|
|
430
608
|
"""
|
|
431
609
|
_response = await self._client_wrapper.httpx_client.request(
|
|
432
|
-
"products",
|
|
610
|
+
"products/",
|
|
433
611
|
method="GET",
|
|
612
|
+
params={
|
|
613
|
+
"limit": limit,
|
|
614
|
+
"offset": offset,
|
|
615
|
+
},
|
|
434
616
|
request_options=request_options,
|
|
435
617
|
)
|
|
436
618
|
try:
|
|
437
619
|
if 200 <= _response.status_code < 300:
|
|
438
620
|
_data = typing.cast(
|
|
439
|
-
|
|
621
|
+
ProductListResponse,
|
|
440
622
|
parse_obj_as(
|
|
441
|
-
type_=
|
|
623
|
+
type_=ProductListResponse, # type: ignore
|
|
442
624
|
object_=_response.json(),
|
|
443
625
|
),
|
|
444
626
|
)
|
|
445
627
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
628
|
+
if _response.status_code == 400:
|
|
629
|
+
raise BadRequestError(
|
|
630
|
+
headers=dict(_response.headers),
|
|
631
|
+
body=typing.cast(
|
|
632
|
+
ErrorResponse,
|
|
633
|
+
parse_obj_as(
|
|
634
|
+
type_=ErrorResponse, # type: ignore
|
|
635
|
+
object_=_response.json(),
|
|
636
|
+
),
|
|
637
|
+
),
|
|
638
|
+
)
|
|
639
|
+
if _response.status_code == 403:
|
|
640
|
+
raise ForbiddenError(
|
|
641
|
+
headers=dict(_response.headers),
|
|
642
|
+
body=typing.cast(
|
|
643
|
+
ErrorResponse,
|
|
644
|
+
parse_obj_as(
|
|
645
|
+
type_=ErrorResponse, # type: ignore
|
|
646
|
+
object_=_response.json(),
|
|
647
|
+
),
|
|
648
|
+
),
|
|
649
|
+
)
|
|
650
|
+
if _response.status_code == 500:
|
|
651
|
+
raise InternalServerError(
|
|
652
|
+
headers=dict(_response.headers),
|
|
653
|
+
body=typing.cast(
|
|
654
|
+
ErrorResponse,
|
|
655
|
+
parse_obj_as(
|
|
656
|
+
type_=ErrorResponse, # type: ignore
|
|
657
|
+
object_=_response.json(),
|
|
658
|
+
),
|
|
659
|
+
),
|
|
660
|
+
)
|
|
446
661
|
_response_json = _response.json()
|
|
447
662
|
except JSONDecodeError:
|
|
448
663
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
449
664
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
450
665
|
|
|
451
|
-
async def
|
|
666
|
+
async def create_a_new_product(
|
|
452
667
|
self,
|
|
453
668
|
*,
|
|
454
669
|
name: str,
|
|
455
670
|
description: typing.Optional[str] = OMIT,
|
|
456
|
-
external_id: typing.Optional[str] = OMIT,
|
|
457
|
-
type: typing.Optional[ProductCreateType] = OMIT,
|
|
458
671
|
active: typing.Optional[bool] = OMIT,
|
|
459
672
|
product_code: typing.Optional[str] = OMIT,
|
|
673
|
+
external_id: typing.Optional[str] = OMIT,
|
|
460
674
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
461
675
|
request_options: typing.Optional[RequestOptions] = None,
|
|
462
676
|
) -> AsyncHttpResponse[Product]:
|
|
463
677
|
"""
|
|
678
|
+
Creates a new product for the organization
|
|
679
|
+
|
|
464
680
|
Parameters
|
|
465
681
|
----------
|
|
466
682
|
name : str
|
|
467
683
|
|
|
468
684
|
description : typing.Optional[str]
|
|
469
685
|
|
|
470
|
-
external_id : typing.Optional[str]
|
|
471
|
-
|
|
472
|
-
type : typing.Optional[ProductCreateType]
|
|
473
|
-
|
|
474
686
|
active : typing.Optional[bool]
|
|
475
687
|
|
|
476
688
|
product_code : typing.Optional[str]
|
|
477
689
|
|
|
690
|
+
external_id : typing.Optional[str]
|
|
691
|
+
|
|
478
692
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
479
693
|
|
|
480
694
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -483,18 +697,17 @@ class AsyncRawProductsClient:
|
|
|
483
697
|
Returns
|
|
484
698
|
-------
|
|
485
699
|
AsyncHttpResponse[Product]
|
|
486
|
-
|
|
700
|
+
201
|
|
487
701
|
"""
|
|
488
702
|
_response = await self._client_wrapper.httpx_client.request(
|
|
489
|
-
"products",
|
|
703
|
+
"products/",
|
|
490
704
|
method="POST",
|
|
491
705
|
json={
|
|
492
706
|
"name": name,
|
|
493
707
|
"description": description,
|
|
494
|
-
"externalId": external_id,
|
|
495
|
-
"type": type,
|
|
496
708
|
"active": active,
|
|
497
709
|
"productCode": product_code,
|
|
710
|
+
"externalId": external_id,
|
|
498
711
|
"metadata": metadata,
|
|
499
712
|
},
|
|
500
713
|
headers={
|
|
@@ -513,18 +726,53 @@ class AsyncRawProductsClient:
|
|
|
513
726
|
),
|
|
514
727
|
)
|
|
515
728
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
729
|
+
if _response.status_code == 400:
|
|
730
|
+
raise BadRequestError(
|
|
731
|
+
headers=dict(_response.headers),
|
|
732
|
+
body=typing.cast(
|
|
733
|
+
ErrorResponse,
|
|
734
|
+
parse_obj_as(
|
|
735
|
+
type_=ErrorResponse, # type: ignore
|
|
736
|
+
object_=_response.json(),
|
|
737
|
+
),
|
|
738
|
+
),
|
|
739
|
+
)
|
|
740
|
+
if _response.status_code == 403:
|
|
741
|
+
raise ForbiddenError(
|
|
742
|
+
headers=dict(_response.headers),
|
|
743
|
+
body=typing.cast(
|
|
744
|
+
ErrorResponse,
|
|
745
|
+
parse_obj_as(
|
|
746
|
+
type_=ErrorResponse, # type: ignore
|
|
747
|
+
object_=_response.json(),
|
|
748
|
+
),
|
|
749
|
+
),
|
|
750
|
+
)
|
|
751
|
+
if _response.status_code == 500:
|
|
752
|
+
raise InternalServerError(
|
|
753
|
+
headers=dict(_response.headers),
|
|
754
|
+
body=typing.cast(
|
|
755
|
+
ErrorResponse,
|
|
756
|
+
parse_obj_as(
|
|
757
|
+
type_=ErrorResponse, # type: ignore
|
|
758
|
+
object_=_response.json(),
|
|
759
|
+
),
|
|
760
|
+
),
|
|
761
|
+
)
|
|
516
762
|
_response_json = _response.json()
|
|
517
763
|
except JSONDecodeError:
|
|
518
764
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
519
765
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
520
766
|
|
|
521
|
-
async def
|
|
522
|
-
self,
|
|
767
|
+
async def get_product(
|
|
768
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
523
769
|
) -> AsyncHttpResponse[Product]:
|
|
524
770
|
"""
|
|
771
|
+
Get a product by its ID
|
|
772
|
+
|
|
525
773
|
Parameters
|
|
526
774
|
----------
|
|
527
|
-
|
|
775
|
+
id : str
|
|
528
776
|
|
|
529
777
|
request_options : typing.Optional[RequestOptions]
|
|
530
778
|
Request-specific configuration.
|
|
@@ -532,10 +780,10 @@ class AsyncRawProductsClient:
|
|
|
532
780
|
Returns
|
|
533
781
|
-------
|
|
534
782
|
AsyncHttpResponse[Product]
|
|
535
|
-
|
|
783
|
+
200
|
|
536
784
|
"""
|
|
537
785
|
_response = await self._client_wrapper.httpx_client.request(
|
|
538
|
-
f"products/{jsonable_encoder(
|
|
786
|
+
f"products/{jsonable_encoder(id)}",
|
|
539
787
|
method="GET",
|
|
540
788
|
request_options=request_options,
|
|
541
789
|
)
|
|
@@ -549,44 +797,72 @@ class AsyncRawProductsClient:
|
|
|
549
797
|
),
|
|
550
798
|
)
|
|
551
799
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
800
|
+
if _response.status_code == 403:
|
|
801
|
+
raise ForbiddenError(
|
|
802
|
+
headers=dict(_response.headers),
|
|
803
|
+
body=typing.cast(
|
|
804
|
+
ErrorResponse,
|
|
805
|
+
parse_obj_as(
|
|
806
|
+
type_=ErrorResponse, # type: ignore
|
|
807
|
+
object_=_response.json(),
|
|
808
|
+
),
|
|
809
|
+
),
|
|
810
|
+
)
|
|
811
|
+
if _response.status_code == 404:
|
|
812
|
+
raise NotFoundError(
|
|
813
|
+
headers=dict(_response.headers),
|
|
814
|
+
body=typing.cast(
|
|
815
|
+
ErrorResponse,
|
|
816
|
+
parse_obj_as(
|
|
817
|
+
type_=ErrorResponse, # type: ignore
|
|
818
|
+
object_=_response.json(),
|
|
819
|
+
),
|
|
820
|
+
),
|
|
821
|
+
)
|
|
822
|
+
if _response.status_code == 500:
|
|
823
|
+
raise InternalServerError(
|
|
824
|
+
headers=dict(_response.headers),
|
|
825
|
+
body=typing.cast(
|
|
826
|
+
ErrorResponse,
|
|
827
|
+
parse_obj_as(
|
|
828
|
+
type_=ErrorResponse, # type: ignore
|
|
829
|
+
object_=_response.json(),
|
|
830
|
+
),
|
|
831
|
+
),
|
|
832
|
+
)
|
|
552
833
|
_response_json = _response.json()
|
|
553
834
|
except JSONDecodeError:
|
|
554
835
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
555
836
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
556
837
|
|
|
557
|
-
async def
|
|
838
|
+
async def update_product(
|
|
558
839
|
self,
|
|
559
|
-
|
|
840
|
+
id: str,
|
|
560
841
|
*,
|
|
561
842
|
name: typing.Optional[str] = OMIT,
|
|
562
843
|
description: typing.Optional[str] = OMIT,
|
|
563
|
-
external_id: typing.Optional[str] = OMIT,
|
|
564
|
-
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
565
844
|
active: typing.Optional[bool] = OMIT,
|
|
566
845
|
product_code: typing.Optional[str] = OMIT,
|
|
567
|
-
|
|
846
|
+
external_id: typing.Optional[str] = OMIT,
|
|
568
847
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
569
848
|
request_options: typing.Optional[RequestOptions] = None,
|
|
570
849
|
) -> AsyncHttpResponse[Product]:
|
|
571
850
|
"""
|
|
851
|
+
Update a product by its ID
|
|
852
|
+
|
|
572
853
|
Parameters
|
|
573
854
|
----------
|
|
574
|
-
|
|
855
|
+
id : str
|
|
575
856
|
|
|
576
857
|
name : typing.Optional[str]
|
|
577
858
|
|
|
578
859
|
description : typing.Optional[str]
|
|
579
860
|
|
|
580
|
-
external_id : typing.Optional[str]
|
|
581
|
-
|
|
582
|
-
type : typing.Optional[ProductUpdateType]
|
|
583
|
-
|
|
584
861
|
active : typing.Optional[bool]
|
|
585
862
|
|
|
586
863
|
product_code : typing.Optional[str]
|
|
587
864
|
|
|
588
|
-
|
|
589
|
-
Pricing attributes for this product
|
|
865
|
+
external_id : typing.Optional[str]
|
|
590
866
|
|
|
591
867
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
592
868
|
|
|
@@ -596,21 +872,17 @@ class AsyncRawProductsClient:
|
|
|
596
872
|
Returns
|
|
597
873
|
-------
|
|
598
874
|
AsyncHttpResponse[Product]
|
|
599
|
-
|
|
875
|
+
200
|
|
600
876
|
"""
|
|
601
877
|
_response = await self._client_wrapper.httpx_client.request(
|
|
602
|
-
f"products/{jsonable_encoder(
|
|
878
|
+
f"products/{jsonable_encoder(id)}",
|
|
603
879
|
method="PUT",
|
|
604
880
|
json={
|
|
605
881
|
"name": name,
|
|
606
882
|
"description": description,
|
|
607
|
-
"externalId": external_id,
|
|
608
|
-
"type": type,
|
|
609
883
|
"active": active,
|
|
610
884
|
"productCode": product_code,
|
|
611
|
-
"
|
|
612
|
-
object_=product_attribute, annotation=typing.Sequence[AgentAttribute], direction="write"
|
|
613
|
-
),
|
|
885
|
+
"externalId": external_id,
|
|
614
886
|
"metadata": metadata,
|
|
615
887
|
},
|
|
616
888
|
headers={
|
|
@@ -629,43 +901,61 @@ class AsyncRawProductsClient:
|
|
|
629
901
|
),
|
|
630
902
|
)
|
|
631
903
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
904
|
+
if _response.status_code == 400:
|
|
905
|
+
raise BadRequestError(
|
|
906
|
+
headers=dict(_response.headers),
|
|
907
|
+
body=typing.cast(
|
|
908
|
+
ErrorResponse,
|
|
909
|
+
parse_obj_as(
|
|
910
|
+
type_=ErrorResponse, # type: ignore
|
|
911
|
+
object_=_response.json(),
|
|
912
|
+
),
|
|
913
|
+
),
|
|
914
|
+
)
|
|
915
|
+
if _response.status_code == 403:
|
|
916
|
+
raise ForbiddenError(
|
|
917
|
+
headers=dict(_response.headers),
|
|
918
|
+
body=typing.cast(
|
|
919
|
+
ErrorResponse,
|
|
920
|
+
parse_obj_as(
|
|
921
|
+
type_=ErrorResponse, # type: ignore
|
|
922
|
+
object_=_response.json(),
|
|
923
|
+
),
|
|
924
|
+
),
|
|
925
|
+
)
|
|
926
|
+
if _response.status_code == 404:
|
|
927
|
+
raise NotFoundError(
|
|
928
|
+
headers=dict(_response.headers),
|
|
929
|
+
body=typing.cast(
|
|
930
|
+
ErrorResponse,
|
|
931
|
+
parse_obj_as(
|
|
932
|
+
type_=ErrorResponse, # type: ignore
|
|
933
|
+
object_=_response.json(),
|
|
934
|
+
),
|
|
935
|
+
),
|
|
936
|
+
)
|
|
937
|
+
if _response.status_code == 500:
|
|
938
|
+
raise InternalServerError(
|
|
939
|
+
headers=dict(_response.headers),
|
|
940
|
+
body=typing.cast(
|
|
941
|
+
ErrorResponse,
|
|
942
|
+
parse_obj_as(
|
|
943
|
+
type_=ErrorResponse, # type: ignore
|
|
944
|
+
object_=_response.json(),
|
|
945
|
+
),
|
|
946
|
+
),
|
|
947
|
+
)
|
|
632
948
|
_response_json = _response.json()
|
|
633
949
|
except JSONDecodeError:
|
|
634
950
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
635
951
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
636
952
|
|
|
637
|
-
async def
|
|
638
|
-
self, product_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
639
|
-
) -> AsyncHttpResponse[None]:
|
|
640
|
-
"""
|
|
641
|
-
Parameters
|
|
642
|
-
----------
|
|
643
|
-
product_id : str
|
|
644
|
-
|
|
645
|
-
request_options : typing.Optional[RequestOptions]
|
|
646
|
-
Request-specific configuration.
|
|
647
|
-
|
|
648
|
-
Returns
|
|
649
|
-
-------
|
|
650
|
-
AsyncHttpResponse[None]
|
|
651
|
-
"""
|
|
652
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
653
|
-
f"products/{jsonable_encoder(product_id)}",
|
|
654
|
-
method="DELETE",
|
|
655
|
-
request_options=request_options,
|
|
656
|
-
)
|
|
657
|
-
try:
|
|
658
|
-
if 200 <= _response.status_code < 300:
|
|
659
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
660
|
-
_response_json = _response.json()
|
|
661
|
-
except JSONDecodeError:
|
|
662
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
663
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
664
|
-
|
|
665
|
-
async def get_by_external_id(
|
|
953
|
+
async def get_product_by_external_id(
|
|
666
954
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
667
955
|
) -> AsyncHttpResponse[Product]:
|
|
668
956
|
"""
|
|
957
|
+
Get a product by its externalId
|
|
958
|
+
|
|
669
959
|
Parameters
|
|
670
960
|
----------
|
|
671
961
|
external_id : str
|
|
@@ -676,7 +966,7 @@ class AsyncRawProductsClient:
|
|
|
676
966
|
Returns
|
|
677
967
|
-------
|
|
678
968
|
AsyncHttpResponse[Product]
|
|
679
|
-
|
|
969
|
+
200
|
|
680
970
|
"""
|
|
681
971
|
_response = await self._client_wrapper.httpx_client.request(
|
|
682
972
|
f"products/external/{jsonable_encoder(external_id)}",
|
|
@@ -693,26 +983,59 @@ class AsyncRawProductsClient:
|
|
|
693
983
|
),
|
|
694
984
|
)
|
|
695
985
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
986
|
+
if _response.status_code == 403:
|
|
987
|
+
raise ForbiddenError(
|
|
988
|
+
headers=dict(_response.headers),
|
|
989
|
+
body=typing.cast(
|
|
990
|
+
ErrorResponse,
|
|
991
|
+
parse_obj_as(
|
|
992
|
+
type_=ErrorResponse, # type: ignore
|
|
993
|
+
object_=_response.json(),
|
|
994
|
+
),
|
|
995
|
+
),
|
|
996
|
+
)
|
|
997
|
+
if _response.status_code == 404:
|
|
998
|
+
raise NotFoundError(
|
|
999
|
+
headers=dict(_response.headers),
|
|
1000
|
+
body=typing.cast(
|
|
1001
|
+
ErrorResponse,
|
|
1002
|
+
parse_obj_as(
|
|
1003
|
+
type_=ErrorResponse, # type: ignore
|
|
1004
|
+
object_=_response.json(),
|
|
1005
|
+
),
|
|
1006
|
+
),
|
|
1007
|
+
)
|
|
1008
|
+
if _response.status_code == 500:
|
|
1009
|
+
raise InternalServerError(
|
|
1010
|
+
headers=dict(_response.headers),
|
|
1011
|
+
body=typing.cast(
|
|
1012
|
+
ErrorResponse,
|
|
1013
|
+
parse_obj_as(
|
|
1014
|
+
type_=ErrorResponse, # type: ignore
|
|
1015
|
+
object_=_response.json(),
|
|
1016
|
+
),
|
|
1017
|
+
),
|
|
1018
|
+
)
|
|
696
1019
|
_response_json = _response.json()
|
|
697
1020
|
except JSONDecodeError:
|
|
698
1021
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
699
1022
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
700
1023
|
|
|
701
|
-
async def
|
|
1024
|
+
async def update_product_by_external_id(
|
|
702
1025
|
self,
|
|
703
1026
|
external_id_: str,
|
|
704
1027
|
*,
|
|
705
1028
|
name: typing.Optional[str] = OMIT,
|
|
706
1029
|
description: typing.Optional[str] = OMIT,
|
|
707
|
-
external_id: typing.Optional[str] = OMIT,
|
|
708
|
-
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
709
1030
|
active: typing.Optional[bool] = OMIT,
|
|
710
1031
|
product_code: typing.Optional[str] = OMIT,
|
|
711
|
-
|
|
1032
|
+
external_id: typing.Optional[str] = OMIT,
|
|
712
1033
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
713
1034
|
request_options: typing.Optional[RequestOptions] = None,
|
|
714
1035
|
) -> AsyncHttpResponse[Product]:
|
|
715
1036
|
"""
|
|
1037
|
+
Update a product by its externalId
|
|
1038
|
+
|
|
716
1039
|
Parameters
|
|
717
1040
|
----------
|
|
718
1041
|
external_id_ : str
|
|
@@ -721,16 +1044,11 @@ class AsyncRawProductsClient:
|
|
|
721
1044
|
|
|
722
1045
|
description : typing.Optional[str]
|
|
723
1046
|
|
|
724
|
-
external_id : typing.Optional[str]
|
|
725
|
-
|
|
726
|
-
type : typing.Optional[ProductUpdateType]
|
|
727
|
-
|
|
728
1047
|
active : typing.Optional[bool]
|
|
729
1048
|
|
|
730
1049
|
product_code : typing.Optional[str]
|
|
731
1050
|
|
|
732
|
-
|
|
733
|
-
Pricing attributes for this product
|
|
1051
|
+
external_id : typing.Optional[str]
|
|
734
1052
|
|
|
735
1053
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
736
1054
|
|
|
@@ -740,7 +1058,7 @@ class AsyncRawProductsClient:
|
|
|
740
1058
|
Returns
|
|
741
1059
|
-------
|
|
742
1060
|
AsyncHttpResponse[Product]
|
|
743
|
-
|
|
1061
|
+
200
|
|
744
1062
|
"""
|
|
745
1063
|
_response = await self._client_wrapper.httpx_client.request(
|
|
746
1064
|
f"products/external/{jsonable_encoder(external_id_)}",
|
|
@@ -748,13 +1066,9 @@ class AsyncRawProductsClient:
|
|
|
748
1066
|
json={
|
|
749
1067
|
"name": name,
|
|
750
1068
|
"description": description,
|
|
751
|
-
"externalId": external_id,
|
|
752
|
-
"type": type,
|
|
753
1069
|
"active": active,
|
|
754
1070
|
"productCode": product_code,
|
|
755
|
-
"
|
|
756
|
-
object_=product_attribute, annotation=typing.Sequence[AgentAttribute], direction="write"
|
|
757
|
-
),
|
|
1071
|
+
"externalId": external_id,
|
|
758
1072
|
"metadata": metadata,
|
|
759
1073
|
},
|
|
760
1074
|
headers={
|
|
@@ -773,34 +1087,50 @@ class AsyncRawProductsClient:
|
|
|
773
1087
|
),
|
|
774
1088
|
)
|
|
775
1089
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
1090
|
+
if _response.status_code == 400:
|
|
1091
|
+
raise BadRequestError(
|
|
1092
|
+
headers=dict(_response.headers),
|
|
1093
|
+
body=typing.cast(
|
|
1094
|
+
ErrorResponse,
|
|
1095
|
+
parse_obj_as(
|
|
1096
|
+
type_=ErrorResponse, # type: ignore
|
|
1097
|
+
object_=_response.json(),
|
|
1098
|
+
),
|
|
1099
|
+
),
|
|
1100
|
+
)
|
|
1101
|
+
if _response.status_code == 403:
|
|
1102
|
+
raise ForbiddenError(
|
|
1103
|
+
headers=dict(_response.headers),
|
|
1104
|
+
body=typing.cast(
|
|
1105
|
+
ErrorResponse,
|
|
1106
|
+
parse_obj_as(
|
|
1107
|
+
type_=ErrorResponse, # type: ignore
|
|
1108
|
+
object_=_response.json(),
|
|
1109
|
+
),
|
|
1110
|
+
),
|
|
1111
|
+
)
|
|
1112
|
+
if _response.status_code == 404:
|
|
1113
|
+
raise NotFoundError(
|
|
1114
|
+
headers=dict(_response.headers),
|
|
1115
|
+
body=typing.cast(
|
|
1116
|
+
ErrorResponse,
|
|
1117
|
+
parse_obj_as(
|
|
1118
|
+
type_=ErrorResponse, # type: ignore
|
|
1119
|
+
object_=_response.json(),
|
|
1120
|
+
),
|
|
1121
|
+
),
|
|
1122
|
+
)
|
|
1123
|
+
if _response.status_code == 500:
|
|
1124
|
+
raise InternalServerError(
|
|
1125
|
+
headers=dict(_response.headers),
|
|
1126
|
+
body=typing.cast(
|
|
1127
|
+
ErrorResponse,
|
|
1128
|
+
parse_obj_as(
|
|
1129
|
+
type_=ErrorResponse, # type: ignore
|
|
1130
|
+
object_=_response.json(),
|
|
1131
|
+
),
|
|
1132
|
+
),
|
|
1133
|
+
)
|
|
804
1134
|
_response_json = _response.json()
|
|
805
1135
|
except JSONDecodeError:
|
|
806
1136
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|