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
@@ -6,7 +6,6 @@ from json.decoder import JSONDecodeError
6
6
 
7
7
  from ..core.api_error import ApiError
8
8
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
- from ..core.datetime_utils import serialize_datetime
10
9
  from ..core.http_response import AsyncHttpResponse, HttpResponse
11
10
  from ..core.jsonable_encoder import jsonable_encoder
12
11
  from ..core.pydantic_utilities import parse_obj_as
@@ -14,15 +13,14 @@ from ..core.request_options import RequestOptions
14
13
  from ..core.serialization import convert_and_respect_annotation_metadata
15
14
  from ..errors.bad_request_error import BadRequestError
16
15
  from ..errors.forbidden_error import ForbiddenError
16
+ from ..errors.internal_server_error import InternalServerError
17
17
  from ..errors.not_found_error import NotFoundError
18
- from ..types.address import Address
19
- from ..types.cost_traces_response import CostTracesResponse
20
- from ..types.creation_source import CreationSource
21
18
  from ..types.customer import Customer
22
- from ..types.entitlement_usage import EntitlementUsage
23
- from ..types.error import Error
24
- from ..types.tax_exempt_status import TaxExemptStatus
25
- from ..types.usage_summaries_response import UsageSummariesResponse
19
+ from ..types.customer_billing_address import CustomerBillingAddress
20
+ from ..types.customer_creation_state import CustomerCreationState
21
+ from ..types.customer_list_response import CustomerListResponse
22
+ from ..types.empty_response import EmptyResponse
23
+ from ..types.error_response import ErrorResponse
26
24
 
27
25
  # this is used as the default value for optional parameters
28
26
  OMIT = typing.cast(typing.Any, ...)
@@ -32,76 +30,126 @@ class RawCustomersClient:
32
30
  def __init__(self, *, client_wrapper: SyncClientWrapper):
33
31
  self._client_wrapper = client_wrapper
34
32
 
35
- def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[typing.List[Customer]]:
33
+ def list_customers(
34
+ self,
35
+ *,
36
+ limit: typing.Optional[int] = None,
37
+ offset: typing.Optional[int] = None,
38
+ request_options: typing.Optional[RequestOptions] = None,
39
+ ) -> HttpResponse[CustomerListResponse]:
36
40
  """
41
+ Get a list of customers for the organization
42
+
37
43
  Parameters
38
44
  ----------
45
+ limit : typing.Optional[int]
46
+
47
+ offset : typing.Optional[int]
48
+
39
49
  request_options : typing.Optional[RequestOptions]
40
50
  Request-specific configuration.
41
51
 
42
52
  Returns
43
53
  -------
44
- HttpResponse[typing.List[Customer]]
45
- Success response
54
+ HttpResponse[CustomerListResponse]
55
+ 200
46
56
  """
47
57
  _response = self._client_wrapper.httpx_client.request(
48
- "customers",
58
+ "customers/",
49
59
  method="GET",
60
+ params={
61
+ "limit": limit,
62
+ "offset": offset,
63
+ },
50
64
  request_options=request_options,
51
65
  )
52
66
  try:
53
67
  if 200 <= _response.status_code < 300:
54
68
  _data = typing.cast(
55
- typing.List[Customer],
69
+ CustomerListResponse,
56
70
  parse_obj_as(
57
- type_=typing.List[Customer], # type: ignore
71
+ type_=CustomerListResponse, # type: ignore
58
72
  object_=_response.json(),
59
73
  ),
60
74
  )
61
75
  return HttpResponse(response=_response, data=_data)
76
+ if _response.status_code == 400:
77
+ raise BadRequestError(
78
+ headers=dict(_response.headers),
79
+ body=typing.cast(
80
+ ErrorResponse,
81
+ parse_obj_as(
82
+ type_=ErrorResponse, # type: ignore
83
+ object_=_response.json(),
84
+ ),
85
+ ),
86
+ )
87
+ if _response.status_code == 403:
88
+ raise ForbiddenError(
89
+ headers=dict(_response.headers),
90
+ body=typing.cast(
91
+ ErrorResponse,
92
+ parse_obj_as(
93
+ type_=ErrorResponse, # type: ignore
94
+ object_=_response.json(),
95
+ ),
96
+ ),
97
+ )
98
+ if _response.status_code == 500:
99
+ raise InternalServerError(
100
+ headers=dict(_response.headers),
101
+ body=typing.cast(
102
+ ErrorResponse,
103
+ parse_obj_as(
104
+ type_=ErrorResponse, # type: ignore
105
+ object_=_response.json(),
106
+ ),
107
+ ),
108
+ )
62
109
  _response_json = _response.json()
63
110
  except JSONDecodeError:
64
111
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
65
112
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
66
113
 
67
- def create(
114
+ def create_a_new_customer(
68
115
  self,
69
116
  *,
70
117
  name: str,
71
- external_id: typing.Optional[str] = OMIT,
118
+ legal_name: typing.Optional[str] = OMIT,
119
+ email: typing.Optional[str] = OMIT,
72
120
  phone: typing.Optional[str] = OMIT,
73
- employee_count: typing.Optional[float] = OMIT,
74
- annual_revenue: typing.Optional[float] = OMIT,
75
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
76
- creation_source: typing.Optional[CreationSource] = OMIT,
77
121
  website: typing.Optional[str] = OMIT,
78
- billing_address: typing.Optional[Address] = OMIT,
122
+ external_id: typing.Optional[str] = OMIT,
123
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
124
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
125
+ vat_number: typing.Optional[str] = OMIT,
79
126
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
80
127
  request_options: typing.Optional[RequestOptions] = None,
81
128
  ) -> HttpResponse[Customer]:
82
129
  """
130
+ Creates a new customer for the organization
131
+
83
132
  Parameters
84
133
  ----------
85
134
  name : str
86
135
 
87
- external_id : typing.Optional[str]
136
+ legal_name : typing.Optional[str]
88
137
 
89
- phone : typing.Optional[str]
138
+ email : typing.Optional[str]
90
139
 
91
- employee_count : typing.Optional[float]
140
+ phone : typing.Optional[str]
92
141
 
93
- annual_revenue : typing.Optional[float]
142
+ website : typing.Optional[str]
94
143
 
95
- tax_exempt_status : typing.Optional[TaxExemptStatus]
144
+ external_id : typing.Optional[str]
96
145
 
97
- creation_source : typing.Optional[CreationSource]
146
+ billing_address : typing.Optional[CustomerBillingAddress]
98
147
 
99
- website : typing.Optional[str]
148
+ creation_state : typing.Optional[CustomerCreationState]
100
149
 
101
- billing_address : typing.Optional[Address]
150
+ vat_number : typing.Optional[str]
102
151
 
103
152
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
104
- Flexible JSON field for storing custom metadata about the customer
105
153
 
106
154
  request_options : typing.Optional[RequestOptions]
107
155
  Request-specific configuration.
@@ -109,23 +157,23 @@ class RawCustomersClient:
109
157
  Returns
110
158
  -------
111
159
  HttpResponse[Customer]
112
- Success response
160
+ 201
113
161
  """
114
162
  _response = self._client_wrapper.httpx_client.request(
115
- "customers",
163
+ "customers/",
116
164
  method="POST",
117
165
  json={
118
166
  "name": name,
119
- "externalId": external_id,
167
+ "legalName": legal_name,
168
+ "email": email,
120
169
  "phone": phone,
121
- "employeeCount": employee_count,
122
- "annualRevenue": annual_revenue,
123
- "taxExemptStatus": tax_exempt_status,
124
- "creationSource": creation_source,
125
170
  "website": website,
171
+ "externalId": external_id,
126
172
  "billingAddress": convert_and_respect_annotation_metadata(
127
- object_=billing_address, annotation=Address, direction="write"
173
+ object_=billing_address, annotation=typing.Optional[CustomerBillingAddress], direction="write"
128
174
  ),
175
+ "creationState": creation_state,
176
+ "vatNumber": vat_number,
129
177
  "metadata": metadata,
130
178
  },
131
179
  headers={
@@ -144,18 +192,53 @@ class RawCustomersClient:
144
192
  ),
145
193
  )
146
194
  return HttpResponse(response=_response, data=_data)
195
+ if _response.status_code == 400:
196
+ raise BadRequestError(
197
+ headers=dict(_response.headers),
198
+ body=typing.cast(
199
+ ErrorResponse,
200
+ parse_obj_as(
201
+ type_=ErrorResponse, # type: ignore
202
+ object_=_response.json(),
203
+ ),
204
+ ),
205
+ )
206
+ if _response.status_code == 403:
207
+ raise ForbiddenError(
208
+ headers=dict(_response.headers),
209
+ body=typing.cast(
210
+ ErrorResponse,
211
+ parse_obj_as(
212
+ type_=ErrorResponse, # type: ignore
213
+ object_=_response.json(),
214
+ ),
215
+ ),
216
+ )
217
+ if _response.status_code == 500:
218
+ raise InternalServerError(
219
+ headers=dict(_response.headers),
220
+ body=typing.cast(
221
+ ErrorResponse,
222
+ parse_obj_as(
223
+ type_=ErrorResponse, # type: ignore
224
+ object_=_response.json(),
225
+ ),
226
+ ),
227
+ )
147
228
  _response_json = _response.json()
148
229
  except JSONDecodeError:
149
230
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
150
231
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
151
232
 
152
- def get(
153
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
233
+ def get_customer(
234
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
154
235
  ) -> HttpResponse[Customer]:
155
236
  """
237
+ Get a customer by its ID
238
+
156
239
  Parameters
157
240
  ----------
158
- customer_id : str
241
+ id : str
159
242
 
160
243
  request_options : typing.Optional[RequestOptions]
161
244
  Request-specific configuration.
@@ -163,10 +246,10 @@ class RawCustomersClient:
163
246
  Returns
164
247
  -------
165
248
  HttpResponse[Customer]
166
- Success response
249
+ 200
167
250
  """
168
251
  _response = self._client_wrapper.httpx_client.request(
169
- f"customers/{jsonable_encoder(customer_id)}",
252
+ f"customers/{jsonable_encoder(id)}",
170
253
  method="GET",
171
254
  request_options=request_options,
172
255
  )
@@ -180,52 +263,89 @@ class RawCustomersClient:
180
263
  ),
181
264
  )
