syllable-sdk 0.35.32__py3-none-any.whl → 0.35.33__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 +83 -211
  4. syllable_sdk/basesdk.py +5 -5
  5. syllable_sdk/batches.py +131 -329
  6. syllable_sdk/campaigns.py +73 -183
  7. syllable_sdk/channels.py +29 -73
  8. syllable_sdk/conversations.py +19 -37
  9. syllable_sdk/custom_messages.py +73 -183
  10. syllable_sdk/dashboards.py +67 -195
  11. syllable_sdk/data_sources.py +85 -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 +15 -37
  19. syllable_sdk/folders.py +121 -293
  20. syllable_sdk/full_summary.py +19 -37
  21. syllable_sdk/incidents.py +83 -215
  22. syllable_sdk/insights_sdk.py +17 -39
  23. syllable_sdk/insights_tools.py +97 -251
  24. syllable_sdk/language_groups.py +85 -215
  25. syllable_sdk/latency.py +19 -37
  26. syllable_sdk/models/__init__.py +0 -8
  27. syllable_sdk/numbers.py +53 -111
  28. syllable_sdk/organizations.py +51 -139
  29. syllable_sdk/permissions.py +11 -33
  30. syllable_sdk/prompts.py +95 -249
  31. syllable_sdk/roles.py +75 -181
  32. syllable_sdk/services.py +73 -183
  33. syllable_sdk/session_debug.py +43 -109
  34. syllable_sdk/session_labels.py +47 -109
  35. syllable_sdk/sessions.py +59 -141
  36. syllable_sdk/takeouts.py +35 -99
  37. syllable_sdk/targets.py +75 -185
  38. syllable_sdk/test.py +15 -37
  39. syllable_sdk/tools.py +75 -181
  40. syllable_sdk/transcript.py +17 -39
  41. syllable_sdk/twilio.py +43 -109
  42. syllable_sdk/users.py +97 -247
  43. syllable_sdk/utils/__init__.py +3 -0
  44. syllable_sdk/utils/serializers.py +21 -3
  45. syllable_sdk/v1.py +97 -247
  46. syllable_sdk/workflows.py +115 -291
  47. {syllable_sdk-0.35.32.dist-info → syllable_sdk-0.35.33.dist-info}/METADATA +58 -45
  48. {syllable_sdk-0.35.32.dist-info → syllable_sdk-0.35.33.dist-info}/RECORD +49 -45
  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.33.dist-info}/WHEEL +0 -0
syllable_sdk/folders.py CHANGED
@@ -2,7 +2,7 @@
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
@@ -108,33 +108,22 @@ class Folders(BaseSDK):
108
108
 
109
109
  response_data: Any = None
110
110
  if utils.match_response(http_res, "200", "application/json"):
111
- return utils.unmarshal_json(
112
- http_res.text, models.ListResponseInsightsFolder
111
+ return utils.unmarshal_json_response(
112
+ models.ListResponseInsightsFolder, http_res
113
113
  )
114
114
  if utils.match_response(http_res, "422", "application/json"):
115
- response_data = utils.unmarshal_json(
116
- http_res.text, models.HTTPValidationErrorData
115
+ response_data = utils.unmarshal_json_response(
116
+ errors.HTTPValidationErrorData, http_res
117
117
  )
118
- raise models.HTTPValidationError(data=response_data)
118
+ raise errors.HTTPValidationError(response_data, http_res)
119
119
  if utils.match_response(http_res, "4XX", "*"):
120
120
  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
- )
121
+ raise errors.APIError("API error occurred", http_res, http_res_text)
124
122
  if utils.match_response(http_res, "5XX", "*"):
125
123
  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
- )
124
+ raise errors.APIError("API error occurred", http_res, http_res_text)
129
125
 
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
- )
126
+ raise errors.APIError("Unexpected response received", http_res)
138
127
 
139
128
  async def list_async(
140
129
  self,
@@ -232,33 +221,22 @@ class Folders(BaseSDK):
232
221
 
233
222
  response_data: Any = None
234
223
  if utils.match_response(http_res, "200", "application/json"):
235
- return utils.unmarshal_json(
236
- http_res.text, models.ListResponseInsightsFolder
224
+ return utils.unmarshal_json_response(
225
+ models.ListResponseInsightsFolder, http_res
237
226
  )
238
227
  if utils.match_response(http_res, "422", "application/json"):
239
- response_data = utils.unmarshal_json(
240
- http_res.text, models.HTTPValidationErrorData
228
+ response_data = utils.unmarshal_json_response(
229
+ errors.HTTPValidationErrorData, http_res
241
230
  )
242
- raise models.HTTPValidationError(data=response_data)
231
+ raise errors.HTTPValidationError(response_data, http_res)
243
232
  if utils.match_response(http_res, "4XX", "*"):
244
233
  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
- )
234
+ raise errors.APIError("API error occurred", http_res, http_res_text)
248
235
  if utils.match_response(http_res, "5XX", "*"):
249
236
  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
- )
237
+ raise errors.APIError("API error occurred", http_res, http_res_text)
253
238
 
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
- )
239
+ raise errors.APIError("Unexpected response received", http_res)
262
240
 
