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/sweeps.py CHANGED
@@ -128,46 +128,33 @@ class Sweeps(BaseSDK):
128
128
  response_data: Any = None
129
129
  if utils.match_response(http_res, "200", "application/json"):
130
130
  return operations.CreateSweepConfigResponse(
131
- result=utils.unmarshal_json(http_res.text, components.SweepConfig),
131
+ result=utils.unmarshal_json_response(components.SweepConfig, http_res),
132
132
  headers=utils.get_response_headers(http_res.headers),
133
133
  )
134
134
  if utils.match_response(http_res, ["400", "409"], "application/json"):
135
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
136
- raise errors.GenericError(data=response_data)
135
+ response_data = utils.unmarshal_json_response(
136
+ errors.GenericErrorData, http_res
137
+ )
138
+ raise errors.GenericError(response_data, http_res)
137
139
  if utils.match_response(http_res, "422", "application/json"):
138
- response_data = utils.unmarshal_json(
139
- http_res.text, errors.CreateSweepConfigErrorData
140
+ response_data = utils.unmarshal_json_response(
141
+ errors.CreateSweepConfigErrorData, http_res
140
142
  )
141
- raise errors.CreateSweepConfigError(data=response_data)
143
+ raise errors.CreateSweepConfigError(response_data, http_res)
142
144
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
143
145
  http_res_text = utils.stream_to_text(http_res)
144
- raise errors.APIError(
145
- "API error occurred", http_res.status_code, http_res_text, http_res
146
- )
146
+ raise errors.APIError("API error occurred", http_res, http_res_text)
147
147
  if utils.match_response(http_res, ["500", "504"], "*"):
148
148
  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
- )
149
+ raise errors.APIError("API error occurred", http_res, http_res_text)
152
150
  if utils.match_response(http_res, "4XX", "*"):
153
151
  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
- )
152
+ raise errors.APIError("API error occurred", http_res, http_res_text)
157
153
  if utils.match_response(http_res, "5XX", "*"):
158
154
  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
- )
155
+ raise errors.APIError("API error occurred", http_res, http_res_text)
162
156
 
163
- content_type = http_res.headers.get("Content-Type")
164
- http_res_text = utils.stream_to_text(http_res)
165
- raise errors.APIError(
166
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
167
- http_res.status_code,
168
- http_res_text,
169
- http_res,
170
- )
157
+ raise errors.APIError("Unexpected response received", http_res)
171
158
 
