syllable-sdk 0.35.32__py3-none-any.whl → 0.35.34__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 (51) hide show
  1. syllable_sdk/__init__.py +0 -1
  2. syllable_sdk/_version.py +3 -3
  3. syllable_sdk/agents.py +80 -211
  4. syllable_sdk/basesdk.py +5 -5
  5. syllable_sdk/batches.py +132 -329
  6. syllable_sdk/campaigns.py +74 -183
  7. syllable_sdk/channels.py +30 -73
  8. syllable_sdk/conversations.py +16 -37
  9. syllable_sdk/custom_messages.py +74 -183
  10. syllable_sdk/dashboards.py +64 -195
  11. syllable_sdk/data_sources.py +74 -183
  12. syllable_sdk/errors/__init__.py +55 -0
  13. syllable_sdk/errors/apierror.py +38 -0
  14. syllable_sdk/errors/httpvalidationerror.py +26 -0
  15. syllable_sdk/errors/no_response_error.py +13 -0
  16. syllable_sdk/errors/responsevalidationerror.py +25 -0
  17. syllable_sdk/errors/syllablesdkerror.py +26 -0
  18. syllable_sdk/events.py +16 -37
  19. syllable_sdk/folders.py +116 -295
  20. syllable_sdk/full_summary.py +16 -37
  21. syllable_sdk/incidents.py +84 -215
  22. syllable_sdk/insights_sdk.py +16 -41
  23. syllable_sdk/insights_tools.py +96 -253
  24. syllable_sdk/language_groups.py +86 -215
  25. syllable_sdk/latency.py +16 -37
  26. syllable_sdk/models/__init__.py +0 -8
  27. syllable_sdk/numbers.py +44 -113
  28. syllable_sdk/organizations.py +52 -139
  29. syllable_sdk/permissions.py +12 -33
  30. syllable_sdk/prompts.py +94 -251
  31. syllable_sdk/roles.py +72 -181
  32. syllable_sdk/services.py +72 -185
  33. syllable_sdk/session_debug.py +44 -109
  34. syllable_sdk/session_labels.py +44 -109
  35. syllable_sdk/sessions.py +56 -141
  36. syllable_sdk/takeouts.py +36 -99
  37. syllable_sdk/targets.py +74 -187
  38. syllable_sdk/test.py +16 -37
  39. syllable_sdk/tools.py +72 -181
  40. syllable_sdk/transcript.py +18 -39
  41. syllable_sdk/twilio.py +44 -109
  42. syllable_sdk/users.py +94 -247
  43. syllable_sdk/utils/serializers.py +3 -2
  44. syllable_sdk/utils/unmarshal_json_response.py +24 -0
  45. syllable_sdk/v1.py +94 -247
  46. syllable_sdk/workflows.py +116 -291
  47. {syllable_sdk-0.35.32.dist-info → syllable_sdk-0.35.34.dist-info}/METADATA +58 -45
  48. {syllable_sdk-0.35.32.dist-info → syllable_sdk-0.35.34.dist-info}/RECORD +49 -44
  49. syllable_sdk/models/apierror.py +0 -22
  50. syllable_sdk/models/httpvalidationerror.py +0 -21
  51. {syllable_sdk-0.35.32.dist-info → syllable_sdk-0.35.34.dist-info}/WHEEL +0 -0
syllable_sdk/folders.py CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  from .basesdk import BaseSDK
4
4
  from datetime import datetime
5
- from syllable_sdk import models, utils
5
+ from syllable_sdk import errors, models, utils
6
6
  from syllable_sdk._hooks import HookContext
7
7
  from syllable_sdk.types import BaseModel, OptionalNullable, UNSET
8
8
  from syllable_sdk.utils import get_security_from_env
9
+ from syllable_sdk.utils.unmarshal_json_response import unmarshal_json_response
9
10
  from typing import Any, List, Mapping, Optional, Union, cast
10
11
 
11
12
 
@@ -108,33 +109,20 @@ class Folders(BaseSDK):
108
109
 
109
110
  response_data: Any = None
110
111
  if utils.match_response(http_res, "200", "application/json"):
