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
@@ -0,0 +1,692 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
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
17
+ from ..types.invoice import Invoice
18
+ from ..types.invoice_lines_response import InvoiceLinesResponse
19
+ from ..types.invoice_list_response import InvoiceListResponse
20
+
21
+ # this is used as the default value for optional parameters
22
+ OMIT = typing.cast(typing.Any, ...)
23
+
24
+
25
+ class RawInvoicesClient:
26
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
27
+ self._client_wrapper = client_wrapper
28
+
29
+ def list_invoices(
30
+ self,
31
+ *,
32
+ limit: typing.Optional[int] = None,
33
+ offset: typing.Optional[int] = None,
34
+ request_options: typing.Optional[RequestOptions] = None,
35
+ ) -> HttpResponse[InvoiceListResponse]:
36
+ """
37
+ Get a list of invoices for the organization
38
+
39
+ Parameters
40
+ ----------
41
+ limit : typing.Optional[int]
42
+
43
+ offset : typing.Optional[int]
44
+
45
+ request_options : typing.Optional[RequestOptions]
46
+ Request-specific configuration.
47
+
48
+ Returns
49
+ -------
50
+ HttpResponse[InvoiceListResponse]
51
+ 200
52
+ """
53
+ _response = self._client_wrapper.httpx_client.request(
54
+ "invoices/",
55
+ method="GET",
56
+ params={
57
+ "limit": limit,
58
+ "offset": offset,
59
+ },
60
+ request_options=request_options,
61
+ )
62
+ try:
63
+ if 200 <= _response.status_code < 300:
64
+ _data = typing.cast(
65
+ InvoiceListResponse,
66
+ parse_obj_as(
67
+ type_=InvoiceListResponse, # type: ignore
68
+ object_=_response.json(),
69
+ ),
70
+ )
71
+ return HttpResponse(response=_response, data=_data)
72
+ if _response.status_code == 400:
73
+ raise BadRequestError(
74
+ headers=dict(_response.headers),
75
+ body=typing.cast(
76
+ ErrorResponse,
77
+ parse_obj_as(
78
+ type_=ErrorResponse, # type: ignore
79
+ object_=_response.json(),
80
+ ),
81
+ ),
82
+ )
83
+ if _response.status_code == 403:
84
+ raise ForbiddenError(
85
+ headers=dict(_response.headers),
86
+ body=typing.cast(
87
+ ErrorResponse,
88
+ parse_obj_as(
89
+ type_=ErrorResponse, # type: ignore
90
+ object_=_response.json(),
91
+ ),
92
+ ),
93
+ )
94
+ if _response.status_code == 500:
95
+ raise InternalServerError(
96
+ headers=dict(_response.headers),
97
+ body=typing.cast(
98
+ ErrorResponse,
99
+ parse_obj_as(
100
+ type_=ErrorResponse, # type: ignore
101
+ object_=_response.json(),
102
+ ),
103
+ ),
104
+ )
105
+ _response_json = _response.json()
106
+ except JSONDecodeError:
107
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
108
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
109
+
110
+ def get_invoice(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Invoice]:
111
+ """
112
+ Get an invoice by its ID
113
+
114
+ Parameters
115
+ ----------
116
+ id : str
117
+
118
+ request_options : typing.Optional[RequestOptions]
119
+ Request-specific configuration.
120
+
121
+ Returns
122
+ -------
123
+ HttpResponse[Invoice]
124
+ 200
125
+ """
126
+ _response = self._client_wrapper.httpx_client.request(
127
+ f"invoices/{jsonable_encoder(id)}",
128
+ method="GET",
129
+ request_options=request_options,
130
+ )
131
+ try:
132
+ if 200 <= _response.status_code < 300:
133
+ _data = typing.cast(
134
+ Invoice,
135
+ parse_obj_as(
136
+ type_=Invoice, # type: ignore
137
+ object_=_response.json(),
138
+ ),
139
+ )
140
+ return HttpResponse(response=_response, data=_data)
141
+ if _response.status_code == 403:
142
+ raise ForbiddenError(
143
+ headers=dict(_response.headers),
144
+ body=typing.cast(
145
+ ErrorResponse,
146
+ parse_obj_as(
147
+ type_=ErrorResponse, # type: ignore
148
+ object_=_response.json(),
149
+ ),
150
+ ),
151
+ )
152
+ if _response.status_code == 404:
153
+ raise NotFoundError(
154
+ headers=dict(_response.headers),
155
+ body=typing.cast(
156
+ ErrorResponse,
157
+ parse_obj_as(
158
+ type_=ErrorResponse, # type: ignore
159
+ object_=_response.json(),
160
+ ),
161
+ ),
162
+ )
163
+ if _response.status_code == 500:
164
+ raise InternalServerError(
165
+ headers=dict(_response.headers),
166
+ body=typing.cast(
167
+ ErrorResponse,
168
+ parse_obj_as(
169
+ type_=ErrorResponse, # type: ignore
170
+ object_=_response.json(),
171
+ ),
172
+ ),
173
+ )
174
+ _response_json = _response.json()
175
+ except JSONDecodeError:
176
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
177
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
178
+
179
+ def update_invoice(
180
+ self,
181
+ id: str,
182
+ *,
183
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
184
+ request_options: typing.Optional[RequestOptions] = None,
185
+ ) -> HttpResponse[Invoice]:
186
+ """
187
+ Update an invoice by its ID (limited fields)
188
+
189
+ Parameters
190
+ ----------
191
+ id : str
192
+
193
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
194
+
195
+ request_options : typing.Optional[RequestOptions]
196
+ Request-specific configuration.
197
+
198
+ Returns
199
+ -------
200
+ HttpResponse[Invoice]
201
+ 200
202
+ """
203
+ _response = self._client_wrapper.httpx_client.request(
204
+ f"invoices/{jsonable_encoder(id)}",
205
+ method="PUT",
206
+ json={
207
+ "metadata": metadata,
208
+ },
209
+ headers={
210
+ "content-type": "application/json",
211
+ },
212
+ request_options=request_options,
213
+ omit=OMIT,
214
+ )
215
+ try:
216
+ if 200 <= _response.status_code < 300:
217
+ _data = typing.cast(
218
+ Invoice,
219
+ parse_obj_as(
220
+ type_=Invoice, # type: ignore
221
+ object_=_response.json(),
222
+ ),
223
+ )
224
+ return HttpResponse(response=_response, data=_data)
225
+ if _response.status_code == 400:
226
+ raise BadRequestError(
227
+ headers=dict(_response.headers),
228
+ body=typing.cast(
229
+ ErrorResponse,
230
+ parse_obj_as(
231
+ type_=ErrorResponse, # type: ignore
232
+ object_=_response.json(),
233
+ ),
234
+ ),
235
+ )
236
+ if _response.status_code == 403:
237
+ raise ForbiddenError(
238
+ headers=dict(_response.headers),
239
+ body=typing.cast(
240
+ ErrorResponse,
241
+ parse_obj_as(
242
+ type_=ErrorResponse, # type: ignore
243
+ object_=_response.json(),
244
+ ),
245
+ ),
246
+ )
247
+ if _response.status_code == 404:
248
+ raise NotFoundError(
249
+ headers=dict(_response.headers),
250
+ body=typing.cast(
251
+ ErrorResponse,
252
+ parse_obj_as(
253
+ type_=ErrorResponse, # type: ignore
254
+ object_=_response.json(),
255
+ ),
256
+ ),
257
+ )
258
+ if _response.status_code == 500:
259
+ raise InternalServerError(
260
+ headers=dict(_response.headers),
261
+ body=typing.cast(
262
+ ErrorResponse,
263
+ parse_obj_as(
264
+ type_=ErrorResponse, # type: ignore
265
+ object_=_response.json(),
266
+ ),
267
+ ),
268
+ )
269
+ _response_json = _response.json()
270
+ except JSONDecodeError:
271
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
272
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
273
+
274
+ def get_invoice_lines(
275
+ self,
276
+ id: str,
277
+ *,
278
+ limit: typing.Optional[int] = None,
279
+ offset: typing.Optional[int] = None,
280
+ request_options: typing.Optional[RequestOptions] = None,
281
+ ) -> HttpResponse[InvoiceLinesResponse]:
282
+ """
283
+ Get the invoice lines for an invoice by its ID
284
+
285
+ Parameters
286
+ ----------
287
+ id : str
288
+
289
+ limit : typing.Optional[int]
290
+
291
+ offset : typing.Optional[int]
292
+
293
+ request_options : typing.Optional[RequestOptions]
294
+ Request-specific configuration.
295
+
296
+ Returns
297
+ -------
298
+ HttpResponse[InvoiceLinesResponse]
299
+ 200
300
+ """
301
+ _response = self._client_wrapper.httpx_client.request(
302
+ f"invoices/{jsonable_encoder(id)}/lines",
303
+ method="GET",
304
+ params={
305
+ "limit": limit,
306
+ "offset": offset,
307
+ },
308
+ request_options=request_options,
309
+ )
310
+ try:
311
+ if 200 <= _response.status_code < 300:
312
+ _data = typing.cast(
313
+ InvoiceLinesResponse,
314
+ parse_obj_as(
315
+ type_=InvoiceLinesResponse, # type: ignore
316
+ object_=_response.json(),
317
+ ),
318
+ )
319
+ return HttpResponse(response=_response, data=_data)
320
+ if _response.status_code == 403:
321
+ raise ForbiddenError(
322
+ headers=dict(_response.headers),
323
+ body=typing.cast(
324
+ ErrorResponse,
325
+ parse_obj_as(
326
+ type_=ErrorResponse, # type: ignore
327
+ object_=_response.json(),
328
+ ),
329
+ ),
330
+ )
331
+ if _response.status_code == 404:
332
+ raise NotFoundError(
333
+ headers=dict(_response.headers),
334
+ body=typing.cast(
335
+ ErrorResponse,
336
+ parse_obj_as(
337
+ type_=ErrorResponse, # type: ignore
338
+ object_=_response.json(),
339
+ ),
340
+ ),
341
+ )
342
+ if _response.status_code == 500:
343
+ raise InternalServerError(
344
+ headers=dict(_response.headers),
345
+ body=typing.cast(
346
+ ErrorResponse,
347
+ parse_obj_as(
348
+ type_=ErrorResponse, # type: ignore
349
+ object_=_response.json(),
350
+ ),
351
+ ),
352
+ )
353
+ _response_json = _response.json()
354
+ except JSONDecodeError:
355
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
356
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
357
+
358
+
359
+ class AsyncRawInvoicesClient:
360
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
361
+ self._client_wrapper = client_wrapper
362
+
363
+ async def list_invoices(
364
+ self,
365
+ *,
366
+ limit: typing.Optional[int] = None,
367
+ offset: typing.Optional[int] = None,
368
+ request_options: typing.Optional[RequestOptions] = None,
369
+ ) -> AsyncHttpResponse[InvoiceListResponse]:
370
+ """
371
+ Get a list of invoices for the organization
372
+
373
+ Parameters
374
+ ----------
375
+ limit : typing.Optional[int]
376
+
377
+ offset : typing.Optional[int]
378
+
379
+ request_options : typing.Optional[RequestOptions]
380
+ Request-specific configuration.
381
+
382
+ Returns
383
+ -------
384
+ AsyncHttpResponse[InvoiceListResponse]
385
+ 200
386
+ """
387
+ _response = await self._client_wrapper.httpx_client.request(
388
+ "invoices/",
389
+ method="GET",
390
+ params={
391
+ "limit": limit,
392
+ "offset": offset,
393
+ },
394
+ request_options=request_options,
395
+ )
396
+ try:
397
+ if 200 <= _response.status_code < 300:
398
+ _data = typing.cast(
399
+ InvoiceListResponse,
400
+ parse_obj_as(
401
+ type_=InvoiceListResponse, # type: ignore
402
+ object_=_response.json(),
403
+ ),
404
+ )
405
+ return AsyncHttpResponse(response=_response, data=_data)
406
+ if _response.status_code == 400:
407
+ raise BadRequestError(
408
+ headers=dict(_response.headers),
409
+ body=typing.cast(
410
+ ErrorResponse,
411
+ parse_obj_as(
412
+ type_=ErrorResponse, # type: ignore
413
+ object_=_response.json(),
414
+ ),
415
+ ),
416
+ )
417
+ if _response.status_code == 403:
418
+ raise ForbiddenError(
419
+ headers=dict(_response.headers),
420
+ body=typing.cast(
421
+ ErrorResponse,
422
+ parse_obj_as(
423
+ type_=ErrorResponse, # type: ignore
424
+ object_=_response.json(),
425
+ ),
426
+ ),
427
+ )
428
+ if _response.status_code == 500:
429
+ raise InternalServerError(
430
+ headers=dict(_response.headers),
431
+ body=typing.cast(
432
+ ErrorResponse,
433
+ parse_obj_as(
434
+ type_=ErrorResponse, # type: ignore
435
+ object_=_response.json(),
436
+ ),
437
+ ),
438
+ )
439
+ _response_json = _response.json()
440
+ except JSONDecodeError:
441
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
442
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
443
+
444
+ async def get_invoice(
445
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
446
+ ) -> AsyncHttpResponse[Invoice]:
447
+ """
448
+ Get an invoice by its ID
449
+
450
+ Parameters
451
+ ----------
452
+ id : str
453
+
454
+ request_options : typing.Optional[RequestOptions]
455
+ Request-specific configuration.
456
+
457
+ Returns
458
+ -------
459
+ AsyncHttpResponse[Invoice]
460
+ 200
461
+ """
462
+ _response = await self._client_wrapper.httpx_client.request(
463
+ f"invoices/{jsonable_encoder(id)}",
464
+ method="GET",
465
+ request_options=request_options,
466
+ )
467
+ try:
468
+ if 200 <= _response.status_code < 300:
469
+ _data = typing.cast(
470
+ Invoice,
471
+ parse_obj_as(
472
+ type_=Invoice, # type: ignore
473
+ object_=_response.json(),
474
+ ),
475
+ )
476
+ return AsyncHttpResponse(response=_response, data=_data)
477
+ if _response.status_code == 403:
478
+ raise ForbiddenError(
479
+ headers=dict(_response.headers),
480
+ body=typing.cast(
481
+ ErrorResponse,
482
+ parse_obj_as(
483
+ type_=ErrorResponse, # type: ignore
484
+ object_=_response.json(),
485
+ ),
486
+ ),
487
+ )
488
+ if _response.status_code == 404:
489
+ raise NotFoundError(
490
+ headers=dict(_response.headers),
491
+ body=typing.cast(
492
+ ErrorResponse,
493
+ parse_obj_as(
494
+ type_=ErrorResponse, # type: ignore
495
+ object_=_response.json(),
496
+ ),
497
+ ),
498
+ )
499
+ if _response.status_code == 500:
500
+ raise InternalServerError(
501
+ headers=dict(_response.headers),
502
+ body=typing.cast(
503
+ ErrorResponse,
504
+ parse_obj_as(
505
+ type_=ErrorResponse, # type: ignore
506
+ object_=_response.json(),
507
+ ),
508
+ ),
509
+ )
510
+ _response_json = _response.json()
511
+ except JSONDecodeError:
512
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
513
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
514
+
515
+ async def update_invoice(
516
+ self,
517
+ id: str,
518
+ *,
519
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
520
+ request_options: typing.Optional[RequestOptions] = None,
521
+ ) -> AsyncHttpResponse[Invoice]:
522
+ """
523
+ Update an invoice by its ID (limited fields)
524
+
525
+ Parameters
526
+ ----------
527
+ id : str
528
+
529
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
530
+
531
+ request_options : typing.Optional[RequestOptions]
532
+ Request-specific configuration.
533
+
534
+ Returns
535
+ -------
536
+ AsyncHttpResponse[Invoice]
537
+ 200
538
+ """
539
+ _response = await self._client_wrapper.httpx_client.request(
540
+ f"invoices/{jsonable_encoder(id)}",
541
+ method="PUT",
542
+ json={
543
+ "metadata": metadata,
544
+ },
545
+ headers={
546
+ "content-type": "application/json",
547
+ },
548
+ request_options=request_options,
549
+ omit=OMIT,
550
+ )
551
+ try:
552
+ if 200 <= _response.status_code < 300:
553
+ _data = typing.cast(
554
+ Invoice,
555
+ parse_obj_as(
556
+ type_=Invoice, # type: ignore
557
+ object_=_response.json(),
558
+ ),
559
+ )
560
+ return AsyncHttpResponse(response=_response, data=_data)
561
+ if _response.status_code == 400:
562
+ raise BadRequestError(
563
+ headers=dict(_response.headers),
564
+ body=typing.cast(
565
+ ErrorResponse,
566
+ parse_obj_as(
567
+ type_=ErrorResponse, # type: ignore
568
+ object_=_response.json(),
569
+ ),
570
+ ),
571
+ )
572
+ if _response.status_code == 403:
573
+ raise ForbiddenError(
574
+ headers=dict(_response.headers),
575
+ body=typing.cast(
576
+ ErrorResponse,
577
+ parse_obj_as(
578
+ type_=ErrorResponse, # type: ignore
579
+ object_=_response.json(),
580
+ ),
581
+ ),
582
+ )
583
+ if _response.status_code == 404:
584
+ raise NotFoundError(
585
+ headers=dict(_response.headers),
586
+ body=typing.cast(
587
+ ErrorResponse,
588
+ parse_obj_as(
589
+ type_=ErrorResponse, # type: ignore
590
+ object_=_response.json(),
591
+ ),
592
+ ),
593
+ )
594
+ if _response.status_code == 500:
595
+ raise InternalServerError(
596
+ headers=dict(_response.headers),
597
+ body=typing.cast(
598
+ ErrorResponse,
599
+ parse_obj_as(
600
+ type_=ErrorResponse, # type: ignore
601
+ object_=_response.json(),
602
+ ),
603
+ ),
604
+ )
605
+ _response_json = _response.json()
606
+ except JSONDecodeError:
607
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
608
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
609
+
610
+ async def get_invoice_lines(
611
+ self,
612
+ id: str,
613
+ *,
614
+ limit: typing.Optional[int] = None,
615
+ offset: typing.Optional[int] = None,
616
+ request_options: typing.Optional[RequestOptions] = None,
617
+ ) -> AsyncHttpResponse[InvoiceLinesResponse]:
618
+ """
619
+ Get the invoice lines for an invoice by its ID
620
+
621
+ Parameters
622
+ ----------
623
+ id : str
624
+
625
+ limit : typing.Optional[int]
626
+
627
+ offset : typing.Optional[int]
628
+
629
+ request_options : typing.Optional[RequestOptions]
630
+ Request-specific configuration.
631
+
632
+ Returns
633
+ -------
634
+ AsyncHttpResponse[InvoiceLinesResponse]
635
+ 200
636
+ """
637
+ _response = await self._client_wrapper.httpx_client.request(
638
+ f"invoices/{jsonable_encoder(id)}/lines",
639
+ method="GET",
640
+ params={
641
+ "limit": limit,
642
+ "offset": offset,
643
+ },
644
+ request_options=request_options,
645
+ )
646
+ try:
647
+ if 200 <= _response.status_code < 300:
648
+ _data = typing.cast(
649
+ InvoiceLinesResponse,
650
+ parse_obj_as(
651
+ type_=InvoiceLinesResponse, # type: ignore
652
+ object_=_response.json(),
653
+ ),
654
+ )
655
+ return AsyncHttpResponse(response=_response, data=_data)
656
+ if _response.status_code == 403:
657
+ raise ForbiddenError(
658
+ headers=dict(_response.headers),
659
+ body=typing.cast(
660
+ ErrorResponse,
661
+ parse_obj_as(
662
+ type_=ErrorResponse, # type: ignore
663
+ object_=_response.json(),
664
+ ),
665
+ ),
666
+ )
667
+ if _response.status_code == 404:
668
+ raise NotFoundError(
669
+ headers=dict(_response.headers),
670
+ body=typing.cast(
671
+ ErrorResponse,
672
+ parse_obj_as(
673
+ type_=ErrorResponse, # type: ignore
674
+ object_=_response.json(),
675
+ ),
676
+ ),
677
+ )
678
+ if _response.status_code == 500:
679
+ raise InternalServerError(
680
+ headers=dict(_response.headers),
681
+ body=typing.cast(
682
+ ErrorResponse,
683
+ parse_obj_as(
684
+ type_=ErrorResponse, # type: ignore
685
+ object_=_response.json(),
686
+ ),
687
+ ),
688
+ )
689
+ _response_json = _response.json()
690
+ except JSONDecodeError:
691
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
692
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
paid/orders/__init__.py CHANGED
@@ -2,6 +2,3 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
- from . import lines
6
-
7
- __all__ = ["lines"]