moovio_sdk 0.12.0__py3-none-any.whl → 0.13.0__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.0.dist-info}/METADATA +103 -28
  98. {moovio_sdk-0.12.0.dist-info → moovio_sdk-0.13.0.dist-info}/RECORD +99 -80
  99. {moovio_sdk-0.12.0.dist-info → moovio_sdk-0.13.0.dist-info}/WHEEL +0 -0
moovio_sdk/disputes.py CHANGED
@@ -145,41 +145,30 @@ class Disputes(BaseSDK):
145
145
  response_data: Any = None
146
146
  if utils.match_response(http_res, "200", "application/json"):
147
147
  return operations.ListDisputesResponse(
148
- result=utils.unmarshal_json(http_res.text, List[components.Dispute]),
148
+ result=utils.unmarshal_json_response(
149
+ List[components.Dispute], http_res
150
+ ),
149
151
  headers=utils.get_response_headers(http_res.headers),
150
152
  )
151
153
  if utils.match_response(http_res, ["400", "409"], "application/json"):
152
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
153
- raise errors.GenericError(data=response_data)
154
+ response_data = utils.unmarshal_json_response(
155
+ errors.GenericErrorData, http_res
156
+ )
157
+ raise errors.GenericError(response_data, http_res)
154
158
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
155
159
  http_res_text = utils.stream_to_text(http_res)
156
- raise errors.APIError(
157
- "API error occurred", http_res.status_code, http_res_text, http_res
158
- )
160
+ raise errors.APIError("API error occurred", http_res, http_res_text)
159
161
  if utils.match_response(http_res, ["500", "504"], "*"):
160
162
  http_res_text = utils.stream_to_text(http_res)
161
- raise errors.APIError(
162
- "API error occurred", http_res.status_code, http_res_text, http_res
163
- )
163
+ raise errors.APIError("API error occurred", http_res, http_res_text)
164
164
  if utils.match_response(http_res, "4XX", "*"):
165
165
  http_res_text = utils.stream_to_text(http_res)
166
- raise errors.APIError(
167
- "API error occurred", http_res.status_code, http_res_text, http_res
168
- )
166
+ raise errors.APIError("API error occurred", http_res, http_res_text)
169
167
  if utils.match_response(http_res, "5XX", "*"):
170
168
  http_res_text = utils.stream_to_text(http_res)
171
- raise errors.APIError(
172
- "API error occurred", http_res.status_code, http_res_text, http_res
173
- )
169
+ raise errors.APIError("API error occurred", http_res, http_res_text)
174
170
 
175
- content_type = http_res.headers.get("Content-Type")
176
- http_res_text = utils.stream_to_text(http_res)
177
- raise errors.APIError(
178
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
179
- http_res.status_code,
180
- http_res_text,
181
- http_res,
182
- )
171
+ raise errors.APIError("Unexpected response received", http_res)
183
172
 
