paid-python 0.6.0__py3-none-any.whl → 1.0.0a0__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 (53) hide show
  1. paid/__init__.py +31 -0
  2. paid/client.py +1 -472
  3. paid/core/client_wrapper.py +3 -2
  4. paid/customers/__init__.py +3 -0
  5. paid/customers/client.py +428 -4
  6. paid/customers/raw_client.py +594 -2
  7. paid/customers/types/__init__.py +8 -0
  8. paid/customers/types/customers_check_entitlement_request_view.py +5 -0
  9. paid/customers/types/customers_check_entitlement_response.py +22 -0
  10. paid/orders/client.py +435 -0
  11. paid/orders/raw_client.py +695 -0
  12. paid/plans/client.py +71 -0
  13. paid/plans/raw_client.py +121 -2
  14. paid/types/__init__.py +28 -0
  15. paid/types/cancel_renewal_response.py +49 -0
  16. paid/types/contact_create_for_customer.py +37 -0
  17. paid/types/invoice.py +75 -0
  18. paid/types/invoice_status.py +5 -0
  19. paid/types/payment_method.py +58 -0
  20. paid/types/payment_method_card.py +49 -0
  21. paid/types/payment_method_type.py +5 -0
  22. paid/types/payment_method_us_bank_account.py +36 -0
  23. paid/types/payment_method_us_bank_account_account_type.py +5 -0
  24. paid/types/plan_plan_products_item.py +6 -0
  25. paid/types/plan_with_features.py +69 -0
  26. paid/types/plan_with_features_features_item.py +34 -0
  27. paid/types/proration_attribute_update.py +44 -0
  28. paid/types/proration_detail.py +49 -0
  29. paid/types/proration_upgrade_response.py +73 -0
  30. paid/types/signal_v_2.py +5 -5
  31. paid/usage/client.py +6 -6
  32. {paid_python-0.6.0.dist-info → paid_python-1.0.0a0.dist-info}/METADATA +6 -4
  33. {paid_python-0.6.0.dist-info → paid_python-1.0.0a0.dist-info}/RECORD +35 -36
  34. opentelemetry/instrumentation/openai/__init__.py +0 -54
  35. opentelemetry/instrumentation/openai/shared/__init__.py +0 -399
  36. opentelemetry/instrumentation/openai/shared/audio_wrappers.py +0 -247
  37. opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -1192
  38. opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -292
  39. opentelemetry/instrumentation/openai/shared/config.py +0 -15
  40. opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -311
  41. opentelemetry/instrumentation/openai/shared/event_emitter.py +0 -108
  42. opentelemetry/instrumentation/openai/shared/event_models.py +0 -41
  43. opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -68
  44. opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
  45. opentelemetry/instrumentation/openai/utils.py +0 -213
  46. opentelemetry/instrumentation/openai/v0/__init__.py +0 -176
  47. opentelemetry/instrumentation/openai/v1/__init__.py +0 -394
  48. opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -329
  49. opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -134
  50. opentelemetry/instrumentation/openai/v1/responses_wrappers.py +0 -1113
  51. opentelemetry/instrumentation/openai/version.py +0 -1
  52. {paid_python-0.6.0.dist-info → paid_python-1.0.0a0.dist-info}/LICENSE +0 -0
  53. {paid_python-0.6.0.dist-info → paid_python-1.0.0a0.dist-info}/WHEEL +0 -0
paid/orders/raw_client.py CHANGED
@@ -1,5 +1,6 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ import datetime as dt
3
4
  import typing
4
5
  from json.decoder import JSONDecodeError
5
6
 
@@ -10,8 +11,16 @@ from ..core.jsonable_encoder import jsonable_encoder
10
11
  from ..core.pydantic_utilities import parse_obj_as
11
12
  from ..core.request_options import RequestOptions
12
13
  from ..core.serialization import convert_and_respect_annotation_metadata