172
159
  async def create_config_async(
173
160
  self,
@@ -287,46 +274,33 @@ class Sweeps(BaseSDK):
287
274
  response_data: Any = None
288
275
  if utils.match_response(http_res, "200", "application/json"):
289
276
  return operations.CreateSweepConfigResponse(
290
- result=utils.unmarshal_json(http_res.text, components.SweepConfig),
277
+ result=utils.unmarshal_json_response(components.SweepConfig, http_res),
291
278
  headers=utils.get_response_headers(http_res.headers),
292
279
  )
293
280
  if utils.match_response(http_res, ["400", "409"], "application/json"):
294
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
295
- raise errors.GenericError(data=response_data)
281
+ response_data = utils.unmarshal_json_response(
282
+ errors.GenericErrorData, http_res
283
+ )
284
+ raise errors.GenericError(response_data, http_res)
296
285
  if utils.match_response(http_res, "422", "application/json"):
297
- response_data = utils.unmarshal_json(
298
- http_res.text, errors.CreateSweepConfigErrorData
286
+ response_data = utils.unmarshal_json_response(
287
+ errors.CreateSweepConfigErrorData, http_res
299
288
  )
300
- raise errors.CreateSweepConfigError(data=response_data)
289
+ raise errors.CreateSweepConfigError(response_data, http_res)
301
290
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
302
291
  http_res_text = await utils.stream_to_text_async(http_res)
303
- raise errors.APIError(
304
- "API error occurred", http_res.status_code, http_res_text, http_res
305
- )
292
+ raise errors.APIError("API error occurred", http_res, http_res_text)
306
293
  if utils.match_response(http_res, ["500", "504"], "*"):
307
294
  http_res_text = await utils.stream_to_text_async(http_res)
308
- raise errors.APIError(
309
- "API error occurred", http_res.status_code, http_res_text, http_res
310
- )
295
+ raise errors.APIError("API error occurred", http_res, http_res_text)
311
296
  if utils.match_response(http_res, "4XX", "*"):
312
297
  http_res_text = await utils.stream_to_text_async(http_res)
313
- raise errors.APIError(
314
- "API error occurred", http_res.status_code, http_res_text, http_res
315
- )
298
+ raise errors.APIError("API error occurred", http_res, http_res_text)
316
299
  if utils.match_response(http_res, "5XX", "*"):
317
300
  http_res_text = await utils.stream_to_text_async(http_res)
318
- raise errors.APIError(
319
- "API error occurred", http_res.status_code, http_res_text, http_res
320
- )
301
+ raise errors.APIError("API error occurred", http_res, http_res_text)
321
302
 
322
- content_type = http_res.headers.get("Content-Type")
323
- http_res_text = await utils.stream_to_text_async(http_res)
324
- raise errors.APIError(
325
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
326
- http_res.status_code,
327
- http_res_text,
328
- http_res,
329
- )
303
+ raise errors.APIError("Unexpected response received", http_res)
330
304
 
331
305
  def list_configs(
332
306
  self,
@@ -406,40 +380,25 @@ class Sweeps(BaseSDK):
406
380
 
407
381
  if utils.match_response(http_res, "200", "application/json"):
408
382
  return operations.ListSweepConfigsResponse(
409
- result=utils.unmarshal_json(
410
- http_res.text, List[components.SweepConfig]
383
+ result=utils.unmarshal_json_response(
384
+ List[components.SweepConfig], http_res
411
385
  ),
412
386
  headers=utils.get_response_headers(http_res.headers),
413
387
  )
414
388
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
415
389
  http_res_text = utils.stream_to_text(http_res)
416
- raise errors.APIError(
417
- "API error occurred", http_res.status_code, http_res_text, http_res
418
- )
390
+ raise errors.APIError("API error occurred", http_res, http_res_text)
419
391
  if utils.match_response(http_res, ["500", "504"], "*"):
420
392
  http_res_text = utils.stream_to_text(http_res)
421
- raise errors.APIError(
422
- "API error occurred", http_res.status_code, http_res_text, http_res
423
- )
393
+ raise errors.APIError("API error occurred", http_res, http_res_text)
424
394
  if utils.match_response(http_res, "4XX", "*"):
425
395
  http_res_text = utils.stream_to_text(http_res)
426
- raise errors.APIError(
427
- "API error occurred", http_res.status_code, http_res_text, http_res
428
- )
396
+ raise errors.APIError("API error occurred", http_res, http_res_text)
429
397
  if utils.match_response(http_res, "5XX", "*"):
430
398
  http_res_text = utils.stream_to_text(http_res)
431
- raise errors.APIError(
432
- "API error occurred", http_res.status_code, http_res_text, http_res
433
- )
399
+ raise errors.APIError("API error occurred", http_res, http_res_text)
434
400
 
435
- content_type = http_res.headers.get("Content-Type")
436
- http_res_text = utils.stream_to_text(http_res)
437
- raise errors.APIError(
438
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
439
- http_res.status_code,
440
- http_res_text,
441
- http_res,
442
- )
401
+ raise errors.APIError("Unexpected response received", http_res)
443
402
 
444
403
  async def list_configs_async(
445
404
  self,
@@ -519,40 +478,25 @@ class Sweeps(BaseSDK):
519
478
 
520
479
  if utils.match_response(http_res, "200", "application/json"):
521
480
  return operations.ListSweepConfigsResponse(
522
- result=utils.unmarshal_json(
523
- http_res.text, List[components.SweepConfig]
481
+ result=utils.unmarshal_json_response(
482
+ List[components.SweepConfig], http_res
524
483
  ),
525
484
  headers=utils.get_response_headers(http_res.headers),
526
485
  )
527
486
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
528
487
  http_res_text = await utils.stream_to_text_async(http_res)
529
- raise errors.APIError(
530
- "API error occurred", http_res.status_code, http_res_text, http_res
531
- )
488
+ raise errors.APIError("API error occurred", http_res, http_res_text)
532
489
  if utils.match_response(http_res, ["500", "504"], "*"):
533
490
  http_res_text = await utils.stream_to_text_async(http_res)
534
- raise errors.APIError(
535
- "API error occurred", http_res.status_code, http_res_text, http_res
536
- )
491
+ raise errors.APIError("API error occurred", http_res, http_res_text)
537
492
  if utils.match_response(http_res, "4XX", "*"):
538
493
  http_res_text = await utils.stream_to_text_async(http_res)
539
- raise errors.APIError(
540
- "API error occurred", http_res.status_code, http_res_text, http_res
541
- )
494
+ raise errors.APIError("API error occurred", http_res, http_res_text)
542
495
  if utils.match_response(http_res, "5XX", "*"):
543
496
  http_res_text = await utils.stream_to_text_async(http_res)
544
- raise errors.APIError(
545
- "API error occurred", http_res.status_code, http_res_text, http_res
546
- )
497
+ raise errors.APIError("API error occurred", http_res, http_res_text)
547
498
 
548
- content_type = http_res.headers.get("Content-Type")
549
- http_res_text = await utils.stream_to_text_async(http_res)
550
- raise errors.APIError(
551
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
552
- http_res.status_code,
553
- http_res_text,
554
- http_res,
555
- )
499
+ raise errors.APIError("Unexpected response received", http_res)
556
500
 
557
501
  def get_config(
558
502
  self,
@@ -635,38 +579,23 @@ class Sweeps(BaseSDK):
635
579
 
636
580
  if utils.match_response(http_res, "200", "application/json"):
637
581
  return operations.GetSweepConfigResponse(
638
- result=utils.unmarshal_json(http_res.text, components.SweepConfig),
582
+ result=utils.unmarshal_json_response(components.SweepConfig, http_res),
639
583
  headers=utils.get_response_headers(http_res.headers),
640
584
  )
641
585
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
642
586
  http_res_text = utils.stream_to_text(http_res)
643
- raise errors.APIError(
644
- "API error occurred", http_res.status_code, http_res_text, http_res
645
- )
587
+ raise errors.APIError("API error occurred", http_res, http_res_text)
646
588
  if utils.match_response(http_res, ["500", "504"], "*"):
647
589
  http_res_text = utils.stream_to_text(http_res)
648
- raise errors.APIError(
649
- "API error occurred", http_res.status_code, http_res_text, http_res
650
- )
590
+ raise errors.APIError("API error occurred", http_res, http_res_text)
651
591
  if utils.match_response(http_res, "4XX", "*"):
652
592
  http_res_text = utils.stream_to_text(http_res)
653
- raise errors.APIError(
654
- "API error occurred", http_res.status_code, http_res_text, http_res
655
- )
593
+ raise errors.APIError("API error occurred", http_res, http_res_text)
656
594
  if utils.match_response(http_res, "5XX", "*"):
657
595
  http_res_text = utils.stream_to_text(http_res)
658
- raise errors.APIError(
659
- "API error occurred", http_res.status_code, http_res_text, http_res
660
- )
596
+ raise errors.APIError("API error occurred", http_res, http_res_text)
661
597
 
662
- content_type = http_res.headers.get("Content-Type")
663
- http_res_text = utils.stream_to_text(http_res)
664
- raise errors.APIError(
665
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
666
- http_res.status_code,
667
- http_res_text,
668
- http_res,
669
- )
598
+ raise errors.APIError("Unexpected response received", http_res)
670
599
 
671
600
  async def get_config_async(
672
601
  self,
@@ -749,38 +678,23 @@ class Sweeps(BaseSDK):
749
678
 
750
679
  if utils.match_response(http_res, "200", "application/json"):
751
680
  return operations.GetSweepConfigResponse(
752
- result=utils.unmarshal_json(http_res.text, components.SweepConfig),
681
+ result=utils.unmarshal_json_response(components.SweepConfig, http_res),
753
682
  headers=utils.get_response_headers(http_res.headers),
754
683
  )
755
684
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
756
685
  http_res_text = await utils.stream_to_text_async(http_res)
757
- raise errors.APIError(
758
- "API error occurred", http_res.status_code, http_res_text, http_res
759
- )
686
+ raise errors.APIError("API error occurred", http_res, http_res_text)
760
687
  if utils.match_response(http_res, ["500", "504"], "*"):
761
688
  http_res_text = await utils.stream_to_text_async(http_res)
762
- raise errors.APIError(
763
- "API error occurred", http_res.status_code, http_res_text, http_res
764
- )
689
+ raise errors.APIError("API error occurred", http_res, http_res_text)
765
690
  if utils.match_response(http_res, "4XX", "*"):
766
691
  http_res_text = await utils.stream_to_text_async(http_res)
767
- raise errors.APIError(
768
- "API error occurred", http_res.status_code, http_res_text, http_res
769
- )
692
+ raise errors.APIError("API error occurred", http_res, http_res_text)
770
693
  if utils.match_response(http_res, "5XX", "*"):
771
694
  http_res_text = await utils.stream_to_text_async(http_res)
772
- raise errors.APIError(
773
- "API error occurred", http_res.status_code, http_res_text, http_res
774
- )
695
+ raise errors.APIError("API error occurred", http_res, http_res_text)
775
696
 
776
- content_type = http_res.headers.get("Content-Type")
777
- http_res_text = await utils.stream_to_text_async(http_res)
778
- raise errors.APIError(
779
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
780
- http_res.status_code,
781
- http_res_text,
782
- http_res,
783
- )
697
+ raise errors.APIError("Unexpected response received", http_res)
784
698
 
785
699
  def update_config(
786
700
  self,
@@ -921,46 +835,33 @@ class Sweeps(BaseSDK):
921
835
  response_data: Any = None
922
836
  if utils.match_response(http_res, "200", "application/json"):
923
837
  return operations.UpdateSweepConfigResponse(
924
- result=utils.unmarshal_json(http_res.text, components.SweepConfig),
838
+ result=utils.unmarshal_json_response(components.SweepConfig, http_res),
925
839
  headers=utils.get_response_headers(http_res.headers),
926
840
  )
927
841
  if utils.match_response(http_res, ["400", "409"], "application/json"):
928
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
929
- raise errors.GenericError(data=response_data)
842
+ response_data = utils.unmarshal_json_response(
843
+ errors.GenericErrorData, http_res
844
+ )
845
+ raise errors.GenericError(response_data, http_res)
930
846
  if utils.match_response(http_res, "422", "application/json"):
931
- response_data = utils.unmarshal_json(
932
- http_res.text, errors.PatchSweepConfigErrorData
847
+ response_data = utils.unmarshal_json_response(
848
+ errors.PatchSweepConfigErrorData, http_res
933
849
  )
934
- raise errors.PatchSweepConfigError(data=response_data)
850
+ raise errors.PatchSweepConfigError(response_data, http_res)
935
851
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
936
852
  http_res_text = utils.stream_to_text(http_res)
937
- raise errors.APIError(
938
- "API error occurred", http_res.status_code, http_res_text, http_res
939
- )
853
+ raise errors.APIError("API error occurred", http_res, http_res_text)
940
854
  if utils.match_response(http_res, ["500", "504"], "*"):
941
855
  http_res_text = utils.stream_to_text(http_res)
942
- raise errors.APIError(
943
- "API error occurred", http_res.status_code, http_res_text, http_res
944
- )
856
+ raise errors.APIError("API error occurred", http_res, http_res_text)
945
857
  if utils.match_response(http_res, "4XX", "*"):
946
858
  http_res_text = utils.stream_to_text(http_res)
947
- raise errors.APIError(
948
- "API error occurred", http_res.status_code, http_res_text, http_res
949
- )
859
+ raise errors.APIError("API error occurred", http_res, http_res_text)
950
860
  if utils.match_response(http_res, "5XX", "*"):
951
861
  http_res_text = utils.stream_to_text(http_res)
952
- raise errors.APIError(
953
- "API error occurred", http_res.status_code, http_res_text, http_res
954
- )
862
+ raise errors.APIError("API error occurred", http_res, http_res_text)
955
863
 
956
- content_type = http_res.headers.get("Content-Type")
957
- http_res_text = utils.stream_to_text(http_res)
958
- raise errors.APIError(
959
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
960
- http_res.status_code,
961
- http_res_text,
962
- http_res,
963
- )
864
+ raise errors.APIError("Unexpected response received", http_res)
964
865
 
965
866
  async def update_config_async(
966
867
  self,
@@ -1101,46 +1002,33 @@ class Sweeps(BaseSDK):
1101
1002
  response_data: Any = None
1102
1003
  if utils.match_response(http_res, "200", "application/json"):
1103
1004
  return operations.UpdateSweepConfigResponse(
1104
- result=utils.unmarshal_json(http_res.text, components.SweepConfig),
1005
+ result=utils.unmarshal_json_response(components.SweepConfig, http_res),
1105
1006
  headers=utils.get_response_headers(http_res.headers),
1106
1007
  )
1107
1008
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1108
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1109
- raise errors.GenericError(data=response_data)
1009
+ response_data = utils.unmarshal_json_response(
1010
+ errors.GenericErrorData, http_res
1011
+ )
1012
+ raise errors.GenericError(response_data, http_res)
1110
1013
  if utils.match_response(http_res, "422", "application/json"):
1111
- response_data = utils.unmarshal_json(
1112
- http_res.text, errors.PatchSweepConfigErrorData
1014
+ response_data = utils.unmarshal_json_response(
1015
+ errors.PatchSweepConfigErrorData, http_res
1113
1016
  )
1114
- raise errors.PatchSweepConfigError(data=response_data)
1017
+ raise errors.PatchSweepConfigError(response_data, http_res)
1115
1018
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1116
1019
  http_res_text = await utils.stream_to_text_async(http_res)
1117
- raise errors.APIError(
1118
- "API error occurred", http_res.status_code, http_res_text, http_res
1119
- )
1020
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1120
1021
  if utils.match_response(http_res, ["500", "504"], "*"):
1121
1022
  http_res_text = await utils.stream_to_text_async(http_res)
1122
- raise errors.APIError(
1123
- "API error occurred", http_res.status_code, http_res_text, http_res
1124
- )
1023
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1125
1024
  if utils.match_response(http_res, "4XX", "*"):
1126
1025
  http_res_text = await utils.stream_to_text_async(http_res)
1127
- raise errors.APIError(
1128
- "API error occurred", http_res.status_code, http_res_text, http_res
1129
- )
1026
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1130
1027
  if utils.match_response(http_res, "5XX", "*"):
1131
1028
  http_res_text = await utils.stream_to_text_async(http_res)
1132
- raise errors.APIError(
1133
- "API error occurred", http_res.status_code, http_res_text, http_res
1134
- )
1029
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1135
1030
 
1136
- content_type = http_res.headers.get("Content-Type")
1137
- http_res_text = await utils.stream_to_text_async(http_res)
1138
- raise errors.APIError(
1139
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1140
- http_res.status_code,
1141
- http_res_text,
1142
- http_res,
1143
- )
1031
+ raise errors.APIError("Unexpected response received", http_res)
1144
1032
 
1145
1033
  def list(
1146
1034
  self,
@@ -1235,38 +1123,23 @@ class Sweeps(BaseSDK):
1235
1123
 
1236
1124
  if utils.match_response(http_res, "200", "application/json"):
1237
1125
  return operations.ListSweepsResponse(
1238
- result=utils.unmarshal_json(http_res.text, List[components.Sweep]),
1126
+ result=utils.unmarshal_json_response(List[components.Sweep], http_res),
1239
1127
  headers=utils.get_response_headers(http_res.headers),
1240
1128
  )
1241
1129
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
1242
1130
  http_res_text = utils.stream_to_text(http_res)
1243
- raise errors.APIError(
1244
- "API error occurred", http_res.status_code, http_res_text, http_res
1245
- )
1131
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1246
1132
  if utils.match_response(http_res, ["500", "504"], "*"):
1247
1133
  http_res_text = utils.stream_to_text(http_res)
1248
- raise errors.APIError(
1249
- "API error occurred", http_res.status_code, http_res_text, http_res
1250
- )
1134
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1251
1135
  if utils.match_response(http_res, "4XX", "*"):
1252
1136
  http_res_text = utils.stream_to_text(http_res)
1253
- raise errors.APIError(
1254
- "API error occurred", http_res.status_code, http_res_text, http_res
1255
- )
1137
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1256
1138
  if utils.match_response(http_res, "5XX", "*"):
1257
1139
  http_res_text = utils.stream_to_text(http_res)
1258
- raise errors.APIError(
1259
- "API error occurred", http_res.status_code, http_res_text, http_res
1260
- )
1140
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1261
1141
 
1262
- content_type = http_res.headers.get("Content-Type")
1263
- http_res_text = utils.stream_to_text(http_res)
1264
- raise errors.APIError(
1265
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1266
- http_res.status_code,
1267
- http_res_text,
1268
- http_res,
1269
- )
1142
+ raise errors.APIError("Unexpected response received", http_res)
1270
1143
 
1271
1144
  async def list_async(
1272
1145
  self,
@@ -1361,38 +1234,23 @@ class Sweeps(BaseSDK):
1361
1234
 
1362
1235
  if utils.match_response(http_res, "200", "application/json"):
1363
1236
  return operations.ListSweepsResponse(
1364
- result=utils.unmarshal_json(http_res.text, List[components.Sweep]),
1237
+ result=utils.unmarshal_json_response(List[components.Sweep], http_res),
1365
1238
  headers=utils.get_response_headers(http_res.headers),
1366
1239
  )
1367
1240
  if utils.match_response(http_res, ["401", "403", "429"], "*"):
1368
1241
  http_res_text = await utils.stream_to_text_async(http_res)
1369
- raise errors.APIError(
1370
- "API error occurred", http_res.status_code, http_res_text, http_res
1371
- )
1242
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1372
1243
  if utils.match_response(http_res, ["500", "504"], "*"):
1373
1244
  http_res_text = await utils.stream_to_text_async(http_res)
1374
- raise errors.APIError(
1375
- "API error occurred", http_res.status_code, http_res_text, http_res
1376
- )
1245
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1377
1246
  if utils.match_response(http_res, "4XX", "*"):
1378
1247
  http_res_text = await utils.stream_to_text_async(http_res)
1379
- raise errors.APIError(
1380
- "API error occurred", http_res.status_code, http_res_text, http_res
1381
- )
1248
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1382
1249
  if utils.match_response(http_res, "5XX", "*"):
1383
1250
  http_res_text = await utils.stream_to_text_async(http_res)
1384
- raise errors.APIError(
1385
- "API error occurred", http_res.status_code, http_res_text, http_res
1386
- )
1251
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1387
1252
 
1388
- content_type = http_res.headers.get("Content-Type")
1389
- http_res_text = await utils.stream_to_text_async(http_res)
1390
- raise errors.APIError(
1391
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1392
- http_res.status_code,
1393
- http_res_text,
1394
- http_res,
1395
- )
1253
+ raise errors.APIError("Unexpected response received", http_res)
1396
1254
 
1397
1255
  def get(
1398
1256
  self,
@@ -1478,38 +1336,23 @@ class Sweeps(BaseSDK):
1478
1336
 
1479
1337
  if utils.match_response(http_res, "200", "application/json"):
1480
1338
  return operations.GetSweepResponse(
1481
- result=utils.unmarshal_json(http_res.text, components.Sweep),
1339
+ result=utils.unmarshal_json_response(components.Sweep, http_res),
1482
1340
  headers=utils.get_response_headers(http_res.headers),
1483
1341
  )
1484
1342
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1485
1343
  http_res_text = utils.stream_to_text(http_res)
1486
- raise errors.APIError(
1487
- "API error occurred", http_res.status_code, http_res_text, http_res
1488
- )
1344
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1489
1345
  if utils.match_response(http_res, ["500", "504"], "*"):
1490
1346
  http_res_text = utils.stream_to_text(http_res)
1491
- raise errors.APIError(
1492
- "API error occurred", http_res.status_code, http_res_text, http_res
1493
- )
1347
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1494
1348
  if utils.match_response(http_res, "4XX", "*"):
1495
1349
  http_res_text = utils.stream_to_text(http_res)
1496
- raise errors.APIError(
1497
- "API error occurred", http_res.status_code, http_res_text, http_res
1498
- )
1350
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1499
1351
  if utils.match_response(http_res, "5XX", "*"):
1500
1352
  http_res_text = utils.stream_to_text(http_res)
1501
- raise errors.APIError(
1502
- "API error occurred", http_res.status_code, http_res_text, http_res
1503
- )
1353
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1504
1354
 
1505
- content_type = http_res.headers.get("Content-Type")
1506
- http_res_text = utils.stream_to_text(http_res)
1507
- raise errors.APIError(
1508
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1509
- http_res.status_code,
1510
- http_res_text,
1511
- http_res,
1512
- )
1355
+ raise errors.APIError("Unexpected response received", http_res)
1513
1356
 
1514
1357
  async def get_async(
1515
1358
  self,
@@ -1595,35 +1438,20 @@ class Sweeps(BaseSDK):
1595
1438
 
1596
1439
  if utils.match_response(http_res, "200", "application/json"):
1597
1440
  return operations.GetSweepResponse(
1598
- result=utils.unmarshal_json(http_res.text, components.Sweep),
1441
+ result=utils.unmarshal_json_response(components.Sweep, http_res),
1599
1442
  headers=utils.get_response_headers(http_res.headers),
1600
1443
  )
1601
1444
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1602
1445
  http_res_text = await utils.stream_to_text_async(http_res)
1603
- raise errors.APIError(
1604
- "API error occurred", http_res.status_code, http_res_text, http_res
1605
- )
1446
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1606
1447
  if utils.match_response(http_res, ["500", "504"], "*"):
1607
1448
  http_res_text = await utils.stream_to_text_async(http_res)
1608
- raise errors.APIError(
1609
- "API error occurred", http_res.status_code, http_res_text, http_res
1610
- )
1449
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1611
1450
  if utils.match_response(http_res, "4XX", "*"):
1612
1451
  http_res_text = await utils.stream_to_text_async(http_res)
1613
- raise errors.APIError(
1614
- "API error occurred", http_res.status_code, http_res_text, http_res
1615
- )
1452
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1616
1453
  if utils.match_response(http_res, "5XX", "*"):
1617
1454
  http_res_text = await utils.stream_to_text_async(http_res)
1618
- raise errors.APIError(
1619
- "API error occurred", http_res.status_code, http_res_text, http_res
1620
- )
1455
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1621
1456
 
1622
- content_type = http_res.headers.get("Content-Type")
1623
- http_res_text = await utils.stream_to_text_async(http_res)
1624
- raise errors.APIError(
1625
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1626
- http_res.status_code,
1627
- http_res_text,
1628
- http_res,
1629
- )
1457
+ raise errors.APIError("Unexpected response received", http_res)