263
241
  def create(
264
242
  self,
@@ -335,31 +313,20 @@ class Folders(BaseSDK):
335
313
 
336
314
  response_data: Any = None
337
315
  if utils.match_response(http_res, "200", "application/json"):
338
- return utils.unmarshal_json(http_res.text, models.InsightsFolder)
316
+ return utils.unmarshal_json_response(models.InsightsFolder, http_res)
339
317
  if utils.match_response(http_res, "422", "application/json"):
340
- response_data = utils.unmarshal_json(
341
- http_res.text, models.HTTPValidationErrorData
318
+ response_data = utils.unmarshal_json_response(
319
+ errors.HTTPValidationErrorData, http_res
342
320
  )
343
- raise models.HTTPValidationError(data=response_data)
321
+ raise errors.HTTPValidationError(response_data, http_res)
344
322
  if utils.match_response(http_res, "4XX", "*"):
345
323
  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
- )
324
+ raise errors.APIError("API error occurred", http_res, http_res_text)
349
325
  if utils.match_response(http_res, "5XX", "*"):
350
326
  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
- )
327
+ raise errors.APIError("API error occurred", http_res, http_res_text)
354
328
 
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
- )
329
+ raise errors.APIError("Unexpected response received", http_res)
363
330
 
364
331
  async def create_async(
365
332
  self,
@@ -436,31 +403,20 @@ class Folders(BaseSDK):
436
403
 
437
404
  response_data: Any = None
438
405
  if utils.match_response(http_res, "200", "application/json"):
439
- return utils.unmarshal_json(http_res.text, models.InsightsFolder)
406
+ return utils.unmarshal_json_response(models.InsightsFolder, http_res)
440
407
  if utils.match_response(http_res, "422", "application/json"):
441
- response_data = utils.unmarshal_json(
442
- http_res.text, models.HTTPValidationErrorData
408
+ response_data = utils.unmarshal_json_response(
409
+ errors.HTTPValidationErrorData, http_res
443
410
  )
444
- raise models.HTTPValidationError(data=response_data)
411
+ raise errors.HTTPValidationError(response_data, http_res)
445
412
  if utils.match_response(http_res, "4XX", "*"):
446
413
  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
- )
414
+ raise errors.APIError("API error occurred", http_res, http_res_text)
450
415
  if utils.match_response(http_res, "5XX", "*"):
451
416
  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
- )
417
+ raise errors.APIError("API error occurred", http_res, http_res_text)
455
418
 
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
- )
419
+ raise errors.APIError("Unexpected response received", http_res)
464
420
 
465
421
  def get_by_id(
466
422
  self,
@@ -534,31 +490,20 @@ class Folders(BaseSDK):
534
490
 
535
491
  response_data: Any = None
536
492
  if utils.match_response(http_res, "200", "application/json"):
537
- return utils.unmarshal_json(http_res.text, models.FolderDetails)
493
+ return utils.unmarshal_json_response(models.FolderDetails, http_res)
538
494
  if utils.match_response(http_res, "422", "application/json"):
539
- response_data = utils.unmarshal_json(
540
- http_res.text, models.HTTPValidationErrorData
495
+ response_data = utils.unmarshal_json_response(
496
+ errors.HTTPValidationErrorData, http_res
541
497
  )
542
- raise models.HTTPValidationError(data=response_data)
498
+ raise errors.HTTPValidationError(response_data, http_res)
543
499
  if utils.match_response(http_res, "4XX", "*"):
544
500
  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
- )
501
+ raise errors.APIError("API error occurred", http_res, http_res_text)
548
502
  if utils.match_response(http_res, "5XX", "*"):
549
503
  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
- )
504
+ raise errors.APIError("API error occurred", http_res, http_res_text)
553
505
 
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
- )
506
+ raise errors.APIError("Unexpected response received", http_res)
562
507
 
