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