14
+ from ..errors.bad_request_error import BadRequestError
15
+ from ..errors.forbidden_error import ForbiddenError
16
+ from ..errors.not_found_error import NotFoundError
17
+ from ..types.cancel_renewal_response import CancelRenewalResponse
18
+ from ..types.error import Error
19
+ from ..types.invoice import Invoice
13
20
  from ..types.order import Order
14
21
  from ..types.order_line_create import OrderLineCreate
22
+ from ..types.proration_attribute_update import ProrationAttributeUpdate
23
+ from ..types.proration_upgrade_response import ProrationUpgradeResponse
15
24
 
16
25
  # this is used as the default value for optional parameters
17
26
  OMIT = typing.cast(typing.Any, ...)
@@ -234,6 +243,349 @@ class RawOrdersClient:
234
243
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
235
244
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
236
245
 
246
+ def activate_and_pay(
247
+ self,
248
+ order_id: str,
249
+ *,
250
+ confirmation_token: str,
251
+ return_url: str,
252
+ request_options: typing.Optional[RequestOptions] = None,
253
+ ) -> HttpResponse[Order]:
254
+ """
255
+ Activates the order and processes the initial payment using the provided Stripe confirmation token.
256
+
257
+ Parameters
258
+ ----------
259
+ order_id : str
260
+ The order ID (can be internal ID or display ID)
261
+
262
+ confirmation_token : str
263
+ Stripe confirmation token for the payment method
264
+
265
+ return_url : str
266
+ URL to redirect to after payment processing
267
+
268
+ request_options : typing.Optional[RequestOptions]
269
+ Request-specific configuration.
270
+
271
+ Returns
272
+ -------
273
+ HttpResponse[Order]
274
+ Order activated and payment processed successfully
275
+ """
276
+ _response = self._client_wrapper.httpx_client.request(
277
+ f"orders/{jsonable_encoder(order_id)}/activate-and-pay",
278
+ method="POST",
279
+ json={
280
+ "confirmationToken": confirmation_token,
281
+ "returnUrl": return_url,
282
+ },
283
+ headers={
284
+ "content-type": "application/json",
285
+ },
286
+ request_options=request_options,
287
+ omit=OMIT,
288
+ )
289
+ try:
290
+ if 200 <= _response.status_code < 300:
291
+ _data = typing.cast(
292
+ Order,
293
+ parse_obj_as(
294
+ type_=Order, # type: ignore
295
+ object_=_response.json(),
296
+ ),
297
+ )
298
+ return HttpResponse(response=_response, data=_data)
299
+ if _response.status_code == 400:
300
+ raise BadRequestError(
301
+ headers=dict(_response.headers),
302
+ body=typing.cast(
303
+ Error,
304
+ parse_obj_as(
305
+ type_=Error, # type: ignore
306
+ object_=_response.json(),
307
+ ),
308
+ ),
309
+ )
310
+ if _response.status_code == 403:
311
+ raise ForbiddenError(
312
+ headers=dict(_response.headers),
313
+ body=typing.cast(
314
+ Error,
315
+ parse_obj_as(
316
+ type_=Error, # type: ignore
317
+ object_=_response.json(),
318
+ ),
319
+ ),
320
+ )
321
+ if _response.status_code == 404:
322
+ raise NotFoundError(
323
+ headers=dict(_response.headers),
324
+ body=typing.cast(
325
+ Error,
326
+ parse_obj_as(
327
+ type_=Error, # type: ignore
328
+ object_=_response.json(),
329
+ ),
330
+ ),
331
+ )
332
+ _response_json = _response.json()
333
+ except JSONDecodeError:
334
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
335
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
336
+
337
+ def cancel_renewal(
338
+ self,
339
+ order_id: str,
340
+ *,
341
+ order_version: int,
342
+ cancel_from_date: dt.datetime,
343
+ request_options: typing.Optional[RequestOptions] = None,
344
+ ) -> HttpResponse[CancelRenewalResponse]:
345
+ """
346
+ Schedules the cancellation of an order's renewal from a specified date. The order will remain active until the cancellation date.
347
+
348
+ Parameters
349
+ ----------
350
+ order_id : str
351
+ The order ID (can be internal ID or display ID)
352
+
353
+ order_version : int
354
+ The current version of the order (for optimistic locking)
355
+
356
+ cancel_from_date : dt.datetime
357
+ The date from which the renewal should be cancelled (ISO 8601 format)
358
+
359
+ request_options : typing.Optional[RequestOptions]
360
+ Request-specific configuration.
361
+
362
+ Returns
363
+ -------
364
+ HttpResponse[CancelRenewalResponse]
365
+ Order renewal cancelled successfully
366
+ """
367
+ _response = self._client_wrapper.httpx_client.request(
368
+ f"orders/{jsonable_encoder(order_id)}/cancel",
369
+ method="POST",
370
+ json={
371
+ "orderVersion": order_version,
372
+ "cancelFromDate": cancel_from_date,
373
+ },
374
+ headers={
375
+ "content-type": "application/json",
376
+ },
377
+ request_options=request_options,
378
+ omit=OMIT,
379
+ )
380
+ try:
381
+ if 200 <= _response.status_code < 300:
382
+ _data = typing.cast(
383
+ CancelRenewalResponse,
384
+ parse_obj_as(
385
+ type_=CancelRenewalResponse, # type: ignore
386
+ object_=_response.json(),
387
+ ),
388
+ )
389
+ return HttpResponse(response=_response, data=_data)
390
+ if _response.status_code == 400:
391
+ raise BadRequestError(
392
+ headers=dict(_response.headers),
393
+ body=typing.cast(
394
+ Error,
395
+ parse_obj_as(
396
+ type_=Error, # type: ignore
397
+ object_=_response.json(),
398
+ ),
399
+ ),
400
+ )
401
+ if _response.status_code == 403:
402
+ raise ForbiddenError(
403
+ headers=dict(_response.headers),
404
+ body=typing.cast(
405
+ Error,
406
+ parse_obj_as(
407
+ type_=Error, # type: ignore
408
+ object_=_response.json(),
409
+ ),
410
+ ),
411
+ )
412
+ if _response.status_code == 404:
413
+ raise NotFoundError(
414
+ headers=dict(_response.headers),
415
+ body=typing.cast(
416
+ Error,
417
+ parse_obj_as(
418
+ type_=Error, # type: ignore
419
+ object_=_response.json(),
420
+ ),
421
+ ),
422
+ )
423
+ _response_json = _response.json()
424
+ except JSONDecodeError:
425
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
426
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
427
+
428
+ def schedule_plan_change(
429
+ self,
430
+ order_id: str,
431
+ *,
432
+ order_version: int,
433
+ effective_date: dt.datetime,
434
+ updated_order_line_attributes: typing.Sequence[ProrationAttributeUpdate],
435
+ request_options: typing.Optional[RequestOptions] = None,
436
+ ) -> HttpResponse[ProrationUpgradeResponse]:
437
+ """
438
+ Schedules a plan upgrade or downgrade for an order with automatic proration calculation. Credits are applied for the unused portion of the current billing period.
439
+
440
+ Parameters
441
+ ----------
442
+ order_id : str
443
+ The order ID (can be internal ID or display ID)
444
+
445
+ order_version : int
446
+ The current version of the order (for optimistic locking)
447
+
448
+ effective_date : dt.datetime
449
+ The date when the plan change should take effect (ISO 8601 format)
450
+
451
+ updated_order_line_attributes : typing.Sequence[ProrationAttributeUpdate]
452
+ The list of order line attributes to update
453
+
454
+ request_options : typing.Optional[RequestOptions]
455
+ Request-specific configuration.
456
+
457
+ Returns
458
+ -------
459
+ HttpResponse[ProrationUpgradeResponse]
460
+ Plan change scheduled successfully
461
+ """
462
+ _response = self._client_wrapper.httpx_client.request(
463
+ f"orders/{jsonable_encoder(order_id)}/schedule-plan-change",
464
+ method="POST",
465
+ json={
466
+ "orderVersion": order_version,
467
+ "effectiveDate": effective_date,
468
+ "updatedOrderLineAttributes": convert_and_respect_annotation_metadata(
469
+ object_=updated_order_line_attributes,
470
+ annotation=typing.Sequence[ProrationAttributeUpdate],
471
+ direction="write",
472
+ ),
473
+ },
474
+ headers={
475
+ "content-type": "application/json",
476
+ },
477
+ request_options=request_options,
478
+ omit=OMIT,
479
+ )
480
+ try:
481
+ if 200 <= _response.status_code < 300:
482
+ _data = typing.cast(
483
+ ProrationUpgradeResponse,
484
+ parse_obj_as(
485
+ type_=ProrationUpgradeResponse, # type: ignore
486
+ object_=_response.json(),
487
+ ),
488
+ )
489
+ return HttpResponse(response=_response, data=_data)
490
+ if _response.status_code == 400:
491
+ raise BadRequestError(
492
+ headers=dict(_response.headers),
493
+ body=typing.cast(
494
+ Error,
495
+ parse_obj_as(
496
+ type_=Error, # type: ignore
497
+ object_=_response.json(),
498
+ ),
499
+ ),
500
+ )
501
+ if _response.status_code == 403:
502
+ raise ForbiddenError(
503
+ headers=dict(_response.headers),
504
+ body=typing.cast(
505
+ Error,
506
+ parse_obj_as(
507
+ type_=Error, # type: ignore
508
+ object_=_response.json(),
509
+ ),
510
+ ),
511
+ )
512
+ if _response.status_code == 404:
513
+ raise NotFoundError(
514
+ headers=dict(_response.headers),
515
+ body=typing.cast(
516
+ Error,
517
+ parse_obj_as(
518
+ type_=Error, # type: ignore
519
+ object_=_response.json(),
520
+ ),
521
+ ),
522
+ )
523
+ _response_json = _response.json()
524
+ except JSONDecodeError:
525
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
526
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
527
+
528
+ def get_invoices(
529
+ self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
530
+ ) -> HttpResponse[typing.List[Invoice]]:
531
+ """
532
+ Retrieves all invoices associated with a specific order.
533
+
534
+ Parameters
535
+ ----------
536
+ order_id : str
537
+ The order ID (can be internal ID or display ID)
538
+
539
+ request_options : typing.Optional[RequestOptions]
540
+ Request-specific configuration.
541
+
542
+ Returns
543
+ -------
544
+ HttpResponse[typing.List[Invoice]]
545
+ Success response
546
+ """
547
+ _response = self._client_wrapper.httpx_client.request(
548
+ f"orders/{jsonable_encoder(order_id)}/invoices",
549
+ method="GET",
550
+ request_options=request_options,
551
+ )
552
+ try:
553
+ if 200 <= _response.status_code < 300:
554
+ _data = typing.cast(
555
+ typing.List[Invoice],
556
+ parse_obj_as(
557
+ type_=typing.List[Invoice], # type: ignore
558
+ object_=_response.json(),
559
+ ),
560
+ )
561
+ return HttpResponse(response=_response, data=_data)
562
+ if _response.status_code == 403:
563
+ raise ForbiddenError(
564
+ headers=dict(_response.headers),
565
+ body=typing.cast(
566
+ Error,
567
+ parse_obj_as(
568
+ type_=Error, # type: ignore
569
+ object_=_response.json(),
570
+ ),
571
+ ),
572
+ )
573
+ if _response.status_code == 404:
574
+ raise NotFoundError(
575
+ headers=dict(_response.headers),
576
+ body=typing.cast(
577
+ Error,
578
+ parse_obj_as(
579
+ type_=Error, # type: ignore
580
+ object_=_response.json(),
581
+ ),
582
+ ),
583
+ )
584
+ _response_json = _response.json()
585
+ except JSONDecodeError:
586
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
587
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
588
+
237
589
 
