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/basesdk.py CHANGED
@@ -245,7 +245,7 @@ class BaseSDK:
245
245
 
246
246
  if http_res is None:
247
247
  logger.debug("Raising no response SDK error")
248
- raise errors.APIError("No response received")
248
+ raise errors.NoResponseError("No response received")
249
249
 
250
250
  logger.debug(
251
251
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -266,7 +266,7 @@ class BaseSDK:
266
266
  http_res = result
267
267
  else:
268
268
  logger.debug("Raising unexpected SDK error")
269
- raise errors.APIError("Unexpected error occurred")
269
+ raise errors.APIError("Unexpected error occurred", http_res)
270
270
 
271
271
  return http_res
272
272
 
@@ -317,7 +317,7 @@ class BaseSDK:
317
317
 
318
318
  if http_res is None:
319
319
  logger.debug("Raising no response SDK error")
320
- raise errors.APIError("No response received")
320
+ raise errors.NoResponseError("No response received")
321
321
 
322
322
  logger.debug(
323
323
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -338,7 +338,7 @@ class BaseSDK:
338
338
  http_res = result
339
339
  else:
340
340
  logger.debug("Raising unexpected SDK error")
341
- raise errors.APIError("Unexpected error occurred")
341
+ raise errors.APIError("Unexpected error occurred", http_res)
342
342
 
343
343
  return http_res
344
344
 
moovio_sdk/branding.py CHANGED
@@ -113,46 +113,35 @@ class Branding(BaseSDK):
113
113
  response_data: Any = None
114
114
  if utils.match_response(http_res, "200", "application/json"):
115
115
  return operations.CreateBrandResponse(
116
- result=utils.unmarshal_json(http_res.text, components.BrandProperties),
116
+ result=utils.unmarshal_json_response(
117
+ components.BrandProperties, http_res
118
+ ),
117
119
  headers=utils.get_response_headers(http_res.headers),
118
120
  )
119
121
  if utils.match_response(http_res, ["400", "409"], "application/json"):
120
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
121
- raise errors.GenericError(data=response_data)
122
+ response_data = utils.unmarshal_json_response(
123
+ errors.GenericErrorData, http_res
124
+ )
125
+ raise errors.GenericError(response_data, http_res)
122
126
  if utils.match_response(http_res, "422", "application/json"):
123
- response_data = utils.unmarshal_json(
124
- http_res.text, errors.BrandValidationErrorData
127
+ response_data = utils.unmarshal_json_response(
128
+ errors.BrandValidationErrorData, http_res
125
129
  )
126
- raise errors.BrandValidationError(data=response_data)
130
+ raise errors.BrandValidationError(response_data, http_res)
127
131
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
128
132
  http_res_text = utils.stream_to_text(http_res)
129
- raise errors.APIError(
130
- "API error occurred", http_res.status_code, http_res_text, http_res
131
- )
133
+ raise errors.APIError("API error occurred", http_res, http_res_text)
132
134
  if utils.match_response(http_res, ["500", "504"], "*"):
133
135
  http_res_text = utils.stream_to_text(http_res)
134
- raise errors.APIError(
135
- "API error occurred", http_res.status_code, http_res_text, http_res
136
- )
136
+ raise errors.APIError("API error occurred", http_res, http_res_text)
137
137
  if utils.match_response(http_res, "4XX", "*"):
138
138
  http_res_text = utils.stream_to_text(http_res)
139
- raise errors.APIError(
140
- "API error occurred", http_res.status_code, http_res_text, http_res
141
- )
139
+ raise errors.APIError("API error occurred", http_res, http_res_text)
142
140
  if utils.match_response(http_res, "5XX", "*"):
143
141
  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
- )
142
+ raise errors.APIError("API error occurred", http_res, http_res_text)
147
143
 
148
- content_type = http_res.headers.get("Content-Type")
149
- http_res_text = utils.stream_to_text(http_res)
150
- raise errors.APIError(
151
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
152
- http_res.status_code,
153
- http_res_text,
154
- http_res,
155
- )
144
+ raise errors.APIError("Unexpected response received", http_res)
156
145
 
157
146
  async def create_async(
158
147
  self,
@@ -257,46 +246,35 @@ class Branding(BaseSDK):
257
246
  response_data: Any = None
258
247
  if utils.match_response(http_res, "200", "application/json"):
259
248
  return operations.CreateBrandResponse(
260
- result=utils.unmarshal_json(http_res.text, components.BrandProperties),
249
+ result=utils.unmarshal_json_response(
250
+ components.BrandProperties, http_res
251
+ ),
261
252
  headers=utils.get_response_headers(http_res.headers),
262
253
  )
263
254
  if utils.match_response(http_res, ["400", "409"], "application/json"):
264
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
265
- raise errors.GenericError(data=response_data)
255
+ response_data = utils.unmarshal_json_response(
256
+ errors.GenericErrorData, http_res
257
+ )
258
+ raise errors.GenericError(response_data, http_res)
266
259
  if utils.match_response(http_res, "422", "application/json"):
267
- response_data = utils.unmarshal_json(
268
- http_res.text, errors.BrandValidationErrorData
260
+ response_data = utils.unmarshal_json_response(
261
+ errors.BrandValidationErrorData, http_res
269
262
  )
270
- raise errors.BrandValidationError(data=response_data)
263
+ raise errors.BrandValidationError(response_data, http_res)
271
264
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
272
265
  http_res_text = await utils.stream_to_text_async(http_res)
273
- raise errors.APIError(
274
- "API error occurred", http_res.status_code, http_res_text, http_res
275
- )
266
+ raise errors.APIError("API error occurred", http_res, http_res_text)
276
267
  if utils.match_response(http_res, ["500", "504"], "*"):
277
268
  http_res_text = await utils.stream_to_text_async(http_res)
278
- raise errors.APIError(
279
- "API error occurred", http_res.status_code, http_res_text, http_res
280
- )
269
+ raise errors.APIError("API error occurred", http_res, http_res_text)
281
270
  if utils.match_response(http_res, "4XX", "*"):
282
271
  http_res_text = await utils.stream_to_text_async(http_res)
283
- raise errors.APIError(
284
- "API error occurred", http_res.status_code, http_res_text, http_res
285
- )
272
+ raise errors.APIError("API error occurred", http_res, http_res_text)
286
273
  if utils.match_response(http_res, "5XX", "*"):
287
274
  http_res_text = await utils.stream_to_text_async(http_res)
288
- raise errors.APIError(
289
- "API error occurred", http_res.status_code, http_res_text, http_res
290
- )
275
+ raise errors.APIError("API error occurred", http_res, http_res_text)
291
276
 
292
- content_type = http_res.headers.get("Content-Type")
293
- http_res_text = await utils.stream_to_text_async(http_res)
294
- raise errors.APIError(
295
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
296
- http_res.status_code,
297
- http_res_text,
298
- http_res,
299
- )
277
+ raise errors.APIError("Unexpected response received", http_res)
300
278
 
301
279
  def upsert(
302
280
  self,
@@ -401,46 +379,35 @@ class Branding(BaseSDK):
401
379
  response_data: Any = None
402
380
  if utils.match_response(http_res, "200", "application/json"):
403
381
  return operations.UpsertBrandResponse(
404
- result=utils.unmarshal_json(http_res.text, components.BrandProperties),
382
+ result=utils.unmarshal_json_response(
383
+ components.BrandProperties, http_res
384
+ ),
405
385
  headers=utils.get_response_headers(http_res.headers),
406
386
  )
407
387
  if utils.match_response(http_res, ["400", "409"], "application/json"):
408
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
409
- raise errors.GenericError(data=response_data)
388
+ response_data = utils.unmarshal_json_response(
389
+ errors.GenericErrorData, http_res
390
+ )
391
+ raise errors.GenericError(response_data, http_res)
410
392
  if utils.match_response(http_res, "422", "application/json"):
411
- response_data = utils.unmarshal_json(
412
- http_res.text, errors.BrandValidationErrorData
393
+ response_data = utils.unmarshal_json_response(
394
+ errors.BrandValidationErrorData, http_res
413
395
  )
414
- raise errors.BrandValidationError(data=response_data)
396
+ raise errors.BrandValidationError(response_data, http_res)
415
397
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
416
398
  http_res_text = utils.stream_to_text(http_res)
417
- raise errors.APIError(
418
- "API error occurred", http_res.status_code, http_res_text, http_res
419
- )
399
+ raise errors.APIError("API error occurred", http_res, http_res_text)
420
400
  if utils.match_response(http_res, ["500", "504"], "*"):
421
401
  http_res_text = utils.stream_to_text(http_res)
422
- raise errors.APIError(
423
- "API error occurred", http_res.status_code, http_res_text, http_res
424
- )
402
+ raise errors.APIError("API error occurred", http_res, http_res_text)
425
403
  if utils.match_response(http_res, "4XX", "*"):
426
404
  http_res_text = utils.stream_to_text(http_res)
427
- raise errors.APIError(
428
- "API error occurred", http_res.status_code, http_res_text, http_res
429
- )
405
+ raise errors.APIError("API error occurred", http_res, http_res_text)
430
406
  if utils.match_response(http_res, "5XX", "*"):
431
407
  http_res_text = utils.stream_to_text(http_res)
432
- raise errors.APIError(
433
- "API error occurred", http_res.status_code, http_res_text, http_res
434
- )
408
+ raise errors.APIError("API error occurred", http_res, http_res_text)
435
409
 
436
- content_type = http_res.headers.get("Content-Type")
437
- http_res_text = utils.stream_to_text(http_res)
438
- raise errors.APIError(
439
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
440
- http_res.status_code,
441
- http_res_text,
442
- http_res,
443
- )
410
+ raise errors.APIError("Unexpected response received", http_res)
444
411
 
445
412
  async def upsert_async(
446
413
  self,
@@ -545,46 +512,35 @@ class Branding(BaseSDK):
545
512
  response_data: Any = None
546
513
  if utils.match_response(http_res, "200", "application/json"):
547
514
  return operations.UpsertBrandResponse(
548
- result=utils.unmarshal_json(http_res.text, components.BrandProperties),
515
+ result=utils.unmarshal_json_response(
516
+ components.BrandProperties, http_res
517
+ ),
549
518
  headers=utils.get_response_headers(http_res.headers),
550
519
  )
551
520
  if utils.match_response(http_res, ["400", "409"], "application/json"):
552
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
553
- raise errors.GenericError(data=response_data)
521
+ response_data = utils.unmarshal_json_response(
522
+ errors.GenericErrorData, http_res
523
+ )
524
+ raise errors.GenericError(response_data, http_res)
554
525
  if utils.match_response(http_res, "422", "application/json"):
555
- response_data = utils.unmarshal_json(
556
- http_res.text, errors.BrandValidationErrorData
526
+ response_data = utils.unmarshal_json_response(
527
+ errors.BrandValidationErrorData, http_res
557
528
  )
558
- raise errors.BrandValidationError(data=response_data)
529
+ raise errors.BrandValidationError(response_data, http_res)
559
530
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
560
531
  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
- )
532
+ raise errors.APIError("API error occurred", http_res, http_res_text)
564
533
  if utils.match_response(http_res, ["500", "504"], "*"):
565
534
  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
- )
535
+ raise errors.APIError("API error occurred", http_res, http_res_text)
569
536
  if utils.match_response(http_res, "4XX", "*"):
570
537
  http_res_text = await utils.stream_to_text_async(http_res)
571
- raise errors.APIError(
572
- "API error occurred", http_res.status_code, http_res_text, http_res
573
- )
538
+ raise errors.APIError("API error occurred", http_res, http_res_text)
574
539
  if utils.match_response(http_res, "5XX", "*"):
575
540
  http_res_text = await utils.stream_to_text_async(http_res)
576
- raise errors.APIError(
577
- "API error occurred", http_res.status_code, http_res_text, http_res
578
- )
541
+ raise errors.APIError("API error occurred", http_res, http_res_text)
579
542
 
580
- content_type = http_res.headers.get("Content-Type")
581
- http_res_text = await utils.stream_to_text_async(http_res)
582
- raise errors.APIError(
583
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
584
- http_res.status_code,
585
- http_res_text,
586
- http_res,
587
- )
543
+ raise errors.APIError("Unexpected response received", http_res)
588
544
 
589
545
  def get(
590
546
  self,
@@ -664,38 +620,25 @@ class Branding(BaseSDK):
664
620
 
665
621
  if utils.match_response(http_res, "200", "application/json"):
666
622
  return operations.GetBrandResponse(
667
- result=utils.unmarshal_json(http_res.text, components.BrandProperties),
623
+ result=utils.unmarshal_json_response(
624
+ components.BrandProperties, http_res
625
+ ),
668
626
  headers=utils.get_response_headers(http_res.headers),
669
627
  )
670
628
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
671
629
  http_res_text = utils.stream_to_text(http_res)
672
- raise errors.APIError(
673
- "API error occurred", http_res.status_code, http_res_text, http_res
674
- )
630
+ raise errors.APIError("API error occurred", http_res, http_res_text)
675
631
  if utils.match_response(http_res, ["500", "504"], "*"):
676
632
  http_res_text = utils.stream_to_text(http_res)
677
- raise errors.APIError(
678
- "API error occurred", http_res.status_code, http_res_text, http_res
679
- )
633
+ raise errors.APIError("API error occurred", http_res, http_res_text)
680
634
  if utils.match_response(http_res, "4XX", "*"):
681
635
  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
- )
636
+ raise errors.APIError("API error occurred", http_res, http_res_text)
685
637
  if utils.match_response(http_res, "5XX", "*"):
686
638
  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
- )
639
+ raise errors.APIError("API error occurred", http_res, http_res_text)
690
640
 
691
- content_type = http_res.headers.get("Content-Type")
692
- http_res_text = utils.stream_to_text(http_res)
693
- raise errors.APIError(
694
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
695
- http_res.status_code,
696
- http_res_text,
697
- http_res,
698
- )
641
+ raise errors.APIError("Unexpected response received", http_res)
699
642
 
700
643
  async def get_async(
701
644
  self,
@@ -775,38 +718,25 @@ class Branding(BaseSDK):
775
718
 
776
719
  if utils.match_response(http_res, "200", "application/json"):
777
720
  return operations.GetBrandResponse(
778
- result=utils.unmarshal_json(http_res.text, components.BrandProperties),
721
+ result=utils.unmarshal_json_response(
722
+ components.BrandProperties, http_res
723
+ ),
779
724
  headers=utils.get_response_headers(http_res.headers),
780
725
  )
781
726
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
782
727
  http_res_text = await utils.stream_to_text_async(http_res)
783
- raise errors.APIError(
784
- "API error occurred", http_res.status_code, http_res_text, http_res
785
- )
728
+ raise errors.APIError("API error occurred", http_res, http_res_text)
786
729
  if utils.match_response(http_res, ["500", "504"], "*"):
787
730
  http_res_text = await utils.stream_to_text_async(http_res)
788
- raise errors.APIError(
789
- "API error occurred", http_res.status_code, http_res_text, http_res
790
- )
731
+ raise errors.APIError("API error occurred", http_res, http_res_text)
791
732
  if utils.match_response(http_res, "4XX", "*"):
792
733
  http_res_text = await utils.stream_to_text_async(http_res)
793
- raise errors.APIError(
794
- "API error occurred", http_res.status_code, http_res_text, http_res
795
- )
734
+ raise errors.APIError("API error occurred", http_res, http_res_text)
796
735
  if utils.match_response(http_res, "5XX", "*"):
797
736
  http_res_text = await utils.stream_to_text_async(http_res)
798
- raise errors.APIError(
799
- "API error occurred", http_res.status_code, http_res_text, http_res
800
- )
737
+ raise errors.APIError("API error occurred", http_res, http_res_text)
801
738
 
802
- content_type = http_res.headers.get("Content-Type")
803
- http_res_text = await utils.stream_to_text_async(http_res)
804
- raise errors.APIError(
805
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
806
- http_res.status_code,
807
- http_res_text,
808
- http_res,
809
- )
739
+ raise errors.APIError("Unexpected response received", http_res)
810
740
 
811
741
  def update(
812
742
  self,
@@ -911,46 +841,35 @@ class Branding(BaseSDK):
911
841
  response_data: Any = None
912
842
  if utils.match_response(http_res, "200", "application/json"):
913
843
  return operations.UpdateBrandResponse(
914
- result=utils.unmarshal_json(http_res.text, components.BrandProperties),
844
+ result=utils.unmarshal_json_response(
845
+ components.BrandProperties, http_res
846
+ ),
915
847
  headers=utils.get_response_headers(http_res.headers),
916
848
  )
917
849
  if utils.match_response(http_res, ["400", "409"], "application/json"):
918
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
919
- raise errors.GenericError(data=response_data)
850
+ response_data = utils.unmarshal_json_response(
851
+ errors.GenericErrorData, http_res
852
+ )
853
+ raise errors.GenericError(response_data, http_res)
920
854
  if utils.match_response(http_res, "422", "application/json"):
921
- response_data = utils.unmarshal_json(
922
- http_res.text, errors.BrandValidationErrorData
855
+ response_data = utils.unmarshal_json_response(
856
+ errors.BrandValidationErrorData, http_res
923
857
  )
924
- raise errors.BrandValidationError(data=response_data)
858
+ raise errors.BrandValidationError(response_data, http_res)
925
859
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
926
860
  http_res_text = utils.stream_to_text(http_res)
927
- raise errors.APIError(
928
- "API error occurred", http_res.status_code, http_res_text, http_res
929
- )
861
+ raise errors.APIError("API error occurred", http_res, http_res_text)
930
862
  if utils.match_response(http_res, ["500", "504"], "*"):
931
863
  http_res_text = utils.stream_to_text(http_res)
932
- raise errors.APIError(
933
- "API error occurred", http_res.status_code, http_res_text, http_res
934
- )
864
+ raise errors.APIError("API error occurred", http_res, http_res_text)
935
865
  if utils.match_response(http_res, "4XX", "*"):
936
866
  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
- )
867
+ raise errors.APIError("API error occurred", http_res, http_res_text)
940
868
  if utils.match_response(http_res, "5XX", "*"):
941
869
  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
- )
870
+ raise errors.APIError("API error occurred", http_res, http_res_text)
945
871
 
946
- content_type = http_res.headers.get("Content-Type")
947
- http_res_text = utils.stream_to_text(http_res)
948
- raise errors.APIError(
949
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
950
- http_res.status_code,
951
- http_res_text,
952
- http_res,
953
- )
872
+ raise errors.APIError("Unexpected response received", http_res)
954
873
 
955
874
  async def update_async(
956
875
  self,
@@ -1055,43 +974,32 @@ class Branding(BaseSDK):
1055
974
  response_data: Any = None
1056
975
  if utils.match_response(http_res, "200", "application/json"):
1057
976
  return operations.UpdateBrandResponse(
1058
- result=utils.unmarshal_json(http_res.text, components.BrandProperties),
977
+ result=utils.unmarshal_json_response(
978
+ components.BrandProperties, http_res
979
+ ),
1059
980
  headers=utils.get_response_headers(http_res.headers),
1060
981
  )
1061
982
  if utils.match_response(http_res, ["400", "409"], "application/json"):
1062
- response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
1063
- raise errors.GenericError(data=response_data)
983
+ response_data = utils.unmarshal_json_response(
984
+ errors.GenericErrorData, http_res
985
+ )
986
+ raise errors.GenericError(response_data, http_res)
1064
987
  if utils.match_response(http_res, "422", "application/json"):
1065
- response_data = utils.unmarshal_json(
1066
- http_res.text, errors.BrandValidationErrorData
988
+ response_data = utils.unmarshal_json_response(
989
+ errors.BrandValidationErrorData, http_res
1067
990
  )
1068
- raise errors.BrandValidationError(data=response_data)
991
+ raise errors.BrandValidationError(response_data, http_res)
1069
992
  if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1070
993
  http_res_text = await utils.stream_to_text_async(http_res)
1071
- raise errors.APIError(
1072
- "API error occurred", http_res.status_code, http_res_text, http_res
1073
- )
994
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1074
995
  if utils.match_response(http_res, ["500", "504"], "*"):
1075
996
  http_res_text = await utils.stream_to_text_async(http_res)
1076
- raise errors.APIError(
1077
- "API error occurred", http_res.status_code, http_res_text, http_res
1078
- )
997
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1079
998
  if utils.match_response(http_res, "4XX", "*"):
1080
999
  http_res_text = await utils.stream_to_text_async(http_res)
1081
- raise errors.APIError(
1082
- "API error occurred", http_res.status_code, http_res_text, http_res
1083
- )
1000
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1084
1001
  if utils.match_response(http_res, "5XX", "*"):
1085
1002
  http_res_text = await utils.stream_to_text_async(http_res)
1086
- raise errors.APIError(
1087
- "API error occurred", http_res.status_code, http_res_text, http_res
1088
- )
1003
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1089
1004
 
1090
- content_type = http_res.headers.get("Content-Type")
1091
- http_res_text = await utils.stream_to_text_async(http_res)
1092
- raise errors.APIError(
1093
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1094
- http_res.status_code,
1095
- http_res_text,
1096
- http_res,
1097
- )
1005
+ raise errors.APIError("Unexpected response received", http_res)