563
508
  async def get_by_id_async(
564
509
  self,
@@ -632,31 +577,20 @@ class Folders(BaseSDK):
632
577
 
633
578
  response_data: Any = None
634
579
  if utils.match_response(http_res, "200", "application/json"):
635
- return utils.unmarshal_json(http_res.text, models.FolderDetails)
580
+ return utils.unmarshal_json_response(models.FolderDetails, http_res)
636
581
  if utils.match_response(http_res, "422", "application/json"):
637
- response_data = utils.unmarshal_json(
638
- http_res.text, models.HTTPValidationErrorData
582
+ response_data = utils.unmarshal_json_response(
583
+ errors.HTTPValidationErrorData, http_res
639
584
  )
640
- raise models.HTTPValidationError(data=response_data)
585
+ raise errors.HTTPValidationError(response_data, http_res)
641
586
  if utils.match_response(http_res, "4XX", "*"):
642
587
  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
- )
588
+ raise errors.APIError("API error occurred", http_res, http_res_text)
646
589
  if utils.match_response(http_res, "5XX", "*"):
647
590
  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
- )
591
+ raise errors.APIError("API error occurred", http_res, http_res_text)
651
592
 
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
- )
593
+ raise errors.APIError("Unexpected response received", http_res)
660
594
 
661
595
  def delete(
662
596
  self,
@@ -730,31 +664,20 @@ class Folders(BaseSDK):
730
664
 
731
665
  response_data: Any = None
732
666
  if utils.match_response(http_res, "200", "application/json"):
733
- return utils.unmarshal_json(http_res.text, bool)
667
+ return utils.unmarshal_json_response(bool, http_res)
734
668
  if utils.match_response(http_res, "422", "application/json"):
735
- response_data = utils.unmarshal_json(
736
- http_res.text, models.HTTPValidationErrorData
669
+ response_data = utils.unmarshal_json_response(
670
+ errors.HTTPValidationErrorData, http_res
737
671
  )
738
- raise models.HTTPValidationError(data=response_data)
672
+ raise errors.HTTPValidationError(response_data, http_res)
739
673
  if utils.match_response(http_res, "4XX", "*"):
740
674
  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
- )
675
+ raise errors.APIError("API error occurred", http_res, http_res_text)
744
676
  if utils.match_response(http_res, "5XX", "*"):
745
677
  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
- )
678
+ raise errors.APIError("API error occurred", http_res, http_res_text)
749
679
 
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
- )
680
+ raise errors.APIError("Unexpected response received", http_res)
758
681
 
759
682
  async def delete_async(
760
683
  self,
@@ -828,31 +751,20 @@ class Folders(BaseSDK):
828
751
 
829
752
  response_data: Any = None
830
753
  if utils.match_response(http_res, "200", "application/json"):
831
- return utils.unmarshal_json(http_res.text, bool)
754
+ return utils.unmarshal_json_response(bool, http_res)
832
755
  if utils.match_response(http_res, "422", "application/json"):
833
- response_data = utils.unmarshal_json(
834
- http_res.text, models.HTTPValidationErrorData
756
+ response_data = utils.unmarshal_json_response(
757
+ errors.HTTPValidationErrorData, http_res
835
758
  )
836
- raise models.HTTPValidationError(data=response_data)
759
+ raise errors.HTTPValidationError(response_data, http_res)
837
760
  if utils.match_response(http_res, "4XX", "*"):
838
761
  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
- )
762
+ raise errors.APIError("API error occurred", http_res, http_res_text)
842
763
  if utils.match_response(http_res, "5XX", "*"):
843
764
  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
- )
765
+ raise errors.APIError("API error occurred", http_res, http_res_text)
847
766
 
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
- )
767
+ raise errors.APIError("Unexpected response received", http_res)
856
768
 
857
769
  def update(
858
770
  self,
@@ -940,31 +852,20 @@ class Folders(BaseSDK):
940
852
 
941
853
  response_data: Any = None
942
854
  if utils.match_response(http_res, "200", "application/json"):
943
- return utils.unmarshal_json(http_res.text, models.InsightsFolder)
855
+ return utils.unmarshal_json_response(models.InsightsFolder, http_res)
944
856
  if utils.match_response(http_res, "422", "application/json"):
945
- response_data = utils.unmarshal_json(
946
- http_res.text, models.HTTPValidationErrorData
857
+ response_data = utils.unmarshal_json_response(
858
+ errors.HTTPValidationErrorData, http_res
947
859
  )
948
- raise models.HTTPValidationError(data=response_data)
860
+ raise errors.HTTPValidationError(response_data, http_res)
949
861
  if utils.match_response(http_res, "4XX", "*"):
950
862
  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
- )
863
+ raise errors.APIError("API error occurred", http_res, http_res_text)
954
864
  if utils.match_response(http_res, "5XX", "*"):
955
865
  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
- )
866
+ raise errors.APIError("API error occurred", http_res, http_res_text)
959
867
 
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
- )
868
+ raise errors.APIError("Unexpected response received", http_res)
968
869
 
