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/cards.py CHANGED
@@ -158,46 +158,33 @@ class Cards(BaseSDK):
158
158
  response_data: Any = None
159
159
  if utils.match_response(http_res, "200", "application/json"):
160
160
  return operations.LinkCardResponse(
161
- result=utils.unmarshal_json(http_res.text, components.Card),
161
+ result=utils.unmarshal_json_response(components.Card, http_res),
162
162
  headers=utils.get_response_headers(http_res.headers),
163
163
  )
164
164
  if utils.match_response(http_res, "400", "application/json"):
165
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
166
- raise errors.GenericError(data=response_data)
165
+ response_data = utils.unmarshal_json_response(
166
+ errors.GenericErrorData, http_res
167
+ )
168
+ raise errors.GenericError(response_data, http_res)
167
169
  if utils.match_response(http_res, "422", "application/json"):
168
- response_data = utils.unmarshal_json(
169
- http_res.text, errors.LinkCardErrorData
170
+ response_data = utils.unmarshal_json_response(
171
+ errors.LinkCardErrorData, http_res
170
172
  )
171
- raise errors.LinkCardError(data=response_data)
173
+ raise errors.LinkCardError(response_data, http_res)
172
174
  if utils.match_response(http_res, ["401", "403", "404", "409", "429"], "*"):
173
175
  http_res_text = utils.stream_to_text(http_res)
174
- raise errors.APIError(
175
- "API error occurred", http_res.status_code, http_res_text, http_res
176
- )
176
+ raise errors.APIError("API error occurred", http_res, http_res_text)
177
177
  if utils.match_response(http_res, ["500", "504"], "*"):
178
178
  http_res_text = utils.stream_to_text(http_res)
179
- raise errors.APIError(
180
- "API error occurred", http_res.status_code, http_res_text, http_res
181
- )
179
+ raise errors.APIError("API error occurred", http_res, http_res_text)
182
180
  if utils.match_response(http_res, "4XX", "*"):
183
181
  http_res_text = utils.stream_to_text(http_res)
184
- raise errors.APIError(
185
- "API error occurred", http_res.status_code, http_res_text, http_res
186
- )
182
+ raise errors.APIError("API error occurred", http_res, http_res_text)
187
183
  if utils.match_response(http_res, "5XX", "*"):
188
184
  http_res_text = utils.stream_to_text(http_res)
189
- raise errors.APIError(
190
- "API error occurred", http_res.status_code, http_res_text, http_res
191
- )
185
+ raise errors.APIError("API error occurred", http_res, http_res_text)
192
186
 
193
- content_type = http_res.headers.get("Content-Type")
194
- http_res_text = utils.stream_to_text(http_res)
195
- raise errors.APIError(
196
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
197
- http_res.status_code,
198
- http_res_text,
199
- http_res,
200
- )
187
+ raise errors.APIError("Unexpected response received", http_res)
201
188
 
202
189
  async def link_async(
203
190
  self,
@@ -347,46 +334,33 @@ class Cards(BaseSDK):
347
334
  response_data: Any = None
348
335
  if utils.match_response(http_res, "200", "application/json"):
349
336
  return operations.LinkCardResponse(
350
- result=utils.unmarshal_json(http_res.text, components.Card),
337
+ result=utils.unmarshal_json_response(components.Card, http_res),
351
338
  headers=utils.get_response_headers(http_res.headers),
352
339
  )
353
340
  if utils.match_response(http_res, "400", "application/json"):
354
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
355
- raise errors.GenericError(data=response_data)
341
+ response_data = utils.unmarshal_json_response(
342
+ errors.GenericErrorData, http_res
343
+ )
344
+ raise errors.GenericError(response_data, http_res)
356
345
  if utils.match_response(http_res, "422", "application/json"):
357
- response_data = utils.unmarshal_json(
358
- http_res.text, errors.LinkCardErrorData
346
+ response_data = utils.unmarshal_json_response(
347
+ errors.LinkCardErrorData, http_res
359
348
  )
360
- raise errors.LinkCardError(data=response_data)
349
+ raise errors.LinkCardError(response_data, http_res)
361
350
  if utils.match_response(http_res, ["401", "403", "404", "409", "429"], "*"):
362
351
  http_res_text = await utils.stream_to_text_async(http_res)
363
- raise errors.APIError(
364
- "API error occurred", http_res.status_code, http_res_text, http_res
365
- )
352
+ raise errors.APIError("API error occurred", http_res, http_res_text)
366
353
  if utils.match_response(http_res, ["500", "504"], "*"):
367
354
  http_res_text = await utils.stream_to_text_async(http_res)
368
- raise errors.APIError(
369
- "API error occurred", http_res.status_code, http_res_text, http_res
370
- )
355
+ raise errors.APIError("API error occurred", http_res, http_res_text)
371
356
  if utils.match_response(http_res, "4XX", "*"):
372
357
  http_res_text = await utils.stream_to_text_async(http_res)
373
- raise errors.APIError(
374
- "API error occurred", http_res.status_code, http_res_text, http_res
375
- )
358
+ raise errors.APIError("API error occurred", http_res, http_res_text)
376
359
  if utils.match_response(http_res, "5XX", "*"):
377
360
  http_res_text = await utils.stream_to_text_async(http_res)
378
- raise errors.APIError(
379
- "API error occurred", http_res.status_code, http_res_text, http_res
380
- )
361
+ raise errors.APIError("API error occurred", http_res, http_res_text)
381
362
 
382
- content_type = http_res.headers.get("Content-Type")
383
- http_res_text = await utils.stream_to_text_async(http_res)
384
- raise errors.APIError(
385
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
386
- http_res.status_code,
387
- http_res_text,
388
- http_res,
389
- )
363
+ raise errors.APIError("Unexpected response received", http_res)
390
364
 
391
365
  def list(
392
366
  self,
@@ -468,38 +442,23 @@ class Cards(BaseSDK):
468
442
 
469
443
  if utils.match_response(http_res, "200", "application/json"):
470
444
  return operations.ListCardsResponse(
471
- result=utils.unmarshal_json(http_res.text, List[components.Card]),
445
+ result=utils.unmarshal_json_response(List[components.Card], http_res),
472
446
  headers=utils.get_response_headers(http_res.headers),
473
447
  )
474
448
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
475
449
  http_res_text = utils.stream_to_text(http_res)
476
- raise errors.APIError(
477
- "API error occurred", http_res.status_code, http_res_text, http_res
478
- )
450
+ raise errors.APIError("API error occurred", http_res, http_res_text)
479
451
  if utils.match_response(http_res, ["500", "504"], "*"):
480
452
  http_res_text = utils.stream_to_text(http_res)
481
- raise errors.APIError(
482
- "API error occurred", http_res.status_code, http_res_text, http_res
483
- )
453
+ raise errors.APIError("API error occurred", http_res, http_res_text)
484
454
  if utils.match_response(http_res, "4XX", "*"):
485
455
  http_res_text = utils.stream_to_text(http_res)
486
- raise errors.APIError(
487
- "API error occurred", http_res.status_code, http_res_text, http_res
488
- )
456
+ raise errors.APIError("API error occurred", http_res, http_res_text)
489
457
  if utils.match_response(http_res, "5XX", "*"):
490
458
  http_res_text = utils.stream_to_text(http_res)
491
- raise errors.APIError(
492
- "API error occurred", http_res.status_code, http_res_text, http_res
493
- )
459
+ raise errors.APIError("API error occurred", http_res, http_res_text)
494
460
 
495
- content_type = http_res.headers.get("Content-Type")
496
- http_res_text = utils.stream_to_text(http_res)
497
- raise errors.APIError(
498
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
499
- http_res.status_code,
500
- http_res_text,
501
- http_res,
502
- )
461
+ raise errors.APIError("Unexpected response received", http_res)
503
462
 
504
463
  async def list_async(
505
464
  self,
@@ -581,38 +540,23 @@ class Cards(BaseSDK):
581
540
 
582
541
  if utils.match_response(http_res, "200", "application/json"):
583
542
  return operations.ListCardsResponse(
584
- result=utils.unmarshal_json(http_res.text, List[components.Card]),
543
+ result=utils.unmarshal_json_response(List[components.Card], http_res),
585
544
  headers=utils.get_response_headers(http_res.headers),
586
545
  )
587
546
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
588
547
  http_res_text = await utils.stream_to_text_async(http_res)
589
- raise errors.APIError(
590
- "API error occurred", http_res.status_code, http_res_text, http_res
591
- )
548
+ raise errors.APIError("API error occurred", http_res, http_res_text)
592
549
  if utils.match_response(http_res, ["500", "504"], "*"):
593
550
  http_res_text = await utils.stream_to_text_async(http_res)
594
- raise errors.APIError(
595
- "API error occurred", http_res.status_code, http_res_text, http_res
596
- )
551
+ raise errors.APIError("API error occurred", http_res, http_res_text)
597
552
  if utils.match_response(http_res, "4XX", "*"):
598
553
  http_res_text = await utils.stream_to_text_async(http_res)
599
- raise errors.APIError(
600
- "API error occurred", http_res.status_code, http_res_text, http_res
601
- )
554
+ raise errors.APIError("API error occurred", http_res, http_res_text)
602
555
  if utils.match_response(http_res, "5XX", "*"):
603
556
  http_res_text = await utils.stream_to_text_async(http_res)
604
- raise errors.APIError(
605
- "API error occurred", http_res.status_code, http_res_text, http_res
606
- )
557
+ raise errors.APIError("API error occurred", http_res, http_res_text)
607
558
 
608
- content_type = http_res.headers.get("Content-Type")
609
- http_res_text = await utils.stream_to_text_async(http_res)
610
- raise errors.APIError(
611
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
612
- http_res.status_code,
613
- http_res_text,
614
- http_res,
615
- )
559
+ raise errors.APIError("Unexpected response received", http_res)
616
560
 
617
561
  def get(
618
562
  self,
@@ -697,38 +641,23 @@ class Cards(BaseSDK):
697
641
 
698
642
  if utils.match_response(http_res, "200", "application/json"):
699
643
  return operations.GetCardResponse(
700
- result=utils.unmarshal_json(http_res.text, components.Card),
644
+ result=utils.unmarshal_json_response(components.Card, http_res),
701
645
  headers=utils.get_response_headers(http_res.headers),
702
646
  )
703
647
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
704
648
  http_res_text = utils.stream_to_text(http_res)
705
- raise errors.APIError(
706
- "API error occurred", http_res.status_code, http_res_text, http_res
707
- )
649
+ raise errors.APIError("API error occurred", http_res, http_res_text)
708
650
  if utils.match_response(http_res, ["500", "504"], "*"):
709
651
  http_res_text = utils.stream_to_text(http_res)
710
- raise errors.APIError(
711
- "API error occurred", http_res.status_code, http_res_text, http_res
712
- )
652
+ raise errors.APIError("API error occurred", http_res, http_res_text)
713
653
  if utils.match_response(http_res, "4XX", "*"):
714
654
  http_res_text = utils.stream_to_text(http_res)
715
- raise errors.APIError(
716
- "API error occurred", http_res.status_code, http_res_text, http_res
717
- )
655
+ raise errors.APIError("API error occurred", http_res, http_res_text)
718
656
  if utils.match_response(http_res, "5XX", "*"):
719
657
  http_res_text = utils.stream_to_text(http_res)
720
- raise errors.APIError(
721
- "API error occurred", http_res.status_code, http_res_text, http_res
722
- )
658
+ raise errors.APIError("API error occurred", http_res, http_res_text)
723
659
 
724
- content_type = http_res.headers.get("Content-Type")
725
- http_res_text = utils.stream_to_text(http_res)
726
- raise errors.APIError(
727
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
728
- http_res.status_code,
729
- http_res_text,
730
- http_res,
731
- )
660
+ raise errors.APIError("Unexpected response received", http_res)
732
661
 
733
662
  async def get_async(
734
663
  self,
@@ -813,38 +742,23 @@ class Cards(BaseSDK):
813
742
 
814
743
  if utils.match_response(http_res, "200", "application/json"):
815
744
  return operations.GetCardResponse(
816
- result=utils.unmarshal_json(http_res.text, components.Card),
745
+ result=utils.unmarshal_json_response(components.Card, http_res),
817
746
  headers=utils.get_response_headers(http_res.headers),
818
747
  )
819
748
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
820
749
  http_res_text = await utils.stream_to_text_async(http_res)
821
- raise errors.APIError(
822
- "API error occurred", http_res.status_code, http_res_text, http_res
823
- )
750
+ raise errors.APIError("API error occurred", http_res, http_res_text)
824
751
  if utils.match_response(http_res, ["500", "504"], "*"):
825
752
  http_res_text = await utils.stream_to_text_async(http_res)
826
- raise errors.APIError(
827
- "API error occurred", http_res.status_code, http_res_text, http_res
828
- )
753
+ raise errors.APIError("API error occurred", http_res, http_res_text)
829
754
  if utils.match_response(http_res, "4XX", "*"):
830
755
  http_res_text = await utils.stream_to_text_async(http_res)
831
- raise errors.APIError(
832
- "API error occurred", http_res.status_code, http_res_text, http_res
833
- )
756
+ raise errors.APIError("API error occurred", http_res, http_res_text)
834
757
  if utils.match_response(http_res, "5XX", "*"):
835
758
  http_res_text = await utils.stream_to_text_async(http_res)
836
- raise errors.APIError(
837
- "API error occurred", http_res.status_code, http_res_text, http_res
838
- )
759
+ raise errors.APIError("API error occurred", http_res, http_res_text)
839
760
 
840
- content_type = http_res.headers.get("Content-Type")
841
- http_res_text = await utils.stream_to_text_async(http_res)
842
- raise errors.APIError(
843
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
844
- http_res.status_code,
845
- http_res_text,
846
- http_res,
847
- )
761
+ raise errors.APIError("Unexpected response received", http_res)
848
762
 
849
763
  def update(
850
764
  self,
@@ -993,46 +907,33 @@ class Cards(BaseSDK):
993
907
  response_data: Any = None
994
908
  if utils.match_response(http_res, "200", "application/json"):
995
909
  return operations.UpdateCardResponse(
996
- result=utils.unmarshal_json(http_res.text, components.Card),
910
+ result=utils.unmarshal_json_response(components.Card, http_res),
997
911
  headers=utils.get_response_headers(http_res.headers),
998
912
  )
999
913
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1000
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1001
- raise errors.GenericError(data=response_data)
914
+ response_data = utils.unmarshal_json_response(
915
+ errors.GenericErrorData, http_res
916
+ )
917
+ raise errors.GenericError(response_data, http_res)
1002
918
  if utils.match_response(http_res, "422", "application/json"):
1003
- response_data = utils.unmarshal_json(
1004
- http_res.text, errors.UpdateCardErrorData
919
+ response_data = utils.unmarshal_json_response(
920
+ errors.UpdateCardErrorData, http_res
1005
921
  )
1006
- raise errors.UpdateCardError(data=response_data)
922
+ raise errors.UpdateCardError(response_data, http_res)
1007
923
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1008
924
  http_res_text = utils.stream_to_text(http_res)
1009
- raise errors.APIError(
1010
- "API error occurred", http_res.status_code, http_res_text, http_res
1011
- )
925
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1012
926
  if utils.match_response(http_res, ["500", "504"], "*"):
1013
927
  http_res_text = utils.stream_to_text(http_res)
1014
- raise errors.APIError(
1015
- "API error occurred", http_res.status_code, http_res_text, http_res
1016
- )
928
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1017
929
  if utils.match_response(http_res, "4XX", "*"):
1018
930
  http_res_text = utils.stream_to_text(http_res)
1019
- raise errors.APIError(
1020
- "API error occurred", http_res.status_code, http_res_text, http_res
1021
- )
931
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1022
932
  if utils.match_response(http_res, "5XX", "*"):
1023
933
  http_res_text = utils.stream_to_text(http_res)
1024
- raise errors.APIError(
1025
- "API error occurred", http_res.status_code, http_res_text, http_res
1026
- )
934
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1027
935
 
1028
- content_type = http_res.headers.get("Content-Type")
1029
- http_res_text = utils.stream_to_text(http_res)
1030
- raise errors.APIError(
1031
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1032
- http_res.status_code,
1033
- http_res_text,
1034
- http_res,
1035
- )
936
+ raise errors.APIError("Unexpected response received", http_res)
1036
937
 
1037
938
  async def update_async(
1038
939
  self,
@@ -1181,46 +1082,33 @@ class Cards(BaseSDK):
1181
1082
  response_data: Any = None
1182
1083
  if utils.match_response(http_res, "200", "application/json"):
1183
1084
  return operations.UpdateCardResponse(
1184
- result=utils.unmarshal_json(http_res.text, components.Card),
1085
+ result=utils.unmarshal_json_response(components.Card, http_res),
1185
1086
  headers=utils.get_response_headers(http_res.headers),
1186
1087
  )
1187
1088
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1188
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1189
- raise errors.GenericError(data=response_data)
1089
+ response_data = utils.unmarshal_json_response(
1090
+ errors.GenericErrorData, http_res
1091
+ )
1092
+ raise errors.GenericError(response_data, http_res)
1190
1093
  if utils.match_response(http_res, "422", "application/json"):
1191
- response_data = utils.unmarshal_json(
1192
- http_res.text, errors.UpdateCardErrorData
1094
+ response_data = utils.unmarshal_json_response(
1095
+ errors.UpdateCardErrorData, http_res
1193
1096
  )
1194
- raise errors.UpdateCardError(data=response_data)
1097
+ raise errors.UpdateCardError(response_data, http_res)
1195
1098
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1196
1099
  http_res_text = await utils.stream_to_text_async(http_res)
1197
- raise errors.APIError(
1198
- "API error occurred", http_res.status_code, http_res_text, http_res
1199
- )
1100
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1200
1101
  if utils.match_response(http_res, ["500", "504"], "*"):
1201
1102
  http_res_text = await utils.stream_to_text_async(http_res)
1202
- raise errors.APIError(
1203
- "API error occurred", http_res.status_code, http_res_text, http_res
1204
- )
1103
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1205
1104
  if utils.match_response(http_res, "4XX", "*"):
1206
1105
  http_res_text = await utils.stream_to_text_async(http_res)
1207
- raise errors.APIError(
1208
- "API error occurred", http_res.status_code, http_res_text, http_res
1209
- )
1106
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1210
1107
  if utils.match_response(http_res, "5XX", "*"):
1211
1108
  http_res_text = await utils.stream_to_text_async(http_res)
1212
- raise errors.APIError(
1213
- "API error occurred", http_res.status_code, http_res_text, http_res
1214
- )
1109
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1215
1110
 
1216
- content_type = http_res.headers.get("Content-Type")
1217
- http_res_text = await utils.stream_to_text_async(http_res)
1218
- raise errors.APIError(
1219
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1220
- http_res.status_code,
1221
- http_res_text,
1222
- http_res,
1223
- )
1111
+ raise errors.APIError("Unexpected response received", http_res)
1224
1112
 
1225
1113
  def disable(
1226
1114
  self,
@@ -1318,37 +1206,24 @@ class Cards(BaseSDK):
1318
1206
  headers=utils.get_response_headers(http_res.headers)
1319
1207
  )
1320
1208
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1321
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1322
- raise errors.GenericError(data=response_data)
1209
+ response_data = utils.unmarshal_json_response(
1210
+ errors.GenericErrorData, http_res
1211
+ )
1212
+ raise errors.GenericError(response_data, http_res)
1323
1213
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1324
1214
  http_res_text = utils.stream_to_text(http_res)
1325
- raise errors.APIError(
1326
- "API error occurred", http_res.status_code, http_res_text, http_res
1327
- )
1215
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1328
1216
  if utils.match_response(http_res, ["500", "504"], "*"):
1329
1217
  http_res_text = utils.stream_to_text(http_res)
1330
- raise errors.APIError(
1331
- "API error occurred", http_res.status_code, http_res_text, http_res
1332
- )
1218
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1333
1219
  if utils.match_response(http_res, "4XX", "*"):
1334
1220
  http_res_text = utils.stream_to_text(http_res)
1335
- raise errors.APIError(
1336
- "API error occurred", http_res.status_code, http_res_text, http_res
1337
- )
1221
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1338
1222
  if utils.match_response(http_res, "5XX", "*"):
1339
1223
  http_res_text = utils.stream_to_text(http_res)
1340
- raise errors.APIError(
1341
- "API error occurred", http_res.status_code, http_res_text, http_res
1342
- )
1224
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1343
1225
 
1344
- content_type = http_res.headers.get("Content-Type")
1345
- http_res_text = utils.stream_to_text(http_res)
1346
- raise errors.APIError(
1347
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1348
- http_res.status_code,
1349
- http_res_text,
1350
- http_res,
1351
- )
1226
+ raise errors.APIError("Unexpected response received", http_res)
1352
1227
 
1353
1228
  async def disable_async(
1354
1229
  self,
@@ -1446,34 +1321,21 @@ class Cards(BaseSDK):
1446
1321
  headers=utils.get_response_headers(http_res.headers)
1447
1322
  )
1448
1323
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1449
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1450
- raise errors.GenericError(data=response_data)
1324
+ response_data = utils.unmarshal_json_response(
1325
+ errors.GenericErrorData, http_res
1326
+ )
1327
+ raise errors.GenericError(response_data, http_res)
1451
1328
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1452
1329
  http_res_text = await utils.stream_to_text_async(http_res)
1453
- raise errors.APIError(
1454
- "API error occurred", http_res.status_code, http_res_text, http_res
1455
- )
1330
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1456
1331
  if utils.match_response(http_res, ["500", "504"], "*"):
1457
1332
  http_res_text = await utils.stream_to_text_async(http_res)
1458
- raise errors.APIError(
1459
- "API error occurred", http_res.status_code, http_res_text, http_res
1460
- )
1333
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1461
1334
  if utils.match_response(http_res, "4XX", "*"):
1462
1335
  http_res_text = await utils.stream_to_text_async(http_res)
1463
- raise errors.APIError(
1464
- "API error occurred", http_res.status_code, http_res_text, http_res
1465
- )
1336
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1466
1337
  if utils.match_response(http_res, "5XX", "*"):
1467
1338
  http_res_text = await utils.stream_to_text_async(http_res)
1468
- raise errors.APIError(
1469
- "API error occurred", http_res.status_code, http_res_text, http_res
1470
- )
1339
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1471
1340
 
1472
- content_type = http_res.headers.get("Content-Type")
1473
- http_res_text = await utils.stream_to_text_async(http_res)
1474
- raise errors.APIError(
1475
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1476
- http_res.status_code,
1477
- http_res_text,
1478
- http_res,
1479
- )
1341
+ raise errors.APIError("Unexpected response received", http_res)