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
moovio_sdk/transfers.py CHANGED
@@ -133,46 +133,35 @@ class Transfers(BaseSDK):
133
133
  response_data: Any = None
134
134
  if utils.match_response(http_res, "200", "application/json"):
135
135
  return operations.CreateTransferOptionsForAccountResponse(
136
- result=utils.unmarshal_json(http_res.text, components.TransferOptions),
136
+ result=utils.unmarshal_json_response(
137
+ components.TransferOptions, http_res
138
+ ),
137
139
  headers=utils.get_response_headers(http_res.headers),
138
140
  )
139
141
  if utils.match_response(http_res, "400", "application/json"):
140
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
141
- raise errors.GenericError(data=response_data)
142
+ response_data = utils.unmarshal_json_response(
143
+ errors.GenericErrorData, http_res
144
+ )
145
+ raise errors.GenericError(response_data, http_res)
142
146
  if utils.match_response(http_res, "422", "application/json"):
143
- response_data = utils.unmarshal_json(
144
- http_res.text, errors.TransferOptionsValidationErrorData
147
+ response_data = utils.unmarshal_json_response(
148
+ errors.TransferOptionsValidationErrorData, http_res
145
149
  )
146
- raise errors.TransferOptionsValidationError(data=response_data)
150
+ raise errors.TransferOptionsValidationError(response_data, http_res)
147
151
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
148
152
  http_res_text = utils.stream_to_text(http_res)
149
- raise errors.APIError(
150
- "API error occurred", http_res.status_code, http_res_text, http_res
151
- )
153
+ raise errors.APIError("API error occurred", http_res, http_res_text)
152
154
  if utils.match_response(http_res, ["500", "504"], "*"):
153
155
  http_res_text = utils.stream_to_text(http_res)
154
- raise errors.APIError(
155
- "API error occurred", http_res.status_code, http_res_text, http_res
156
- )
156
+ raise errors.APIError("API error occurred", http_res, http_res_text)
157
157
  if utils.match_response(http_res, "4XX", "*"):
158
158
  http_res_text = utils.stream_to_text(http_res)
159
- raise errors.APIError(
160
- "API error occurred", http_res.status_code, http_res_text, http_res
161
- )
159
+ raise errors.APIError("API error occurred", http_res, http_res_text)
162
160
  if utils.match_response(http_res, "5XX", "*"):
163
161
  http_res_text = utils.stream_to_text(http_res)
164
- raise errors.APIError(
165
- "API error occurred", http_res.status_code, http_res_text, http_res
166
- )
162
+ raise errors.APIError("API error occurred", http_res, http_res_text)
167
163
 
168
- content_type = http_res.headers.get("Content-Type")
169
- http_res_text = utils.stream_to_text(http_res)
170
- raise errors.APIError(
171
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
172
- http_res.status_code,
173
- http_res_text,
174
- http_res,
175
- )
164
+ raise errors.APIError("Unexpected response received", http_res)
176
165
 
177
166
  async def generate_options_for_account_async(
178
167
  self,
@@ -296,46 +285,35 @@ class Transfers(BaseSDK):
296
285
  response_data: Any = None
297
286
  if utils.match_response(http_res, "200", "application/json"):
298
287
  return operations.CreateTransferOptionsForAccountResponse(
299
- result=utils.unmarshal_json(http_res.text, components.TransferOptions),
288
+ result=utils.unmarshal_json_response(
289
+ components.TransferOptions, http_res
290
+ ),
300
291
  headers=utils.get_response_headers(http_res.headers),
301
292
  )
302
293
  if utils.match_response(http_res, "400", "application/json"):
303
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
304
- raise errors.GenericError(data=response_data)
294
+ response_data = utils.unmarshal_json_response(
295
+ errors.GenericErrorData, http_res
296
+ )
297
+ raise errors.GenericError(response_data, http_res)
305
298
  if utils.match_response(http_res, "422", "application/json"):
306
- response_data = utils.unmarshal_json(
307
- http_res.text, errors.TransferOptionsValidationErrorData
299
+ response_data = utils.unmarshal_json_response(
300
+ errors.TransferOptionsValidationErrorData, http_res
308
301
  )
309
- raise errors.TransferOptionsValidationError(data=response_data)
302
+ raise errors.TransferOptionsValidationError(response_data, http_res)
310
303
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
311
304
  http_res_text = await utils.stream_to_text_async(http_res)
312
- raise errors.APIError(
313
- "API error occurred", http_res.status_code, http_res_text, http_res
314
- )
305
+ raise errors.APIError("API error occurred", http_res, http_res_text)
315
306
  if utils.match_response(http_res, ["500", "504"], "*"):
316
307
  http_res_text = await utils.stream_to_text_async(http_res)
317
- raise errors.APIError(
318
- "API error occurred", http_res.status_code, http_res_text, http_res
319
- )
308
+ raise errors.APIError("API error occurred", http_res, http_res_text)
320
309
  if utils.match_response(http_res, "4XX", "*"):
321
310
  http_res_text = await utils.stream_to_text_async(http_res)
322
- raise errors.APIError(
323
- "API error occurred", http_res.status_code, http_res_text, http_res
324
- )
311
+ raise errors.APIError("API error occurred", http_res, http_res_text)
325
312
  if utils.match_response(http_res, "5XX", "*"):
326
313
  http_res_text = await utils.stream_to_text_async(http_res)
327
- raise errors.APIError(
328
- "API error occurred", http_res.status_code, http_res_text, http_res
329
- )
314
+ raise errors.APIError("API error occurred", http_res, http_res_text)
330
315
 
331
- content_type = http_res.headers.get("Content-Type")
332
- http_res_text = await utils.stream_to_text_async(http_res)
333
- raise errors.APIError(
334
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
335
- http_res.status_code,
336
- http_res_text,
337
- http_res,
338
- )
316
+ raise errors.APIError("Unexpected response received", http_res)
339
317
 
340
318
  def create(
341
319
  self,
@@ -480,59 +458,50 @@ class Transfers(BaseSDK):
480
458
  response_data: Any = None
481
459
  if utils.match_response(http_res, "200", "application/json"):
482
460
  return operations.CreateTransferResponse(
483
- result=utils.unmarshal_json(http_res.text, components.CreatedTransfer),
461
+ result=utils.unmarshal_json_response(
462
+ components.CreatedTransfer, http_res
463
+ ),
484
464
  headers=utils.get_response_headers(http_res.headers),
485
465
  )
486
466
  if utils.match_response(http_res, "201", "application/json"):
487
467
  return operations.CreateTransferResponse(
488
- result=utils.unmarshal_json(http_res.text, components.AsyncTransfer),
468
+ result=utils.unmarshal_json_response(
469
+ components.AsyncTransfer, http_res
470
+ ),
489
471
  headers=utils.get_response_headers(http_res.headers),
490
472
  )
491
473
  if utils.match_response(http_res, "202", "application/json"):
492
474
  return operations.CreateTransferResponse(
493
- result=utils.unmarshal_json(http_res.text, components.Transfer),
475
+ result=utils.unmarshal_json_response(components.Transfer, http_res),
494
476
  headers=utils.get_response_headers(http_res.headers),
495
477
  )
496
478
  if utils.match_response(http_res, "400", "application/json"):
497
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
498
- raise errors.GenericError(data=response_data)
479
+ response_data = utils.unmarshal_json_response(
480
+ errors.GenericErrorData, http_res
481
+ )
482
+ raise errors.GenericError(response_data, http_res)
499
483
  if utils.match_response(http_res, "409", "application/json"):
500
- response_data = utils.unmarshal_json(http_res.text, errors.TransferData)
501
- raise errors.Transfer(data=response_data)
484
+ response_data = utils.unmarshal_json_response(errors.TransferData, http_res)
485
+ raise errors.Transfer(response_data, http_res)
502
486
  if utils.match_response(http_res, "422", "application/json"):
503
- response_data = utils.unmarshal_json(
504
- http_res.text, errors.TransferValidationErrorData
487
+ response_data = utils.unmarshal_json_response(
488
+ errors.TransferValidationErrorData, http_res
505
489
  )
506
- raise errors.TransferValidationError(data=response_data)
490
+ raise errors.TransferValidationError(response_data, http_res)
507
491
  if utils.match_response(http_res, ["404", "429"], "*"):
508
492
  http_res_text = utils.stream_to_text(http_res)
509
- raise errors.APIError(
510
- "API error occurred", http_res.status_code, http_res_text, http_res
511
- )
493
+ raise errors.APIError("API error occurred", http_res, http_res_text)
512
494
  if utils.match_response(http_res, ["500", "504"], "*"):
513
495
  http_res_text = utils.stream_to_text(http_res)
514
- raise errors.APIError(
515
- "API error occurred", http_res.status_code, http_res_text, http_res
516
- )
496
+ raise errors.APIError("API error occurred", http_res, http_res_text)
517
497
  if utils.match_response(http_res, "4XX", "*"):
518
498
  http_res_text = utils.stream_to_text(http_res)
519
- raise errors.APIError(
520
- "API error occurred", http_res.status_code, http_res_text, http_res
521
- )
499
+ raise errors.APIError("API error occurred", http_res, http_res_text)
522
500
  if utils.match_response(http_res, "5XX", "*"):
523
501
  http_res_text = utils.stream_to_text(http_res)
524
- raise errors.APIError(
525
- "API error occurred", http_res.status_code, http_res_text, http_res
526
- )
502
+ raise errors.APIError("API error occurred", http_res, http_res_text)
527
503
 
528
- content_type = http_res.headers.get("Content-Type")
529
- http_res_text = utils.stream_to_text(http_res)
530
- raise errors.APIError(
531
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
532
- http_res.status_code,
533
- http_res_text,
534
- http_res,
535
- )
504
+ raise errors.APIError("Unexpected response received", http_res)
536
505
 
537
506
  async def create_async(
538
507
  self,
@@ -677,59 +646,50 @@ class Transfers(BaseSDK):
677
646
  response_data: Any = None
678
647
  if utils.match_response(http_res, "200", "application/json"):
679
648
  return operations.CreateTransferResponse(
680
- result=utils.unmarshal_json(http_res.text, components.CreatedTransfer),
649
+ result=utils.unmarshal_json_response(
650
+ components.CreatedTransfer, http_res
651
+ ),
681
652
  headers=utils.get_response_headers(http_res.headers),
682
653
  )
683
654
  if utils.match_response(http_res, "201", "application/json"):
684
655
  return operations.CreateTransferResponse(
685
- result=utils.unmarshal_json(http_res.text, components.AsyncTransfer),
656
+ result=utils.unmarshal_json_response(
657
+ components.AsyncTransfer, http_res
658
+ ),
686
659
  headers=utils.get_response_headers(http_res.headers),
687
660
  )
688
661
  if utils.match_response(http_res, "202", "application/json"):
689
662
  return operations.CreateTransferResponse(
690
- result=utils.unmarshal_json(http_res.text, components.Transfer),
663
+ result=utils.unmarshal_json_response(components.Transfer, http_res),
691
664
  headers=utils.get_response_headers(http_res.headers),
692
665
  )
693
666
  if utils.match_response(http_res, "400", "application/json"):
694
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
695
- raise errors.GenericError(data=response_data)
667
+ response_data = utils.unmarshal_json_response(
668
+ errors.GenericErrorData, http_res
669
+ )
670
+ raise errors.GenericError(response_data, http_res)
696
671
  if utils.match_response(http_res, "409", "application/json"):
697
- response_data = utils.unmarshal_json(http_res.text, errors.TransferData)
698
- raise errors.Transfer(data=response_data)
672
+ response_data = utils.unmarshal_json_response(errors.TransferData, http_res)
673
+ raise errors.Transfer(response_data, http_res)
699
674
  if utils.match_response(http_res, "422", "application/json"):
700
- response_data = utils.unmarshal_json(
701
- http_res.text, errors.TransferValidationErrorData
675
+ response_data = utils.unmarshal_json_response(
676
+ errors.TransferValidationErrorData, http_res
702
677
  )
703
- raise errors.TransferValidationError(data=response_data)
678
+ raise errors.TransferValidationError(response_data, http_res)
704
679
  if utils.match_response(http_res, ["404", "429"], "*"):
705
680
  http_res_text = await utils.stream_to_text_async(http_res)
706
- raise errors.APIError(
707
- "API error occurred", http_res.status_code, http_res_text, http_res
708
- )
681
+ raise errors.APIError("API error occurred", http_res, http_res_text)
709
682
  if utils.match_response(http_res, ["500", "504"], "*"):
710
683
  http_res_text = await utils.stream_to_text_async(http_res)
711
- raise errors.APIError(
712
- "API error occurred", http_res.status_code, http_res_text, http_res
713
- )
684
+ raise errors.APIError("API error occurred", http_res, http_res_text)
714
685
  if utils.match_response(http_res, "4XX", "*"):
715
686
  http_res_text = await utils.stream_to_text_async(http_res)
716
- raise errors.APIError(
717
- "API error occurred", http_res.status_code, http_res_text, http_res
718
- )
687
+ raise errors.APIError("API error occurred", http_res, http_res_text)
719
688
  if utils.match_response(http_res, "5XX", "*"):
720
689
  http_res_text = await utils.stream_to_text_async(http_res)
721
- raise errors.APIError(
722
- "API error occurred", http_res.status_code, http_res_text, http_res
723
- )
690
+ raise errors.APIError("API error occurred", http_res, http_res_text)
724
691
 
725
- content_type = http_res.headers.get("Content-Type")
726
- http_res_text = await utils.stream_to_text_async(http_res)
727
- raise errors.APIError(
728
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
729
- http_res.status_code,
730
- http_res_text,
731
- http_res,
732
- )
692
+ raise errors.APIError("Unexpected response received", http_res)
733
693
 
734
694
  def list(
735
695
  self,
@@ -852,38 +812,25 @@ class Transfers(BaseSDK):
852
812
 
853
813
  if utils.match_response(http_res, "200", "application/json"):
854
814
  return operations.ListTransfersResponse(
855
- result=utils.unmarshal_json(http_res.text, List[components.Transfer]),
815
+ result=utils.unmarshal_json_response(
816
+ List[components.Transfer], http_res
817
+ ),
856
818
  headers=utils.get_response_headers(http_res.headers),
857
819
  )
858
820
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
859
821
  http_res_text = utils.stream_to_text(http_res)
860
- raise errors.APIError(
861
- "API error occurred", http_res.status_code, http_res_text, http_res
862
- )
822
+ raise errors.APIError("API error occurred", http_res, http_res_text)
863
823
  if utils.match_response(http_res, ["500", "504"], "*"):
864
824
  http_res_text = utils.stream_to_text(http_res)
865
- raise errors.APIError(
866
- "API error occurred", http_res.status_code, http_res_text, http_res
867
- )
825
+ raise errors.APIError("API error occurred", http_res, http_res_text)
868
826
  if utils.match_response(http_res, "4XX", "*"):
869
827
  http_res_text = utils.stream_to_text(http_res)
870
- raise errors.APIError(
871
- "API error occurred", http_res.status_code, http_res_text, http_res
872
- )
828
+ raise errors.APIError("API error occurred", http_res, http_res_text)
873
829
  if utils.match_response(http_res, "5XX", "*"):
874
830
  http_res_text = utils.stream_to_text(http_res)
875
- raise errors.APIError(
876
- "API error occurred", http_res.status_code, http_res_text, http_res
877
- )
831
+ raise errors.APIError("API error occurred", http_res, http_res_text)
878
832
 
879
- content_type = http_res.headers.get("Content-Type")
880
- http_res_text = utils.stream_to_text(http_res)
881
- raise errors.APIError(
882
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
883
- http_res.status_code,
884
- http_res_text,
885
- http_res,
886
- )
833
+ raise errors.APIError("Unexpected response received", http_res)
887
834
 
888
835
  async def list_async(
889
836
  self,
@@ -1006,38 +953,25 @@ class Transfers(BaseSDK):
1006
953
 
1007
954
  if utils.match_response(http_res, "200", "application/json"):
1008
955
  return operations.ListTransfersResponse(
1009
- result=utils.unmarshal_json(http_res.text, List[components.Transfer]),
956
+ result=utils.unmarshal_json_response(
957
+ List[components.Transfer], http_res
958
+ ),
1010
959
  headers=utils.get_response_headers(http_res.headers),
1011
960
  )
1012
961
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
1013
962
  http_res_text = await utils.stream_to_text_async(http_res)
1014
- raise errors.APIError(
1015
- "API error occurred", http_res.status_code, http_res_text, http_res
1016
- )
963
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1017
964
  if utils.match_response(http_res, ["500", "504"], "*"):
1018
965
  http_res_text = await utils.stream_to_text_async(http_res)
1019
- raise errors.APIError(
1020
- "API error occurred", http_res.status_code, http_res_text, http_res
1021
- )
966
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1022
967
  if utils.match_response(http_res, "4XX", "*"):
1023
968
  http_res_text = await utils.stream_to_text_async(http_res)
1024
- raise errors.APIError(
1025
- "API error occurred", http_res.status_code, http_res_text, http_res
1026
- )
969
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1027
970
  if utils.match_response(http_res, "5XX", "*"):
1028
971
  http_res_text = await utils.stream_to_text_async(http_res)
1029
- raise errors.APIError(
1030
- "API error occurred", http_res.status_code, http_res_text, http_res
1031
- )
972
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1032
973
 
1033
- content_type = http_res.headers.get("Content-Type")
1034
- http_res_text = await utils.stream_to_text_async(http_res)
1035
- raise errors.APIError(
1036
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1037
- http_res.status_code,
1038
- http_res_text,
1039
- http_res,
1040
- )
974
+ raise errors.APIError("Unexpected response received", http_res)
1041
975
 
1042
976
  def get(
1043
977
  self,
@@ -1123,38 +1057,23 @@ class Transfers(BaseSDK):
1123
1057
 
1124
1058
  if utils.match_response(http_res, "200", "application/json"):
1125
1059
  return operations.GetTransferResponse(
1126
- result=utils.unmarshal_json(http_res.text, components.Transfer),
1060
+ result=utils.unmarshal_json_response(components.Transfer, http_res),
1127
1061
  headers=utils.get_response_headers(http_res.headers),
1128
1062
  )
1129
1063
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1130
1064
  http_res_text = utils.stream_to_text(http_res)
1131
- raise errors.APIError(
1132
- "API error occurred", http_res.status_code, http_res_text, http_res
1133
- )
1065
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1134
1066
  if utils.match_response(http_res, ["500", "504"], "*"):
1135
1067
  http_res_text = utils.stream_to_text(http_res)
1136
- raise errors.APIError(
1137
- "API error occurred", http_res.status_code, http_res_text, http_res
1138
- )
1068
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1139
1069
  if utils.match_response(http_res, "4XX", "*"):
1140
1070
  http_res_text = utils.stream_to_text(http_res)
1141
- raise errors.APIError(
1142
- "API error occurred", http_res.status_code, http_res_text, http_res
1143
- )
1071
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1144
1072
  if utils.match_response(http_res, "5XX", "*"):
1145
1073
  http_res_text = utils.stream_to_text(http_res)
1146
- raise errors.APIError(
1147
- "API error occurred", http_res.status_code, http_res_text, http_res
1148
- )
1074
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1149
1075
 
1150
- content_type = http_res.headers.get("Content-Type")
1151
- http_res_text = utils.stream_to_text(http_res)
1152
- raise errors.APIError(
1153
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1154
- http_res.status_code,
1155
- http_res_text,
1156
- http_res,
1157
- )
1076
+ raise errors.APIError("Unexpected response received", http_res)
1158
1077
 
1159
1078
  async def get_async(
1160
1079
  self,
@@ -1240,38 +1159,23 @@ class Transfers(BaseSDK):
1240
1159
 
1241
1160
  if utils.match_response(http_res, "200", "application/json"):
1242
1161
  return operations.GetTransferResponse(
1243
- result=utils.unmarshal_json(http_res.text, components.Transfer),
1162
+ result=utils.unmarshal_json_response(components.Transfer, http_res),
1244
1163
  headers=utils.get_response_headers(http_res.headers),
1245
1164
  )
1246
1165
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1247
1166
  http_res_text = await utils.stream_to_text_async(http_res)
1248
- raise errors.APIError(
1249
- "API error occurred", http_res.status_code, http_res_text, http_res
1250
- )
1167
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1251
1168
  if utils.match_response(http_res, ["500", "504"], "*"):
1252
1169
  http_res_text = await utils.stream_to_text_async(http_res)
1253
- raise errors.APIError(
1254
- "API error occurred", http_res.status_code, http_res_text, http_res
1255
- )
1170
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1256
1171
  if utils.match_response(http_res, "4XX", "*"):
1257
1172
  http_res_text = await utils.stream_to_text_async(http_res)
1258
- raise errors.APIError(
1259
- "API error occurred", http_res.status_code, http_res_text, http_res
1260
- )
1173
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1261
1174
  if utils.match_response(http_res, "5XX", "*"):
1262
1175
  http_res_text = await utils.stream_to_text_async(http_res)
1263
- raise errors.APIError(
1264
- "API error occurred", http_res.status_code, http_res_text, http_res
1265
- )
1176
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1266
1177
 
1267
- content_type = http_res.headers.get("Content-Type")
1268
- http_res_text = await utils.stream_to_text_async(http_res)
1269
- raise errors.APIError(
1270
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1271
- http_res.status_code,
1272
- http_res_text,
1273
- http_res,
1274
- )
1178
+ raise errors.APIError("Unexpected response received", http_res)
1275
1179
 
1276
1180
  def update(
1277
1181
  self,
@@ -1364,38 +1268,23 @@ class Transfers(BaseSDK):
1364
1268
 
1365
1269
  if utils.match_response(http_res, "200", "application/json"):
1366
1270
  return operations.UpdateTransferResponse(
1367
- result=utils.unmarshal_json(http_res.text, components.Transfer),
1271
+ result=utils.unmarshal_json_response(components.Transfer, http_res),
1368
1272
  headers=utils.get_response_headers(http_res.headers),
1369
1273
  )
1370
1274
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1371
1275
  http_res_text = utils.stream_to_text(http_res)
1372
- raise errors.APIError(
1373
- "API error occurred", http_res.status_code, http_res_text, http_res
1374
- )
1276
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1375
1277
  if utils.match_response(http_res, ["500", "504"], "*"):
1376
1278
  http_res_text = utils.stream_to_text(http_res)
1377
- raise errors.APIError(
1378
- "API error occurred", http_res.status_code, http_res_text, http_res
1379
- )
1279
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1380
1280
  if utils.match_response(http_res, "4XX", "*"):
1381
1281
  http_res_text = utils.stream_to_text(http_res)
1382
- raise errors.APIError(
1383
- "API error occurred", http_res.status_code, http_res_text, http_res
1384
- )
1282
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1385
1283
  if utils.match_response(http_res, "5XX", "*"):
1386
1284
  http_res_text = utils.stream_to_text(http_res)
1387
- raise errors.APIError(
1388
- "API error occurred", http_res.status_code, http_res_text, http_res
1389
- )
1285
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1390
1286
 
1391
- content_type = http_res.headers.get("Content-Type")
1392
- http_res_text = utils.stream_to_text(http_res)
1393
- raise errors.APIError(
1394
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1395
- http_res.status_code,
1396
- http_res_text,
1397
- http_res,
1398
- )
1287
+ raise errors.APIError("Unexpected response received", http_res)
1399
1288
 
1400
1289
  async def update_async(
1401
1290
  self,
@@ -1488,38 +1377,23 @@ class Transfers(BaseSDK):
1488
1377
 
1489
1378
  if utils.match_response(http_res, "200", "application/json"):
1490
1379
  return operations.UpdateTransferResponse(
1491
- result=utils.unmarshal_json(http_res.text, components.Transfer),
1380
+ result=utils.unmarshal_json_response(components.Transfer, http_res),
1492
1381
  headers=utils.get_response_headers(http_res.headers),
1493
1382
  )
1494
1383
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1495
1384
  http_res_text = await utils.stream_to_text_async(http_res)
1496
- raise errors.APIError(
1497
- "API error occurred", http_res.status_code, http_res_text, http_res
1498
- )
1385
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1499
1386
  if utils.match_response(http_res, ["500", "504"], "*"):
1500
1387
  http_res_text = await utils.stream_to_text_async(http_res)
1501
- raise errors.APIError(
1502
- "API error occurred", http_res.status_code, http_res_text, http_res
1503
- )
1388
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1504
1389
  if utils.match_response(http_res, "4XX", "*"):
1505
1390
  http_res_text = await utils.stream_to_text_async(http_res)
1506
- raise errors.APIError(
1507
- "API error occurred", http_res.status_code, http_res_text, http_res
1508
- )
1391
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1509
1392
  if utils.match_response(http_res, "5XX", "*"):
1510
1393
  http_res_text = await utils.stream_to_text_async(http_res)
1511
- raise errors.APIError(
1512
- "API error occurred", http_res.status_code, http_res_text, http_res
1513
- )
1394
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1514
1395
 
1515
- content_type = http_res.headers.get("Content-Type")
1516
- http_res_text = await utils.stream_to_text_async(http_res)
1517
- raise errors.APIError(
1518
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1519
- http_res.status_code,
1520
- http_res_text,
1521
- http_res,
1522
- )
1396
+ raise errors.APIError("Unexpected response received", http_res)
1523
1397
 
1524
1398
  def create_cancellation(
1525
1399
  self,
@@ -1613,41 +1487,28 @@ class Transfers(BaseSDK):
1613
1487
  response_data: Any = None
1614
1488
  if utils.match_response(http_res, ["200", "202"], "application/json"):
1615
1489
  return operations.CreateCancellationResponse(
1616
- result=utils.unmarshal_json(http_res.text, components.Cancellation),
1490
+ result=utils.unmarshal_json_response(components.Cancellation, http_res),
1617
1491
  headers=utils.get_response_headers(http_res.headers),
1618
1492
  )
1619
1493
  if utils.match_response(http_res, "400", "application/json"):
1620
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1621
- raise errors.GenericError(data=response_data)
1494
+ response_data = utils.unmarshal_json_response(
1495
+ errors.GenericErrorData, http_res
1496
+ )
1497
+ raise errors.GenericError(response_data, http_res)
1622
1498
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1623
1499
  http_res_text = utils.stream_to_text(http_res)
1624
- raise errors.APIError(
1625
- "API error occurred", http_res.status_code, http_res_text, http_res
1626
- )
1500
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1627
1501
  if utils.match_response(http_res, ["500", "504"], "*"):
1628
1502
  http_res_text = utils.stream_to_text(http_res)
1629
- raise errors.APIError(
1630
- "API error occurred", http_res.status_code, http_res_text, http_res
1631
- )
1503
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1632
1504
  if utils.match_response(http_res, "4XX", "*"):
1633
1505
  http_res_text = utils.stream_to_text(http_res)
1634
- raise errors.APIError(
1635
- "API error occurred", http_res.status_code, http_res_text, http_res
1636
- )
1506
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1637
1507
  if utils.match_response(http_res, "5XX", "*"):
1638
1508
  http_res_text = utils.stream_to_text(http_res)
1639
- raise errors.APIError(
1640
- "API error occurred", http_res.status_code, http_res_text, http_res
1641
- )
1509
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1642
1510
 
1643
- content_type = http_res.headers.get("Content-Type")
1644
- http_res_text = utils.stream_to_text(http_res)
1645
- raise errors.APIError(
1646
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1647
- http_res.status_code,
1648
- http_res_text,
1649
- http_res,
1650
- )
1511
+ raise errors.APIError("Unexpected response received", http_res)
1651
1512
 
1652
1513
  async def create_cancellation_async(
1653
1514
  self,
@@ -1741,41 +1602,28 @@ class Transfers(BaseSDK):
1741
1602
  response_data: Any = None
1742
1603
  if utils.match_response(http_res, ["200", "202"], "application/json"):
1743
1604
  return operations.CreateCancellationResponse(
1744
- result=utils.unmarshal_json(http_res.text, components.Cancellation),
1605
+ result=utils.unmarshal_json_response(components.Cancellation, http_res),
1745
1606
  headers=utils.get_response_headers(http_res.headers),
1746
1607
  )
1747
1608
  if utils.match_response(http_res, "400", "application/json"):
1748
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1749
- raise errors.GenericError(data=response_data)
1609
+ response_data = utils.unmarshal_json_response(
1610
+ errors.GenericErrorData, http_res
1611
+ )
1612
+ raise errors.GenericError(response_data, http_res)
1750
1613
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1751
1614
  http_res_text = await utils.stream_to_text_async(http_res)
1752
- raise errors.APIError(
1753
- "API error occurred", http_res.status_code, http_res_text, http_res
1754
- )
1615
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1755
1616
  if utils.match_response(http_res, ["500", "504"], "*"):
1756
1617
  http_res_text = await utils.stream_to_text_async(http_res)
1757
- raise errors.APIError(
1758
- "API error occurred", http_res.status_code, http_res_text, http_res
1759
- )
1618
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1760
1619
  if utils.match_response(http_res, "4XX", "*"):
1761
1620
  http_res_text = await utils.stream_to_text_async(http_res)
1762
- raise errors.APIError(
1763
- "API error occurred", http_res.status_code, http_res_text, http_res
1764
- )
1621
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1765
1622
  if utils.match_response(http_res, "5XX", "*"):
1766
1623
  http_res_text = await utils.stream_to_text_async(http_res)
1767
- raise errors.APIError(
1768
- "API error occurred", http_res.status_code, http_res_text, http_res
1769
- )
1624
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1770
1625
 
1771
- content_type = http_res.headers.get("Content-Type")
1772
- http_res_text = await utils.stream_to_text_async(http_res)
1773
- raise errors.APIError(
1774
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1775
- http_res.status_code,
1776
- http_res_text,
1777
- http_res,
1778
- )
1626
+ raise errors.APIError("Unexpected response received", http_res)
1779
1627
 
1780
1628
  def get_cancellation(
1781
1629
  self,
@@ -1861,38 +1709,23 @@ class Transfers(BaseSDK):
1861
1709
 
1862
1710
  if utils.match_response(http_res, "200", "application/json"):
1863
1711
  return operations.GetCancellationResponse(
1864
- result=utils.unmarshal_json(http_res.text, components.Cancellation),
1712
+ result=utils.unmarshal_json_response(components.Cancellation, http_res),
1865
1713
  headers=utils.get_response_headers(http_res.headers),
1866
1714
  )
1867
1715
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1868
1716
  http_res_text = utils.stream_to_text(http_res)
1869
- raise errors.APIError(
1870
- "API error occurred", http_res.status_code, http_res_text, http_res
1871
- )
1717
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1872
1718
  if utils.match_response(http_res, ["500", "504"], "*"):
1873
1719
  http_res_text = utils.stream_to_text(http_res)
1874
- raise errors.APIError(
1875
- "API error occurred", http_res.status_code, http_res_text, http_res
1876
- )
1720
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1877
1721
  if utils.match_response(http_res, "4XX", "*"):
1878
1722
  http_res_text = utils.stream_to_text(http_res)
1879
- raise errors.APIError(
1880
- "API error occurred", http_res.status_code, http_res_text, http_res
1881
- )
1723
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1882
1724
  if utils.match_response(http_res, "5XX", "*"):
1883
1725
  http_res_text = utils.stream_to_text(http_res)
1884
- raise errors.APIError(
1885
- "API error occurred", http_res.status_code, http_res_text, http_res
1886
- )
1726
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1887
1727
 
1888
- content_type = http_res.headers.get("Content-Type")
1889
- http_res_text = utils.stream_to_text(http_res)
1890
- raise errors.APIError(
1891
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1892
- http_res.status_code,
1893
- http_res_text,
1894
- http_res,
1895
- )
1728
+ raise errors.APIError("Unexpected response received", http_res)
1896
1729
 
1897
1730
  async def get_cancellation_async(
1898
1731
  self,
@@ -1978,38 +1811,23 @@ class Transfers(BaseSDK):
1978
1811
 
1979
1812
  if utils.match_response(http_res, "200", "application/json"):
1980
1813
  return operations.GetCancellationResponse(
1981
- result=utils.unmarshal_json(http_res.text, components.Cancellation),
1814
+ result=utils.unmarshal_json_response(components.Cancellation, http_res),
1982
1815
  headers=utils.get_response_headers(http_res.headers),
1983
1816
  )
1984
1817
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1985
1818
  http_res_text = await utils.stream_to_text_async(http_res)
1986
- raise errors.APIError(
1987
- "API error occurred", http_res.status_code, http_res_text, http_res
1988
- )
1819
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1989
1820
  if utils.match_response(http_res, ["500", "504"], "*"):
1990
1821
  http_res_text = await utils.stream_to_text_async(http_res)
1991
- raise errors.APIError(
1992
- "API error occurred", http_res.status_code, http_res_text, http_res
1993
- )
1822
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1994
1823
  if utils.match_response(http_res, "4XX", "*"):
1995
1824
  http_res_text = await utils.stream_to_text_async(http_res)
1996
- raise errors.APIError(
1997
- "API error occurred", http_res.status_code, http_res_text, http_res
1998
- )
1825
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1999
1826
  if utils.match_response(http_res, "5XX", "*"):
2000
1827
  http_res_text = await utils.stream_to_text_async(http_res)
2001
- raise errors.APIError(
2002
- "API error occurred", http_res.status_code, http_res_text, http_res
2003
- )
1828
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2004
1829
 
2005
- content_type = http_res.headers.get("Content-Type")
2006
- http_res_text = await utils.stream_to_text_async(http_res)
2007
- raise errors.APIError(
2008
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2009
- http_res.status_code,
2010
- http_res_text,
2011
- http_res,
2012
- )
1830
+ raise errors.APIError("Unexpected response received", http_res)
2013
1831
 
2014
1832
  def initiate_refund(
2015
1833
  self,
@@ -2124,60 +1942,47 @@ class Transfers(BaseSDK):
2124
1942
  response_data: Any = None
2125
1943
  if utils.match_response(http_res, "200", "application/json"):
2126
1944
  return operations.InitiateRefundResponse(
2127
- result=utils.unmarshal_json(
2128
- http_res.text, components.CreateRefundResponse
1945
+ result=utils.unmarshal_json_response(
1946
+ components.CreateRefundResponse, http_res
2129
1947
  ),
2130
1948
  headers=utils.get_response_headers(http_res.headers),
2131
1949
  )
2132
1950
  if utils.match_response(http_res, "202", "application/json"):
2133
1951
  return operations.InitiateRefundResponse(
2134
- result=utils.unmarshal_json(
2135
- http_res.text, components.CardAcquiringRefund
1952
+ result=utils.unmarshal_json_response(
1953
+ components.CardAcquiringRefund, http_res
2136
1954
  ),
2137
1955
  headers=utils.get_response_headers(http_res.headers),
2138
1956
  )
2139
1957
  if utils.match_response(http_res, "400", "application/json"):
2140
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2141
- raise errors.GenericError(data=response_data)
1958
+ response_data = utils.unmarshal_json_response(
1959
+ errors.GenericErrorData, http_res
1960
+ )
1961
+ raise errors.GenericError(response_data, http_res)
2142
1962
  if utils.match_response(http_res, "409", "application/json"):
2143
- response_data = utils.unmarshal_json(
2144
- http_res.text, errors.CardAcquiringRefundData
1963
+ response_data = utils.unmarshal_json_response(
1964
+ errors.CardAcquiringRefundData, http_res
2145
1965
  )
2146
- raise errors.CardAcquiringRefund(data=response_data)
1966
+ raise errors.CardAcquiringRefund(response_data, http_res)
2147
1967
  if utils.match_response(http_res, "422", "application/json"):
2148
- response_data = utils.unmarshal_json(
2149
- http_res.text, errors.RefundValidationErrorData
1968
+ response_data = utils.unmarshal_json_response(
1969
+ errors.RefundValidationErrorData, http_res
2150
1970
  )
2151
- raise errors.RefundValidationError(data=response_data)
1971
+ raise errors.RefundValidationError(response_data, http_res)
2152
1972
  if utils.match_response(http_res, ["404", "429"], "*"):
2153
1973
  http_res_text = utils.stream_to_text(http_res)
2154
- raise errors.APIError(
2155
- "API error occurred", http_res.status_code, http_res_text, http_res
2156
- )
1974
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2157
1975
  if utils.match_response(http_res, ["500", "504"], "*"):
2158
1976
  http_res_text = utils.stream_to_text(http_res)
2159
- raise errors.APIError(
2160
- "API error occurred", http_res.status_code, http_res_text, http_res
2161
- )
1977
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2162
1978
  if utils.match_response(http_res, "4XX", "*"):
2163
1979
  http_res_text = utils.stream_to_text(http_res)
2164
- raise errors.APIError(
2165
- "API error occurred", http_res.status_code, http_res_text, http_res
2166
- )
1980
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2167
1981
  if utils.match_response(http_res, "5XX", "*"):
2168
1982
  http_res_text = utils.stream_to_text(http_res)
2169
- raise errors.APIError(
2170
- "API error occurred", http_res.status_code, http_res_text, http_res
2171
- )
1983
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2172
1984
 
2173
- content_type = http_res.headers.get("Content-Type")
2174
- http_res_text = utils.stream_to_text(http_res)
2175
- raise errors.APIError(
2176
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2177
- http_res.status_code,
2178
- http_res_text,
2179
- http_res,
2180
- )
1985
+ raise errors.APIError("Unexpected response received", http_res)
2181
1986
 
2182
1987
  async def initiate_refund_async(
2183
1988
  self,
@@ -2292,60 +2097,47 @@ class Transfers(BaseSDK):
2292
2097
  response_data: Any = None
2293
2098
  if utils.match_response(http_res, "200", "application/json"):
2294
2099
  return operations.InitiateRefundResponse(
2295
- result=utils.unmarshal_json(
2296
- http_res.text, components.CreateRefundResponse
2100
+ result=utils.unmarshal_json_response(
2101
+ components.CreateRefundResponse, http_res
2297
2102
  ),
2298
2103
  headers=utils.get_response_headers(http_res.headers),
2299
2104
  )
2300
2105
  if utils.match_response(http_res, "202", "application/json"):
2301
2106
  return operations.InitiateRefundResponse(
2302
- result=utils.unmarshal_json(
2303
- http_res.text, components.CardAcquiringRefund
2107
+ result=utils.unmarshal_json_response(
2108
+ components.CardAcquiringRefund, http_res
2304
2109
  ),
2305
2110
  headers=utils.get_response_headers(http_res.headers),
2306
2111
  )
2307
2112
  if utils.match_response(http_res, "400", "application/json"):
2308
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2309
- raise errors.GenericError(data=response_data)
2113
+ response_data = utils.unmarshal_json_response(
2114
+ errors.GenericErrorData, http_res
2115
+ )
2116
+ raise errors.GenericError(response_data, http_res)
2310
2117
  if utils.match_response(http_res, "409", "application/json"):
2311
- response_data = utils.unmarshal_json(
2312
- http_res.text, errors.CardAcquiringRefundData
2118
+ response_data = utils.unmarshal_json_response(
2119
+ errors.CardAcquiringRefundData, http_res
2313
2120
  )
2314
- raise errors.CardAcquiringRefund(data=response_data)
2121
+ raise errors.CardAcquiringRefund(response_data, http_res)
2315
2122
  if utils.match_response(http_res, "422", "application/json"):
2316
- response_data = utils.unmarshal_json(
2317
- http_res.text, errors.RefundValidationErrorData
2123
+ response_data = utils.unmarshal_json_response(
2124
+ errors.RefundValidationErrorData, http_res
2318
2125
  )
2319
- raise errors.RefundValidationError(data=response_data)
2126
+ raise errors.RefundValidationError(response_data, http_res)
2320
2127
  if utils.match_response(http_res, ["404", "429"], "*"):
2321
2128
  http_res_text = await utils.stream_to_text_async(http_res)
2322
- raise errors.APIError(
2323
- "API error occurred", http_res.status_code, http_res_text, http_res
2324
- )
2129
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2325
2130
  if utils.match_response(http_res, ["500", "504"], "*"):
2326
2131
  http_res_text = await utils.stream_to_text_async(http_res)
2327
- raise errors.APIError(
2328
- "API error occurred", http_res.status_code, http_res_text, http_res
2329
- )
2132
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2330
2133
  if utils.match_response(http_res, "4XX", "*"):
2331
2134
  http_res_text = await utils.stream_to_text_async(http_res)
2332
- raise errors.APIError(
2333
- "API error occurred", http_res.status_code, http_res_text, http_res
2334
- )
2135
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2335
2136
  if utils.match_response(http_res, "5XX", "*"):
2336
2137
  http_res_text = await utils.stream_to_text_async(http_res)
2337
- raise errors.APIError(
2338
- "API error occurred", http_res.status_code, http_res_text, http_res
2339
- )
2138
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2340
2139
 
2341
- content_type = http_res.headers.get("Content-Type")
2342
- http_res_text = await utils.stream_to_text_async(http_res)
2343
- raise errors.APIError(
2344
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2345
- http_res.status_code,
2346
- http_res_text,
2347
- http_res,
2348
- )
2140
+ raise errors.APIError("Unexpected response received", http_res)
2349
2141
 
2350
2142
  def list_refunds(
2351
2143
  self,
@@ -2428,40 +2220,25 @@ class Transfers(BaseSDK):
2428
2220
 
2429
2221
  if utils.match_response(http_res, "200", "application/json"):
2430
2222
  return operations.ListRefundsResponse(
2431
- result=utils.unmarshal_json(
2432
- http_res.text, List[components.CardAcquiringRefund]
2223
+ result=utils.unmarshal_json_response(
2224
+ List[components.CardAcquiringRefund], http_res
2433
2225
  ),
2434
2226
  headers=utils.get_response_headers(http_res.headers),
2435
2227
  )
2436
2228
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
2437
2229
  http_res_text = utils.stream_to_text(http_res)
2438
- raise errors.APIError(
2439
- "API error occurred", http_res.status_code, http_res_text, http_res
2440
- )
2230
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2441
2231
  if utils.match_response(http_res, ["500", "504"], "*"):
2442
2232
  http_res_text = utils.stream_to_text(http_res)
2443
- raise errors.APIError(
2444
- "API error occurred", http_res.status_code, http_res_text, http_res
2445
- )
2233
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2446
2234
  if utils.match_response(http_res, "4XX", "*"):
2447
2235
  http_res_text = utils.stream_to_text(http_res)
2448
- raise errors.APIError(
2449
- "API error occurred", http_res.status_code, http_res_text, http_res
2450
- )
2236
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2451
2237
  if utils.match_response(http_res, "5XX", "*"):
2452
2238
  http_res_text = utils.stream_to_text(http_res)
2453
- raise errors.APIError(
2454
- "API error occurred", http_res.status_code, http_res_text, http_res
2455
- )
2239
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2456
2240
 
2457
- content_type = http_res.headers.get("Content-Type")
2458
- http_res_text = utils.stream_to_text(http_res)
2459
- raise errors.APIError(
2460
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2461
- http_res.status_code,
2462
- http_res_text,
2463
- http_res,
2464
- )
2241
+ raise errors.APIError("Unexpected response received", http_res)
2465
2242
 
2466
2243
  async def list_refunds_async(
2467
2244
  self,
@@ -2544,40 +2321,25 @@ class Transfers(BaseSDK):
2544
2321
 
2545
2322
  if utils.match_response(http_res, "200", "application/json"):
2546
2323
  return operations.ListRefundsResponse(
2547
- result=utils.unmarshal_json(
2548
- http_res.text, List[components.CardAcquiringRefund]
2324
+ result=utils.unmarshal_json_response(
2325
+ List[components.CardAcquiringRefund], http_res
2549
2326
  ),
2550
2327
  headers=utils.get_response_headers(http_res.headers),
2551
2328
  )
2552
2329
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
2553
2330
  http_res_text = await utils.stream_to_text_async(http_res)
2554
- raise errors.APIError(
2555
- "API error occurred", http_res.status_code, http_res_text, http_res
2556
- )
2331
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2557
2332
  if utils.match_response(http_res, ["500", "504"], "*"):
2558
2333
  http_res_text = await utils.stream_to_text_async(http_res)
2559
- raise errors.APIError(
2560
- "API error occurred", http_res.status_code, http_res_text, http_res
2561
- )
2334
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2562
2335
  if utils.match_response(http_res, "4XX", "*"):
2563
2336
  http_res_text = await utils.stream_to_text_async(http_res)
2564
- raise errors.APIError(
2565
- "API error occurred", http_res.status_code, http_res_text, http_res
2566
- )
2337
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2567
2338
  if utils.match_response(http_res, "5XX", "*"):
2568
2339
  http_res_text = await utils.stream_to_text_async(http_res)
2569
- raise errors.APIError(
2570
- "API error occurred", http_res.status_code, http_res_text, http_res
2571
- )
2340
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2572
2341
 
2573
- content_type = http_res.headers.get("Content-Type")
2574
- http_res_text = await utils.stream_to_text_async(http_res)
2575
- raise errors.APIError(
2576
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2577
- http_res.status_code,
2578
- http_res_text,
2579
- http_res,
2580
- )
2342
+ raise errors.APIError("Unexpected response received", http_res)
2581
2343
 
2582
2344
  def get_refund(
2583
2345
  self,
@@ -2663,40 +2425,25 @@ class Transfers(BaseSDK):
2663
2425
 
2664
2426
  if utils.match_response(http_res, "200", "application/json"):
2665
2427
  return operations.GetRefundResponse(
2666
- result=utils.unmarshal_json(
2667
- http_res.text, components.CardAcquiringRefund
2428
+ result=utils.unmarshal_json_response(
2429
+ components.CardAcquiringRefund, http_res
2668
2430
  ),
2669
2431
  headers=utils.get_response_headers(http_res.headers),
2670
2432
  )
2671
2433
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2672
2434
  http_res_text = utils.stream_to_text(http_res)
2673
- raise errors.APIError(
2674
- "API error occurred", http_res.status_code, http_res_text, http_res
2675
- )
2435
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2676
2436
  if utils.match_response(http_res, ["500", "504"], "*"):
2677
2437
  http_res_text = utils.stream_to_text(http_res)
2678
- raise errors.APIError(
2679
- "API error occurred", http_res.status_code, http_res_text, http_res
2680
- )
2438
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2681
2439
  if utils.match_response(http_res, "4XX", "*"):
2682
2440
  http_res_text = utils.stream_to_text(http_res)
2683
- raise errors.APIError(
2684
- "API error occurred", http_res.status_code, http_res_text, http_res
2685
- )
2441
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2686
2442
  if utils.match_response(http_res, "5XX", "*"):
2687
2443
  http_res_text = utils.stream_to_text(http_res)
2688
- raise errors.APIError(
2689
- "API error occurred", http_res.status_code, http_res_text, http_res
2690
- )
2444
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2691
2445
 
2692
- content_type = http_res.headers.get("Content-Type")
2693
- http_res_text = utils.stream_to_text(http_res)
2694
- raise errors.APIError(
2695
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2696
- http_res.status_code,
2697
- http_res_text,
2698
- http_res,
2699
- )
2446
+ raise errors.APIError("Unexpected response received", http_res)
2700
2447
 
2701
2448
  async def get_refund_async(
2702
2449
  self,
@@ -2782,40 +2529,25 @@ class Transfers(BaseSDK):
2782
2529
 
2783
2530
  if utils.match_response(http_res, "200", "application/json"):
2784
2531
  return operations.GetRefundResponse(
2785
- result=utils.unmarshal_json(
2786
- http_res.text, components.CardAcquiringRefund
2532
+ result=utils.unmarshal_json_response(
2533
+ components.CardAcquiringRefund, http_res
2787
2534
  ),
2788
2535
  headers=utils.get_response_headers(http_res.headers),
2789
2536
  )
2790
2537
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2791
2538
  http_res_text = await utils.stream_to_text_async(http_res)
2792
- raise errors.APIError(
2793
- "API error occurred", http_res.status_code, http_res_text, http_res
2794
- )
2539
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2795
2540
  if utils.match_response(http_res, ["500", "504"], "*"):
2796
2541
  http_res_text = await utils.stream_to_text_async(http_res)
2797
- raise errors.APIError(
2798
- "API error occurred", http_res.status_code, http_res_text, http_res
2799
- )
2542
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2800
2543
  if utils.match_response(http_res, "4XX", "*"):
2801
2544
  http_res_text = await utils.stream_to_text_async(http_res)
2802
- raise errors.APIError(
2803
- "API error occurred", http_res.status_code, http_res_text, http_res
2804
- )
2545
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2805
2546
  if utils.match_response(http_res, "5XX", "*"):
2806
2547
  http_res_text = await utils.stream_to_text_async(http_res)
2807
- raise errors.APIError(
2808
- "API error occurred", http_res.status_code, http_res_text, http_res
2809
- )
2548
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2810
2549
 
2811
- content_type = http_res.headers.get("Content-Type")
2812
- http_res_text = await utils.stream_to_text_async(http_res)
2813
- raise errors.APIError(
2814
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2815
- http_res.status_code,
2816
- http_res_text,
2817
- http_res,
2818
- )
2550
+ raise errors.APIError("Unexpected response received", http_res)
2819
2551
 
2820
2552
  def create_reversal(
2821
2553
  self,
@@ -2928,46 +2660,33 @@ class Transfers(BaseSDK):
2928
2660
  response_data: Any = None
2929
2661
  if utils.match_response(http_res, ["200", "202"], "application/json"):
2930
2662
  return operations.CreateReversalResponse(
2931
- result=utils.unmarshal_json(http_res.text, components.Reversal),
2663
+ result=utils.unmarshal_json_response(components.Reversal, http_res),
2932
2664
  headers=utils.get_response_headers(http_res.headers),
2933
2665
  )
2934
2666
  if utils.match_response(http_res, ["400", "409"], "application/json"):
2935
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2936
- raise errors.GenericError(data=response_data)
2667
+ response_data = utils.unmarshal_json_response(
2668
+ errors.GenericErrorData, http_res
2669
+ )
2670
+ raise errors.GenericError(response_data, http_res)
2937
2671
  if utils.match_response(http_res, "422", "application/json"):
2938
- response_data = utils.unmarshal_json(
2939
- http_res.text, errors.ReversalValidationErrorData
2672
+ response_data = utils.unmarshal_json_response(
2673
+ errors.ReversalValidationErrorData, http_res
2940
2674
  )
2941
- raise errors.ReversalValidationError(data=response_data)
2675
+ raise errors.ReversalValidationError(response_data, http_res)
2942
2676
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2943
2677
  http_res_text = utils.stream_to_text(http_res)
2944
- raise errors.APIError(
2945
- "API error occurred", http_res.status_code, http_res_text, http_res
2946
- )
2678
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2947
2679
  if utils.match_response(http_res, ["500", "504"], "*"):
2948
2680
  http_res_text = utils.stream_to_text(http_res)
2949
- raise errors.APIError(
2950
- "API error occurred", http_res.status_code, http_res_text, http_res
2951
- )
2681
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2952
2682
  if utils.match_response(http_res, "4XX", "*"):
2953
2683
  http_res_text = utils.stream_to_text(http_res)
2954
- raise errors.APIError(
2955
- "API error occurred", http_res.status_code, http_res_text, http_res
2956
- )
2684
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2957
2685
  if utils.match_response(http_res, "5XX", "*"):
2958
2686
  http_res_text = utils.stream_to_text(http_res)
2959
- raise errors.APIError(
2960
- "API error occurred", http_res.status_code, http_res_text, http_res
2961
- )
2687
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2962
2688
 
2963
- content_type = http_res.headers.get("Content-Type")
2964
- http_res_text = utils.stream_to_text(http_res)
2965
- raise errors.APIError(
2966
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2967
- http_res.status_code,
2968
- http_res_text,
2969
- http_res,
2970
- )
2689
+ raise errors.APIError("Unexpected response received", http_res)
2971
2690
 
2972
2691
  async def create_reversal_async(
2973
2692
  self,
@@ -3080,46 +2799,33 @@ class Transfers(BaseSDK):
3080
2799
  response_data: Any = None
3081
2800
  if utils.match_response(http_res, ["200", "202"], "application/json"):
3082
2801
  return operations.CreateReversalResponse(
3083
- result=utils.unmarshal_json(http_res.text, components.Reversal),
2802
+ result=utils.unmarshal_json_response(components.Reversal, http_res),
3084
2803
  headers=utils.get_response_headers(http_res.headers),
3085
2804
  )
3086
2805
  if utils.match_response(http_res, ["400", "409"], "application/json"):
3087
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
3088
- raise errors.GenericError(data=response_data)
2806
+ response_data = utils.unmarshal_json_response(
2807
+ errors.GenericErrorData, http_res
2808
+ )
2809
+ raise errors.GenericError(response_data, http_res)
3089
2810
  if utils.match_response(http_res, "422", "application/json"):
3090
- response_data = utils.unmarshal_json(
3091
- http_res.text, errors.ReversalValidationErrorData
2811
+ response_data = utils.unmarshal_json_response(
2812
+ errors.ReversalValidationErrorData, http_res
3092
2813
  )
3093
- raise errors.ReversalValidationError(data=response_data)
2814
+ raise errors.ReversalValidationError(response_data, http_res)
3094
2815
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
3095
2816
  http_res_text = await utils.stream_to_text_async(http_res)
3096
- raise errors.APIError(
3097
- "API error occurred", http_res.status_code, http_res_text, http_res
3098
- )
2817
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3099
2818
  if utils.match_response(http_res, ["500", "504"], "*"):
3100
2819
  http_res_text = await utils.stream_to_text_async(http_res)
3101
- raise errors.APIError(
3102
- "API error occurred", http_res.status_code, http_res_text, http_res
3103
- )
2820
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3104
2821
  if utils.match_response(http_res, "4XX", "*"):
3105
2822
  http_res_text = await utils.stream_to_text_async(http_res)
3106
- raise errors.APIError(
3107
- "API error occurred", http_res.status_code, http_res_text, http_res
3108
- )
2823
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3109
2824
  if utils.match_response(http_res, "5XX", "*"):
3110
2825
  http_res_text = await utils.stream_to_text_async(http_res)
3111
- raise errors.APIError(
3112
- "API error occurred", http_res.status_code, http_res_text, http_res
3113
- )
2826
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3114
2827
 
3115
- content_type = http_res.headers.get("Content-Type")
3116
- http_res_text = await utils.stream_to_text_async(http_res)
3117
- raise errors.APIError(
3118
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3119
- http_res.status_code,
3120
- http_res_text,
3121
- http_res,
3122
- )
2828
+ raise errors.APIError("Unexpected response received", http_res)
3123
2829
 
3124
2830
  def generate_options(
3125
2831
  self,
@@ -3232,46 +2938,35 @@ class Transfers(BaseSDK):
3232
2938
  response_data: Any = None
3233
2939
  if utils.match_response(http_res, "200", "application/json"):
3234
2940
  return operations.CreateTransferOptionsResponse(
3235
- result=utils.unmarshal_json(http_res.text, components.TransferOptions),
2941
+ result=utils.unmarshal_json_response(
2942
+ components.TransferOptions, http_res
2943
+ ),
3236
2944
  headers=utils.get_response_headers(http_res.headers),
3237
2945
  )
3238
2946
  if utils.match_response(http_res, "400", "application/json"):
3239
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
3240
- raise errors.GenericError(data=response_data)
2947
+ response_data = utils.unmarshal_json_response(
2948
+ errors.GenericErrorData, http_res
2949
+ )
2950
+ raise errors.GenericError(response_data, http_res)
3241
2951
  if utils.match_response(http_res, "422", "application/json"):
3242
- response_data = utils.unmarshal_json(
3243
- http_res.text, errors.TransferOptionsValidationErrorData
2952
+ response_data = utils.unmarshal_json_response(
2953
+ errors.TransferOptionsValidationErrorData, http_res
3244
2954
  )
3245
- raise errors.TransferOptionsValidationError(data=response_data)
2955
+ raise errors.TransferOptionsValidationError(response_data, http_res)
3246
2956
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
3247
2957
  http_res_text = utils.stream_to_text(http_res)
3248
- raise errors.APIError(
3249
- "API error occurred", http_res.status_code, http_res_text, http_res
3250
- )
2958
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3251
2959
  if utils.match_response(http_res, ["500", "504"], "*"):
3252
2960
  http_res_text = utils.stream_to_text(http_res)
3253
- raise errors.APIError(
3254
- "API error occurred", http_res.status_code, http_res_text, http_res
3255
- )
2961
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3256
2962
  if utils.match_response(http_res, "4XX", "*"):
3257
2963
  http_res_text = utils.stream_to_text(http_res)
3258
- raise errors.APIError(
3259
- "API error occurred", http_res.status_code, http_res_text, http_res
3260
- )
2964
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3261
2965
  if utils.match_response(http_res, "5XX", "*"):
3262
2966
  http_res_text = utils.stream_to_text(http_res)
3263
- raise errors.APIError(
3264
- "API error occurred", http_res.status_code, http_res_text, http_res
3265
- )
2967
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3266
2968
 
3267
- content_type = http_res.headers.get("Content-Type")
3268
- http_res_text = utils.stream_to_text(http_res)
3269
- raise errors.APIError(
3270
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3271
- http_res.status_code,
3272
- http_res_text,
3273
- http_res,
3274
- )
2969
+ raise errors.APIError("Unexpected response received", http_res)
3275
2970
 
3276
2971
  async def generate_options_async(
3277
2972
  self,
@@ -3384,43 +3079,32 @@ class Transfers(BaseSDK):
3384
3079
  response_data: Any = None
3385
3080
  if utils.match_response(http_res, "200", "application/json"):
3386
3081
  return operations.CreateTransferOptionsResponse(
3387
- result=utils.unmarshal_json(http_res.text, components.TransferOptions),
3082
+ result=utils.unmarshal_json_response(
3083
+ components.TransferOptions, http_res
3084
+ ),
3388
3085
  headers=utils.get_response_headers(http_res.headers),
3389
3086
  )
3390
3087
  if utils.match_response(http_res, "400", "application/json"):
3391
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
3392
- raise errors.GenericError(data=response_data)
3088
+ response_data = utils.unmarshal_json_response(
3089
+ errors.GenericErrorData, http_res
3090
+ )
3091
+ raise errors.GenericError(response_data, http_res)
3393
3092
  if utils.match_response(http_res, "422", "application/json"):
3394
- response_data = utils.unmarshal_json(
3395
- http_res.text, errors.TransferOptionsValidationErrorData
3093
+ response_data = utils.unmarshal_json_response(
3094
+ errors.TransferOptionsValidationErrorData, http_res
3396
3095
  )
3397
- raise errors.TransferOptionsValidationError(data=response_data)
3096
+ raise errors.TransferOptionsValidationError(response_data, http_res)
3398
3097
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
3399
3098
  http_res_text = await utils.stream_to_text_async(http_res)
3400
- raise errors.APIError(
3401
- "API error occurred", http_res.status_code, http_res_text, http_res
3402
- )
3099
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3403
3100
  if utils.match_response(http_res, ["500", "504"], "*"):
3404
3101
  http_res_text = await utils.stream_to_text_async(http_res)
3405
- raise errors.APIError(
3406
- "API error occurred", http_res.status_code, http_res_text, http_res
3407
- )
3102
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3408
3103
  if utils.match_response(http_res, "4XX", "*"):
3409
3104
  http_res_text = await utils.stream_to_text_async(http_res)
3410
- raise errors.APIError(
3411
- "API error occurred", http_res.status_code, http_res_text, http_res
3412
- )
3105
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3413
3106
  if utils.match_response(http_res, "5XX", "*"):
3414
3107
  http_res_text = await utils.stream_to_text_async(http_res)
3415
- raise errors.APIError(
3416
- "API error occurred", http_res.status_code, http_res_text, http_res
3417
- )
3108
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3418
3109
 
3419
- content_type = http_res.headers.get("Content-Type")
3420
- http_res_text = await utils.stream_to_text_async(http_res)
3421
- raise errors.APIError(
3422
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3423
- http_res.status_code,
3424
- http_res_text,
3425
- http_res,
3426
- )
3110
+ raise errors.APIError("Unexpected response received", http_res)