969
870
  async def update_async(
970
871
  self,
@@ -1052,31 +953,20 @@ class Folders(BaseSDK):
1052
953
 
1053
954
  response_data: Any = None
1054
955
  if utils.match_response(http_res, "200", "application/json"):
1055
- return utils.unmarshal_json(http_res.text, models.InsightsFolder)
956
+ return utils.unmarshal_json_response(models.InsightsFolder, http_res)
1056
957
  if utils.match_response(http_res, "422", "application/json"):
1057
- response_data = utils.unmarshal_json(
1058
- http_res.text, models.HTTPValidationErrorData
958
+ response_data = utils.unmarshal_json_response(
959
+ errors.HTTPValidationErrorData, http_res
1059
960
  )
1060
- raise models.HTTPValidationError(data=response_data)
961
+ raise errors.HTTPValidationError(response_data, http_res)
1061
962
  if utils.match_response(http_res, "4XX", "*"):
1062
963
  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
- )
964
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1066
965
  if utils.match_response(http_res, "5XX", "*"):
1067
966
  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
- )
967
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1071
968
 
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
- )
969
+ raise errors.APIError("Unexpected response received", http_res)
1080
970
 
1081
971
  def upload_file(
1082
972
  self,
@@ -1189,31 +1079,20 @@ class Folders(BaseSDK):
1189
1079
 
1190
1080
  response_data: Any = None
1191
1081
  if utils.match_response(http_res, "200", "application/json"):
1192
- return utils.unmarshal_json(http_res.text, models.InsightsUploadFile)
1082
+ return utils.unmarshal_json_response(models.InsightsUploadFile, http_res)
1193
1083
  if utils.match_response(http_res, "422", "application/json"):
1194
- response_data = utils.unmarshal_json(
1195
- http_res.text, models.HTTPValidationErrorData
1084
+ response_data = utils.unmarshal_json_response(
1085
+ errors.HTTPValidationErrorData, http_res
1196
1086
  )
1197
- raise models.HTTPValidationError(data=response_data)
1087
+ raise errors.HTTPValidationError(response_data, http_res)
1198
1088
  if utils.match_response(http_res, "4XX", "*"):
1199
1089
  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
- )
1090
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1203
1091
  if utils.match_response(http_res, "5XX", "*"):
1204
1092
  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
- )
1093
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1208
1094
 
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
- )
1095
+ raise errors.APIError("Unexpected response received", http_res)
1217
1096
 
1218
1097
  async def upload_file_async(
1219
1098
  self,
@@ -1326,31 +1205,20 @@ class Folders(BaseSDK):
1326
1205
 
1327
1206
  response_data: Any = None
1328
1207
  if utils.match_response(http_res, "200", "application/json"):
1329
- return utils.unmarshal_json(http_res.text, models.InsightsUploadFile)
1208
+ return utils.unmarshal_json_response(models.InsightsUploadFile, http_res)
1330
1209
  if utils.match_response(http_res, "422", "application/json"):
1331
- response_data = utils.unmarshal_json(
1332
- http_res.text, models.HTTPValidationErrorData
1210
+ response_data = utils.unmarshal_json_response(
1211
+ errors.HTTPValidationErrorData, http_res
1333
1212
  )
1334
- raise models.HTTPValidationError(data=response_data)
1213
+ raise errors.HTTPValidationError(response_data, http_res)
1335
1214
  if utils.match_response(http_res, "4XX", "*"):
1336
1215
  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
- )
1216
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1340
1217
  if utils.match_response(http_res, "5XX", "*"):
1341
1218
  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
- )
1219
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1345
1220
 
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
- )
1221
+ raise errors.APIError("Unexpected response received", http_res)
1354
1222
 