238
590
  class AsyncRawOrdersClient:
239
591
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -457,3 +809,346 @@ class AsyncRawOrdersClient:
457
809
  except JSONDecodeError:
458
810
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
459
811
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
812
+
813
+ async def activate_and_pay(
814
+ self,
815
+ order_id: str,
816
+ *,
817
+ confirmation_token: str,
818
+ return_url: str,
819
+ request_options: typing.Optional[RequestOptions] = None,
820
+ ) -> AsyncHttpResponse[Order]:
821
+ """
822
+ Activates the order and processes the initial payment using the provided Stripe confirmation token.
823
+
824
+ Parameters
825
+ ----------
826
+ order_id : str
827
+ The order ID (can be internal ID or display ID)
828
+
829
+ confirmation_token : str
830
+ Stripe confirmation token for the payment method
831
+
832
+ return_url : str
833
+ URL to redirect to after payment processing
834
+
835
+ request_options : typing.Optional[RequestOptions]
836
+ Request-specific configuration.
837
+
838
+ Returns
839
+ -------
840
+ AsyncHttpResponse[Order]
841
+ Order activated and payment processed successfully
842
+ """
843
+ _response = await self._client_wrapper.httpx_client.request(
844
+ f"orders/{jsonable_encoder(order_id)}/activate-and-pay",
845
+ method="POST",
846
+ json={
847
+ "confirmationToken": confirmation_token,
848
+ "returnUrl": return_url,
849
+ },
850
+ headers={
851
+ "content-type": "application/json",
852
+ },
853
+ request_options=request_options,
854
+ omit=OMIT,
855
+ )
856
+ try:
857
+ if 200 <= _response.status_code < 300:
858
+ _data = typing.cast(
859
+ Order,
860
+ parse_obj_as(
861
+ type_=Order, # type: ignore
862
+ object_=_response.json(),
863
+ ),
864
+ )
865
+ return AsyncHttpResponse(response=_response, data=_data)
866
+ if _response.status_code == 400:
867
+ raise BadRequestError(
868
+ headers=dict(_response.headers),
869
+ body=typing.cast(
870
+ Error,
871
+ parse_obj_as(
872
+ type_=Error, # type: ignore
873
+ object_=_response.json(),
874
+ ),
875
+ ),
876
+ )
877
+ if _response.status_code == 403:
878
+ raise ForbiddenError(
879
+ headers=dict(_response.headers),
880
+ body=typing.cast(
881
+ Error,
882
+ parse_obj_as(
883
+ type_=Error, # type: ignore
884
+ object_=_response.json(),
885
+ ),
886
+ ),
887
+ )
888
+ if _response.status_code == 404:
889
+ raise NotFoundError(
890
+ headers=dict(_response.headers),
891
+ body=typing.cast(
892
+ Error,
893
+ parse_obj_as(
894
+ type_=Error, # type: ignore
895
+ object_=_response.json(),
896
+ ),
897
+ ),
898
+ )
899
+ _response_json = _response.json()
900
+ except JSONDecodeError:
901
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
902
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
903
+
904
+ async def cancel_renewal(
905
+ self,
906
+ order_id: str,
907
+ *,
908
+ order_version: int,
909
+ cancel_from_date: dt.datetime,
910
+ request_options: typing.Optional[RequestOptions] = None,
911
+ ) -> AsyncHttpResponse[CancelRenewalResponse]:
912
+ """
913
+ Schedules the cancellation of an order's renewal from a specified date. The order will remain active until the cancellation date.
914
+
915
+ Parameters
916
+ ----------
917
+ order_id : str
918
+ The order ID (can be internal ID or display ID)
919
+
920
+ order_version : int
921
+ The current version of the order (for optimistic locking)
922
+
923
+ cancel_from_date : dt.datetime
924
+ The date from which the renewal should be cancelled (ISO 8601 format)
925
+
926
+ request_options : typing.Optional[RequestOptions]
927
+ Request-specific configuration.
928
+
929
+ Returns
930
+ -------
931
+ AsyncHttpResponse[CancelRenewalResponse]
932
+ Order renewal cancelled successfully
933
+ """
934
+ _response = await self._client_wrapper.httpx_client.request(
935
+ f"orders/{jsonable_encoder(order_id)}/cancel",
936
+ method="POST",
937
+ json={
938
+ "orderVersion": order_version,
939
+ "cancelFromDate": cancel_from_date,
940
+ },
941
+ headers={
942
+ "content-type": "application/json",
943
+ },
944
+ request_options=request_options,
945
+ omit=OMIT,
946
+ )
947
+ try:
948
+ if 200 <= _response.status_code < 300:
949
+ _data = typing.cast(
950
+ CancelRenewalResponse,
951
+ parse_obj_as(
952
+ type_=CancelRenewalResponse, # type: ignore
953
+ object_=_response.json(),
954
+ ),
955
+ )
956
+ return AsyncHttpResponse(response=_response, data=_data)
957
+ if _response.status_code == 400:
958
+ raise BadRequestError(
959
+ headers=dict(_response.headers),
960
+ body=typing.cast(
961
+ Error,
962
+ parse_obj_as(
963
+ type_=Error, # type: ignore
964
+ object_=_response.json(),
965
+ ),
966
+ ),
967
+ )
968
+ if _response.status_code == 403:
969
+ raise ForbiddenError(
970
+ headers=dict(_response.headers),
971
+ body=typing.cast(
972
+ Error,
973
+ parse_obj_as(
974
+ type_=Error, # type: ignore
975
+ object_=_response.json(),
976
+ ),
977
+ ),
978
+ )
979
+ if _response.status_code == 404:
980
+ raise NotFoundError(
981
+ headers=dict(_response.headers),
982
+ body=typing.cast(
983
+ Error,
984
+ parse_obj_as(
985
+ type_=Error, # type: ignore
986
+ object_=_response.json(),
987
+ ),
988
+ ),
989
+ )
990
+ _response_json = _response.json()
991
+ except JSONDecodeError:
992
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
993
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
994
+
995
+ async def schedule_plan_change(
996
+ self,
997
+ order_id: str,
998
+ *,
999
+ order_version: int,
1000
+ effective_date: dt.datetime,
1001
+ updated_order_line_attributes: typing.Sequence[ProrationAttributeUpdate],
1002
+ request_options: typing.Optional[RequestOptions] = None,
1003
+ ) -> AsyncHttpResponse[ProrationUpgradeResponse]:
1004
+ """
1005
+ Schedules a plan upgrade or downgrade for an order with automatic proration calculation. Credits are applied for the unused portion of the current billing period.
1006
+
1007
+ Parameters
1008
+ ----------
1009
+ order_id : str
1010
+ The order ID (can be internal ID or display ID)
1011
+
1012
+ order_version : int
1013
+ The current version of the order (for optimistic locking)
1014
+
1015
+ effective_date : dt.datetime
1016
+ The date when the plan change should take effect (ISO 8601 format)
1017
+
1018
+ updated_order_line_attributes : typing.Sequence[ProrationAttributeUpdate]
1019
+ The list of order line attributes to update
1020
+
1021
+ request_options : typing.Optional[RequestOptions]
1022
+ Request-specific configuration.
1023
+
1024
+ Returns
1025
+ -------
1026
+ AsyncHttpResponse[ProrationUpgradeResponse]
1027
+ Plan change scheduled successfully
1028
+ """
1029
+ _response = await self._client_wrapper.httpx_client.request(
1030
+ f"orders/{jsonable_encoder(order_id)}/schedule-plan-change",
1031
+ method="POST",
1032
+ json={
1033
+ "orderVersion": order_version,
1034
+ "effectiveDate": effective_date,
1035
+ "updatedOrderLineAttributes": convert_and_respect_annotation_metadata(
1036
+ object_=updated_order_line_attributes,
1037
+ annotation=typing.Sequence[ProrationAttributeUpdate],
1038
+ direction="write",
1039
+ ),
1040
+ },
1041
+ headers={
1042
+ "content-type": "application/json",
1043
+ },
1044
+ request_options=request_options,
1045
+ omit=OMIT,
1046
+ )
1047
+ try:
1048
+ if 200 <= _response.status_code < 300:
1049
+ _data = typing.cast(
1050
+ ProrationUpgradeResponse,
1051
+ parse_obj_as(
1052
+ type_=ProrationUpgradeResponse, # type: ignore
1053
+ object_=_response.json(),
1054
+ ),
1055
+ )
1056
+ return AsyncHttpResponse(response=_response, data=_data)
1057
+ if _response.status_code == 400:
1058
+ raise BadRequestError(
1059
+ headers=dict(_response.headers),
1060
+ body=typing.cast(
1061
+ Error,
1062
+ parse_obj_as(
1063
+ type_=Error, # type: ignore
1064
+ object_=_response.json(),
1065
+ ),
1066
+ ),
1067
+ )
1068
+ if _response.status_code == 403:
1069
+ raise ForbiddenError(
1070
+ headers=dict(_response.headers),
1071
+ body=typing.cast(
1072
+ Error,
1073
+ parse_obj_as(
1074
+ type_=Error, # type: ignore
1075
+ object_=_response.json(),
1076
+ ),
1077
+ ),
1078
+ )
1079
+ if _response.status_code == 404:
1080
+ raise NotFoundError(
1081
+ headers=dict(_response.headers),
1082
+ body=typing.cast(
1083
+ Error,
1084
+ parse_obj_as(
1085
+ type_=Error, # type: ignore
1086
+ object_=_response.json(),
1087
+ ),
1088
+ ),
1089
+ )
1090
+ _response_json = _response.json()
1091
+ except JSONDecodeError:
1092
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1093
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1094
+
1095
+ async def get_invoices(
1096
+ self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
1097
+ ) -> AsyncHttpResponse[typing.List[Invoice]]:
1098
+ """
1099
+ Retrieves all invoices associated with a specific order.
1100
+
1101
+ Parameters
1102
+ ----------
1103
+ order_id : str
1104
+ The order ID (can be internal ID or display ID)
1105
+
1106
+ request_options : typing.Optional[RequestOptions]
1107
+ Request-specific configuration.
1108
+
1109
+ Returns
1110
+ -------
1111
+ AsyncHttpResponse[typing.List[Invoice]]
1112
+ Success response
1113
+ """
1114
+ _response = await self._client_wrapper.httpx_client.request(
1115
+ f"orders/{jsonable_encoder(order_id)}/invoices",
1116
+ method="GET",
1117
+ request_options=request_options,
1118
+ )
1119
+ try:
1120
+ if 200 <= _response.status_code < 300:
1121
+ _data = typing.cast(
1122
+ typing.List[Invoice],
1123
+ parse_obj_as(
1124
+ type_=typing.List[Invoice], # type: ignore
1125
+ object_=_response.json(),
1126
+ ),
1127
+ )
1128
+ return AsyncHttpResponse(response=_response, data=_data)
1129
+ if _response.status_code == 403:
1130
+ raise ForbiddenError(
1131
+ headers=dict(_response.headers),
1132
+ body=typing.cast(
1133
+ Error,
1134
+ parse_obj_as(
1135
+ type_=Error, # type: ignore
1136
+ object_=_response.json(),
1137
+ ),
1138
+ ),
1139
+ )
1140
+ if _response.status_code == 404:
1141
+ raise NotFoundError(
1142
+ headers=dict(_response.headers),
1143
+ body=typing.cast(
1144
+ Error,
1145
+ parse_obj_as(
1146
+ type_=Error, # type: ignore
1147
+ object_=_response.json(),
1148
+ ),
1149
+ ),
1150
+ )
1151
+ _response_json = _response.json()
1152
+ except JSONDecodeError:
1153
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1154
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)