184
173
  async def list_async(
185
174
  self,
@@ -308,41 +297,30 @@ class Disputes(BaseSDK):
308
297
  response_data: Any = None
309
298
  if utils.match_response(http_res, "200", "application/json"):
310
299
  return operations.ListDisputesResponse(
311
- result=utils.unmarshal_json(http_res.text, List[components.Dispute]),
300
+ result=utils.unmarshal_json_response(
301
+ List[components.Dispute], http_res
302
+ ),
312
303
  headers=utils.get_response_headers(http_res.headers),
313
304
  )
314
305
  if utils.match_response(http_res, ["400", "409"], "application/json"):
315
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
316
- raise errors.GenericError(data=response_data)
306
+ response_data = utils.unmarshal_json_response(
307
+ errors.GenericErrorData, http_res
308
+ )
309
+ raise errors.GenericError(response_data, http_res)
317
310
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
318
311
  http_res_text = await utils.stream_to_text_async(http_res)
319
- raise errors.APIError(
320
- "API error occurred", http_res.status_code, http_res_text, http_res
321
- )
312
+ raise errors.APIError("API error occurred", http_res, http_res_text)
322
313
  if utils.match_response(http_res, ["500", "504"], "*"):
323
314
  http_res_text = await utils.stream_to_text_async(http_res)
324
- raise errors.APIError(
325
- "API error occurred", http_res.status_code, http_res_text, http_res
326
- )
315
+ raise errors.APIError("API error occurred", http_res, http_res_text)
327
316
  if utils.match_response(http_res, "4XX", "*"):
328
317
  http_res_text = await utils.stream_to_text_async(http_res)
329
- raise errors.APIError(
330
- "API error occurred", http_res.status_code, http_res_text, http_res
331
- )
318
+ raise errors.APIError("API error occurred", http_res, http_res_text)
332
319
  if utils.match_response(http_res, "5XX", "*"):
333
320
  http_res_text = await utils.stream_to_text_async(http_res)
334
- raise errors.APIError(
335
- "API error occurred", http_res.status_code, http_res_text, http_res
336
- )
321
+ raise errors.APIError("API error occurred", http_res, http_res_text)
337
322
 
338
- content_type = http_res.headers.get("Content-Type")
339
- http_res_text = await utils.stream_to_text_async(http_res)
340
- raise errors.APIError(
341
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
342
- http_res.status_code,
343
- http_res_text,
344
- http_res,
345
- )
323
+ raise errors.APIError("Unexpected response received", http_res)
346
324
 
347
325
  def get(
348
326
  self,
@@ -427,38 +405,23 @@ class Disputes(BaseSDK):
427
405
 
428
406
  if utils.match_response(http_res, "200", "application/json"):
429
407
  return operations.GetDisputeResponse(
430
- result=utils.unmarshal_json(http_res.text, components.Dispute),
408
+ result=utils.unmarshal_json_response(components.Dispute, http_res),
431
409
  headers=utils.get_response_headers(http_res.headers),
432
410
  )
433
411
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
434
412
  http_res_text = utils.stream_to_text(http_res)
435
- raise errors.APIError(
436
- "API error occurred", http_res.status_code, http_res_text, http_res
437
- )
413
+ raise errors.APIError("API error occurred", http_res, http_res_text)
438
414
  if utils.match_response(http_res, ["500", "504"], "*"):
439
415
  http_res_text = utils.stream_to_text(http_res)
440
- raise errors.APIError(
441
- "API error occurred", http_res.status_code, http_res_text, http_res
442
- )
416
+ raise errors.APIError("API error occurred", http_res, http_res_text)
443
417
  if utils.match_response(http_res, "4XX", "*"):
444
418
  http_res_text = utils.stream_to_text(http_res)
445
- raise errors.APIError(
446
- "API error occurred", http_res.status_code, http_res_text, http_res
447
- )
419
+ raise errors.APIError("API error occurred", http_res, http_res_text)
448
420
  if utils.match_response(http_res, "5XX", "*"):
449
421
  http_res_text = utils.stream_to_text(http_res)
450
- raise errors.APIError(
451
- "API error occurred", http_res.status_code, http_res_text, http_res
452
- )
422
+ raise errors.APIError("API error occurred", http_res, http_res_text)
453
423
 
454
- content_type = http_res.headers.get("Content-Type")
455
- http_res_text = utils.stream_to_text(http_res)
456
- raise errors.APIError(
457
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
458
- http_res.status_code,
459
- http_res_text,
460
- http_res,
461
- )
424
+ raise errors.APIError("Unexpected response received", http_res)
462
425
 
463
426
  async def get_async(
464
427
  self,
@@ -543,38 +506,23 @@ class Disputes(BaseSDK):
543
506
 
544
507
  if utils.match_response(http_res, "200", "application/json"):
545
508
  return operations.GetDisputeResponse(
546
- result=utils.unmarshal_json(http_res.text, components.Dispute),
509
+ result=utils.unmarshal_json_response(components.Dispute, http_res),
547
510
  headers=utils.get_response_headers(http_res.headers),
548
511
  )
549
512
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
550
513
  http_res_text = await utils.stream_to_text_async(http_res)
551
- raise errors.APIError(
552
- "API error occurred", http_res.status_code, http_res_text, http_res
553
- )
514
+ raise errors.APIError("API error occurred", http_res, http_res_text)
554
515
  if utils.match_response(http_res, ["500", "504"], "*"):
555
516
  http_res_text = await utils.stream_to_text_async(http_res)
556
- raise errors.APIError(
557
- "API error occurred", http_res.status_code, http_res_text, http_res
558
- )
517
+ raise errors.APIError("API error occurred", http_res, http_res_text)
559
518
  if utils.match_response(http_res, "4XX", "*"):
560
519
  http_res_text = await utils.stream_to_text_async(http_res)
561
- raise errors.APIError(
562
- "API error occurred", http_res.status_code, http_res_text, http_res
563
- )
520
+ raise errors.APIError("API error occurred", http_res, http_res_text)
564
521
  if utils.match_response(http_res, "5XX", "*"):
565
522
  http_res_text = await utils.stream_to_text_async(http_res)
566
- raise errors.APIError(
567
- "API error occurred", http_res.status_code, http_res_text, http_res
568
- )
523
+ raise errors.APIError("API error occurred", http_res, http_res_text)
569
524
 
570
- content_type = http_res.headers.get("Content-Type")
571
- http_res_text = await utils.stream_to_text_async(http_res)
572
- raise errors.APIError(
573
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
574
- http_res.status_code,
575
- http_res_text,
576
- http_res,
577
- )
525
+ raise errors.APIError("Unexpected response received", http_res)
578
526
 
579
527
  def accept(
580
528
  self,
@@ -671,41 +619,28 @@ class Disputes(BaseSDK):
671
619
  response_data: Any = None
672
620
  if utils.match_response(http_res, "200", "application/json"):
673
621
  return operations.AcceptDisputeResponse(
674
- result=utils.unmarshal_json(http_res.text, components.Dispute),
622
+ result=utils.unmarshal_json_response(components.Dispute, http_res),
675
623
  headers=utils.get_response_headers(http_res.headers),
676
624
  )
677
625
  if utils.match_response(http_res, ["400", "409"], "application/json"):
678
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
679
- raise errors.GenericError(data=response_data)
626
+ response_data = utils.unmarshal_json_response(
627
+ errors.GenericErrorData, http_res
628
+ )
629
+ raise errors.GenericError(response_data, http_res)
680
630
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
681
631
  http_res_text = utils.stream_to_text(http_res)
682
- raise errors.APIError(
683
- "API error occurred", http_res.status_code, http_res_text, http_res
684
- )
632
+ raise errors.APIError("API error occurred", http_res, http_res_text)
685
633
  if utils.match_response(http_res, ["500", "504"], "*"):
686
634
  http_res_text = utils.stream_to_text(http_res)
687
- raise errors.APIError(
688
- "API error occurred", http_res.status_code, http_res_text, http_res
689
- )
635
+ raise errors.APIError("API error occurred", http_res, http_res_text)
690
636
  if utils.match_response(http_res, "4XX", "*"):
691
637
  http_res_text = utils.stream_to_text(http_res)
692
- raise errors.APIError(
693
- "API error occurred", http_res.status_code, http_res_text, http_res
694
- )
638
+ raise errors.APIError("API error occurred", http_res, http_res_text)
695
639
  if utils.match_response(http_res, "5XX", "*"):
696
640
  http_res_text = utils.stream_to_text(http_res)
697
- raise errors.APIError(
698
- "API error occurred", http_res.status_code, http_res_text, http_res
699
- )
641
+ raise errors.APIError("API error occurred", http_res, http_res_text)
700
642
 
701
- content_type = http_res.headers.get("Content-Type")
702
- http_res_text = utils.stream_to_text(http_res)
703
- raise errors.APIError(
704
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
705
- http_res.status_code,
706
- http_res_text,
707
- http_res,
708
- )
643
+ raise errors.APIError("Unexpected response received", http_res)
709
644
 
710
645
  async def accept_async(
711
646
  self,
@@ -802,41 +737,28 @@ class Disputes(BaseSDK):
802
737
  response_data: Any = None
803
738
  if utils.match_response(http_res, "200", "application/json"):
804
739
  return operations.AcceptDisputeResponse(
805
- result=utils.unmarshal_json(http_res.text, components.Dispute),
740
+ result=utils.unmarshal_json_response(components.Dispute, http_res),
806
741
  headers=utils.get_response_headers(http_res.headers),
807
742
  )
808
743
  if utils.match_response(http_res, ["400", "409"], "application/json"):
809
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
810
- raise errors.GenericError(data=response_data)
744
+ response_data = utils.unmarshal_json_response(
745
+ errors.GenericErrorData, http_res
746
+ )
747
+ raise errors.GenericError(response_data, http_res)
811
748
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
812
749
  http_res_text = await utils.stream_to_text_async(http_res)
813
- raise errors.APIError(
814
- "API error occurred", http_res.status_code, http_res_text, http_res
815
- )
750
+ raise errors.APIError("API error occurred", http_res, http_res_text)
816
751
  if utils.match_response(http_res, ["500", "504"], "*"):
817
752
  http_res_text = await utils.stream_to_text_async(http_res)
818
- raise errors.APIError(
819
- "API error occurred", http_res.status_code, http_res_text, http_res
820
- )
753
+ raise errors.APIError("API error occurred", http_res, http_res_text)
821
754
  if utils.match_response(http_res, "4XX", "*"):
822
755
  http_res_text = await utils.stream_to_text_async(http_res)
823
- raise errors.APIError(
824
- "API error occurred", http_res.status_code, http_res_text, http_res
825
- )
756
+ raise errors.APIError("API error occurred", http_res, http_res_text)
826
757
  if utils.match_response(http_res, "5XX", "*"):
827
758
  http_res_text = await utils.stream_to_text_async(http_res)
828
- raise errors.APIError(
829
- "API error occurred", http_res.status_code, http_res_text, http_res
830
- )
759
+ raise errors.APIError("API error occurred", http_res, http_res_text)
831
760
 
832
- content_type = http_res.headers.get("Content-Type")
833
- http_res_text = await utils.stream_to_text_async(http_res)
834
- raise errors.APIError(
835
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
836
- http_res.status_code,
837
- http_res_text,
838
- http_res,
839
- )
761
+ raise errors.APIError("Unexpected response received", http_res)
840
762
 
841
763
  def list_evidence(
842
764
  self,
@@ -921,40 +843,25 @@ class Disputes(BaseSDK):
921
843
 
922
844
  if utils.match_response(http_res, "200", "application/json"):
923
845
  return operations.ListDisputeEvidenceResponse(
924
- result=utils.unmarshal_json(
925
- http_res.text, List[components.DisputeEvidenceResponse]
846
+ result=utils.unmarshal_json_response(
847
+ List[components.DisputeEvidenceResponse], http_res
926
848
  ),
927
849
  headers=utils.get_response_headers(http_res.headers),
928
850
  )
929
851
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
930
852
  http_res_text = utils.stream_to_text(http_res)
931
- raise errors.APIError(
932
- "API error occurred", http_res.status_code, http_res_text, http_res
933
- )
853
+ raise errors.APIError("API error occurred", http_res, http_res_text)
934
854
  if utils.match_response(http_res, ["500", "504"], "*"):
935
855
  http_res_text = utils.stream_to_text(http_res)
936
- raise errors.APIError(
937
- "API error occurred", http_res.status_code, http_res_text, http_res
938
- )
856
+ raise errors.APIError("API error occurred", http_res, http_res_text)
939
857
  if utils.match_response(http_res, "4XX", "*"):
940
858
  http_res_text = utils.stream_to_text(http_res)
941
- raise errors.APIError(
942
- "API error occurred", http_res.status_code, http_res_text, http_res
943
- )
859
+ raise errors.APIError("API error occurred", http_res, http_res_text)
944
860
  if utils.match_response(http_res, "5XX", "*"):
945
861
  http_res_text = utils.stream_to_text(http_res)
946
- raise errors.APIError(
947
- "API error occurred", http_res.status_code, http_res_text, http_res
948
- )
862
+ raise errors.APIError("API error occurred", http_res, http_res_text)
949
863
 
950
- content_type = http_res.headers.get("Content-Type")
951
- http_res_text = utils.stream_to_text(http_res)
952
- raise errors.APIError(
953
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
954
- http_res.status_code,
955
- http_res_text,
956
- http_res,
957
- )
864
+ raise errors.APIError("Unexpected response received", http_res)
958
865
 
959
866
  async def list_evidence_async(
960
867
  self,
@@ -1039,40 +946,25 @@ class Disputes(BaseSDK):
1039
946
 
1040
947
  if utils.match_response(http_res, "200", "application/json"):
1041
948
  return operations.ListDisputeEvidenceResponse(
1042
- result=utils.unmarshal_json(
1043
- http_res.text, List[components.DisputeEvidenceResponse]
949
+ result=utils.unmarshal_json_response(
950
+ List[components.DisputeEvidenceResponse], http_res
1044
951
  ),
1045
952
  headers=utils.get_response_headers(http_res.headers),
1046
953
  )
1047
954
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
1048
955
  http_res_text = await utils.stream_to_text_async(http_res)
1049
- raise errors.APIError(
1050
- "API error occurred", http_res.status_code, http_res_text, http_res
1051
- )
956
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1052
957
  if utils.match_response(http_res, ["500", "504"], "*"):
1053
958
  http_res_text = await utils.stream_to_text_async(http_res)
1054
- raise errors.APIError(
1055
- "API error occurred", http_res.status_code, http_res_text, http_res
1056
- )
959
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1057
960
  if utils.match_response(http_res, "4XX", "*"):
1058
961
  http_res_text = await utils.stream_to_text_async(http_res)
1059
- raise errors.APIError(
1060
- "API error occurred", http_res.status_code, http_res_text, http_res
1061
- )
962
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1062
963
  if utils.match_response(http_res, "5XX", "*"):
1063
964
  http_res_text = await utils.stream_to_text_async(http_res)
1064
- raise errors.APIError(
1065
- "API error occurred", http_res.status_code, http_res_text, http_res
1066
- )
965
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1067
966
 
1068
- content_type = http_res.headers.get("Content-Type")
1069
- http_res_text = await utils.stream_to_text_async(http_res)
1070
- raise errors.APIError(
1071
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1072
- http_res.status_code,
1073
- http_res_text,
1074
- http_res,
1075
- )
967
+ raise errors.APIError("Unexpected response received", http_res)
1076
968
 
1077
969
  def upload_evidence_file(
1078
970
  self,
@@ -1185,48 +1077,35 @@ class Disputes(BaseSDK):
1185
1077
  response_data: Any = None
1186
1078
  if utils.match_response(http_res, "201", "application/json"):
1187
1079
  return operations.UploadDisputeEvidenceFileResponse(
1188
- result=utils.unmarshal_json(
1189
- http_res.text, components.EvidenceUploadResponse
1080
+ result=utils.unmarshal_json_response(
1081
+ components.EvidenceUploadResponse, http_res
1190
1082
  ),
1191
1083
  headers=utils.get_response_headers(http_res.headers),
1192
1084
  )
1193
1085
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1194
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1195
- raise errors.GenericError(data=response_data)
1086
+ response_data = utils.unmarshal_json_response(
1087
+ errors.GenericErrorData, http_res
1088
+ )
1089
+ raise errors.GenericError(response_data, http_res)
1196
1090
  if utils.match_response(http_res, "422", "application/json"):
1197
- response_data = utils.unmarshal_json(
1198
- http_res.text, errors.FileUploadValidationErrorData
1091
+ response_data = utils.unmarshal_json_response(
1092
+ errors.FileUploadValidationErrorData, http_res
1199
1093
  )
1200
- raise errors.FileUploadValidationError(data=response_data)
1094
+ raise errors.FileUploadValidationError(response_data, http_res)
1201
1095
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1202
1096
  http_res_text = utils.stream_to_text(http_res)
1203
- raise errors.APIError(
1204
- "API error occurred", http_res.status_code, http_res_text, http_res
1205
- )
1097
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1206
1098
  if utils.match_response(http_res, ["500", "504"], "*"):
1207
1099
  http_res_text = utils.stream_to_text(http_res)
1208
- raise errors.APIError(
1209
- "API error occurred", http_res.status_code, http_res_text, http_res
1210
- )
1100
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1211
1101
  if utils.match_response(http_res, "4XX", "*"):
1212
1102
  http_res_text = utils.stream_to_text(http_res)
1213
- raise errors.APIError(
1214
- "API error occurred", http_res.status_code, http_res_text, http_res
1215
- )
1103
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1216
1104
  if utils.match_response(http_res, "5XX", "*"):
1217
1105
  http_res_text = utils.stream_to_text(http_res)
1218
- raise errors.APIError(
1219
- "API error occurred", http_res.status_code, http_res_text, http_res
1220
- )
1106
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1221
1107
 
1222
- content_type = http_res.headers.get("Content-Type")
1223
- http_res_text = utils.stream_to_text(http_res)
1224
- raise errors.APIError(
1225
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1226
- http_res.status_code,
1227
- http_res_text,
1228
- http_res,
1229
- )
1108
+ raise errors.APIError("Unexpected response received", http_res)
1230
1109
 
1231
1110
  async def upload_evidence_file_async(
1232
1111
  self,
@@ -1339,48 +1218,35 @@ class Disputes(BaseSDK):
1339
1218
  response_data: Any = None
1340
1219
  if utils.match_response(http_res, "201", "application/json"):
1341
1220
  return operations.UploadDisputeEvidenceFileResponse(
1342
- result=utils.unmarshal_json(
1343
- http_res.text, components.EvidenceUploadResponse
1221
+ result=utils.unmarshal_json_response(
1222
+ components.EvidenceUploadResponse, http_res
1344
1223
  ),
1345
1224
  headers=utils.get_response_headers(http_res.headers),
1346
1225
  )
1347
1226
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1348
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1349
- raise errors.GenericError(data=response_data)
1227
+ response_data = utils.unmarshal_json_response(
1228
+ errors.GenericErrorData, http_res
1229
+ )
1230
+ raise errors.GenericError(response_data, http_res)
1350
1231
  if utils.match_response(http_res, "422", "application/json"):
1351
- response_data = utils.unmarshal_json(
1352
- http_res.text, errors.FileUploadValidationErrorData
1232
+ response_data = utils.unmarshal_json_response(
1233
+ errors.FileUploadValidationErrorData, http_res
1353
1234
  )
1354
- raise errors.FileUploadValidationError(data=response_data)
1235
+ raise errors.FileUploadValidationError(response_data, http_res)
1355
1236
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1356
1237
  http_res_text = await utils.stream_to_text_async(http_res)
1357
- raise errors.APIError(
1358
- "API error occurred", http_res.status_code, http_res_text, http_res
1359
- )
1238
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1360
1239
  if utils.match_response(http_res, ["500", "504"], "*"):
1361
1240
  http_res_text = await utils.stream_to_text_async(http_res)
1362
- raise errors.APIError(
1363
- "API error occurred", http_res.status_code, http_res_text, http_res
1364
- )
1241
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1365
1242
  if utils.match_response(http_res, "4XX", "*"):
1366
1243
  http_res_text = await utils.stream_to_text_async(http_res)
1367
- raise errors.APIError(
1368
- "API error occurred", http_res.status_code, http_res_text, http_res
1369
- )
1244
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1370
1245
  if utils.match_response(http_res, "5XX", "*"):
1371
1246
  http_res_text = await utils.stream_to_text_async(http_res)
1372
- raise errors.APIError(
1373
- "API error occurred", http_res.status_code, http_res_text, http_res
1374
- )
1247
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1375
1248
 
1376
- content_type = http_res.headers.get("Content-Type")
1377
- http_res_text = await utils.stream_to_text_async(http_res)
1378
- raise errors.APIError(
1379
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1380
- http_res.status_code,
1381
- http_res_text,
1382
- http_res,
1383
- )
1249
+ raise errors.APIError("Unexpected response received", http_res)
1384
1250
 
1385
1251
  def upload_evidence_text(
1386
1252
  self,
@@ -1492,43 +1358,30 @@ class Disputes(BaseSDK):
1492
1358
  response_data: Any = None
1493
1359
  if utils.match_response(http_res, "201", "application/json"):
1494
1360
  return operations.UploadDisputeEvidenceTextResponse(
1495
- result=utils.unmarshal_json(
1496
- http_res.text, components.EvidenceTextResponse
1361
+ result=utils.unmarshal_json_response(
1362
+ components.EvidenceTextResponse, http_res
1497
1363
  ),
1498
1364
  headers=utils.get_response_headers(http_res.headers),
1499
1365
  )
1500
1366
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1501
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1502
- raise errors.GenericError(data=response_data)
1367
+ response_data = utils.unmarshal_json_response(
1368
+ errors.GenericErrorData, http_res
1369
+ )
1370
+ raise errors.GenericError(response_data, http_res)
1503
1371
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1504
1372
  http_res_text = utils.stream_to_text(http_res)
1505
- raise errors.APIError(
1506
- "API error occurred", http_res.status_code, http_res_text, http_res
1507
- )
1373
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1508
1374
  if utils.match_response(http_res, ["500", "504"], "*"):
1509
1375
  http_res_text = utils.stream_to_text(http_res)
1510
- raise errors.APIError(
1511
- "API error occurred", http_res.status_code, http_res_text, http_res
1512
- )
1376
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1513
1377
  if utils.match_response(http_res, "4XX", "*"):
1514
1378
  http_res_text = utils.stream_to_text(http_res)
1515
- raise errors.APIError(
1516
- "API error occurred", http_res.status_code, http_res_text, http_res
1517
- )
1379
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1518
1380
  if utils.match_response(http_res, "5XX", "*"):
1519
1381
  http_res_text = utils.stream_to_text(http_res)
1520
- raise errors.APIError(
1521
- "API error occurred", http_res.status_code, http_res_text, http_res
1522
- )
1382
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1523
1383
 
1524
- content_type = http_res.headers.get("Content-Type")
1525
- http_res_text = utils.stream_to_text(http_res)
1526
- raise errors.APIError(
1527
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1528
- http_res.status_code,
1529
- http_res_text,
1530
- http_res,
1531
- )
1384
+ raise errors.APIError("Unexpected response received", http_res)
1532
1385
 
1533
1386
  async def upload_evidence_text_async(
1534
1387
  self,
@@ -1640,43 +1493,30 @@ class Disputes(BaseSDK):
1640
1493
  response_data: Any = None
1641
1494
  if utils.match_response(http_res, "201", "application/json"):
1642
1495
  return operations.UploadDisputeEvidenceTextResponse(
1643
- result=utils.unmarshal_json(
1644
- http_res.text, components.EvidenceTextResponse
1496
+ result=utils.unmarshal_json_response(
1497
+ components.EvidenceTextResponse, http_res
1645
1498
  ),
1646
1499
  headers=utils.get_response_headers(http_res.headers),
1647
1500
  )
1648
1501
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1649
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1650
- raise errors.GenericError(data=response_data)
1502
+ response_data = utils.unmarshal_json_response(
1503
+ errors.GenericErrorData, http_res
1504
+ )
1505
+ raise errors.GenericError(response_data, http_res)
1651
1506
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1652
1507
  http_res_text = await utils.stream_to_text_async(http_res)
1653
- raise errors.APIError(
1654
- "API error occurred", http_res.status_code, http_res_text, http_res
1655
- )
1508
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1656
1509
  if utils.match_response(http_res, ["500", "504"], "*"):
1657
1510
  http_res_text = await utils.stream_to_text_async(http_res)
1658
- raise errors.APIError(
1659
- "API error occurred", http_res.status_code, http_res_text, http_res
1660
- )
1511
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1661
1512
  if utils.match_response(http_res, "4XX", "*"):
1662
1513
  http_res_text = await utils.stream_to_text_async(http_res)
1663
- raise errors.APIError(
1664
- "API error occurred", http_res.status_code, http_res_text, http_res
1665
- )
1514
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1666
1515
  if utils.match_response(http_res, "5XX", "*"):
1667
1516
  http_res_text = await utils.stream_to_text_async(http_res)
1668
- raise errors.APIError(
1669
- "API error occurred", http_res.status_code, http_res_text, http_res
1670
- )
1517
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1671
1518
 
1672
- content_type = http_res.headers.get("Content-Type")
1673
- http_res_text = await utils.stream_to_text_async(http_res)
1674
- raise errors.APIError(
1675
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1676
- http_res.status_code,
1677
- http_res_text,
1678
- http_res,
1679
- )
1519
+ raise errors.APIError("Unexpected response received", http_res)
1680
1520
 
1681
1521
  def submit_evidence(
1682
1522
  self,
@@ -1776,41 +1616,28 @@ class Disputes(BaseSDK):
1776
1616
  response_data: Any = None
1777
1617
  if utils.match_response(http_res, "200", "application/json"):
1778
1618
  return operations.SubmitDisputeEvidenceResponse(
1779
- result=utils.unmarshal_json(http_res.text, components.Dispute),
1619
+ result=utils.unmarshal_json_response(components.Dispute, http_res),
1780
1620
  headers=utils.get_response_headers(http_res.headers),
1781
1621
  )
1782
1622
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1783
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1784
- raise errors.GenericError(data=response_data)
1623
+ response_data = utils.unmarshal_json_response(
1624
+ errors.GenericErrorData, http_res
1625
+ )
1626
+ raise errors.GenericError(response_data, http_res)
1785
1627
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1786
1628
  http_res_text = utils.stream_to_text(http_res)
1787
- raise errors.APIError(
1788
- "API error occurred", http_res.status_code, http_res_text, http_res
1789
- )
1629
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1790
1630
  if utils.match_response(http_res, ["500", "504"], "*"):
1791
1631
  http_res_text = utils.stream_to_text(http_res)
1792
- raise errors.APIError(
1793
- "API error occurred", http_res.status_code, http_res_text, http_res
1794
- )
1632
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1795
1633
  if utils.match_response(http_res, "4XX", "*"):
1796
1634
  http_res_text = utils.stream_to_text(http_res)
1797
- raise errors.APIError(
1798
- "API error occurred", http_res.status_code, http_res_text, http_res
1799
- )
1635
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1800
1636
  if utils.match_response(http_res, "5XX", "*"):
1801
1637
  http_res_text = utils.stream_to_text(http_res)
1802
- raise errors.APIError(
1803
- "API error occurred", http_res.status_code, http_res_text, http_res
1804
- )
1638
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1805
1639
 
1806
- content_type = http_res.headers.get("Content-Type")
1807
- http_res_text = utils.stream_to_text(http_res)
1808
- raise errors.APIError(
1809
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1810
- http_res.status_code,
1811
- http_res_text,
1812
- http_res,
1813
- )
1640
+ raise errors.APIError("Unexpected response received", http_res)
1814
1641
 
1815
1642
  async def submit_evidence_async(
1816
1643
  self,
@@ -1910,41 +1737,28 @@ class Disputes(BaseSDK):
1910
1737
  response_data: Any = None
1911
1738
  if utils.match_response(http_res, "200", "application/json"):
1912
1739
  return operations.SubmitDisputeEvidenceResponse(
1913
- result=utils.unmarshal_json(http_res.text, components.Dispute),
1740
+ result=utils.unmarshal_json_response(components.Dispute, http_res),
1914
1741
  headers=utils.get_response_headers(http_res.headers),
1915
1742
  )
1916
1743
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1917
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1918
- raise errors.GenericError(data=response_data)
1744
+ response_data = utils.unmarshal_json_response(
1745
+ errors.GenericErrorData, http_res
1746
+ )
1747
+ raise errors.GenericError(response_data, http_res)
1919
1748
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1920
1749
  http_res_text = await utils.stream_to_text_async(http_res)
1921
- raise errors.APIError(
1922
- "API error occurred", http_res.status_code, http_res_text, http_res
1923
- )
1750
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1924
1751
  if utils.match_response(http_res, ["500", "504"], "*"):
1925
1752
  http_res_text = await utils.stream_to_text_async(http_res)
1926
- raise errors.APIError(
1927
- "API error occurred", http_res.status_code, http_res_text, http_res
1928
- )
1753
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1929
1754
  if utils.match_response(http_res, "4XX", "*"):
1930
1755
  http_res_text = await utils.stream_to_text_async(http_res)
1931
- raise errors.APIError(
1932
- "API error occurred", http_res.status_code, http_res_text, http_res
1933
- )
1756
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1934
1757
  if utils.match_response(http_res, "5XX", "*"):
1935
1758
  http_res_text = await utils.stream_to_text_async(http_res)
1936
- raise errors.APIError(
1937
- "API error occurred", http_res.status_code, http_res_text, http_res
1938
- )
1759
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1939
1760
 
1940
- content_type = http_res.headers.get("Content-Type")
1941
- http_res_text = await utils.stream_to_text_async(http_res)
1942
- raise errors.APIError(
1943
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1944
- http_res.status_code,
1945
- http_res_text,
1946
- http_res,
1947
- )
1761
+ raise errors.APIError("Unexpected response received", http_res)
1948
1762
 
1949
1763
  def get_evidence(
1950
1764
  self,
@@ -2032,40 +1846,25 @@ class Disputes(BaseSDK):
2032
1846
 
2033
1847
  if utils.match_response(http_res, "200", "application/json"):
2034
1848
  return operations.GetDisputeEvidenceResponse(
2035
- result=utils.unmarshal_json(
2036
- http_res.text, components.DisputeEvidenceResponse
1849
+ result=utils.unmarshal_json_response(
1850
+ components.DisputeEvidenceResponse, http_res
2037
1851
  ),
2038
1852
  headers=utils.get_response_headers(http_res.headers),
2039
1853
  )
2040
1854
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2041
1855
  http_res_text = utils.stream_to_text(http_res)
2042
- raise errors.APIError(
2043
- "API error occurred", http_res.status_code, http_res_text, http_res
2044
- )
1856
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2045
1857
  if utils.match_response(http_res, ["500", "504"], "*"):
2046
1858
  http_res_text = utils.stream_to_text(http_res)
2047
- raise errors.APIError(
2048
- "API error occurred", http_res.status_code, http_res_text, http_res
2049
- )
1859
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2050
1860
  if utils.match_response(http_res, "4XX", "*"):
2051
1861
  http_res_text = utils.stream_to_text(http_res)
2052
- raise errors.APIError(
2053
- "API error occurred", http_res.status_code, http_res_text, http_res
2054
- )
1862
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2055
1863
  if utils.match_response(http_res, "5XX", "*"):
2056
1864
  http_res_text = utils.stream_to_text(http_res)
2057
- raise errors.APIError(
2058
- "API error occurred", http_res.status_code, http_res_text, http_res
2059
- )
1865
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2060
1866
 
2061
- content_type = http_res.headers.get("Content-Type")
2062
- http_res_text = utils.stream_to_text(http_res)
2063
- raise errors.APIError(
2064
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2065
- http_res.status_code,
2066
- http_res_text,
2067
- http_res,
2068
- )
1867
+ raise errors.APIError("Unexpected response received", http_res)
2069
1868
 
2070
1869
  async def get_evidence_async(
2071
1870
  self,
@@ -2153,40 +1952,25 @@ class Disputes(BaseSDK):
2153
1952
 
2154
1953
  if utils.match_response(http_res, "200", "application/json"):
2155
1954
  return operations.GetDisputeEvidenceResponse(
2156
- result=utils.unmarshal_json(
2157
- http_res.text, components.DisputeEvidenceResponse
1955
+ result=utils.unmarshal_json_response(
1956
+ components.DisputeEvidenceResponse, http_res
2158
1957
  ),
2159
1958
  headers=utils.get_response_headers(http_res.headers),
2160
1959
  )
2161
1960
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2162
1961
  http_res_text = await utils.stream_to_text_async(http_res)
2163
- raise errors.APIError(
2164
- "API error occurred", http_res.status_code, http_res_text, http_res
2165
- )
1962
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2166
1963
  if utils.match_response(http_res, ["500", "504"], "*"):
2167
1964
  http_res_text = await utils.stream_to_text_async(http_res)
2168
- raise errors.APIError(
2169
- "API error occurred", http_res.status_code, http_res_text, http_res
2170
- )
1965
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2171
1966
  if utils.match_response(http_res, "4XX", "*"):
2172
1967
  http_res_text = await utils.stream_to_text_async(http_res)
2173
- raise errors.APIError(
2174
- "API error occurred", http_res.status_code, http_res_text, http_res
2175
- )
1968
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2176
1969
  if utils.match_response(http_res, "5XX", "*"):
2177
1970
  http_res_text = await utils.stream_to_text_async(http_res)
2178
- raise errors.APIError(
2179
- "API error occurred", http_res.status_code, http_res_text, http_res
2180
- )
1971
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2181
1972
 
2182
- content_type = http_res.headers.get("Content-Type")
2183
- http_res_text = await utils.stream_to_text_async(http_res)
2184
- raise errors.APIError(
2185
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2186
- http_res.status_code,
2187
- http_res_text,
2188
- http_res,
2189
- )
1973
+ raise errors.APIError("Unexpected response received", http_res)
2190
1974
 
2191
1975
  def update_evidence(
2192
1976
  self,
@@ -2296,43 +2080,30 @@ class Disputes(BaseSDK):
2296
2080
  response_data: Any = None
2297
2081
  if utils.match_response(http_res, "200", "application/json"):
2298
2082
  return operations.UpdateDisputeEvidenceResponse(
2299
- result=utils.unmarshal_json(
2300
- http_res.text, components.DisputeEvidenceResponse
2083
+ result=utils.unmarshal_json_response(
2084
+ components.DisputeEvidenceResponse, http_res
2301
2085
  ),
2302
2086
  headers=utils.get_response_headers(http_res.headers),
2303
2087
  )
2304
2088
  if utils.match_response(http_res, "400", "application/json"):
2305
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2306
- raise errors.GenericError(data=response_data)
2089
+ response_data = utils.unmarshal_json_response(
2090
+ errors.GenericErrorData, http_res
2091
+ )
2092
+ raise errors.GenericError(response_data, http_res)
2307
2093
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2308
2094
  http_res_text = utils.stream_to_text(http_res)
2309
- raise errors.APIError(
2310
- "API error occurred", http_res.status_code, http_res_text, http_res
2311
- )
2095
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2312
2096
  if utils.match_response(http_res, ["500", "504"], "*"):
2313
2097
  http_res_text = utils.stream_to_text(http_res)
2314
- raise errors.APIError(
2315
- "API error occurred", http_res.status_code, http_res_text, http_res
2316
- )
2098
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2317
2099
  if utils.match_response(http_res, "4XX", "*"):
2318
2100
  http_res_text = utils.stream_to_text(http_res)
2319
- raise errors.APIError(
2320
- "API error occurred", http_res.status_code, http_res_text, http_res
2321
- )
2101
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2322
2102
  if utils.match_response(http_res, "5XX", "*"):
2323
2103
  http_res_text = utils.stream_to_text(http_res)
2324
- raise errors.APIError(
2325
- "API error occurred", http_res.status_code, http_res_text, http_res
2326
- )
2104
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2327
2105
 
2328
- content_type = http_res.headers.get("Content-Type")
2329
- http_res_text = utils.stream_to_text(http_res)
2330
- raise errors.APIError(
2331
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2332
- http_res.status_code,
2333
- http_res_text,
2334
- http_res,
2335
- )
2106
+ raise errors.APIError("Unexpected response received", http_res)
2336
2107
 
2337
2108
  async def update_evidence_async(
2338
2109
  self,
@@ -2442,43 +2213,30 @@ class Disputes(BaseSDK):
2442
2213
  response_data: Any = None
2443
2214
  if utils.match_response(http_res, "200", "application/json"):
2444
2215
  return operations.UpdateDisputeEvidenceResponse(
2445
- result=utils.unmarshal_json(
2446
- http_res.text, components.DisputeEvidenceResponse
2216
+ result=utils.unmarshal_json_response(
2217
+ components.DisputeEvidenceResponse, http_res
2447
2218
  ),
2448
2219
  headers=utils.get_response_headers(http_res.headers),
2449
2220
  )
2450
2221
  if utils.match_response(http_res, "400", "application/json"):
2451
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2452
- raise errors.GenericError(data=response_data)
2222
+ response_data = utils.unmarshal_json_response(
2223
+ errors.GenericErrorData, http_res
2224
+ )
2225
+ raise errors.GenericError(response_data, http_res)
2453
2226
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2454
2227
  http_res_text = await utils.stream_to_text_async(http_res)
2455
- raise errors.APIError(
2456
- "API error occurred", http_res.status_code, http_res_text, http_res
2457
- )
2228
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2458
2229
  if utils.match_response(http_res, ["500", "504"], "*"):
2459
2230
  http_res_text = await utils.stream_to_text_async(http_res)
2460
- raise errors.APIError(
2461
- "API error occurred", http_res.status_code, http_res_text, http_res
2462
- )
2231
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2463
2232
  if utils.match_response(http_res, "4XX", "*"):
2464
2233
  http_res_text = await utils.stream_to_text_async(http_res)
2465
- raise errors.APIError(
2466
- "API error occurred", http_res.status_code, http_res_text, http_res
2467
- )
2234
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2468
2235
  if utils.match_response(http_res, "5XX", "*"):
2469
2236
  http_res_text = await utils.stream_to_text_async(http_res)
2470
- raise errors.APIError(
2471
- "API error occurred", http_res.status_code, http_res_text, http_res
2472
- )
2237
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2473
2238
 
2474
- content_type = http_res.headers.get("Content-Type")
2475
- http_res_text = await utils.stream_to_text_async(http_res)
2476
- raise errors.APIError(
2477
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2478
- http_res.status_code,
2479
- http_res_text,
2480
- http_res,
2481
- )
2239
+ raise errors.APIError("Unexpected response received", http_res)
2482
2240
 
2483
2241
  def delete_evidence(
2484
2242
  self,
@@ -2580,37 +2338,24 @@ class Disputes(BaseSDK):
2580
2338
  headers=utils.get_response_headers(http_res.headers)
2581
2339
  )
2582
2340
  if utils.match_response(http_res, "409", "application/json"):
2583
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2584
- raise errors.GenericError(data=response_data)
2341
+ response_data = utils.unmarshal_json_response(
2342
+ errors.GenericErrorData, http_res
2343
+ )
2344
+ raise errors.GenericError(response_data, http_res)
2585
2345
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2586
2346
  http_res_text = utils.stream_to_text(http_res)
2587
- raise errors.APIError(
2588
- "API error occurred", http_res.status_code, http_res_text, http_res
2589
- )
2347
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2590
2348
  if utils.match_response(http_res, ["500", "504"], "*"):
2591
2349
  http_res_text = utils.stream_to_text(http_res)
2592
- raise errors.APIError(
2593
- "API error occurred", http_res.status_code, http_res_text, http_res
2594
- )
2350
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2595
2351
  if utils.match_response(http_res, "4XX", "*"):
2596
2352
  http_res_text = utils.stream_to_text(http_res)
2597
- raise errors.APIError(
2598
- "API error occurred", http_res.status_code, http_res_text, http_res
2599
- )
2353
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2600
2354
  if utils.match_response(http_res, "5XX", "*"):
2601
2355
  http_res_text = utils.stream_to_text(http_res)
2602
- raise errors.APIError(
2603
- "API error occurred", http_res.status_code, http_res_text, http_res
2604
- )
2356
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2605
2357
 
2606
- content_type = http_res.headers.get("Content-Type")
2607
- http_res_text = utils.stream_to_text(http_res)
2608
- raise errors.APIError(
2609
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2610
- http_res.status_code,
2611
- http_res_text,
2612
- http_res,
2613
- )
2358
+ raise errors.APIError("Unexpected response received", http_res)
2614
2359
 
2615
2360
  async def delete_evidence_async(
2616
2361
  self,
@@ -2712,37 +2457,24 @@ class Disputes(BaseSDK):
2712
2457
  headers=utils.get_response_headers(http_res.headers)
2713
2458
  )
2714
2459
  if utils.match_response(http_res, "409", "application/json"):
2715
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
2716
- raise errors.GenericError(data=response_data)
2460
+ response_data = utils.unmarshal_json_response(
2461
+ errors.GenericErrorData, http_res
2462
+ )
2463
+ raise errors.GenericError(response_data, http_res)
2717
2464
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2718
2465
  http_res_text = await utils.stream_to_text_async(http_res)
2719
- raise errors.APIError(
2720
- "API error occurred", http_res.status_code, http_res_text, http_res
2721
- )
2466
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2722
2467
  if utils.match_response(http_res, ["500", "504"], "*"):
2723
2468
  http_res_text = await utils.stream_to_text_async(http_res)
2724
- raise errors.APIError(
2725
- "API error occurred", http_res.status_code, http_res_text, http_res
2726
- )
2469
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2727
2470
  if utils.match_response(http_res, "4XX", "*"):
2728
2471
  http_res_text = await utils.stream_to_text_async(http_res)
2729
- raise errors.APIError(
2730
- "API error occurred", http_res.status_code, http_res_text, http_res
2731
- )
2472
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2732
2473
  if utils.match_response(http_res, "5XX", "*"):
2733
2474
  http_res_text = await utils.stream_to_text_async(http_res)
2734
- raise errors.APIError(
2735
- "API error occurred", http_res.status_code, http_res_text, http_res
2736
- )
2475
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2737
2476
 
2738
- content_type = http_res.headers.get("Content-Type")
2739
- http_res_text = await utils.stream_to_text_async(http_res)
2740
- raise errors.APIError(
2741
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2742
- http_res.status_code,
2743
- http_res_text,
2744
- http_res,
2745
- )
2477
+ raise errors.APIError("Unexpected response received", http_res)
2746
2478
 
2747
2479
  def get_evidence_data(
2748
2480
  self,
@@ -2847,33 +2579,19 @@ class Disputes(BaseSDK):
2847
2579
  )
2848
2580
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2849
2581
  http_res_text = utils.stream_to_text(http_res)
2850
- raise errors.APIError(
2851
- "API error occurred", http_res.status_code, http_res_text, http_res
2852
- )
2582
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2853
2583
  if utils.match_response(http_res, ["500", "504"], "*"):
2854
2584
  http_res_text = utils.stream_to_text(http_res)
2855
- raise errors.APIError(
2856
- "API error occurred", http_res.status_code, http_res_text, http_res
2857
- )
2585
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2858
2586
  if utils.match_response(http_res, "4XX", "*"):
2859
2587
  http_res_text = utils.stream_to_text(http_res)
2860
- raise errors.APIError(
2861
- "API error occurred", http_res.status_code, http_res_text, http_res
2862
- )
2588
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2863
2589
  if utils.match_response(http_res, "5XX", "*"):
2864
2590
  http_res_text = utils.stream_to_text(http_res)
2865
- raise errors.APIError(
2866
- "API error occurred", http_res.status_code, http_res_text, http_res
2867
- )
2591
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2868
2592
 
2869
- content_type = http_res.headers.get("Content-Type")
2870
2593
  http_res_text = utils.stream_to_text(http_res)
2871
- raise errors.APIError(
2872
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2873
- http_res.status_code,
2874
- http_res_text,
2875
- http_res,
2876
- )
2594
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)
2877
2595
 
2878
2596
  async def get_evidence_data_async(
2879
2597
  self,
@@ -2978,30 +2696,16 @@ class Disputes(BaseSDK):
2978
2696
  )
2979
2697
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
2980
2698
  http_res_text = await utils.stream_to_text_async(http_res)
2981
- raise errors.APIError(
2982
- "API error occurred", http_res.status_code, http_res_text, http_res
2983
- )
2699
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2984
2700
  if utils.match_response(http_res, ["500", "504"], "*"):
2985
2701
  http_res_text = await utils.stream_to_text_async(http_res)
2986
- raise errors.APIError(
2987
- "API error occurred", http_res.status_code, http_res_text, http_res
2988
- )
2702
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2989
2703
  if utils.match_response(http_res, "4XX", "*"):
2990
2704
  http_res_text = await utils.stream_to_text_async(http_res)
2991
- raise errors.APIError(
2992
- "API error occurred", http_res.status_code, http_res_text, http_res
2993
- )
2705
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2994
2706
  if utils.match_response(http_res, "5XX", "*"):
2995
2707
  http_res_text = await utils.stream_to_text_async(http_res)
2996
- raise errors.APIError(
2997
- "API error occurred", http_res.status_code, http_res_text, http_res
2998
- )
2708
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2999
2709
 
3000
- content_type = http_res.headers.get("Content-Type")
3001
2710
  http_res_text = await utils.stream_to_text_async(http_res)
3002
- raise errors.APIError(
3003
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3004
- http_res.status_code,
3005
- http_res_text,
3006
- http_res,
3007
- )
2711
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)