1355
1223
  def list_files(
1356
1224
  self,
@@ -1451,33 +1319,22 @@ class Folders(BaseSDK):
1451
1319
 
1452
1320
  response_data: Any = None
1453
1321
  if utils.match_response(http_res, "200", "application/json"):
1454
- return utils.unmarshal_json(
1455
- http_res.text, models.ListResponseInsightsUploadFile
1322
+ return utils.unmarshal_json_response(
1323
+ models.ListResponseInsightsUploadFile, http_res
1456
1324
  )
1457
1325
  if utils.match_response(http_res, "422", "application/json"):
1458
- response_data = utils.unmarshal_json(
1459
- http_res.text, models.HTTPValidationErrorData
1326
+ response_data = utils.unmarshal_json_response(
1327
+ errors.HTTPValidationErrorData, http_res
1460
1328
  )
1461
- raise models.HTTPValidationError(data=response_data)
1329
+ raise errors.HTTPValidationError(response_data, http_res)
1462
1330
  if utils.match_response(http_res, "4XX", "*"):
1463
1331
  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
- )
1332
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1467
1333
  if utils.match_response(http_res, "5XX", "*"):
1468
1334
  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
- )
1335
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1472
1336
 
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
- )
1337
+ raise errors.APIError("Unexpected response received", http_res)
1481
1338
 
1482
1339
  async def list_files_async(
1483
1340
  self,
@@ -1578,33 +1435,22 @@ class Folders(BaseSDK):
1578
1435
 
1579
1436
  response_data: Any = None
1580
1437
  if utils.match_response(http_res, "200", "application/json"):
1581
- return utils.unmarshal_json(
1582
- http_res.text, models.ListResponseInsightsUploadFile
1438
+ return utils.unmarshal_json_response(
1439
+ models.ListResponseInsightsUploadFile, http_res
1583
1440
  )
1584
1441
  if utils.match_response(http_res, "422", "application/json"):
1585
- response_data = utils.unmarshal_json(
1586
- http_res.text, models.HTTPValidationErrorData
1442
+ response_data = utils.unmarshal_json_response(
1443
+ errors.HTTPValidationErrorData, http_res
1587
1444
  )
1588
- raise models.HTTPValidationError(data=response_data)
1445
+ raise errors.HTTPValidationError(response_data, http_res)
1589
1446
  if utils.match_response(http_res, "4XX", "*"):
1590
1447
  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
- )
1448
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1594
1449
  if utils.match_response(http_res, "5XX", "*"):
1595
1450
  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
- )
1451
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1599
1452
 
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
- )
1453
+ raise errors.APIError("Unexpected response received", http_res)
1608
1454
 
1609
1455
  def move_files(
1610
1456
  self,
@@ -1692,31 +1538,22 @@ class Folders(BaseSDK):
1692
1538
 
1693
1539
  response_data: Any = None
1694
1540
  if utils.match_response(http_res, "200", "application/json"):
1695
- return utils.unmarshal_json(http_res.text, List[models.InsightsUploadFile])
1541
+ return utils.unmarshal_json_response(
1542
+ List[models.InsightsUploadFile], http_res
1543
+ )
1696
1544
  if utils.match_response(http_res, "422", "application/json"):
1697
- response_data = utils.unmarshal_json(
1698
- http_res.text, models.HTTPValidationErrorData
1545
+ response_data = utils.unmarshal_json_response(
1546
+ errors.HTTPValidationErrorData, http_res
1699
1547
  )
1700
- raise models.HTTPValidationError(data=response_data)
1548
+ raise errors.HTTPValidationError(response_data, http_res)
1701
1549
  if utils.match_response(http_res, "4XX", "*"):
1702
1550
  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
- )
1551
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1706
1552
  if utils.match_response(http_res, "5XX", "*"):
1707
1553
  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
- )
1554
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1711
1555
 
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
- )
1556
+ raise errors.APIError("Unexpected response received", http_res)
1720
1557
 
1721
1558
  async def move_files_async(
1722
1559
  self,
@@ -1804,28 +1641,19 @@ class Folders(BaseSDK):
1804
1641
 
1805
1642
  response_data: Any = None
1806
1643
  if utils.match_response(http_res, "200", "application/json"):
1807
- return utils.unmarshal_json(http_res.text, List[models.InsightsUploadFile])
1644
+ return utils.unmarshal_json_response(
1645
+ List[models.InsightsUploadFile], http_res
1646
+ )
1808
1647
  if utils.match_response(http_res, "422", "application/json"):
1809
- response_data = utils.unmarshal_json(
1810
- http_res.text, models.HTTPValidationErrorData
1648
+ response_data = utils.unmarshal_json_response(
1649
+ errors.HTTPValidationErrorData, http_res
1811
1650
  )
1812
- raise models.HTTPValidationError(data=response_data)
1651
+ raise errors.HTTPValidationError(response_data, http_res)
1813
1652
  if utils.match_response(http_res, "4XX", "*"):
1814
1653
  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
- )
1654
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1818
1655
  if utils.match_response(http_res, "5XX", "*"):
1819
1656
  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
- )
1657
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1823
1658
 
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
- )
1659
+ raise errors.APIError("Unexpected response received", http_res)