paid-python 0.6.0__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.
Files changed (140) hide show
  1. paid/__init__.py +65 -95
  2. paid/client.py +17 -494
  3. paid/contacts/client.py +415 -133
  4. paid/contacts/raw_client.py +1046 -118
  5. paid/core/client_wrapper.py +9 -10
  6. paid/customers/client.py +270 -566
  7. paid/customers/raw_client.py +731 -537
  8. paid/environment.py +1 -1
  9. paid/errors/bad_request_error.py +2 -2
  10. paid/errors/forbidden_error.py +2 -2
  11. paid/errors/internal_server_error.py +2 -2
  12. paid/errors/not_found_error.py +2 -2
  13. paid/invoices/client.py +369 -0
  14. paid/invoices/raw_client.py +692 -0
  15. paid/orders/__init__.py +0 -3
  16. paid/orders/client.py +371 -128
  17. paid/orders/raw_client.py +829 -121
  18. paid/products/__init__.py +0 -3
  19. paid/products/client.py +129 -265
  20. paid/products/raw_client.py +563 -233
  21. paid/signals/client.py +130 -0
  22. paid/signals/raw_client.py +190 -0
  23. paid/tracing/autoinstrumentation.py +12 -6
  24. paid/tracing/context_manager.py +2 -6
  25. paid/tracing/distributed_tracing.py +3 -3
  26. paid/tracing/signal.py +3 -3
  27. paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
  28. paid/types/__init__.py +62 -86
  29. paid/types/attribution.py +8 -0
  30. paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
  31. paid/types/contact.py +12 -20
  32. paid/types/{address.py → contact_billing_address.py} +6 -7
  33. paid/types/{traces_response.py → contact_list_response.py} +5 -9
  34. paid/types/customer.py +15 -22
  35. paid/types/customer_attribution.py +8 -0
  36. paid/types/customer_billing_address.py +26 -0
  37. paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
  38. paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
  39. paid/types/customer_creation_state.py +5 -0
  40. paid/types/customer_list_response.py +22 -0
  41. paid/types/empty_response.py +17 -0
  42. paid/types/{error.py → error_response.py} +4 -7
  43. paid/types/invoice.py +57 -0
  44. paid/types/invoice_line.py +42 -0
  45. paid/types/invoice_line_payment_status.py +7 -0
  46. paid/types/invoice_lines_response.py +22 -0
  47. paid/types/invoice_list_response.py +22 -0
  48. paid/types/invoice_payment_status.py +5 -0
  49. paid/types/invoice_source.py +5 -0
  50. paid/types/invoice_status.py +7 -0
  51. paid/types/invoice_tax_status.py +7 -0
  52. paid/types/order.py +30 -29
  53. paid/types/order_creation_state.py +5 -0
  54. paid/types/order_line.py +6 -24
  55. paid/types/order_lines_response.py +22 -0
  56. paid/types/order_list_response.py +22 -0
  57. paid/types/pagination.py +24 -0
  58. paid/types/product.py +4 -29
  59. paid/types/{tier.py → product_by_external_id.py} +5 -4
  60. paid/types/{cost_amount.py → product_by_id.py} +5 -12
  61. paid/types/product_list_response.py +22 -0
  62. paid/types/signal.py +8 -34
  63. paid/types/{agent.py → update_contact_request.py} +10 -11
  64. paid/types/update_customer_request.py +38 -0
  65. paid/types/{product_update.py → update_product_request.py} +2 -12
  66. {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/METADATA +27 -11
  67. paid_python-1.0.0a1.dist-info/RECORD +110 -0
  68. opentelemetry/instrumentation/openai/__init__.py +0 -54
  69. opentelemetry/instrumentation/openai/shared/__init__.py +0 -399
  70. opentelemetry/instrumentation/openai/shared/audio_wrappers.py +0 -247
  71. opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -1192
  72. opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -292
  73. opentelemetry/instrumentation/openai/shared/config.py +0 -15
  74. opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -311
  75. opentelemetry/instrumentation/openai/shared/event_emitter.py +0 -108
  76. opentelemetry/instrumentation/openai/shared/event_models.py +0 -41
  77. opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -68
  78. opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
  79. opentelemetry/instrumentation/openai/utils.py +0 -213
  80. opentelemetry/instrumentation/openai/v0/__init__.py +0 -176
  81. opentelemetry/instrumentation/openai/v1/__init__.py +0 -394
  82. opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -329
  83. opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -134
  84. opentelemetry/instrumentation/openai/v1/responses_wrappers.py +0 -1113
  85. opentelemetry/instrumentation/openai/version.py +0 -1
  86. paid/agents/client.py +0 -880
  87. paid/agents/raw_client.py +0 -785
  88. paid/orders/lines/client.py +0 -144
  89. paid/orders/lines/raw_client.py +0 -129
  90. paid/plans/__init__.py +0 -4
  91. paid/plans/client.py +0 -332
  92. paid/plans/raw_client.py +0 -464
  93. paid/products/types/__init__.py +0 -7
  94. paid/products/types/product_create_type.py +0 -5
  95. paid/traces/__init__.py +0 -4
  96. paid/traces/client.py +0 -218
  97. paid/traces/raw_client.py +0 -226
  98. paid/types/agent_price_point.py +0 -27
  99. paid/types/agent_price_point_tiers.py +0 -23
  100. paid/types/agent_update.py +0 -29
  101. paid/types/api_error.py +0 -29
  102. paid/types/billing_frequency.py +0 -5
  103. paid/types/charge_type.py +0 -5
  104. paid/types/cost_trace.py +0 -55
  105. paid/types/cost_traces_response.py +0 -26
  106. paid/types/creation_source.py +0 -5
  107. paid/types/creation_state.py +0 -5
  108. paid/types/customer_update.py +0 -40
  109. paid/types/entitlement_usage.py +0 -48
  110. paid/types/order_line_attribute.py +0 -27
  111. paid/types/order_line_attribute_create_one.py +0 -5
  112. paid/types/order_line_attribute_pricing.py +0 -33
  113. paid/types/order_line_create.py +0 -72
  114. paid/types/pagination_meta.py +0 -84
  115. paid/types/plan.py +0 -81
  116. paid/types/plan_group.py +0 -60
  117. paid/types/plan_plan_products_item.py +0 -35
  118. paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
  119. paid/types/price_point.py +0 -25
  120. paid/types/pricing.py +0 -31
  121. paid/types/pricing_model_type.py +0 -7
  122. paid/types/product_type.py +0 -5
  123. paid/types/product_update_type.py +0 -5
  124. paid/types/salutation.py +0 -5
  125. paid/types/signal_v_2.py +0 -56
  126. paid/types/tax_exempt_status.py +0 -5
  127. paid/types/trace.py +0 -69
  128. paid/types/usage_pagination_meta.py +0 -43
  129. paid/types/usage_summaries_response.py +0 -26
  130. paid/types/usage_summary.py +0 -121
  131. paid/usage/__init__.py +0 -7
  132. paid/usage/client.py +0 -321
  133. paid/usage/raw_client.py +0 -387
  134. paid/usage/types/__init__.py +0 -7
  135. paid/usage/types/usage_check_usage_response.py +0 -53
  136. paid_python-0.6.0.dist-info/RECORD +0 -153
  137. /paid/{agents → invoices}/__init__.py +0 -0
  138. /paid/{orders/lines → signals}/__init__.py +0 -0
  139. {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/LICENSE +0 -0
  140. {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.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_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
- 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,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 get(self, product_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Product]:
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
- product_id : str
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
- Success response
224
+ 200
141
225
  """
142
226
  _response = self._client_wrapper.httpx_client.request(
143
- f"products/{jsonable_encoder(product_id)}",
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 update(
279
+ def update_product(
163
280
  self,
164
- product_id: str,
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
- product_attribute: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
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
- product_id : str
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
- product_attribute : typing.Optional[typing.Sequence[AgentAttribute]]
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
- Success response
316
+ 200
205
317
  """
206
318
  _response = self._client_wrapper.httpx_client.request(
207
- f"products/{jsonable_encoder(product_id)}",
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
- "ProductAttribute": convert_and_respect_annotation_metadata(
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 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(
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
- Success response
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 update_by_external_id(
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
- product_attribute: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
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
- product_attribute : typing.Optional[typing.Sequence[AgentAttribute]]
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
- Success response
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
- "ProductAttribute": convert_and_respect_annotation_metadata(
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
- _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)
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 list(
418
- self, *, request_options: typing.Optional[RequestOptions] = None
419
- ) -> AsyncHttpResponse[typing.List[Product]]:
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[typing.List[Product]]
429
- Success response
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
- typing.List[Product],
621
+ ProductListResponse,
440
622
  parse_obj_as(
441
- type_=typing.List[Product], # type: ignore
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 create(
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
- Success response
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 get(
522
- self, product_id: str, *, request_options: typing.Optional[RequestOptions] = None
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
- product_id : str
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
- Success response
783
+ 200
536
784
  """
537
785
  _response = await self._client_wrapper.httpx_client.request(
538
- f"products/{jsonable_encoder(product_id)}",
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 update(
838
+ async def update_product(
558
839
  self,
559
- product_id: str,
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
- product_attribute: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
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
- product_id : str
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
- product_attribute : typing.Optional[typing.Sequence[AgentAttribute]]
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
- Success response
875
+ 200
600
876
  """
601
877
  _response = await self._client_wrapper.httpx_client.request(
602
- f"products/{jsonable_encoder(product_id)}",
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
- "ProductAttribute": convert_and_respect_annotation_metadata(
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 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(
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
- Success response
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 update_by_external_id(
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
- product_attribute: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
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
- product_attribute : typing.Optional[typing.Sequence[AgentAttribute]]
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
- Success response
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
- "ProductAttribute": convert_and_respect_annotation_metadata(
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
- _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)
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)