111
- return utils.unmarshal_json(
112
- http_res.text, models.ListResponseInsightsFolder
113
- )
112
+ return unmarshal_json_response(models.ListResponseInsightsFolder, http_res)
114
113
  if utils.match_response(http_res, "422", "application/json"):
115
- response_data = utils.unmarshal_json(
116
- http_res.text, models.HTTPValidationErrorData
114
+ response_data = unmarshal_json_response(
115
+ errors.HTTPValidationErrorData, http_res
117
116
  )
118
- raise models.HTTPValidationError(data=response_data)
117
+ raise errors.HTTPValidationError(response_data, http_res)
119
118
  if utils.match_response(http_res, "4XX", "*"):
120
119
  http_res_text = utils.stream_to_text(http_res)
121
- raise models.APIError(
122
- "API error occurred", http_res.status_code, http_res_text, http_res
123
- )
120
+ raise errors.APIError("API error occurred", http_res, http_res_text)
124
121
  if utils.match_response(http_res, "5XX", "*"):
125
122
  http_res_text = utils.stream_to_text(http_res)
126
- raise models.APIError(
127
- "API error occurred", http_res.status_code, http_res_text, http_res
128
- )
123
+ raise errors.APIError("API error occurred", http_res, http_res_text)
129
124
 
130
- content_type = http_res.headers.get("Content-Type")
131
- http_res_text = utils.stream_to_text(http_res)
132
- raise models.APIError(
133
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
134
- http_res.status_code,
135
- http_res_text,
136
- http_res,
137
- )
125
+ raise errors.APIError("Unexpected response received", http_res)
138
126
 
139
127
  async def list_async(
140
128
  self,
@@ -232,33 +220,20 @@ class Folders(BaseSDK):
232
220
 
233
221
  response_data: Any = None
234
222
  if utils.match_response(http_res, "200", "application/json"):
235
- return utils.unmarshal_json(
236
- http_res.text, models.ListResponseInsightsFolder
237
- )
223
+ return unmarshal_json_response(models.ListResponseInsightsFolder, http_res)
238
224
  if utils.match_response(http_res, "422", "application/json"):
239
- response_data = utils.unmarshal_json(
240
- http_res.text, models.HTTPValidationErrorData
225
+ response_data = unmarshal_json_response(
226
+ errors.HTTPValidationErrorData, http_res
241
227
  )
242
- raise models.HTTPValidationError(data=response_data)
228
+ raise errors.HTTPValidationError(response_data, http_res)
243
229
  if utils.match_response(http_res, "4XX", "*"):
244
230
  http_res_text = await utils.stream_to_text_async(http_res)
245
- raise models.APIError(
246
- "API error occurred", http_res.status_code, http_res_text, http_res
247
- )
231
+ raise errors.APIError("API error occurred", http_res, http_res_text)
248
232
  if utils.match_response(http_res, "5XX", "*"):
249
233
  http_res_text = await utils.stream_to_text_async(http_res)
250
- raise models.APIError(
251
- "API error occurred", http_res.status_code, http_res_text, http_res
252
- )
234
+ raise errors.APIError("API error occurred", http_res, http_res_text)
253
235
 
254
- content_type = http_res.headers.get("Content-Type")
255
- http_res_text = await utils.stream_to_text_async(http_res)
256
- raise models.APIError(
257
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
258
- http_res.status_code,
259
- http_res_text,
260
- http_res,
261
- )
236
+ raise errors.APIError("Unexpected response received", http_res)
262
237
 
263
238
  def create(
264
239
  self,
@@ -335,31 +310,20 @@ class Folders(BaseSDK):
335
310
 
336
311
  response_data: Any = None
337
312
  if utils.match_response(http_res, "200", "application/json"):
338
- return utils.unmarshal_json(http_res.text, models.InsightsFolder)
313
+ return unmarshal_json_response(models.InsightsFolder, http_res)
339
314
  if utils.match_response(http_res, "422", "application/json"):
340
- response_data = utils.unmarshal_json(
341
- http_res.text, models.HTTPValidationErrorData
315
+ response_data = unmarshal_json_response(
316
+ errors.HTTPValidationErrorData, http_res
342
317
  )
343
- raise models.HTTPValidationError(data=response_data)
318
+ raise errors.HTTPValidationError(response_data, http_res)
344
319
  if utils.match_response(http_res, "4XX", "*"):
345
320
  http_res_text = utils.stream_to_text(http_res)
346
- raise models.APIError(
347
- "API error occurred", http_res.status_code, http_res_text, http_res
348
- )
321
+ raise errors.APIError("API error occurred", http_res, http_res_text)
349
322
  if utils.match_response(http_res, "5XX", "*"):
350
323
  http_res_text = utils.stream_to_text(http_res)
351
- raise models.APIError(
352
- "API error occurred", http_res.status_code, http_res_text, http_res
353
- )
324
+ raise errors.APIError("API error occurred", http_res, http_res_text)
354
325
 
355
- content_type = http_res.headers.get("Content-Type")
356
- http_res_text = utils.stream_to_text(http_res)
357
- raise models.APIError(
358
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
359
- http_res.status_code,
360
- http_res_text,
361
- http_res,
362
- )
326
+ raise errors.APIError("Unexpected response received", http_res)
363
327
 
364
328
  async def create_async(
365
329
  self,
@@ -436,31 +400,20 @@ class Folders(BaseSDK):
436
400
 
437
401
  response_data: Any = None
438
402
  if utils.match_response(http_res, "200", "application/json"):
439
- return utils.unmarshal_json(http_res.text, models.InsightsFolder)
403
+ return unmarshal_json_response(models.InsightsFolder, http_res)
440
404
  if utils.match_response(http_res, "422", "application/json"):
441
- response_data = utils.unmarshal_json(
442
- http_res.text, models.HTTPValidationErrorData
405
+ response_data = unmarshal_json_response(
406
+ errors.HTTPValidationErrorData, http_res
443
407
  )
444
- raise models.HTTPValidationError(data=response_data)
408
+ raise errors.HTTPValidationError(response_data, http_res)
445
409
  if utils.match_response(http_res, "4XX", "*"):
446
410
  http_res_text = await utils.stream_to_text_async(http_res)
447
- raise models.APIError(
448
- "API error occurred", http_res.status_code, http_res_text, http_res
449
- )
411
+ raise errors.APIError("API error occurred", http_res, http_res_text)
450
412
  if utils.match_response(http_res, "5XX", "*"):
451
413
  http_res_text = await utils.stream_to_text_async(http_res)
452
- raise models.APIError(
453
- "API error occurred", http_res.status_code, http_res_text, http_res
454
- )
414
+ raise errors.APIError("API error occurred", http_res, http_res_text)
455
415
 
456
- content_type = http_res.headers.get("Content-Type")
457
- http_res_text = await utils.stream_to_text_async(http_res)
458
- raise models.APIError(
459
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
460
- http_res.status_code,
461
- http_res_text,
462
- http_res,
463
- )
416
+ raise errors.APIError("Unexpected response received", http_res)
464
417
 
465
418
  def get_by_id(
466
419
  self,
@@ -534,31 +487,20 @@ class Folders(BaseSDK):
534
487
 
535
488
  response_data: Any = None
536
489
  if utils.match_response(http_res, "200", "application/json"):
537
- return utils.unmarshal_json(http_res.text, models.FolderDetails)
490
+ return unmarshal_json_response(models.FolderDetails, http_res)
538
491
  if utils.match_response(http_res, "422", "application/json"):
539
- response_data = utils.unmarshal_json(
540
- http_res.text, models.HTTPValidationErrorData
492
+ response_data = unmarshal_json_response(
493
+ errors.HTTPValidationErrorData, http_res
541
494
  )
542
- raise models.HTTPValidationError(data=response_data)
495
+ raise errors.HTTPValidationError(response_data, http_res)
543
496
  if utils.match_response(http_res, "4XX", "*"):
544
497
  http_res_text = utils.stream_to_text(http_res)
545
- raise models.APIError(
546
- "API error occurred", http_res.status_code, http_res_text, http_res
547
- )
498
+ raise errors.APIError("API error occurred", http_res, http_res_text)
548
499
  if utils.match_response(http_res, "5XX", "*"):
549
500
  http_res_text = utils.stream_to_text(http_res)
550
- raise models.APIError(
551
- "API error occurred", http_res.status_code, http_res_text, http_res
552
- )
501
+ raise errors.APIError("API error occurred", http_res, http_res_text)
553
502
 
554
- content_type = http_res.headers.get("Content-Type")
555
- http_res_text = utils.stream_to_text(http_res)
556
- raise models.APIError(
557
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
558
- http_res.status_code,
559
- http_res_text,
560
- http_res,
561
- )
503
+ raise errors.APIError("Unexpected response received", http_res)
562
504
 
563
505
  async def get_by_id_async(
564
506
  self,
@@ -632,31 +574,20 @@ class Folders(BaseSDK):
632
574
 
633
575
  response_data: Any = None
634
576
  if utils.match_response(http_res, "200", "application/json"):
635
- return utils.unmarshal_json(http_res.text, models.FolderDetails)
577
+ return unmarshal_json_response(models.FolderDetails, http_res)
636
578
  if utils.match_response(http_res, "422", "application/json"):
637
- response_data = utils.unmarshal_json(
638
- http_res.text, models.HTTPValidationErrorData
579
+ response_data = unmarshal_json_response(
580
+ errors.HTTPValidationErrorData, http_res
639
581
  )
640
- raise models.HTTPValidationError(data=response_data)
582
+ raise errors.HTTPValidationError(response_data, http_res)
641
583
  if utils.match_response(http_res, "4XX", "*"):
642
584
  http_res_text = await utils.stream_to_text_async(http_res)
643
- raise models.APIError(
644
- "API error occurred", http_res.status_code, http_res_text, http_res
645
- )
585
+ raise errors.APIError("API error occurred", http_res, http_res_text)
646
586
  if utils.match_response(http_res, "5XX", "*"):
647
587
  http_res_text = await utils.stream_to_text_async(http_res)
648
- raise models.APIError(
649
- "API error occurred", http_res.status_code, http_res_text, http_res
650
- )
588
+ raise errors.APIError("API error occurred", http_res, http_res_text)
651
589
 
652
- content_type = http_res.headers.get("Content-Type")
653
- http_res_text = await utils.stream_to_text_async(http_res)
654
- raise models.APIError(
655
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
656
- http_res.status_code,
657
- http_res_text,
658
- http_res,
659
- )
590
+ raise errors.APIError("Unexpected response received", http_res)
660
591
 
661
592
  def delete(
662
593
  self,
@@ -730,31 +661,20 @@ class Folders(BaseSDK):
730
661
 
731
662
  response_data: Any = None
732
663
  if utils.match_response(http_res, "200", "application/json"):
733
- return utils.unmarshal_json(http_res.text, bool)
664
+ return unmarshal_json_response(bool, http_res)
734
665
  if utils.match_response(http_res, "422", "application/json"):
735
- response_data = utils.unmarshal_json(
736
- http_res.text, models.HTTPValidationErrorData
666
+ response_data = unmarshal_json_response(
667
+ errors.HTTPValidationErrorData, http_res
737
668
  )
738
- raise models.HTTPValidationError(data=response_data)
669
+ raise errors.HTTPValidationError(response_data, http_res)
739
670
  if utils.match_response(http_res, "4XX", "*"):
740
671
  http_res_text = utils.stream_to_text(http_res)
741
- raise models.APIError(
742
- "API error occurred", http_res.status_code, http_res_text, http_res
743
- )
672
+ raise errors.APIError("API error occurred", http_res, http_res_text)
744
673
  if utils.match_response(http_res, "5XX", "*"):
745
674
  http_res_text = utils.stream_to_text(http_res)
746
- raise models.APIError(
747
- "API error occurred", http_res.status_code, http_res_text, http_res
748
- )
675
+ raise errors.APIError("API error occurred", http_res, http_res_text)
749
676
 
750
- content_type = http_res.headers.get("Content-Type")
751
- http_res_text = utils.stream_to_text(http_res)
752
- raise models.APIError(
753
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
754
- http_res.status_code,
755
- http_res_text,
756
- http_res,
757
- )
677
+ raise errors.APIError("Unexpected response received", http_res)
758
678
 
759
679
  async def delete_async(
760
680
  self,
@@ -828,31 +748,20 @@ class Folders(BaseSDK):
828
748
 
829
749
  response_data: Any = None
830
750
  if utils.match_response(http_res, "200", "application/json"):
831
- return utils.unmarshal_json(http_res.text, bool)
751
+ return unmarshal_json_response(bool, http_res)
832
752
  if utils.match_response(http_res, "422", "application/json"):
833
- response_data = utils.unmarshal_json(
834
- http_res.text, models.HTTPValidationErrorData
753
+ response_data = unmarshal_json_response(
754
+ errors.HTTPValidationErrorData, http_res
835
755
  )
836
- raise models.HTTPValidationError(data=response_data)
756
+ raise errors.HTTPValidationError(response_data, http_res)
837
757
  if utils.match_response(http_res, "4XX", "*"):
838
758
  http_res_text = await utils.stream_to_text_async(http_res)
839
- raise models.APIError(
840
- "API error occurred", http_res.status_code, http_res_text, http_res
841
- )
759
+ raise errors.APIError("API error occurred", http_res, http_res_text)
842
760
  if utils.match_response(http_res, "5XX", "*"):
843
761
  http_res_text = await utils.stream_to_text_async(http_res)
844
- raise models.APIError(
845
- "API error occurred", http_res.status_code, http_res_text, http_res
846
- )
762
+ raise errors.APIError("API error occurred", http_res, http_res_text)
847
763
 
848
- content_type = http_res.headers.get("Content-Type")
849
- http_res_text = await utils.stream_to_text_async(http_res)
850
- raise models.APIError(
851
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
852
- http_res.status_code,
853
- http_res_text,
854
- http_res,
855
- )
764
+ raise errors.APIError("Unexpected response received", http_res)
856
765
 
857
766
  def update(
858
767
  self,
@@ -940,31 +849,20 @@ class Folders(BaseSDK):
940
849
 
941
850
  response_data: Any = None
942
851
  if utils.match_response(http_res, "200", "application/json"):
943
- return utils.unmarshal_json(http_res.text, models.InsightsFolder)
852
+ return unmarshal_json_response(models.InsightsFolder, http_res)
944
853
  if utils.match_response(http_res, "422", "application/json"):
945
- response_data = utils.unmarshal_json(
946
- http_res.text, models.HTTPValidationErrorData
854
+ response_data = unmarshal_json_response(
855
+ errors.HTTPValidationErrorData, http_res
947
856
  )
948
- raise models.HTTPValidationError(data=response_data)
857
+ raise errors.HTTPValidationError(response_data, http_res)
949
858
  if utils.match_response(http_res, "4XX", "*"):
950
859
  http_res_text = utils.stream_to_text(http_res)
951
- raise models.APIError(
952
- "API error occurred", http_res.status_code, http_res_text, http_res
953
- )
860
+ raise errors.APIError("API error occurred", http_res, http_res_text)
954
861
  if utils.match_response(http_res, "5XX", "*"):
955
862
  http_res_text = utils.stream_to_text(http_res)
956
- raise models.APIError(
957
- "API error occurred", http_res.status_code, http_res_text, http_res
958
- )
863
+ raise errors.APIError("API error occurred", http_res, http_res_text)
959
864
 
960
- content_type = http_res.headers.get("Content-Type")
961
- http_res_text = utils.stream_to_text(http_res)
962
- raise models.APIError(
963
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
964
- http_res.status_code,
965
- http_res_text,
966
- http_res,
967
- )
865
+ raise errors.APIError("Unexpected response received", http_res)
968
866
 
969
867
  async def update_async(
970
868
  self,
@@ -1052,31 +950,20 @@ class Folders(BaseSDK):
1052
950
 
1053
951
  response_data: Any = None
1054
952
  if utils.match_response(http_res, "200", "application/json"):
1055
- return utils.unmarshal_json(http_res.text, models.InsightsFolder)
953
+ return unmarshal_json_response(models.InsightsFolder, http_res)
1056
954
  if utils.match_response(http_res, "422", "application/json"):
1057
- response_data = utils.unmarshal_json(
1058
- http_res.text, models.HTTPValidationErrorData
955
+ response_data = unmarshal_json_response(
956
+ errors.HTTPValidationErrorData, http_res
1059
957
  )
1060
- raise models.HTTPValidationError(data=response_data)
958
+ raise errors.HTTPValidationError(response_data, http_res)
1061
959
  if utils.match_response(http_res, "4XX", "*"):
1062
960
  http_res_text = await utils.stream_to_text_async(http_res)
1063
- raise models.APIError(
1064
- "API error occurred", http_res.status_code, http_res_text, http_res
1065
- )
961
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1066
962
  if utils.match_response(http_res, "5XX", "*"):
1067
963
  http_res_text = await utils.stream_to_text_async(http_res)
1068
- raise models.APIError(
1069
- "API error occurred", http_res.status_code, http_res_text, http_res
1070
- )
964
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1071
965
 
1072
- content_type = http_res.headers.get("Content-Type")
1073
- http_res_text = await utils.stream_to_text_async(http_res)
1074
- raise models.APIError(
1075
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1076
- http_res.status_code,
1077
- http_res_text,
1078
- http_res,
1079
- )
966
+ raise errors.APIError("Unexpected response received", http_res)
1080
967
 
1081
968
  def upload_file(
1082
969
  self,
@@ -1189,31 +1076,20 @@ class Folders(BaseSDK):
1189
1076
 
1190
1077
  response_data: Any = None
1191
1078
  if utils.match_response(http_res, "200", "application/json"):
1192
- return utils.unmarshal_json(http_res.text, models.InsightsUploadFile)
1079
+ return unmarshal_json_response(models.InsightsUploadFile, http_res)
1193
1080
  if utils.match_response(http_res, "422", "application/json"):
1194
- response_data = utils.unmarshal_json(
1195
- http_res.text, models.HTTPValidationErrorData
1081
+ response_data = unmarshal_json_response(
1082
+ errors.HTTPValidationErrorData, http_res
1196
1083
  )
1197
- raise models.HTTPValidationError(data=response_data)
1084
+ raise errors.HTTPValidationError(response_data, http_res)
1198
1085
  if utils.match_response(http_res, "4XX", "*"):
1199
1086
  http_res_text = utils.stream_to_text(http_res)
1200
- raise models.APIError(
1201
- "API error occurred", http_res.status_code, http_res_text, http_res
1202
- )
1087
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1203
1088
  if utils.match_response(http_res, "5XX", "*"):
1204
1089
  http_res_text = utils.stream_to_text(http_res)
1205
- raise models.APIError(
1206
- "API error occurred", http_res.status_code, http_res_text, http_res
1207
- )
1090
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1208
1091
 
1209
- content_type = http_res.headers.get("Content-Type")
1210
- http_res_text = utils.stream_to_text(http_res)
1211
- raise models.APIError(
1212
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1213
- http_res.status_code,
1214
- http_res_text,
1215
- http_res,
1216
- )
1092
+ raise errors.APIError("Unexpected response received", http_res)
1217
1093
 
1218
1094
  async def upload_file_async(
1219
1095
  self,
@@ -1326,31 +1202,20 @@ class Folders(BaseSDK):
1326
1202
 
1327
1203
  response_data: Any = None
1328
1204
  if utils.match_response(http_res, "200", "application/json"):
1329
- return utils.unmarshal_json(http_res.text, models.InsightsUploadFile)
1205
+ return unmarshal_json_response(models.InsightsUploadFile, http_res)
1330
1206
  if utils.match_response(http_res, "422", "application/json"):
1331
- response_data = utils.unmarshal_json(
1332
- http_res.text, models.HTTPValidationErrorData
1207
+ response_data = unmarshal_json_response(
1208
+ errors.HTTPValidationErrorData, http_res
1333
1209
  )
1334
- raise models.HTTPValidationError(data=response_data)
1210
+ raise errors.HTTPValidationError(response_data, http_res)
1335
1211
  if utils.match_response(http_res, "4XX", "*"):
1336
1212
  http_res_text = await utils.stream_to_text_async(http_res)
1337
- raise models.APIError(
1338
- "API error occurred", http_res.status_code, http_res_text, http_res
1339
- )
1213
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1340
1214
  if utils.match_response(http_res, "5XX", "*"):
1341
1215
  http_res_text = await utils.stream_to_text_async(http_res)
1342
- raise models.APIError(
1343
- "API error occurred", http_res.status_code, http_res_text, http_res
1344
- )
1216
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1345
1217
 
1346
- content_type = http_res.headers.get("Content-Type")
1347
- http_res_text = await utils.stream_to_text_async(http_res)
1348
- raise models.APIError(
1349
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1350
- http_res.status_code,
1351
- http_res_text,
1352
- http_res,
1353
- )
1218
+ raise errors.APIError("Unexpected response received", http_res)
1354
1219
 
1355
1220
  def list_files(
1356
1221
  self,
@@ -1451,33 +1316,22 @@ class Folders(BaseSDK):
1451
1316
 
1452
1317
  response_data: Any = None
1453
1318
  if utils.match_response(http_res, "200", "application/json"):
1454
- return utils.unmarshal_json(
1455
- http_res.text, models.ListResponseInsightsUploadFile
1319
+ return unmarshal_json_response(
1320
+ models.ListResponseInsightsUploadFile, http_res
1456
1321
  )
1457
1322
  if utils.match_response(http_res, "422", "application/json"):
1458
- response_data = utils.unmarshal_json(
1459
- http_res.text, models.HTTPValidationErrorData
1323
+ response_data = unmarshal_json_response(
1324
+ errors.HTTPValidationErrorData, http_res
1460
1325
  )
1461
- raise models.HTTPValidationError(data=response_data)
1326
+ raise errors.HTTPValidationError(response_data, http_res)
1462
1327
  if utils.match_response(http_res, "4XX", "*"):
1463
1328
  http_res_text = utils.stream_to_text(http_res)
1464
- raise models.APIError(
1465
- "API error occurred", http_res.status_code, http_res_text, http_res
1466
- )
1329
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1467
1330
  if utils.match_response(http_res, "5XX", "*"):
1468
1331
  http_res_text = utils.stream_to_text(http_res)
1469
- raise models.APIError(
1470
- "API error occurred", http_res.status_code, http_res_text, http_res
1471
- )
1332
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1472
1333
 
1473
- content_type = http_res.headers.get("Content-Type")
1474
- http_res_text = utils.stream_to_text(http_res)
1475
- raise models.APIError(
1476
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1477
- http_res.status_code,
1478
- http_res_text,
1479
- http_res,
1480
- )
1334
+ raise errors.APIError("Unexpected response received", http_res)
1481
1335
 
1482
1336
  async def list_files_async(
1483
1337
  self,
@@ -1578,33 +1432,22 @@ class Folders(BaseSDK):
1578
1432
 
1579
1433
  response_data: Any = None
1580
1434
  if utils.match_response(http_res, "200", "application/json"):
1581
- return utils.unmarshal_json(
1582
- http_res.text, models.ListResponseInsightsUploadFile
1435
+ return unmarshal_json_response(
1436
+ models.ListResponseInsightsUploadFile, http_res
1583
1437
  )
1584
1438
  if utils.match_response(http_res, "422", "application/json"):
1585
- response_data = utils.unmarshal_json(
1586
- http_res.text, models.HTTPValidationErrorData
1439
+ response_data = unmarshal_json_response(
1440
+ errors.HTTPValidationErrorData, http_res
1587
1441
  )
1588
- raise models.HTTPValidationError(data=response_data)
1442
+ raise errors.HTTPValidationError(response_data, http_res)
1589
1443
  if utils.match_response(http_res, "4XX", "*"):
1590
1444
  http_res_text = await utils.stream_to_text_async(http_res)
1591
- raise models.APIError(
1592
- "API error occurred", http_res.status_code, http_res_text, http_res
1593
- )
1445
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1594
1446
  if utils.match_response(http_res, "5XX", "*"):
1595
1447
  http_res_text = await utils.stream_to_text_async(http_res)
1596
- raise models.APIError(
1597
- "API error occurred", http_res.status_code, http_res_text, http_res
1598
- )
1448
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1599
1449
 
1600
- content_type = http_res.headers.get("Content-Type")
1601
- http_res_text = await utils.stream_to_text_async(http_res)
1602
- raise models.APIError(
1603
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1604
- http_res.status_code,
1605
- http_res_text,
1606
- http_res,
1607
- )
1450
+ raise errors.APIError("Unexpected response received", http_res)
1608
1451
 
1609
1452
  def move_files(
1610
1453
  self,
@@ -1692,31 +1535,20 @@ class Folders(BaseSDK):
1692
1535
 
1693
1536
  response_data: Any = None
1694
1537
  if utils.match_response(http_res, "200", "application/json"):
1695
- return utils.unmarshal_json(http_res.text, List[models.InsightsUploadFile])
1538
+ return unmarshal_json_response(List[models.InsightsUploadFile], http_res)
1696
1539
  if utils.match_response(http_res, "422", "application/json"):
1697
- response_data = utils.unmarshal_json(
1698
- http_res.text, models.HTTPValidationErrorData
1540
+ response_data = unmarshal_json_response(
1541
+ errors.HTTPValidationErrorData, http_res
1699
1542
  )
1700
- raise models.HTTPValidationError(data=response_data)
1543
+ raise errors.HTTPValidationError(response_data, http_res)
1701
1544
  if utils.match_response(http_res, "4XX", "*"):
1702
1545
  http_res_text = utils.stream_to_text(http_res)
1703
- raise models.APIError(
1704
- "API error occurred", http_res.status_code, http_res_text, http_res
1705
- )
1546
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1706
1547
  if utils.match_response(http_res, "5XX", "*"):
1707
1548
  http_res_text = utils.stream_to_text(http_res)
1708
- raise models.APIError(
1709
- "API error occurred", http_res.status_code, http_res_text, http_res
1710
- )
1549
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1711
1550
 
1712
- content_type = http_res.headers.get("Content-Type")
1713
- http_res_text = utils.stream_to_text(http_res)
1714
- raise models.APIError(
1715
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1716
- http_res.status_code,
1717
- http_res_text,
1718
- http_res,
1719
- )
1551
+ raise errors.APIError("Unexpected response received", http_res)
1720
1552
 
1721
1553
  async def move_files_async(
1722
1554
  self,
@@ -1804,28 +1636,17 @@ class Folders(BaseSDK):
1804
1636
 
1805
1637
  response_data: Any = None
1806
1638
  if utils.match_response(http_res, "200", "application/json"):
1807
- return utils.unmarshal_json(http_res.text, List[models.InsightsUploadFile])
1639
+ return unmarshal_json_response(List[models.InsightsUploadFile], http_res)
1808
1640
  if utils.match_response(http_res, "422", "application/json"):
1809
- response_data = utils.unmarshal_json(
1810
- http_res.text, models.HTTPValidationErrorData
1641
+ response_data = unmarshal_json_response(
1642
+ errors.HTTPValidationErrorData, http_res
1811
1643
  )
1812
- raise models.HTTPValidationError(data=response_data)
1644
+ raise errors.HTTPValidationError(response_data, http_res)
1813
1645
  if utils.match_response(http_res, "4XX", "*"):
1814
1646
  http_res_text = await utils.stream_to_text_async(http_res)
1815
- raise models.APIError(
1816
- "API error occurred", http_res.status_code, http_res_text, http_res
1817
- )
1647
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1818
1648
  if utils.match_response(http_res, "5XX", "*"):
1819
1649
  http_res_text = await utils.stream_to_text_async(http_res)
1820
- raise models.APIError(
1821
- "API error occurred", http_res.status_code, http_res_text, http_res
1822
- )
1650
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1823
1651
 
1824
- content_type = http_res.headers.get("Content-Type")
1825
- http_res_text = await utils.stream_to_text_async(http_res)
1826
- raise models.APIError(
1827
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1828
- http_res.status_code,
1829
- http_res_text,
1830
- http_res,
1831
- )
1652
+ raise errors.APIError("Unexpected response received", http_res)