182
265
  return HttpResponse(response=_response, data=_data)
266
+ if _response.status_code == 403:
267
+ raise ForbiddenError(
268
+ headers=dict(_response.headers),
269
+ body=typing.cast(
270
+ ErrorResponse,
271
+ parse_obj_as(
272
+ type_=ErrorResponse, # type: ignore
273
+ object_=_response.json(),
274
+ ),
275
+ ),
276
+ )
277
+ if _response.status_code == 404:
278
+ raise NotFoundError(
279
+ headers=dict(_response.headers),
280
+ body=typing.cast(
281
+ ErrorResponse,
282
+ parse_obj_as(
283
+ type_=ErrorResponse, # type: ignore
284
+ object_=_response.json(),
285
+ ),
286
+ ),
287
+ )
288
+ if _response.status_code == 500:
289
+ raise InternalServerError(
290
+ headers=dict(_response.headers),
291
+ body=typing.cast(
292
+ ErrorResponse,
293
+ parse_obj_as(
294
+ type_=ErrorResponse, # type: ignore
295
+ object_=_response.json(),
296
+ ),
297
+ ),
298
+ )
183
299
  _response_json = _response.json()
184
300
  except JSONDecodeError:
185
301
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
186
302
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
187
303
 
188
- def update(
304
+ def update_customer(
189
305
  self,
190
- customer_id: str,
306
+ id: str,
191
307
  *,
192
308
  name: typing.Optional[str] = OMIT,
193
- external_id: typing.Optional[str] = OMIT,
309
+ legal_name: typing.Optional[str] = OMIT,
310
+ email: typing.Optional[str] = OMIT,
194
311
  phone: typing.Optional[str] = OMIT,
195
- employee_count: typing.Optional[float] = OMIT,
196
- annual_revenue: typing.Optional[float] = OMIT,
197
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
198
- creation_source: typing.Optional[CreationSource] = OMIT,
199
312
  website: typing.Optional[str] = OMIT,
200
- billing_address: typing.Optional[Address] = OMIT,
313
+ external_id: typing.Optional[str] = OMIT,
314
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
315
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
316
+ churn_date: typing.Optional[dt.datetime] = OMIT,
317
+ vat_number: typing.Optional[str] = OMIT,
201
318
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
202
319
  request_options: typing.Optional[RequestOptions] = None,
203
320
  ) -> HttpResponse[Customer]:
204
321
  """
322
+ Update a customer by its ID
323
+
205
324
  Parameters
206
325
  ----------
207
- customer_id : str
326
+ id : str
208
327
 
209
328
  name : typing.Optional[str]
210
329
 
211
- external_id : typing.Optional[str]
330
+ legal_name : typing.Optional[str]
331
+
332
+ email : typing.Optional[str]
212
333
 
213
334
  phone : typing.Optional[str]
214
335
 
215
- employee_count : typing.Optional[float]
336
+ website : typing.Optional[str]
216
337
 
217
- annual_revenue : typing.Optional[float]
338
+ external_id : typing.Optional[str]
218
339
 
219
- tax_exempt_status : typing.Optional[TaxExemptStatus]
340
+ billing_address : typing.Optional[CustomerBillingAddress]
220
341
 
221
- creation_source : typing.Optional[CreationSource]
342
+ creation_state : typing.Optional[CustomerCreationState]
222
343
 
223
- website : typing.Optional[str]
344
+ churn_date : typing.Optional[dt.datetime]
224
345
 
225
- billing_address : typing.Optional[Address]
346
+ vat_number : typing.Optional[str]
226
347
 
227
348
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
228
- Flexible JSON field for storing custom metadata about the customer
229
349
 
230
350
  request_options : typing.Optional[RequestOptions]
231
351
  Request-specific configuration.
@@ -233,23 +353,24 @@ class RawCustomersClient:
233
353
  Returns
234
354
  -------
235
355
  HttpResponse[Customer]
236
- Customer updated successfully
356
+ 200
237
357
  """
238
358
  _response = self._client_wrapper.httpx_client.request(
239
- f"customers/{jsonable_encoder(customer_id)}",
359
+ f"customers/{jsonable_encoder(id)}",
240
360
  method="PUT",
241
361
  json={
242
362
  "name": name,
243
- "externalId": external_id,
363
+ "legalName": legal_name,
364
+ "email": email,
244
365
  "phone": phone,
245
- "employeeCount": employee_count,
246
- "annualRevenue": annual_revenue,
247
- "taxExemptStatus": tax_exempt_status,
248
- "creationSource": creation_source,
249
366
  "website": website,
367
+ "externalId": external_id,
250
368
  "billingAddress": convert_and_respect_annotation_metadata(
251
- object_=billing_address, annotation=Address, direction="write"
369
+ object_=billing_address, annotation=typing.Optional[CustomerBillingAddress], direction="write"
252
370
  ),
371
+ "creationState": creation_state,
372
+ "churnDate": churn_date,
373
+ "vatNumber": vat_number,
253
374
  "metadata": metadata,
254
375
  },
255
376
  headers={
@@ -268,67 +389,84 @@ class RawCustomersClient:
268
389
  ),
269
390
  )
270
391
  return HttpResponse(response=_response, data=_data)
392
+ if _response.status_code == 400:
393
+ raise BadRequestError(
394
+ headers=dict(_response.headers),
395
+ body=typing.cast(
396
+ ErrorResponse,
397
+ parse_obj_as(
398
+ type_=ErrorResponse, # type: ignore
399
+ object_=_response.json(),
400
+ ),
401
+ ),
402
+ )
403
+ if _response.status_code == 403:
404
+ raise ForbiddenError(
405
+ headers=dict(_response.headers),
406
+ body=typing.cast(
407
+ ErrorResponse,
408
+ parse_obj_as(
409
+ type_=ErrorResponse, # type: ignore
410
+ object_=_response.json(),
411
+ ),
412
+ ),
413
+ )
414
+ if _response.status_code == 404:
415
+ raise NotFoundError(
416
+ headers=dict(_response.headers),
417
+ body=typing.cast(
418
+ ErrorResponse,
419
+ parse_obj_as(
420
+ type_=ErrorResponse, # type: ignore
421
+ object_=_response.json(),
422
+ ),
423
+ ),
424
+ )
425
+ if _response.status_code == 500:
426
+ raise InternalServerError(
427
+ headers=dict(_response.headers),
428
+ body=typing.cast(
429
+ ErrorResponse,
430
+ parse_obj_as(
431
+ type_=ErrorResponse, # type: ignore
432
+ object_=_response.json(),
433
+ ),
434
+ ),
435
+ )
271
436
  _response_json = _response.json()
272
437
  except JSONDecodeError:
273
438
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
274
439
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
275
440
 
276
- def delete(
277
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
278
- ) -> HttpResponse[None]:
279
- """
280
- Parameters
281
- ----------
282
- customer_id : str
283
-
284
- request_options : typing.Optional[RequestOptions]
285
- Request-specific configuration.
286
-
287
- Returns
288
- -------
289
- HttpResponse[None]
441
+ def delete_customer(
442
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
443
+ ) -> HttpResponse[EmptyResponse]:
290
444
  """
291
- _response = self._client_wrapper.httpx_client.request(
292
- f"customers/{jsonable_encoder(customer_id)}",
293
- method="DELETE",
294
- request_options=request_options,
295
- )
296
- try:
297
- if 200 <= _response.status_code < 300:
298
- return HttpResponse(response=_response, data=None)
299
- _response_json = _response.json()
300
- except JSONDecodeError:
301
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
302
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
445
+ Delete a customer by its ID
303
446
 
304
- def get_entitlements(
305
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
306
- ) -> HttpResponse[typing.List[EntitlementUsage]]:
307
- """
308
447
  Parameters
309
448
  ----------
310
- customer_id : str
311
- The customer ID
449
+ id : str
312
450
 
313
451
  request_options : typing.Optional[RequestOptions]
314
452
  Request-specific configuration.
315
453
 
316
454
  Returns
317
455
  -------
318
- HttpResponse[typing.List[EntitlementUsage]]
319
- Success response
456
+ HttpResponse[EmptyResponse]
457
+ 200
320
458
  """
321
459
  _response = self._client_wrapper.httpx_client.request(
322
- f"customers/{jsonable_encoder(customer_id)}/credit-bundles",
323
- method="GET",
460
+ f"customers/{jsonable_encoder(id)}",
461
+ method="DELETE",
324
462
  request_options=request_options,
325
463
  )
326
464
  try:
327
465
  if 200 <= _response.status_code < 300:
328
466
  _data = typing.cast(
329
- typing.List[EntitlementUsage],
467
+ EmptyResponse,
330
468
  parse_obj_as(
331
- type_=typing.List[EntitlementUsage], # type: ignore
469
+ type_=EmptyResponse, # type: ignore
332
470
  object_=_response.json(),
333
471
  ),
334
472
  )
@@ -337,9 +475,31 @@ class RawCustomersClient:
337
475
  raise ForbiddenError(
338
476
  headers=dict(_response.headers),
339
477
  body=typing.cast(
340
- Error,
478
+ ErrorResponse,
479
+ parse_obj_as(
480
+ type_=ErrorResponse, # type: ignore
481
+ object_=_response.json(),
482
+ ),
483
+ ),
484
+ )
485
+ if _response.status_code == 404:
486
+ raise NotFoundError(
487
+ headers=dict(_response.headers),
488
+ body=typing.cast(
489
+ ErrorResponse,
341
490
  parse_obj_as(
342
- type_=Error, # type: ignore
491
+ type_=ErrorResponse, # type: ignore
492
+ object_=_response.json(),
493
+ ),
494
+ ),
495
+ )
496
+ if _response.status_code == 500:
497
+ raise InternalServerError(
498
+ headers=dict(_response.headers),
499
+ body=typing.cast(
500
+ ErrorResponse,
501
+ parse_obj_as(
502
+ type_=ErrorResponse, # type: ignore
343
503
  object_=_response.json(),
344
504
  ),
345
505
  ),
@@ -349,10 +509,12 @@ class RawCustomersClient:
349
509
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
350
510
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
351
511
 
352
- def get_by_external_id(
512
+ def get_customer_by_external_id(
353
513
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
354
514
  ) -> HttpResponse[Customer]:
355
515
  """
516
+ Get a customer by its externalId
517
+
356
518
  Parameters
357
519
  ----------
358
520
  external_id : str
@@ -363,7 +525,7 @@ class RawCustomersClient:
363
525
  Returns
364
526
  -------
365
527
  HttpResponse[Customer]
366
- Success response
528
+ 200
367
529
  """
368
530
  _response = self._client_wrapper.httpx_client.request(
369
531
  f"customers/external/{jsonable_encoder(external_id)}",
@@ -380,52 +542,89 @@ class RawCustomersClient:
380
542
  ),
381
543
  )
382
544
  return HttpResponse(response=_response, data=_data)
545
+ if _response.status_code == 403:
546
+ raise ForbiddenError(
547
+ headers=dict(_response.headers),
548
+ body=typing.cast(
549
+ ErrorResponse,
550
+ parse_obj_as(
551
+ type_=ErrorResponse, # type: ignore
552
+ object_=_response.json(),
553
+ ),
554
+ ),
555
+ )
556
+ if _response.status_code == 404:
557
+ raise NotFoundError(
558
+ headers=dict(_response.headers),
559
+ body=typing.cast(
560
+ ErrorResponse,
561
+ parse_obj_as(
562
+ type_=ErrorResponse, # type: ignore
563
+ object_=_response.json(),
564
+ ),
565
+ ),
566
+ )
567
+ if _response.status_code == 500:
568
+ raise InternalServerError(
569
+ headers=dict(_response.headers),
570
+ body=typing.cast(
571
+ ErrorResponse,
572
+ parse_obj_as(
573
+ type_=ErrorResponse, # type: ignore
574
+ object_=_response.json(),
575
+ ),
576
+ ),
577
+ )
383
578
  _response_json = _response.json()
384
579
  except JSONDecodeError:
385
580
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
386
581
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
387
582
 
388
- def update_by_external_id(
583
+ def update_customer_by_external_id(
389
584
  self,
390
585
  external_id_: str,
391
586
  *,
392
587
  name: typing.Optional[str] = OMIT,
393
- external_id: typing.Optional[str] = OMIT,
588
+ legal_name: typing.Optional[str] = OMIT,
589
+ email: typing.Optional[str] = OMIT,
394
590
  phone: typing.Optional[str] = OMIT,
395
- employee_count: typing.Optional[float] = OMIT,
396
- annual_revenue: typing.Optional[float] = OMIT,
397
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
398
- creation_source: typing.Optional[CreationSource] = OMIT,
399
591
  website: typing.Optional[str] = OMIT,
400
- billing_address: typing.Optional[Address] = OMIT,
592
+ external_id: typing.Optional[str] = OMIT,
593
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
594
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
595
+ churn_date: typing.Optional[dt.datetime] = OMIT,
596
+ vat_number: typing.Optional[str] = OMIT,
401
597
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
402
598
  request_options: typing.Optional[RequestOptions] = None,
403
599
  ) -> HttpResponse[Customer]:
404
600
  """
601
+ Update a customer by its externalId
602
+
405
603
  Parameters
406
604
  ----------
407
605
  external_id_ : str
408
606
 
409
607
  name : typing.Optional[str]
410
608
 
411
- external_id : typing.Optional[str]
609
+ legal_name : typing.Optional[str]
610
+
611
+ email : typing.Optional[str]
412
612
 
413
613
  phone : typing.Optional[str]
414
614
 
415
- employee_count : typing.Optional[float]
615
+ website : typing.Optional[str]
416
616
 
417
- annual_revenue : typing.Optional[float]
617
+ external_id : typing.Optional[str]
418
618
 
419
- tax_exempt_status : typing.Optional[TaxExemptStatus]
619
+ billing_address : typing.Optional[CustomerBillingAddress]
420
620
 
421
- creation_source : typing.Optional[CreationSource]
621
+ creation_state : typing.Optional[CustomerCreationState]
422
622
 
423
- website : typing.Optional[str]
623
+ churn_date : typing.Optional[dt.datetime]
424
624
 
425
- billing_address : typing.Optional[Address]
625
+ vat_number : typing.Optional[str]
426
626
 
427
627
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
428
- Flexible JSON field for storing custom metadata about the customer
429
628
 
430
629
  request_options : typing.Optional[RequestOptions]
431
630
  Request-specific configuration.
@@ -433,23 +632,24 @@ class RawCustomersClient:
433
632
  Returns
434
633
  -------
435
634
  HttpResponse[Customer]
436
- Success response
635
+ 200
437
636
  """
438
637
  _response = self._client_wrapper.httpx_client.request(
439
638
  f"customers/external/{jsonable_encoder(external_id_)}",
440
639
  method="PUT",
441
640
  json={
442
641
  "name": name,
443
- "externalId": external_id,
642
+ "legalName": legal_name,
643
+ "email": email,
444
644
  "phone": phone,
445
- "employeeCount": employee_count,
446
- "annualRevenue": annual_revenue,
447
- "taxExemptStatus": tax_exempt_status,
448
- "creationSource": creation_source,
449
645
  "website": website,
646
+ "externalId": external_id,
450
647
  "billingAddress": convert_and_respect_annotation_metadata(
451
- object_=billing_address, annotation=Address, direction="write"
648
+ object_=billing_address, annotation=typing.Optional[CustomerBillingAddress], direction="write"
452
649
  ),
650
+ "creationState": creation_state,
651
+ "churnDate": churn_date,
652
+ "vatNumber": vat_number,
453
653
  "metadata": metadata,
454
654
  },
455
655
  headers={
@@ -468,15 +668,61 @@ class RawCustomersClient:
468
668
  ),
469
669
  )
470
670
  return HttpResponse(response=_response, data=_data)
671
+ if _response.status_code == 400:
672
+ raise BadRequestError(
673
+ headers=dict(_response.headers),
674
+ body=typing.cast(
675
+ ErrorResponse,
676
+ parse_obj_as(
677
+ type_=ErrorResponse, # type: ignore
678
+ object_=_response.json(),
679
+ ),
680
+ ),
681
+ )
682
+ if _response.status_code == 403:
683
+ raise ForbiddenError(
684
+ headers=dict(_response.headers),
685
+ body=typing.cast(
686
+ ErrorResponse,
687
+ parse_obj_as(
688
+ type_=ErrorResponse, # type: ignore
689
+ object_=_response.json(),
690
+ ),
691
+ ),
692
+ )
693
+ if _response.status_code == 404:
694
+ raise NotFoundError(
695
+ headers=dict(_response.headers),
696
+ body=typing.cast(
697
+ ErrorResponse,
698
+ parse_obj_as(
699
+ type_=ErrorResponse, # type: ignore
700
+ object_=_response.json(),
701
+ ),
702
+ ),
703
+ )
704
+ if _response.status_code == 500:
705
+ raise InternalServerError(
706
+ headers=dict(_response.headers),
707
+ body=typing.cast(
708
+ ErrorResponse,
709
+ parse_obj_as(
710
+ type_=ErrorResponse, # type: ignore
711
+ object_=_response.json(),
712
+ ),
713
+ ),
714
+ )
471
715
  _response_json = _response.json()
472
716
  except JSONDecodeError:
473
717
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
474
718
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
475
719
 
476
- def delete_by_external_id(
720
+ def delete_customer_by_external_id(
477
721
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
478
- ) -> HttpResponse[None]:
722
+ ) -> HttpResponse[EmptyResponse]:
479
723
  """
724
+ Delete a customer by its externalId
725
+
480
726
  Parameters
481
727
  ----------
482
728
  external_id : str
@@ -486,107 +732,53 @@ class RawCustomersClient:
486
732
 
487
733
  Returns
488
734
  -------
489
- HttpResponse[None]
735
+ HttpResponse[EmptyResponse]
736
+ 200
490
737
  """
491
738
  _response = self._client_wrapper.httpx_client.request(
492
739
  f"customers/external/{jsonable_encoder(external_id)}",
493
740
  method="DELETE",
494
741
  request_options=request_options,
495
742
  )
496
- try:
497
- if 200 <= _response.status_code < 300:
498
- return HttpResponse(response=_response, data=None)
499
- _response_json = _response.json()
500
- except JSONDecodeError:
501
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
502
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
503
-
504
- def get_costs_by_external_id(
505
- self,
506
- external_id: str,
507
- *,
508
- limit: typing.Optional[int] = None,
509
- offset: typing.Optional[int] = None,
510
- start_time: typing.Optional[dt.datetime] = None,
511
- end_time: typing.Optional[dt.datetime] = None,
512
- request_options: typing.Optional[RequestOptions] = None,
513
- ) -> HttpResponse[CostTracesResponse]:
514
- """
515
- Parameters
516
- ----------
517
- external_id : str
518
- The external ID of the customer
519
-
520
- limit : typing.Optional[int]
521
- Maximum number of traces to return (1-1000)
522
-
523
- offset : typing.Optional[int]
524
- Number of traces to skip for pagination
525
-
526
- start_time : typing.Optional[dt.datetime]
527
- Filter traces starting from this time (ISO 8601 format)
528
-
529
- end_time : typing.Optional[dt.datetime]
530
- Filter traces up to this time (ISO 8601 format)
531
-
532
- request_options : typing.Optional[RequestOptions]
533
- Request-specific configuration.
534
-
535
- Returns
536
- -------
537
- HttpResponse[CostTracesResponse]
538
- Success response
539
- """
540
- _response = self._client_wrapper.httpx_client.request(
541
- f"customers/external/{jsonable_encoder(external_id)}/costs",
542
- method="GET",
543
- params={
544
- "limit": limit,
545
- "offset": offset,
546
- "startTime": serialize_datetime(start_time) if start_time is not None else None,
547
- "endTime": serialize_datetime(end_time) if end_time is not None else None,
548
- },
549
- request_options=request_options,
550
- )
551
743
  try:
552
744
  if 200 <= _response.status_code < 300:
553
745
  _data = typing.cast(
554
- CostTracesResponse,
746
+ EmptyResponse,
555
747
  parse_obj_as(
556
- type_=CostTracesResponse, # type: ignore
748
+ type_=EmptyResponse, # type: ignore
557
749
  object_=_response.json(),
558
750
  ),
559
751
  )
560
752
  return HttpResponse(response=_response, data=_data)
561
- if _response.status_code == 400:
562
- raise BadRequestError(
753
+ if _response.status_code == 403:
754
+ raise ForbiddenError(
563
755
  headers=dict(_response.headers),
564
756
  body=typing.cast(
565
- Error,
757
+ ErrorResponse,
566
758
  parse_obj_as(
567
- type_=Error, # type: ignore
759
+ type_=ErrorResponse, # type: ignore
568
760
  object_=_response.json(),
569
761
  ),
570
762
  ),
571
763
  )
572
- if _response.status_code == 403:
573
- raise ForbiddenError(
764
+ if _response.status_code == 404:
765
+ raise NotFoundError(
574
766
  headers=dict(_response.headers),
575
767
  body=typing.cast(
576
- Error,
768
+ ErrorResponse,
577
769
  parse_obj_as(
578
- type_=Error, # type: ignore
770
+ type_=ErrorResponse, # type: ignore
579
771
  object_=_response.json(),
580
772
  ),
581
773
  ),
582
774
  )
583
- if _response.status_code == 404:
584
- raise NotFoundError(
775
+ if _response.status_code == 500:
776
+ raise InternalServerError(
585
777
  headers=dict(_response.headers),
586
778
  body=typing.cast(
587
- Error,
779
+ ErrorResponse,
588
780
  parse_obj_as(
589
- type_=Error, # type: ignore
781
+ type_=ErrorResponse, # type: ignore
590
782
  object_=_response.json(),
591
783
  ),
592
784
  ),
@@ -596,70 +788,61 @@ class RawCustomersClient:
596
788
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
597
789
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
598
790
 
599
- def get_usage_by_external_id(
791
+
792
+ class AsyncRawCustomersClient:
793
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
794
+ self._client_wrapper = client_wrapper
795
+
796
+ async def list_customers(
600
797
  self,
601
- external_id: str,
602
798
  *,
603
799
  limit: typing.Optional[int] = None,
604
800
  offset: typing.Optional[int] = None,
605
- start_time: typing.Optional[dt.datetime] = None,
606
- end_time: typing.Optional[dt.datetime] = None,
607
801
  request_options: typing.Optional[RequestOptions] = None,
608
- ) -> HttpResponse[UsageSummariesResponse]:
802
+ ) -> AsyncHttpResponse[CustomerListResponse]:
609
803
  """
804
+ Get a list of customers for the organization
805
+
610
806
  Parameters
611
807
  ----------
612
- external_id : str
613
- The external ID of the customer
614
-
615
808
  limit : typing.Optional[int]
616
- Maximum number of usage summaries to return (1-1000)
617
809
 
618
810
  offset : typing.Optional[int]
619
- Number of usage summaries to skip for pagination
620
-
621
- start_time : typing.Optional[dt.datetime]
622
- Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
623
-
624
- end_time : typing.Optional[dt.datetime]
625
- Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
626
811
 
627
812
  request_options : typing.Optional[RequestOptions]
628
813
  Request-specific configuration.
629
814
 
630
815
  Returns
631
816
  -------
632
- HttpResponse[UsageSummariesResponse]
633
- Success response
817
+ AsyncHttpResponse[CustomerListResponse]
818
+ 200
634
819
  """
635
- _response = self._client_wrapper.httpx_client.request(
636
- f"customers/external/{jsonable_encoder(external_id)}/usage",
820
+ _response = await self._client_wrapper.httpx_client.request(
821
+ "customers/",
637
822
  method="GET",
638
823
  params={
639
824
  "limit": limit,
640
825
  "offset": offset,
641
- "startTime": serialize_datetime(start_time) if start_time is not None else None,
642
- "endTime": serialize_datetime(end_time) if end_time is not None else None,
643
826
  },
644
827
  request_options=request_options,
645
828
  )
646
829
  try:
647
830
  if 200 <= _response.status_code < 300:
648
831
  _data = typing.cast(
649
- UsageSummariesResponse,
832
+ CustomerListResponse,
650
833
  parse_obj_as(
651
- type_=UsageSummariesResponse, # type: ignore
834
+ type_=CustomerListResponse, # type: ignore
652
835
  object_=_response.json(),
653
836
  ),
654
837
  )
655
- return HttpResponse(response=_response, data=_data)
838
+ return AsyncHttpResponse(response=_response, data=_data)
656
839
  if _response.status_code == 400:
657
840
  raise BadRequestError(
658
841
  headers=dict(_response.headers),
659
842
  body=typing.cast(
660
- Error,
843
+ ErrorResponse,
661
844
  parse_obj_as(
662
- type_=Error, # type: ignore
845
+ type_=ErrorResponse, # type: ignore
663
846
  object_=_response.json(),
664
847
  ),
665
848
  ),
@@ -668,20 +851,20 @@ class RawCustomersClient:
668
851
  raise ForbiddenError(
669
852
  headers=dict(_response.headers),
670
853
  body=typing.cast(
671
- Error,
854
+ ErrorResponse,
672
855
  parse_obj_as(
673
- type_=Error, # type: ignore
856
+ type_=ErrorResponse, # type: ignore
674
857
  object_=_response.json(),
675
858
  ),
676
859
  ),
677
860
  )
678
- if _response.status_code == 404:
679
- raise NotFoundError(
861
+ if _response.status_code == 500:
862
+ raise InternalServerError(
680
863
  headers=dict(_response.headers),
681
864
  body=typing.cast(
682
- Error,
865
+ ErrorResponse,
683
866
  parse_obj_as(
684
- type_=Error, # type: ignore
867
+ type_=ErrorResponse, # type: ignore
685
868
  object_=_response.json(),
686
869
  ),
687
870
  ),
@@ -691,83 +874,45 @@ class RawCustomersClient:
691
874
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
692
875
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
693
876
 
694
-
695
- class AsyncRawCustomersClient:
696
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
697
- self._client_wrapper = client_wrapper
698
-
699
- async def list(
700
- self, *, request_options: typing.Optional[RequestOptions] = None
701
- ) -> AsyncHttpResponse[typing.List[Customer]]:
702
- """
703
- Parameters
704
- ----------
705
- request_options : typing.Optional[RequestOptions]
706
- Request-specific configuration.
707
-
708
- Returns
709
- -------
710
- AsyncHttpResponse[typing.List[Customer]]
711
- Success response
712
- """
713
- _response = await self._client_wrapper.httpx_client.request(
714
- "customers",
715
- method="GET",
716
- request_options=request_options,
717
- )
718
- try:
719
- if 200 <= _response.status_code < 300:
720
- _data = typing.cast(
721
- typing.List[Customer],
722
- parse_obj_as(
723
- type_=typing.List[Customer], # type: ignore
724
- object_=_response.json(),
725
- ),
726
- )
727
- return AsyncHttpResponse(response=_response, data=_data)
728
- _response_json = _response.json()
729
- except JSONDecodeError:
730
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
731
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
732
-
733
- async def create(
877
+ async def create_a_new_customer(
734
878
  self,
735
879
  *,
736
880
  name: str,
737
- external_id: typing.Optional[str] = OMIT,
881
+ legal_name: typing.Optional[str] = OMIT,
882
+ email: typing.Optional[str] = OMIT,
738
883
  phone: typing.Optional[str] = OMIT,
739
- employee_count: typing.Optional[float] = OMIT,
740
- annual_revenue: typing.Optional[float] = OMIT,
741
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
742
- creation_source: typing.Optional[CreationSource] = OMIT,
743
884
  website: typing.Optional[str] = OMIT,
744
- billing_address: typing.Optional[Address] = OMIT,
885
+ external_id: typing.Optional[str] = OMIT,
886
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
887
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
888
+ vat_number: typing.Optional[str] = OMIT,
745
889
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
746
890
  request_options: typing.Optional[RequestOptions] = None,
747
891
  ) -> AsyncHttpResponse[Customer]:
748
892
  """
893
+ Creates a new customer for the organization
894
+
749
895
  Parameters
750
896
  ----------
751
897
  name : str
752
898
 
753
- external_id : typing.Optional[str]
899
+ legal_name : typing.Optional[str]
754
900
 
755
- phone : typing.Optional[str]
901
+ email : typing.Optional[str]
756
902
 
757
- employee_count : typing.Optional[float]
903
+ phone : typing.Optional[str]
758
904
 
759
- annual_revenue : typing.Optional[float]
905
+ website : typing.Optional[str]
760
906
 
761
- tax_exempt_status : typing.Optional[TaxExemptStatus]
907
+ external_id : typing.Optional[str]
762
908
 
763
- creation_source : typing.Optional[CreationSource]
909
+ billing_address : typing.Optional[CustomerBillingAddress]
764
910
 
765
- website : typing.Optional[str]
911
+ creation_state : typing.Optional[CustomerCreationState]
766
912
 
767
- billing_address : typing.Optional[Address]
913
+ vat_number : typing.Optional[str]
768
914
 
769
915
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
770
- Flexible JSON field for storing custom metadata about the customer
771
916
 
772
917
  request_options : typing.Optional[RequestOptions]
773
918
  Request-specific configuration.
@@ -775,23 +920,23 @@ class AsyncRawCustomersClient:
775
920
  Returns
776
921
  -------
777
922
  AsyncHttpResponse[Customer]
778
- Success response
923
+ 201
779
924
  """
780
925
  _response = await self._client_wrapper.httpx_client.request(
781
- "customers",
926
+ "customers/",
782
927
  method="POST",
783
928
  json={
784
929
  "name": name,
785
- "externalId": external_id,
930
+ "legalName": legal_name,
931
+ "email": email,
786
932
  "phone": phone,
787
- "employeeCount": employee_count,
788
- "annualRevenue": annual_revenue,
789
- "taxExemptStatus": tax_exempt_status,
790
- "creationSource": creation_source,
791
933
  "website": website,
934
+ "externalId": external_id,
792
935
  "billingAddress": convert_and_respect_annotation_metadata(
793
- object_=billing_address, annotation=Address, direction="write"
936
+ object_=billing_address, annotation=typing.Optional[CustomerBillingAddress], direction="write"
794
937
  ),
938
+ "creationState": creation_state,
939
+ "vatNumber": vat_number,
795
940
  "metadata": metadata,
796
941
  },
797
942
  headers={
@@ -810,18 +955,53 @@ class AsyncRawCustomersClient:
810
955
  ),
811
956
  )
812
957
  return AsyncHttpResponse(response=_response, data=_data)
958
+ if _response.status_code == 400:
959
+ raise BadRequestError(
960
+ headers=dict(_response.headers),
961
+ body=typing.cast(
962
+ ErrorResponse,
963
+ parse_obj_as(
964
+ type_=ErrorResponse, # type: ignore
965
+ object_=_response.json(),
966
+ ),
967
+ ),
968
+ )
969
+ if _response.status_code == 403:
970
+ raise ForbiddenError(
971
+ headers=dict(_response.headers),
972
+ body=typing.cast(
973
+ ErrorResponse,
974
+ parse_obj_as(
975
+ type_=ErrorResponse, # type: ignore
976
+ object_=_response.json(),
977
+ ),
978
+ ),
979
+ )
980
+ if _response.status_code == 500:
981
+ raise InternalServerError(
982
+ headers=dict(_response.headers),
983
+ body=typing.cast(
984
+ ErrorResponse,
985
+ parse_obj_as(
986
+ type_=ErrorResponse, # type: ignore
987
+ object_=_response.json(),
988
+ ),
989
+ ),
990
+ )
813
991
  _response_json = _response.json()
814
992
  except JSONDecodeError:
815
993
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
816
994
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
817
995
 
818
- async def get(
819
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
996
+ async def get_customer(
997
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
820
998
  ) -> AsyncHttpResponse[Customer]:
821
999
  """
1000
+ Get a customer by its ID
1001
+
822
1002
  Parameters
823
1003
  ----------
824
- customer_id : str
1004
+ id : str
825
1005
 
826
1006
  request_options : typing.Optional[RequestOptions]
827
1007
  Request-specific configuration.
@@ -829,10 +1009,10 @@ class AsyncRawCustomersClient:
829
1009
  Returns
830
1010
  -------
831
1011
  AsyncHttpResponse[Customer]
832
- Success response
1012
+ 200
833
1013
  """
834
1014
  _response = await self._client_wrapper.httpx_client.request(
835
- f"customers/{jsonable_encoder(customer_id)}",
1015
+ f"customers/{jsonable_encoder(id)}",
836
1016
  method="GET",
837
1017
  request_options=request_options,
838
1018
  )
@@ -846,52 +1026,89 @@ class AsyncRawCustomersClient:
846
1026
  ),
847
1027
  )
848
1028
  return AsyncHttpResponse(response=_response, data=_data)
1029
+ if _response.status_code == 403:
1030
+ raise ForbiddenError(
1031
+ headers=dict(_response.headers),
1032
+ body=typing.cast(
1033
+ ErrorResponse,
1034
+ parse_obj_as(
1035
+ type_=ErrorResponse, # type: ignore
1036
+ object_=_response.json(),
1037
+ ),
1038
+ ),
1039
+ )
1040
+ if _response.status_code == 404:
1041
+ raise NotFoundError(
1042
+ headers=dict(_response.headers),
1043
+ body=typing.cast(
1044
+ ErrorResponse,
1045
+ parse_obj_as(
1046
+ type_=ErrorResponse, # type: ignore
1047
+ object_=_response.json(),
1048
+ ),
1049
+ ),
1050
+ )
1051
+ if _response.status_code == 500:
1052
+ raise InternalServerError(
1053
+ headers=dict(_response.headers),
1054
+ body=typing.cast(
1055
+ ErrorResponse,
1056
+ parse_obj_as(
1057
+ type_=ErrorResponse, # type: ignore
1058
+ object_=_response.json(),
1059
+ ),
1060
+ ),
1061
+ )
849
1062
  _response_json = _response.json()
850
1063
  except JSONDecodeError:
851
1064
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
852
1065
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
853
1066
 
854
- async def update(
1067
+ async def update_customer(
855
1068
  self,
856
- customer_id: str,
1069
+ id: str,
857
1070
  *,
858
1071
  name: typing.Optional[str] = OMIT,
859
- external_id: typing.Optional[str] = OMIT,
1072
+ legal_name: typing.Optional[str] = OMIT,
1073
+ email: typing.Optional[str] = OMIT,
860
1074
  phone: typing.Optional[str] = OMIT,
861
- employee_count: typing.Optional[float] = OMIT,
862
- annual_revenue: typing.Optional[float] = OMIT,
863
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
864
- creation_source: typing.Optional[CreationSource] = OMIT,
865
1075
  website: typing.Optional[str] = OMIT,
866
- billing_address: typing.Optional[Address] = OMIT,
1076
+ external_id: typing.Optional[str] = OMIT,
1077
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
1078
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
1079
+ churn_date: typing.Optional[dt.datetime] = OMIT,
1080
+ vat_number: typing.Optional[str] = OMIT,
867
1081
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
868
1082
  request_options: typing.Optional[RequestOptions] = None,
869
1083
  ) -> AsyncHttpResponse[Customer]:
870
1084
  """
1085
+ Update a customer by its ID
1086
+
871
1087
  Parameters
872
1088
  ----------
873
- customer_id : str
1089
+ id : str
874
1090
 
875
1091
  name : typing.Optional[str]
876
1092
 
877
- external_id : typing.Optional[str]
1093
+ legal_name : typing.Optional[str]
1094
+
1095
+ email : typing.Optional[str]
878
1096
 
879
1097
  phone : typing.Optional[str]
880
1098
 
881
- employee_count : typing.Optional[float]
1099
+ website : typing.Optional[str]
882
1100
 
883
- annual_revenue : typing.Optional[float]
1101
+ external_id : typing.Optional[str]
884
1102
 
885
- tax_exempt_status : typing.Optional[TaxExemptStatus]
1103
+ billing_address : typing.Optional[CustomerBillingAddress]
886
1104
 
887
- creation_source : typing.Optional[CreationSource]
1105
+ creation_state : typing.Optional[CustomerCreationState]
888
1106
 
889
- website : typing.Optional[str]
1107
+ churn_date : typing.Optional[dt.datetime]
890
1108
 
891
- billing_address : typing.Optional[Address]
1109
+ vat_number : typing.Optional[str]
892
1110
 
893
1111
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
894
- Flexible JSON field for storing custom metadata about the customer
895
1112
 
896
1113
  request_options : typing.Optional[RequestOptions]
897
1114
  Request-specific configuration.
@@ -899,23 +1116,24 @@ class AsyncRawCustomersClient:
899
1116
  Returns
900
1117
  -------
901
1118
  AsyncHttpResponse[Customer]
902
- Customer updated successfully
1119
+ 200
903
1120
  """
904
1121
  _response = await self._client_wrapper.httpx_client.request(
905
- f"customers/{jsonable_encoder(customer_id)}",
1122
+ f"customers/{jsonable_encoder(id)}",
906
1123
  method="PUT",
907
1124
  json={
908
1125
  "name": name,
909
- "externalId": external_id,
1126
+ "legalName": legal_name,
1127
+ "email": email,
910
1128
  "phone": phone,
911
- "employeeCount": employee_count,
912
- "annualRevenue": annual_revenue,
913
- "taxExemptStatus": tax_exempt_status,
914
- "creationSource": creation_source,
915
1129
  "website": website,
1130
+ "externalId": external_id,
916
1131
  "billingAddress": convert_and_respect_annotation_metadata(
917
- object_=billing_address, annotation=Address, direction="write"
1132
+ object_=billing_address, annotation=typing.Optional[CustomerBillingAddress], direction="write"
918
1133
  ),
1134
+ "creationState": creation_state,
1135
+ "churnDate": churn_date,
1136
+ "vatNumber": vat_number,
919
1137
  "metadata": metadata,
920
1138
  },
921
1139
  headers={
@@ -934,67 +1152,84 @@ class AsyncRawCustomersClient:
934
1152
  ),
935
1153
  )
936
1154
  return AsyncHttpResponse(response=_response, data=_data)
1155
+ if _response.status_code == 400:
1156
+ raise BadRequestError(
1157
+ headers=dict(_response.headers),
1158
+ body=typing.cast(
1159
+ ErrorResponse,
1160
+ parse_obj_as(
1161
+ type_=ErrorResponse, # type: ignore
1162
+ object_=_response.json(),
1163
+ ),
1164
+ ),
1165
+ )
1166
+ if _response.status_code == 403:
1167
+ raise ForbiddenError(
1168
+ headers=dict(_response.headers),
1169
+ body=typing.cast(
1170
+ ErrorResponse,
1171
+ parse_obj_as(
1172
+ type_=ErrorResponse, # type: ignore
1173
+ object_=_response.json(),
1174
+ ),
1175
+ ),
1176
+ )
1177
+ if _response.status_code == 404:
1178
+ raise NotFoundError(
1179
+ headers=dict(_response.headers),
1180
+ body=typing.cast(
1181
+ ErrorResponse,
1182
+ parse_obj_as(
1183
+ type_=ErrorResponse, # type: ignore
1184
+ object_=_response.json(),
1185
+ ),
1186
+ ),
1187
+ )
1188
+ if _response.status_code == 500:
1189
+ raise InternalServerError(
1190
+ headers=dict(_response.headers),
1191
+ body=typing.cast(
1192
+ ErrorResponse,
1193
+ parse_obj_as(
1194
+ type_=ErrorResponse, # type: ignore
1195
+ object_=_response.json(),
1196
+ ),
1197
+ ),
1198
+ )
937
1199
  _response_json = _response.json()
938
1200
  except JSONDecodeError:
939
1201
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
940
1202
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
941
1203
 
942
- async def delete(
943
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
944
- ) -> AsyncHttpResponse[None]:
1204
+ async def delete_customer(
1205
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1206
+ ) -> AsyncHttpResponse[EmptyResponse]:
945
1207
  """
946
- Parameters
947
- ----------
948
- customer_id : str
1208
+ Delete a customer by its ID
949
1209
 
950
- request_options : typing.Optional[RequestOptions]
951
- Request-specific configuration.
952
-
953
- Returns
954
- -------
955
- AsyncHttpResponse[None]
956
- """
957
- _response = await self._client_wrapper.httpx_client.request(
958
- f"customers/{jsonable_encoder(customer_id)}",
959
- method="DELETE",
960
- request_options=request_options,
961
- )
962
- try:
963
- if 200 <= _response.status_code < 300:
964
- return AsyncHttpResponse(response=_response, data=None)
965
- _response_json = _response.json()
966
- except JSONDecodeError:
967
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
968
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
969
-
970
- async def get_entitlements(
971
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
972
- ) -> AsyncHttpResponse[typing.List[EntitlementUsage]]:
973
- """
974
1210
  Parameters
975
1211
  ----------
976
- customer_id : str
977
- The customer ID
1212
+ id : str
978
1213
 
979
1214
  request_options : typing.Optional[RequestOptions]
980
1215
  Request-specific configuration.
981
1216
 
982
1217
  Returns
983
1218
  -------
984
- AsyncHttpResponse[typing.List[EntitlementUsage]]
985
- Success response
1219
+ AsyncHttpResponse[EmptyResponse]
1220
+ 200
986
1221
  """
987
1222
  _response = await self._client_wrapper.httpx_client.request(
988
- f"customers/{jsonable_encoder(customer_id)}/credit-bundles",
989
- method="GET",
1223
+ f"customers/{jsonable_encoder(id)}",
1224
+ method="DELETE",
990
1225
  request_options=request_options,
991
1226
  )
992
1227
  try:
993
1228
  if 200 <= _response.status_code < 300:
994
1229
  _data = typing.cast(
995
- typing.List[EntitlementUsage],
1230
+ EmptyResponse,
996
1231
  parse_obj_as(
997
- type_=typing.List[EntitlementUsage], # type: ignore
1232
+ type_=EmptyResponse, # type: ignore
998
1233
  object_=_response.json(),
999
1234
  ),
1000
1235
  )
@@ -1003,9 +1238,31 @@ class AsyncRawCustomersClient:
1003
1238
  raise ForbiddenError(
1004
1239
  headers=dict(_response.headers),
1005
1240
  body=typing.cast(
1006
- Error,
1241
+ ErrorResponse,
1242
+ parse_obj_as(
1243
+ type_=ErrorResponse, # type: ignore
1244
+ object_=_response.json(),
1245
+ ),
1246
+ ),
1247
+ )
1248
+ if _response.status_code == 404:
1249
+ raise NotFoundError(
1250
+ headers=dict(_response.headers),
1251
+ body=typing.cast(
1252
+ ErrorResponse,
1253
+ parse_obj_as(
1254
+ type_=ErrorResponse, # type: ignore
1255
+ object_=_response.json(),
1256
+ ),
1257
+ ),
1258
+ )
1259
+ if _response.status_code == 500:
1260
+ raise InternalServerError(
1261
+ headers=dict(_response.headers),
1262
+ body=typing.cast(
1263
+ ErrorResponse,
1007
1264
  parse_obj_as(
1008
- type_=Error, # type: ignore
1265
+ type_=ErrorResponse, # type: ignore
1009
1266
  object_=_response.json(),
1010
1267
  ),
1011
1268
  ),
@@ -1015,10 +1272,12 @@ class AsyncRawCustomersClient:
1015
1272
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1016
1273
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1017
1274
 
1018
- async def get_by_external_id(
1275
+ async def get_customer_by_external_id(
1019
1276
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1020
1277
  ) -> AsyncHttpResponse[Customer]:
1021
1278
  """
1279
+ Get a customer by its externalId
1280
+
1022
1281
  Parameters
1023
1282
  ----------
1024
1283
  external_id : str
@@ -1029,7 +1288,7 @@ class AsyncRawCustomersClient:
1029
1288
  Returns
1030
1289
  -------
1031
1290
  AsyncHttpResponse[Customer]
1032
- Success response
1291
+ 200
1033
1292
  """
1034
1293
  _response = await self._client_wrapper.httpx_client.request(
1035
1294
  f"customers/external/{jsonable_encoder(external_id)}",
@@ -1046,52 +1305,89 @@ class AsyncRawCustomersClient:
1046
1305
  ),
1047
1306
  )
1048
1307
  return AsyncHttpResponse(response=_response, data=_data)
1308
+ if _response.status_code == 403:
1309
+ raise ForbiddenError(
1310
+ headers=dict(_response.headers),
1311
+ body=typing.cast(
1312
+ ErrorResponse,
1313
+ parse_obj_as(
1314
+ type_=ErrorResponse, # type: ignore
1315
+ object_=_response.json(),
1316
+ ),
1317
+ ),
1318
+ )
1319
+ if _response.status_code == 404:
1320
+ raise NotFoundError(
1321
+ headers=dict(_response.headers),
1322
+ body=typing.cast(
1323
+ ErrorResponse,
1324
+ parse_obj_as(
1325
+ type_=ErrorResponse, # type: ignore
1326
+ object_=_response.json(),
1327
+ ),
1328
+ ),
1329
+ )
1330
+ if _response.status_code == 500:
1331
+ raise InternalServerError(
1332
+ headers=dict(_response.headers),
1333
+ body=typing.cast(
1334
+ ErrorResponse,
1335
+ parse_obj_as(
1336
+ type_=ErrorResponse, # type: ignore
1337
+ object_=_response.json(),
1338
+ ),
1339
+ ),
1340
+ )
1049
1341
  _response_json = _response.json()
1050
1342
  except JSONDecodeError:
1051
1343
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1052
1344
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1053
1345
 
1054
- async def update_by_external_id(
1346
+ async def update_customer_by_external_id(
1055
1347
  self,
1056
1348
  external_id_: str,
1057
1349
  *,
1058
1350
  name: typing.Optional[str] = OMIT,
1059
- external_id: typing.Optional[str] = OMIT,
1351
+ legal_name: typing.Optional[str] = OMIT,
1352
+ email: typing.Optional[str] = OMIT,
1060
1353
  phone: typing.Optional[str] = OMIT,
1061
- employee_count: typing.Optional[float] = OMIT,
1062
- annual_revenue: typing.Optional[float] = OMIT,
1063
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
1064
- creation_source: typing.Optional[CreationSource] = OMIT,
1065
1354
  website: typing.Optional[str] = OMIT,
1066
- billing_address: typing.Optional[Address] = OMIT,
1355
+ external_id: typing.Optional[str] = OMIT,
1356
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
1357
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
1358
+ churn_date: typing.Optional[dt.datetime] = OMIT,
1359
+ vat_number: typing.Optional[str] = OMIT,
1067
1360
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1068
1361
  request_options: typing.Optional[RequestOptions] = None,
1069
1362
  ) -> AsyncHttpResponse[Customer]:
1070
1363
  """
1364
+ Update a customer by its externalId
1365
+
1071
1366
  Parameters
1072
1367
  ----------
1073
1368
  external_id_ : str
1074
1369
 
1075
1370
  name : typing.Optional[str]
1076
1371
 
1077
- external_id : typing.Optional[str]
1372
+ legal_name : typing.Optional[str]
1373
+
1374
+ email : typing.Optional[str]
1078
1375
 
1079
1376
  phone : typing.Optional[str]
1080
1377
 
1081
- employee_count : typing.Optional[float]
1378
+ website : typing.Optional[str]
1082
1379
 
1083
- annual_revenue : typing.Optional[float]
1380
+ external_id : typing.Optional[str]
1084
1381
 
1085
- tax_exempt_status : typing.Optional[TaxExemptStatus]
1382
+ billing_address : typing.Optional[CustomerBillingAddress]
1086
1383
 
1087
- creation_source : typing.Optional[CreationSource]
1384
+ creation_state : typing.Optional[CustomerCreationState]
1088
1385
 
1089
- website : typing.Optional[str]
1386
+ churn_date : typing.Optional[dt.datetime]
1090
1387
 
1091
- billing_address : typing.Optional[Address]
1388
+ vat_number : typing.Optional[str]
1092
1389
 
1093
1390
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1094
- Flexible JSON field for storing custom metadata about the customer
1095
1391
 
1096
1392
  request_options : typing.Optional[RequestOptions]
1097
1393
  Request-specific configuration.
@@ -1099,23 +1395,24 @@ class AsyncRawCustomersClient:
1099
1395
  Returns
1100
1396
  -------
1101
1397
  AsyncHttpResponse[Customer]
1102
- Success response
1398
+ 200
1103
1399
  """
1104
1400
  _response = await self._client_wrapper.httpx_client.request(
1105
1401
  f"customers/external/{jsonable_encoder(external_id_)}",
1106
1402
  method="PUT",
1107
1403
  json={
1108
1404
  "name": name,
1109
- "externalId": external_id,
1405
+ "legalName": legal_name,
1406
+ "email": email,
1110
1407
  "phone": phone,
1111
- "employeeCount": employee_count,
1112
- "annualRevenue": annual_revenue,
1113
- "taxExemptStatus": tax_exempt_status,
1114
- "creationSource": creation_source,
1115
1408
  "website": website,
1409
+ "externalId": external_id,
1116
1410
  "billingAddress": convert_and_respect_annotation_metadata(
1117
- object_=billing_address, annotation=Address, direction="write"
1411
+ object_=billing_address, annotation=typing.Optional[CustomerBillingAddress], direction="write"
1118
1412
  ),
1413
+ "creationState": creation_state,
1414
+ "churnDate": churn_date,
1415
+ "vatNumber": vat_number,
1119
1416
  "metadata": metadata,
1120
1417
  },
1121
1418
  headers={
@@ -1134,103 +1431,13 @@ class AsyncRawCustomersClient:
1134
1431
  ),
1135
1432
  )
1136
1433
  return AsyncHttpResponse(response=_response, data=_data)
1137
- _response_json = _response.json()
1138
- except JSONDecodeError:
1139
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1140
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1141
-
1142
- async def delete_by_external_id(
1143
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1144
- ) -> AsyncHttpResponse[None]:
1145
- """
1146
- Parameters
1147
- ----------
1148
- external_id : str
1149
-
1150
- request_options : typing.Optional[RequestOptions]
1151
- Request-specific configuration.
1152
-
1153
- Returns
1154
- -------
1155
- AsyncHttpResponse[None]
1156
- """
1157
- _response = await self._client_wrapper.httpx_client.request(
1158
- f"customers/external/{jsonable_encoder(external_id)}",
1159
- method="DELETE",
1160
- request_options=request_options,
1161
- )
1162
- try:
1163
- if 200 <= _response.status_code < 300:
1164
- return AsyncHttpResponse(response=_response, data=None)
1165
- _response_json = _response.json()
1166
- except JSONDecodeError:
1167
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1168
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1169
-
1170
- async def get_costs_by_external_id(
1171
- self,
1172
- external_id: str,
1173
- *,
1174
- limit: typing.Optional[int] = None,
1175
- offset: typing.Optional[int] = None,
1176
- start_time: typing.Optional[dt.datetime] = None,
1177
- end_time: typing.Optional[dt.datetime] = None,
1178
- request_options: typing.Optional[RequestOptions] = None,
1179
- ) -> AsyncHttpResponse[CostTracesResponse]:
1180
- """
1181
- Parameters
1182
- ----------
1183
- external_id : str
1184
- The external ID of the customer
1185
-
1186
- limit : typing.Optional[int]
1187
- Maximum number of traces to return (1-1000)
1188
-
1189
- offset : typing.Optional[int]
1190
- Number of traces to skip for pagination
1191
-
1192
- start_time : typing.Optional[dt.datetime]
1193
- Filter traces starting from this time (ISO 8601 format)
1194
-
1195
- end_time : typing.Optional[dt.datetime]
1196
- Filter traces up to this time (ISO 8601 format)
1197
-
1198
- request_options : typing.Optional[RequestOptions]
1199
- Request-specific configuration.
1200
-
1201
- Returns
1202
- -------
1203
- AsyncHttpResponse[CostTracesResponse]
1204
- Success response
1205
- """
1206
- _response = await self._client_wrapper.httpx_client.request(
1207
- f"customers/external/{jsonable_encoder(external_id)}/costs",
1208
- method="GET",
1209
- params={
1210
- "limit": limit,
1211
- "offset": offset,
1212
- "startTime": serialize_datetime(start_time) if start_time is not None else None,
1213
- "endTime": serialize_datetime(end_time) if end_time is not None else None,
1214
- },
1215
- request_options=request_options,
1216
- )
1217
- try:
1218
- if 200 <= _response.status_code < 300:
1219
- _data = typing.cast(
1220
- CostTracesResponse,
1221
- parse_obj_as(
1222
- type_=CostTracesResponse, # type: ignore
1223
- object_=_response.json(),
1224
- ),
1225
- )
1226
- return AsyncHttpResponse(response=_response, data=_data)
1227
1434
  if _response.status_code == 400:
1228
1435
  raise BadRequestError(
1229
1436
  headers=dict(_response.headers),
1230
1437
  body=typing.cast(
1231
- Error,
1438
+ ErrorResponse,
1232
1439
  parse_obj_as(
1233
- type_=Error, # type: ignore
1440
+ type_=ErrorResponse, # type: ignore
1234
1441
  object_=_response.json(),
1235
1442
  ),
1236
1443
  ),
@@ -1239,9 +1446,9 @@ class AsyncRawCustomersClient:
1239
1446
  raise ForbiddenError(
1240
1447
  headers=dict(_response.headers),
1241
1448
  body=typing.cast(
1242
- Error,
1449
+ ErrorResponse,
1243
1450
  parse_obj_as(
1244
- type_=Error, # type: ignore
1451
+ type_=ErrorResponse, # type: ignore
1245
1452
  object_=_response.json(),
1246
1453
  ),
1247
1454
  ),
@@ -1250,9 +1457,20 @@ class AsyncRawCustomersClient:
1250
1457
  raise NotFoundError(
1251
1458
  headers=dict(_response.headers),
1252
1459
  body=typing.cast(
1253
- Error,
1460
+ ErrorResponse,
1461
+ parse_obj_as(
1462
+ type_=ErrorResponse, # type: ignore
1463
+ object_=_response.json(),
1464
+ ),
1465
+ ),
1466
+ )
1467
+ if _response.status_code == 500:
1468
+ raise InternalServerError(
1469
+ headers=dict(_response.headers),
1470
+ body=typing.cast(
1471
+ ErrorResponse,
1254
1472
  parse_obj_as(
1255
- type_=Error, # type: ignore
1473
+ type_=ErrorResponse, # type: ignore
1256
1474
  object_=_response.json(),
1257
1475
  ),
1258
1476
  ),
@@ -1262,92 +1480,68 @@ class AsyncRawCustomersClient:
1262
1480
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1263
1481
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1264
1482
 
1265
- async def get_usage_by_external_id(
1266
- self,
1267
- external_id: str,
1268
- *,
1269
- limit: typing.Optional[int] = None,
1270
- offset: typing.Optional[int] = None,
1271
- start_time: typing.Optional[dt.datetime] = None,
1272
- end_time: typing.Optional[dt.datetime] = None,
1273
- request_options: typing.Optional[RequestOptions] = None,
1274
- ) -> AsyncHttpResponse[UsageSummariesResponse]:
1483
+ async def delete_customer_by_external_id(
1484
+ self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1485
+ ) -> AsyncHttpResponse[EmptyResponse]:
1275
1486
  """
1487
+ Delete a customer by its externalId
1488
+
1276
1489
  Parameters
1277
1490
  ----------
1278
1491
  external_id : str
1279
- The external ID of the customer
1280
-
1281
- limit : typing.Optional[int]
1282
- Maximum number of usage summaries to return (1-1000)
1283
-
1284
- offset : typing.Optional[int]
1285
- Number of usage summaries to skip for pagination
1286
-
1287
- start_time : typing.Optional[dt.datetime]
1288
- Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
1289
-
1290
- end_time : typing.Optional[dt.datetime]
1291
- Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
1292
1492
 
1293
1493
  request_options : typing.Optional[RequestOptions]
1294
1494
  Request-specific configuration.
1295
1495
 
1296
1496
  Returns
1297
1497
  -------
1298
- AsyncHttpResponse[UsageSummariesResponse]
1299
- Success response
1498
+ AsyncHttpResponse[EmptyResponse]
1499
+ 200
1300
1500
  """
1301
1501
  _response = await self._client_wrapper.httpx_client.request(
1302
- f"customers/external/{jsonable_encoder(external_id)}/usage",
1303
- method="GET",
1304
- params={
1305
- "limit": limit,
1306
- "offset": offset,
1307
- "startTime": serialize_datetime(start_time) if start_time is not None else None,
1308
- "endTime": serialize_datetime(end_time) if end_time is not None else None,
1309
- },
1502
+ f"customers/external/{jsonable_encoder(external_id)}",
1503
+ method="DELETE",
1310
1504
  request_options=request_options,
1311
1505
  )
1312
1506
  try:
1313
1507
  if 200 <= _response.status_code < 300:
1314
1508
  _data = typing.cast(
1315
- UsageSummariesResponse,
1509
+ EmptyResponse,
1316
1510
  parse_obj_as(
1317
- type_=UsageSummariesResponse, # type: ignore
1511
+ type_=EmptyResponse, # type: ignore
1318
1512
  object_=_response.json(),
1319
1513
  ),
1320
1514
  )
1321
1515
  return AsyncHttpResponse(response=_response, data=_data)
1322
- if _response.status_code == 400:
1323
- raise BadRequestError(
1516
+ if _response.status_code == 403:
1517
+ raise ForbiddenError(
1324
1518
  headers=dict(_response.headers),
1325
1519
  body=typing.cast(
1326
- Error,
1520
+ ErrorResponse,
1327
1521
  parse_obj_as(
1328
- type_=Error, # type: ignore
1522
+ type_=ErrorResponse, # type: ignore
1329
1523
  object_=_response.json(),
1330
1524
  ),
1331
1525
  ),
1332
1526
  )
1333
- if _response.status_code == 403:
1334
- raise ForbiddenError(
1527
+ if _response.status_code == 404:
1528
+ raise NotFoundError(
1335
1529
  headers=dict(_response.headers),
1336
1530
  body=typing.cast(
1337
- Error,
1531
+ ErrorResponse,
1338
1532
  parse_obj_as(
1339
- type_=Error, # type: ignore
1533
+ type_=ErrorResponse, # type: ignore
1340
1534
  object_=_response.json(),
1341
1535
  ),
1342
1536
  ),
1343
1537
  )
1344
- if _response.status_code == 404:
1345
- raise NotFoundError(
1538
+ if _response.status_code == 500:
1539
+ raise InternalServerError(
1346
1540
  headers=dict(_response.headers),
1347
1541
  body=typing.cast(
1348
- Error,
1542
+ ErrorResponse,
1349
1543
  parse_obj_as(
1350
- type_=Error, # type: ignore
1544
+ type_=ErrorResponse, # type: ignore
1351
1545
  object_=_response.json(),
1352
1546
  ),
1353
1547
  ),