moovio_sdk 0.12.0__py3-none-any.whl → 0.13.1__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 (99) hide show
  1. moovio_sdk/_version.py +3 -3
  2. moovio_sdk/account_terminal_applications.py +70 -186
  3. moovio_sdk/accounts.py +168 -408
  4. moovio_sdk/adjustments.py +28 -84
  5. moovio_sdk/apple_pay.py +102 -236
  6. moovio_sdk/authentication.py +50 -102
  7. moovio_sdk/avatars.py +10 -38
  8. moovio_sdk/bank_accounts.py +174 -420
  9. moovio_sdk/basesdk.py +4 -4
  10. moovio_sdk/branding.py +106 -198
  11. moovio_sdk/capabilities.py +76 -180
  12. moovio_sdk/card_issuing.py +94 -228
  13. moovio_sdk/cards.py +94 -232
  14. moovio_sdk/disputes.py +204 -500
  15. moovio_sdk/end_to_end_encryption.py +28 -80
  16. moovio_sdk/enriched_address.py +14 -44
  17. moovio_sdk/enriched_profile.py +14 -44
  18. moovio_sdk/fee_plans.py +116 -314
  19. moovio_sdk/files.py +52 -138
  20. moovio_sdk/industries.py +14 -44
  21. moovio_sdk/institutions.py +36 -92
  22. moovio_sdk/issuing_transactions.py +70 -220
  23. moovio_sdk/models/components/__init__.py +39 -0
  24. moovio_sdk/models/components/createticket.py +24 -0
  25. moovio_sdk/models/components/createticketcontacterror.py +17 -0
  26. moovio_sdk/models/components/ticket.py +44 -0
  27. moovio_sdk/models/components/ticketcontact.py +17 -0
  28. moovio_sdk/models/components/ticketmessage.py +21 -0
  29. moovio_sdk/models/components/ticketstatus.py +11 -0
  30. moovio_sdk/models/components/updateticket.py +19 -0
  31. moovio_sdk/models/components/updateticketstatus.py +8 -0
  32. moovio_sdk/models/errors/__init__.py +19 -0
  33. moovio_sdk/models/errors/accountterminalapplicationerror.py +11 -6
  34. moovio_sdk/models/errors/addcapabilitieserror.py +11 -6
  35. moovio_sdk/models/errors/apierror.py +30 -14
  36. moovio_sdk/models/errors/assigncountrieserror.py +12 -6
  37. moovio_sdk/models/errors/authtokenrequesterror.py +11 -6
  38. moovio_sdk/models/errors/bankaccountvalidationerror.py +11 -6
  39. moovio_sdk/models/errors/brandvalidationerror.py +11 -6
  40. moovio_sdk/models/errors/cardacquiringrefund.py +11 -6
  41. moovio_sdk/models/errors/createaccount.py +12 -6
  42. moovio_sdk/models/errors/createpaymentlinkerror.py +11 -6
  43. moovio_sdk/models/errors/createsweepconfigerror.py +11 -6
  44. moovio_sdk/models/errors/createticketerror.py +34 -0
  45. moovio_sdk/models/errors/feeplanagreementerror.py +11 -6
  46. moovio_sdk/models/errors/fileuploadvalidationerror.py +11 -6
  47. moovio_sdk/models/errors/filevalidationerror.py +11 -6
  48. moovio_sdk/models/errors/genericerror.py +12 -6
  49. moovio_sdk/models/errors/linkapplepayerror.py +11 -6
  50. moovio_sdk/models/errors/linkcarderror.py +11 -6
  51. moovio_sdk/models/errors/microdepositvalidationerror.py +11 -6
  52. moovio_sdk/models/errors/mooverror.py +26 -0
  53. moovio_sdk/models/errors/no_response_error.py +13 -0
  54. moovio_sdk/models/errors/onboardinginviteerror.py +11 -6
  55. moovio_sdk/models/errors/patchsweepconfigerror.py +11 -6
  56. moovio_sdk/models/errors/refundvalidationerror.py +11 -6
  57. moovio_sdk/models/errors/representativevalidationerror.py +11 -6
  58. moovio_sdk/models/errors/requestcarderror.py +11 -6
  59. moovio_sdk/models/errors/responsevalidationerror.py +25 -0
  60. moovio_sdk/models/errors/reversalvalidationerror.py +11 -6
  61. moovio_sdk/models/errors/revoketokenrequesterror.py +11 -6
  62. moovio_sdk/models/errors/schedulevalidationerror.py +11 -6
  63. moovio_sdk/models/errors/terminalapplicationerror.py +11 -6
  64. moovio_sdk/models/errors/transfer.py +11 -6
  65. moovio_sdk/models/errors/transferoptionsvalidationerror.py +11 -6
  66. moovio_sdk/models/errors/transfervalidationerror.py +11 -6
  67. moovio_sdk/models/errors/updateaccount.py +12 -6
  68. moovio_sdk/models/errors/updatecarderror.py +11 -6
  69. moovio_sdk/models/errors/updateissuedcarderror.py +11 -6
  70. moovio_sdk/models/errors/updatepaymentlinkerror.py +11 -6
  71. moovio_sdk/models/errors/updateticketerror.py +25 -0
  72. moovio_sdk/models/errors/updateunderwritingerror.py +11 -6
  73. moovio_sdk/models/errors/upsertunderwritingerror.py +11 -6
  74. moovio_sdk/models/operations/__init__.py +100 -0
  75. moovio_sdk/models/operations/createticket.py +78 -0
  76. moovio_sdk/models/operations/getticket.py +71 -0
  77. moovio_sdk/models/operations/listticketmessages.py +88 -0
  78. moovio_sdk/models/operations/listtickets.py +81 -0
  79. moovio_sdk/models/operations/updateticket.py +85 -0
  80. moovio_sdk/onboarding.py +66 -166
  81. moovio_sdk/payment_links.py +106 -272
  82. moovio_sdk/payment_methods.py +30 -86
  83. moovio_sdk/ping.py +10 -40
  84. moovio_sdk/receipts.py +36 -92
  85. moovio_sdk/representatives.py +102 -228
  86. moovio_sdk/scheduling.py +122 -278
  87. moovio_sdk/sdk.py +3 -0
  88. moovio_sdk/support.py +1153 -0
  89. moovio_sdk/sweeps.py +102 -274
  90. moovio_sdk/terminal_applications.py +74 -186
  91. moovio_sdk/transfers.py +266 -582
  92. moovio_sdk/underwriting.py +64 -146
  93. moovio_sdk/utils/__init__.py +3 -0
  94. moovio_sdk/utils/serializers.py +21 -3
  95. moovio_sdk/wallet_transactions.py +28 -88
  96. moovio_sdk/wallets.py +24 -84
  97. {moovio_sdk-0.12.0.dist-info → moovio_sdk-0.13.1.dist-info}/METADATA +103 -28
  98. {moovio_sdk-0.12.0.dist-info → moovio_sdk-0.13.1.dist-info}/RECORD +99 -80
  99. {moovio_sdk-0.12.0.dist-info → moovio_sdk-0.13.1.dist-info}/WHEEL +0 -0
