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