@@ -153,46 +153,35 @@ class Representatives(BaseSDK):
153
153
  response_data: Any = None
154
154
  if utils.match_response(http_res, "200", "application/json"):
155
155
  return operations.CreateRepresentativeResponse(
156
- result=utils.unmarshal_json(http_res.text, components.Representative),
156
+ result=utils.unmarshal_json_response(
157
+ components.Representative, http_res
158
+ ),
157
159
  headers=utils.get_response_headers(http_res.headers),
158
160
  )
159
161
  if utils.match_response(http_res, ["400", "409"], "application/json"):
160
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
161
- raise errors.GenericError(data=response_data)
162
+ response_data = utils.unmarshal_json_response(
163
+ errors.GenericErrorData, http_res
164
+ )
165
+ raise errors.GenericError(response_data, http_res)
162
166
  if utils.match_response(http_res, "422", "application/json"):
163
- response_data = utils.unmarshal_json(
164
- http_res.text, errors.RepresentativeValidationErrorData
167
+ response_data = utils.unmarshal_json_response(
168
+ errors.RepresentativeValidationErrorData, http_res
165
169
  )
166
- raise errors.RepresentativeValidationError(data=response_data)
170
+ raise errors.RepresentativeValidationError(response_data, http_res)
167
171
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
168
172
  http_res_text = utils.stream_to_text(http_res)
169
- raise errors.APIError(
170
- "API error occurred", http_res.status_code, http_res_text, http_res
171
- )
173
+ raise errors.APIError("API error occurred", http_res, http_res_text)
172
174
  if utils.match_response(http_res, ["500", "504"], "*"):
173
175
  http_res_text = utils.stream_to_text(http_res)
174
- raise errors.APIError(
175
- "API error occurred", http_res.status_code, http_res_text, http_res
176
- )
176
+ raise errors.APIError("API error occurred", http_res, http_res_text)
177
177
  if utils.match_response(http_res, "4XX", "*"):
178
178
  http_res_text = utils.stream_to_text(http_res)
179
- raise errors.APIError(
180
- "API error occurred", http_res.status_code, http_res_text, http_res
181
- )
179
+ raise errors.APIError("API error occurred", http_res, http_res_text)
182
180
  if utils.match_response(http_res, "5XX", "*"):
183
181
  http_res_text = utils.stream_to_text(http_res)
184
- raise errors.APIError(
185
- "API error occurred", http_res.status_code, http_res_text, http_res
186
- )
182
+ raise errors.APIError("API error occurred", http_res, http_res_text)
187
183
 
188
- content_type = http_res.headers.get("Content-Type")
189
- http_res_text = utils.stream_to_text(http_res)
190
- raise errors.APIError(
191
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
192
- http_res.status_code,
193
- http_res_text,
194
- http_res,
195
- )
184
+ raise errors.APIError("Unexpected response received", http_res)
196
185
 
197
186
  async def create_async(
198
187
  self,
@@ -337,46 +326,35 @@ class Representatives(BaseSDK):
337
326
  response_data: Any = None
338
327
  if utils.match_response(http_res, "200", "application/json"):
339
328
  return operations.CreateRepresentativeResponse(
340
- result=utils.unmarshal_json(http_res.text, components.Representative),
329
+ result=utils.unmarshal_json_response(
330
+ components.Representative, http_res
331
+ ),
341
332
  headers=utils.get_response_headers(http_res.headers),
342
333
  )
343
334
  if utils.match_response(http_res, ["400", "409"], "application/json"):
344
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
345
- raise errors.GenericError(data=response_data)
335
+ response_data = utils.unmarshal_json_response(
336
+ errors.GenericErrorData, http_res
337
+ )
338
+ raise errors.GenericError(response_data, http_res)
346
339
  if utils.match_response(http_res, "422", "application/json"):
347
- response_data = utils.unmarshal_json(
348
- http_res.text, errors.RepresentativeValidationErrorData
340
+ response_data = utils.unmarshal_json_response(
341
+ errors.RepresentativeValidationErrorData, http_res
349
342
  )
350
- raise errors.RepresentativeValidationError(data=response_data)
343
+ raise errors.RepresentativeValidationError(response_data, http_res)
351
344
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
352
345
  http_res_text = await utils.stream_to_text_async(http_res)
353
- raise errors.APIError(
354
- "API error occurred", http_res.status_code, http_res_text, http_res
355
- )
346
+ raise errors.APIError("API error occurred", http_res, http_res_text)
356
347
  if utils.match_response(http_res, ["500", "504"], "*"):
357
348
  http_res_text = await utils.stream_to_text_async(http_res)
358
- raise errors.APIError(
359
- "API error occurred", http_res.status_code, http_res_text, http_res
360
- )
349
+ raise errors.APIError("API error occurred", http_res, http_res_text)
361
350
  if utils.match_response(http_res, "4XX", "*"):
362
351
  http_res_text = await utils.stream_to_text_async(http_res)
363
- raise errors.APIError(
364
- "API error occurred", http_res.status_code, http_res_text, http_res
365
- )
352
+ raise errors.APIError("API error occurred", http_res, http_res_text)
366
353
  if utils.match_response(http_res, "5XX", "*"):
367
354
  http_res_text = await utils.stream_to_text_async(http_res)
368
- raise errors.APIError(
369
- "API error occurred", http_res.status_code, http_res_text, http_res
370
- )
355
+ raise errors.APIError("API error occurred", http_res, http_res_text)
371
356
 
372
- content_type = http_res.headers.get("Content-Type")
373
- http_res_text = await utils.stream_to_text_async(http_res)
374
- raise errors.APIError(
375
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
376
- http_res.status_code,
377
- http_res_text,
378
- http_res,
379
- )
357
+ raise errors.APIError("Unexpected response received", http_res)
380
358
 
381
359
  def list(
382
360
  self,
@@ -459,40 +437,25 @@ class Representatives(BaseSDK):
459
437
 
460
438
  if utils.match_response(http_res, "200", "application/json"):
461
439
  return operations.ListRepresentativesResponse(
462
- result=utils.unmarshal_json(
463
- http_res.text, List[components.Representative]
440
+ result=utils.unmarshal_json_response(
441
+ List[components.Representative], http_res
464
442
  ),
465
443
  headers=utils.get_response_headers(http_res.headers),
466
444
  )
467
445
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
468
446
  http_res_text = utils.stream_to_text(http_res)
469
- raise errors.APIError(
470
- "API error occurred", http_res.status_code, http_res_text, http_res
471
- )
447
+ raise errors.APIError("API error occurred", http_res, http_res_text)
472
448
  if utils.match_response(http_res, ["500", "504"], "*"):
473
449
  http_res_text = utils.stream_to_text(http_res)
474
- raise errors.APIError(
475
- "API error occurred", http_res.status_code, http_res_text, http_res
476
- )
450
+ raise errors.APIError("API error occurred", http_res, http_res_text)
477
451
  if utils.match_response(http_res, "4XX", "*"):
478
452
  http_res_text = utils.stream_to_text(http_res)
479
- raise errors.APIError(
480
- "API error occurred", http_res.status_code, http_res_text, http_res
481
- )
453
+ raise errors.APIError("API error occurred", http_res, http_res_text)
482
454
  if utils.match_response(http_res, "5XX", "*"):
483
455
  http_res_text = utils.stream_to_text(http_res)
484
- raise errors.APIError(
485
- "API error occurred", http_res.status_code, http_res_text, http_res
486
- )
456
+ raise errors.APIError("API error occurred", http_res, http_res_text)
487
457
 
488
- content_type = http_res.headers.get("Content-Type")
489
- http_res_text = utils.stream_to_text(http_res)
490
- raise errors.APIError(
491
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
492
- http_res.status_code,
493
- http_res_text,
494
- http_res,
495
- )
458
+ raise errors.APIError("Unexpected response received", http_res)
496
459
 
497
460
  async def list_async(
498
461
  self,
@@ -575,40 +538,25 @@ class Representatives(BaseSDK):
575
538
 
576
539
  if utils.match_response(http_res, "200", "application/json"):
577
540
  return operations.ListRepresentativesResponse(
578
- result=utils.unmarshal_json(
579
- http_res.text, List[components.Representative]
541
+ result=utils.unmarshal_json_response(
542
+ List[components.Representative], http_res
580
543
  ),
581
544
  headers=utils.get_response_headers(http_res.headers),
582
545
  )
583
546
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
584
547
  http_res_text = await utils.stream_to_text_async(http_res)
585
- raise errors.APIError(
586
- "API error occurred", http_res.status_code, http_res_text, http_res
587
- )
548
+ raise errors.APIError("API error occurred", http_res, http_res_text)
588
549
  if utils.match_response(http_res, ["500", "504"], "*"):
589
550
  http_res_text = await utils.stream_to_text_async(http_res)
590
- raise errors.APIError(
591
- "API error occurred", http_res.status_code, http_res_text, http_res
592
- )
551
+ raise errors.APIError("API error occurred", http_res, http_res_text)
593
552
  if utils.match_response(http_res, "4XX", "*"):
594
553
  http_res_text = await utils.stream_to_text_async(http_res)
595
- raise errors.APIError(
596
- "API error occurred", http_res.status_code, http_res_text, http_res
597
- )
554
+ raise errors.APIError("API error occurred", http_res, http_res_text)
598
555
  if utils.match_response(http_res, "5XX", "*"):
599
556
  http_res_text = await utils.stream_to_text_async(http_res)
600
- raise errors.APIError(
601
- "API error occurred", http_res.status_code, http_res_text, http_res
602
- )
557
+ raise errors.APIError("API error occurred", http_res, http_res_text)
603
558
 
604
- content_type = http_res.headers.get("Content-Type")
605
- http_res_text = await utils.stream_to_text_async(http_res)
606
- raise errors.APIError(
607
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
608
- http_res.status_code,
609
- http_res_text,
610
- http_res,
611
- )
559
+ raise errors.APIError("Unexpected response received", http_res)
612
560
 
613
561
  def delete(
614
562
  self,
@@ -706,37 +654,24 @@ class Representatives(BaseSDK):
706
654
  headers=utils.get_response_headers(http_res.headers)
707
655
  )
708
656
  if utils.match_response(http_res, ["400", "409"], "application/json"):
709
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
710
- raise errors.GenericError(data=response_data)
657
+ response_data = utils.unmarshal_json_response(
658
+ errors.GenericErrorData, http_res
659
+ )
660
+ raise errors.GenericError(response_data, http_res)
711
661
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
712
662
  http_res_text = utils.stream_to_text(http_res)
713
- raise errors.APIError(
714
- "API error occurred", http_res.status_code, http_res_text, http_res
715
- )
663
+ raise errors.APIError("API error occurred", http_res, http_res_text)
716
664
  if utils.match_response(http_res, ["500", "504"], "*"):
717
665
  http_res_text = utils.stream_to_text(http_res)
718
- raise errors.APIError(
719
- "API error occurred", http_res.status_code, http_res_text, http_res
720
- )
666
+ raise errors.APIError("API error occurred", http_res, http_res_text)
721
667
  if utils.match_response(http_res, "4XX", "*"):
722
668
  http_res_text = utils.stream_to_text(http_res)
723
- raise errors.APIError(
724
- "API error occurred", http_res.status_code, http_res_text, http_res
725
- )
669
+ raise errors.APIError("API error occurred", http_res, http_res_text)
726
670
  if utils.match_response(http_res, "5XX", "*"):
727
671
  http_res_text = utils.stream_to_text(http_res)
728
- raise errors.APIError(
729
- "API error occurred", http_res.status_code, http_res_text, http_res
730
- )
672
+ raise errors.APIError("API error occurred", http_res, http_res_text)
731
673
 
732
- content_type = http_res.headers.get("Content-Type")
733
- http_res_text = utils.stream_to_text(http_res)
734
- raise errors.APIError(
735
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
736
- http_res.status_code,
737
- http_res_text,
738
- http_res,
739
- )
674
+ raise errors.APIError("Unexpected response received", http_res)
740
675
 
741
676
  async def delete_async(
742
677
  self,
@@ -834,37 +769,24 @@ class Representatives(BaseSDK):
834
769
  headers=utils.get_response_headers(http_res.headers)
835
770
  )
836
771
  if utils.match_response(http_res, ["400", "409"], "application/json"):
837
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
838
- raise errors.GenericError(data=response_data)
772
+ response_data = utils.unmarshal_json_response(
773
+ errors.GenericErrorData, http_res
774
+ )
775
+ raise errors.GenericError(response_data, http_res)
839
776
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
840
777
  http_res_text = await utils.stream_to_text_async(http_res)
841
- raise errors.APIError(
842
- "API error occurred", http_res.status_code, http_res_text, http_res
843
- )
778
+ raise errors.APIError("API error occurred", http_res, http_res_text)
844
779
  if utils.match_response(http_res, ["500", "504"], "*"):
845
780
  http_res_text = await utils.stream_to_text_async(http_res)
846
- raise errors.APIError(
847
- "API error occurred", http_res.status_code, http_res_text, http_res
848
- )
781
+ raise errors.APIError("API error occurred", http_res, http_res_text)
849
782
  if utils.match_response(http_res, "4XX", "*"):
850
783
  http_res_text = await utils.stream_to_text_async(http_res)
851
- raise errors.APIError(
852
- "API error occurred", http_res.status_code, http_res_text, http_res
853
- )
784
+ raise errors.APIError("API error occurred", http_res, http_res_text)
854
785
  if utils.match_response(http_res, "5XX", "*"):
855
786
  http_res_text = await utils.stream_to_text_async(http_res)
856
- raise errors.APIError(
857
- "API error occurred", http_res.status_code, http_res_text, http_res
858
- )
787
+ raise errors.APIError("API error occurred", http_res, http_res_text)
859
788
 
860
- content_type = http_res.headers.get("Content-Type")
861
- http_res_text = await utils.stream_to_text_async(http_res)
862
- raise errors.APIError(
863
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
864
- http_res.status_code,
865
- http_res_text,
866
- http_res,
867
- )
789
+ raise errors.APIError("Unexpected response received", http_res)
868
790
 
869
791
  def get(
870
792
  self,
@@ -947,38 +869,25 @@ class Representatives(BaseSDK):
947
869
 
948
870
  if utils.match_response(http_res, "200", "application/json"):
949
871
  return operations.GetRepresentativeResponse(
950
- result=utils.unmarshal_json(http_res.text, components.Representative),
872
+ result=utils.unmarshal_json_response(
873
+ components.Representative, http_res
874
+ ),
951
875
  headers=utils.get_response_headers(http_res.headers),
952
876
  )
953
877
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
954
878
  http_res_text = utils.stream_to_text(http_res)
955
- raise errors.APIError(
956
- "API error occurred", http_res.status_code, http_res_text, http_res
957
- )
879
+ raise errors.APIError("API error occurred", http_res, http_res_text)
958
880
  if utils.match_response(http_res, ["500", "504"], "*"):
959
881
  http_res_text = utils.stream_to_text(http_res)
960
- raise errors.APIError(
961
- "API error occurred", http_res.status_code, http_res_text, http_res
962
- )
882
+ raise errors.APIError("API error occurred", http_res, http_res_text)
963
883
  if utils.match_response(http_res, "4XX", "*"):
964
884
  http_res_text = utils.stream_to_text(http_res)
965
- raise errors.APIError(
966
- "API error occurred", http_res.status_code, http_res_text, http_res
967
- )
885
+ raise errors.APIError("API error occurred", http_res, http_res_text)
968
886
  if utils.match_response(http_res, "5XX", "*"):
969
887
  http_res_text = utils.stream_to_text(http_res)
970
- raise errors.APIError(
971
- "API error occurred", http_res.status_code, http_res_text, http_res
972
- )
888
+ raise errors.APIError("API error occurred", http_res, http_res_text)
973
889
 
974
- content_type = http_res.headers.get("Content-Type")
975
- http_res_text = utils.stream_to_text(http_res)
976
- raise errors.APIError(
977
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
978
- http_res.status_code,
979
- http_res_text,
980
- http_res,
981
- )
890
+ raise errors.APIError("Unexpected response received", http_res)
982
891
 
983
892
  async def get_async(
984
893
  self,
@@ -1061,38 +970,25 @@ class Representatives(BaseSDK):
1061
970
 
1062
971
  if utils.match_response(http_res, "200", "application/json"):
1063
972
  return operations.GetRepresentativeResponse(
1064
- result=utils.unmarshal_json(http_res.text, components.Representative),
973
+ result=utils.unmarshal_json_response(
974
+ components.Representative, http_res
975
+ ),
1065
976
  headers=utils.get_response_headers(http_res.headers),
1066
977
  )
1067
978
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1068
979
  http_res_text = await utils.stream_to_text_async(http_res)
1069
- raise errors.APIError(
1070
- "API error occurred", http_res.status_code, http_res_text, http_res
1071
- )
980
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1072
981
  if utils.match_response(http_res, ["500", "504"], "*"):
1073
982
  http_res_text = await utils.stream_to_text_async(http_res)
1074
- raise errors.APIError(
1075
- "API error occurred", http_res.status_code, http_res_text, http_res
1076
- )
983
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1077
984
  if utils.match_response(http_res, "4XX", "*"):
1078
985
  http_res_text = await utils.stream_to_text_async(http_res)
1079
- raise errors.APIError(
1080
- "API error occurred", http_res.status_code, http_res_text, http_res
1081
- )
986
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1082
987
  if utils.match_response(http_res, "5XX", "*"):
1083
988
  http_res_text = await utils.stream_to_text_async(http_res)
1084
- raise errors.APIError(
1085
- "API error occurred", http_res.status_code, http_res_text, http_res
1086
- )
989
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1087
990
 
1088
- content_type = http_res.headers.get("Content-Type")
1089
- http_res_text = await utils.stream_to_text_async(http_res)
1090
- raise errors.APIError(
1091
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1092
- http_res.status_code,
1093
- http_res_text,
1094
- http_res,
1095
- )
991
+ raise errors.APIError("Unexpected response received", http_res)
1096
992
 
1097
993
  def update(
1098
994
  self,
@@ -1272,41 +1168,30 @@ class Representatives(BaseSDK):
1272
1168
  response_data: Any = None
1273
1169
  if utils.match_response(http_res, "200", "application/json"):
1274
1170
  return operations.UpdateRepresentativeResponse(
1275
- result=utils.unmarshal_json(http_res.text, components.Representative),
1171
+ result=utils.unmarshal_json_response(
1172
+ components.Representative, http_res
1173
+ ),
1276
1174
  headers=utils.get_response_headers(http_res.headers),
1277
1175
  )
1278
1176
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1279
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1280
- raise errors.GenericError(data=response_data)
1177
+ response_data = utils.unmarshal_json_response(
1178
+ errors.GenericErrorData, http_res
1179
+ )
1180
+ raise errors.GenericError(response_data, http_res)
1281
1181
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1282
1182
  http_res_text = utils.stream_to_text(http_res)
1283
- raise errors.APIError(
1284
- "API error occurred", http_res.status_code, http_res_text, http_res
1285
- )
1183
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1286
1184
  if utils.match_response(http_res, ["500", "504"], "*"):
1287
1185
  http_res_text = utils.stream_to_text(http_res)
1288
- raise errors.APIError(
1289
- "API error occurred", http_res.status_code, http_res_text, http_res
1290
- )
1186
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1291
1187
  if utils.match_response(http_res, "4XX", "*"):
1292
1188
  http_res_text = utils.stream_to_text(http_res)
1293
- raise errors.APIError(
1294
- "API error occurred", http_res.status_code, http_res_text, http_res
1295
- )
1189
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1296
1190
  if utils.match_response(http_res, "5XX", "*"):
1297
1191
  http_res_text = utils.stream_to_text(http_res)
1298
- raise errors.APIError(
1299
- "API error occurred", http_res.status_code, http_res_text, http_res
1300
- )
1192
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1301
1193
 
1302
- content_type = http_res.headers.get("Content-Type")
1303
- http_res_text = utils.stream_to_text(http_res)
1304
- raise errors.APIError(
1305
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1306
- http_res.status_code,
1307
- http_res_text,
1308
- http_res,
1309
- )
1194
+ raise errors.APIError("Unexpected response received", http_res)
1310
1195
 
1311
1196
  async def update_async(
1312
1197
  self,
@@ -1486,38 +1371,27 @@ class Representatives(BaseSDK):
1486
1371
  response_data: Any = None
1487
1372
  if utils.match_response(http_res, "200", "application/json"):
1488
1373
  return operations.UpdateRepresentativeResponse(
1489
- result=utils.unmarshal_json(http_res.text, components.Representative),
1374
+ result=utils.unmarshal_json_response(
1375
+ components.Representative, http_res
1376
+ ),
1490
1377
  headers=utils.get_response_headers(http_res.headers),
1491
1378
  )
1492
1379
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1493
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1494
- raise errors.GenericError(data=response_data)
1380
+ response_data = utils.unmarshal_json_response(
1381
+ errors.GenericErrorData, http_res
1382
+ )
1383
+ raise errors.GenericError(response_data, http_res)
1495
1384
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1496
1385
  http_res_text = await utils.stream_to_text_async(http_res)
1497
- raise errors.APIError(
1498
- "API error occurred", http_res.status_code, http_res_text, http_res
1499
- )
1386
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1500
1387
  if utils.match_response(http_res, ["500", "504"], "*"):
1501
1388
  http_res_text = await utils.stream_to_text_async(http_res)
1502
- raise errors.APIError(
1503
- "API error occurred", http_res.status_code, http_res_text, http_res
1504
- )
1389
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1505
1390
  if utils.match_response(http_res, "4XX", "*"):
1506
1391
  http_res_text = await utils.stream_to_text_async(http_res)
1507
- raise errors.APIError(
1508
- "API error occurred", http_res.status_code, http_res_text, http_res
1509
- )
1392
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1510
1393
  if utils.match_response(http_res, "5XX", "*"):
1511
1394
  http_res_text = await utils.stream_to_text_async(http_res)
1512
- raise errors.APIError(
1513
- "API error occurred", http_res.status_code, http_res_text, http_res
1514
- )
1395
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1515
1396
 
1516
- content_type = http_res.headers.get("Content-Type")
1517
- http_res_text = await utils.stream_to_text_async(http_res)
1518
- raise errors.APIError(
1519
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1520
- http_res.status_code,
1521
- http_res_text,
1522
- http_res,
1523
- )
1397
+ raise errors.APIError("Unexpected response received", http_res)