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
@@ -1,10 +1,11 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from .basesdk import BaseSDK
4
- from syllable_sdk import models, utils
4
+ from syllable_sdk import errors, models, utils
5
5
  from syllable_sdk._hooks import HookContext
6
6
  from syllable_sdk.types import OptionalNullable, UNSET
7
7
  from syllable_sdk.utils import get_security_from_env
8
+ from syllable_sdk.utils.unmarshal_json_response import unmarshal_json_response
8
9
  from typing import Any, List, Mapping, Optional
9
10
  from typing_extensions import deprecated
10
11
 
@@ -113,33 +114,22 @@ class Dashboards(BaseSDK):
113
114
 
114
115
  response_data: Any = None
115
116
  if utils.match_response(http_res, "200", "application/json"):
116
- return utils.unmarshal_json(
117
- http_res.text, models.ListResponseDashboardResponse
117
+ return unmarshal_json_response(
118
+ models.ListResponseDashboardResponse, http_res
118
119
  )
119
120
  if utils.match_response(http_res, "422", "application/json"):
120
- response_data = utils.unmarshal_json(
121
- http_res.text, models.HTTPValidationErrorData
121
+ response_data = unmarshal_json_response(
122
+ errors.HTTPValidationErrorData, http_res
122
123
  )
123
- raise models.HTTPValidationError(data=response_data)
124
+ raise errors.HTTPValidationError(response_data, http_res)
124
125
  if utils.match_response(http_res, "4XX", "*"):
125
126
  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
- )
127
+ raise errors.APIError("API error occurred", http_res, http_res_text)
129
128
  if utils.match_response(http_res, "5XX", "*"):
130
129
  http_res_text = utils.stream_to_text(http_res)
131
- raise models.APIError(
132
- "API error occurred", http_res.status_code, http_res_text, http_res
133
- )
130
+ raise errors.APIError("API error occurred", http_res, http_res_text)
134
131
 
135
- content_type = http_res.headers.get("Content-Type")
136
- http_res_text = utils.stream_to_text(http_res)
137
- raise models.APIError(
138
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
139
- http_res.status_code,
140
- http_res_text,
141
- http_res,
142
- )
132
+ raise errors.APIError("Unexpected response received", http_res)
143
133
 
144
134
  async def post_list_dashboard_async(
145
135
  self,
@@ -242,33 +232,22 @@ class Dashboards(BaseSDK):
242
232
 
243
233
  response_data: Any = None
244
234
  if utils.match_response(http_res, "200", "application/json"):
245
- return utils.unmarshal_json(
246
- http_res.text, models.ListResponseDashboardResponse
235
+ return unmarshal_json_response(
236
+ models.ListResponseDashboardResponse, http_res
247
237
  )
248
238
  if utils.match_response(http_res, "422", "application/json"):
249
- response_data = utils.unmarshal_json(
250
- http_res.text, models.HTTPValidationErrorData
239
+ response_data = unmarshal_json_response(
240
+ errors.HTTPValidationErrorData, http_res
251
241
  )
252
- raise models.HTTPValidationError(data=response_data)
242
+ raise errors.HTTPValidationError(response_data, http_res)
253
243
  if utils.match_response(http_res, "4XX", "*"):
254
244
  http_res_text = await utils.stream_to_text_async(http_res)
255
- raise models.APIError(
256
- "API error occurred", http_res.status_code, http_res_text, http_res
257
- )
245
+ raise errors.APIError("API error occurred", http_res, http_res_text)
258
246
  if utils.match_response(http_res, "5XX", "*"):
259
247
  http_res_text = await utils.stream_to_text_async(http_res)
260
- raise models.APIError(
261
- "API error occurred", http_res.status_code, http_res_text, http_res
262
- )
248
+ raise errors.APIError("API error occurred", http_res, http_res_text)
263
249
 
264
- content_type = http_res.headers.get("Content-Type")
265
- http_res_text = await utils.stream_to_text_async(http_res)
266
- raise models.APIError(
267
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
268
- http_res.status_code,
269
- http_res_text,
270
- http_res,
271
- )
250
+ raise errors.APIError("Unexpected response received", http_res)
272
251
 
273
252
  def post_get_dashboard(
274
253
  self,
@@ -347,31 +326,20 @@ class Dashboards(BaseSDK):
347
326
 
348
327
  response_data: Any = None
349
328
  if utils.match_response(http_res, "200", "application/json"):
350
- return utils.unmarshal_json(http_res.text, models.DashboardTokenResponse)
329
+ return unmarshal_json_response(models.DashboardTokenResponse, http_res)
351
330
  if utils.match_response(http_res, "422", "application/json"):
352
- response_data = utils.unmarshal_json(
353
- http_res.text, models.HTTPValidationErrorData
331
+ response_data = unmarshal_json_response(
332
+ errors.HTTPValidationErrorData, http_res
354
333
  )
355
- raise models.HTTPValidationError(data=response_data)
334
+ raise errors.HTTPValidationError(response_data, http_res)
356
335
  if utils.match_response(http_res, "4XX", "*"):
357
336
  http_res_text = utils.stream_to_text(http_res)
358
- raise models.APIError(
359
- "API error occurred", http_res.status_code, http_res_text, http_res
360
- )
337
+ raise errors.APIError("API error occurred", http_res, http_res_text)
361
338
  if utils.match_response(http_res, "5XX", "*"):
362
339
  http_res_text = utils.stream_to_text(http_res)
363
- raise models.APIError(
364
- "API error occurred", http_res.status_code, http_res_text, http_res
365
- )
340
+ raise errors.APIError("API error occurred", http_res, http_res_text)
366
341
 
367
- content_type = http_res.headers.get("Content-Type")
368
- http_res_text = utils.stream_to_text(http_res)
369
- raise models.APIError(
370
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
371
- http_res.status_code,
372
- http_res_text,
373
- http_res,
374
- )
342
+ raise errors.APIError("Unexpected response received", http_res)
375
343
 
376
344
  async def post_get_dashboard_async(
377
345
  self,
@@ -450,31 +418,20 @@ class Dashboards(BaseSDK):
450
418
 
451
419
  response_data: Any = None
452
420
  if utils.match_response(http_res, "200", "application/json"):
453
- return utils.unmarshal_json(http_res.text, models.DashboardTokenResponse)
421
+ return unmarshal_json_response(models.DashboardTokenResponse, http_res)
454
422
  if utils.match_response(http_res, "422", "application/json"):
455
- response_data = utils.unmarshal_json(
456
- http_res.text, models.HTTPValidationErrorData
423
+ response_data = unmarshal_json_response(
424
+ errors.HTTPValidationErrorData, http_res
457
425
  )
458
- raise models.HTTPValidationError(data=response_data)
426
+ raise errors.HTTPValidationError(response_data, http_res)
459
427
  if utils.match_response(http_res, "4XX", "*"):
460
428
  http_res_text = await utils.stream_to_text_async(http_res)
461
- raise models.APIError(
462
- "API error occurred", http_res.status_code, http_res_text, http_res
463
- )
429
+ raise errors.APIError("API error occurred", http_res, http_res_text)
464
430
  if utils.match_response(http_res, "5XX", "*"):
465
431
  http_res_text = await utils.stream_to_text_async(http_res)
466
- raise models.APIError(
467
- "API error occurred", http_res.status_code, http_res_text, http_res
468
- )
432
+ raise errors.APIError("API error occurred", http_res, http_res_text)
469
433
 
470
- content_type = http_res.headers.get("Content-Type")
471
- http_res_text = await utils.stream_to_text_async(http_res)
472
- raise models.APIError(
473
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
474
- http_res.status_code,
475
- http_res_text,
476
- http_res,
477
- )
434
+ raise errors.APIError("Unexpected response received", http_res)
478
435
 
479
436
  @deprecated(
480
437
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -549,26 +506,15 @@ class Dashboards(BaseSDK):
549
506
  )
550
507
 
551
508
  if utils.match_response(http_res, "200", "application/json"):
552
- return utils.unmarshal_json(http_res.text, models.Dashboard)
509
+ return unmarshal_json_response(models.Dashboard, http_res)
553
510
  if utils.match_response(http_res, "4XX", "*"):
554
511
  http_res_text = utils.stream_to_text(http_res)
555
- raise models.APIError(
556
- "API error occurred", http_res.status_code, http_res_text, http_res
557
- )
512
+ raise errors.APIError("API error occurred", http_res, http_res_text)
558
513
  if utils.match_response(http_res, "5XX", "*"):
559
514
  http_res_text = utils.stream_to_text(http_res)
560
- raise models.APIError(
561
- "API error occurred", http_res.status_code, http_res_text, http_res
562
- )
515
+ raise errors.APIError("API error occurred", http_res, http_res_text)
563
516
 
564
- content_type = http_res.headers.get("Content-Type")
565
- http_res_text = utils.stream_to_text(http_res)
566
- raise models.APIError(
567
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
568
- http_res.status_code,
569
- http_res_text,
570
- http_res,
571
- )
517
+ raise errors.APIError("Unexpected response received", http_res)
572
518
 
573
519
  @deprecated(
574
520
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -643,26 +589,15 @@ class Dashboards(BaseSDK):
643
589
  )
644
590
 
645
591
  if utils.match_response(http_res, "200", "application/json"):
646
- return utils.unmarshal_json(http_res.text, models.Dashboard)
592
+ return unmarshal_json_response(models.Dashboard, http_res)
647
593
  if utils.match_response(http_res, "4XX", "*"):
648
594
  http_res_text = await utils.stream_to_text_async(http_res)
649
- raise models.APIError(
650
- "API error occurred", http_res.status_code, http_res_text, http_res
651
- )
595
+ raise errors.APIError("API error occurred", http_res, http_res_text)
652
596
  if utils.match_response(http_res, "5XX", "*"):
653
597
  http_res_text = await utils.stream_to_text_async(http_res)
654
- raise models.APIError(
655
- "API error occurred", http_res.status_code, http_res_text, http_res
656
- )
598
+ raise errors.APIError("API error occurred", http_res, http_res_text)
657
599
 
658
- content_type = http_res.headers.get("Content-Type")
659
- http_res_text = await utils.stream_to_text_async(http_res)
660
- raise models.APIError(
661
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
662
- http_res.status_code,
663
- http_res_text,
664
- http_res,
665
- )
600
+ raise errors.APIError("Unexpected response received", http_res)
666
601
 
667
602
  @deprecated(
668
603
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -737,26 +672,15 @@ class Dashboards(BaseSDK):
737
672
  )
738
673
 
739
674
  if utils.match_response(http_res, "200", "application/json"):
740
- return utils.unmarshal_json(http_res.text, models.Dashboard)
675
+ return unmarshal_json_response(models.Dashboard, http_res)
741
676
  if utils.match_response(http_res, "4XX", "*"):
742
677
  http_res_text = utils.stream_to_text(http_res)
743
- raise models.APIError(
744
- "API error occurred", http_res.status_code, http_res_text, http_res
745
- )
678
+ raise errors.APIError("API error occurred", http_res, http_res_text)
746
679
  if utils.match_response(http_res, "5XX", "*"):
747
680
  http_res_text = utils.stream_to_text(http_res)
748
- raise models.APIError(
749
- "API error occurred", http_res.status_code, http_res_text, http_res
750
- )
681
+ raise errors.APIError("API error occurred", http_res, http_res_text)
751
682
 
752
- content_type = http_res.headers.get("Content-Type")
753
- http_res_text = utils.stream_to_text(http_res)
754
- raise models.APIError(
755
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
756
- http_res.status_code,
757
- http_res_text,
758
- http_res,
759
- )
683
+ raise errors.APIError("Unexpected response received", http_res)
760
684
 
761
685
  @deprecated(
762
686
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -831,26 +755,15 @@ class Dashboards(BaseSDK):
831
755
  )
832
756
 
833
757
  if utils.match_response(http_res, "200", "application/json"):
834
- return utils.unmarshal_json(http_res.text, models.Dashboard)
758
+ return unmarshal_json_response(models.Dashboard, http_res)
835
759
  if utils.match_response(http_res, "4XX", "*"):
836
760
  http_res_text = await utils.stream_to_text_async(http_res)
837
- raise models.APIError(
838
- "API error occurred", http_res.status_code, http_res_text, http_res
839
- )
761
+ raise errors.APIError("API error occurred", http_res, http_res_text)
840
762
  if utils.match_response(http_res, "5XX", "*"):
841
763
  http_res_text = await utils.stream_to_text_async(http_res)
842
- raise models.APIError(
843
- "API error occurred", http_res.status_code, http_res_text, http_res
844
- )
764
+ raise errors.APIError("API error occurred", http_res, http_res_text)
845
765
 
846
- content_type = http_res.headers.get("Content-Type")
847
- http_res_text = await utils.stream_to_text_async(http_res)
848
- raise models.APIError(
849
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
850
- http_res.status_code,
851
- http_res_text,
852
- http_res,
853
- )
766
+ raise errors.APIError("Unexpected response received", http_res)
854
767
 
855
768
  @deprecated(
856
769
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -925,26 +838,15 @@ class Dashboards(BaseSDK):
925
838
  )
926
839
 
927
840
  if utils.match_response(http_res, "200", "application/json"):
928
- return utils.unmarshal_json(http_res.text, models.Dashboard)
841
+ return unmarshal_json_response(models.Dashboard, http_res)
929
842
  if utils.match_response(http_res, "4XX", "*"):
930
843
  http_res_text = utils.stream_to_text(http_res)
931
- raise models.APIError(
932
- "API error occurred", http_res.status_code, http_res_text, http_res
933
- )
844
+ raise errors.APIError("API error occurred", http_res, http_res_text)
934
845
  if utils.match_response(http_res, "5XX", "*"):
935
846
  http_res_text = utils.stream_to_text(http_res)
936
- raise models.APIError(
937
- "API error occurred", http_res.status_code, http_res_text, http_res
938
- )
847
+ raise errors.APIError("API error occurred", http_res, http_res_text)
939
848
 
940
- content_type = http_res.headers.get("Content-Type")
941
- http_res_text = utils.stream_to_text(http_res)
942
- raise models.APIError(
943
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
944
- http_res.status_code,
945
- http_res_text,
946
- http_res,
947
- )
849
+ raise errors.APIError("Unexpected response received", http_res)
948
850
 
949
851
  @deprecated(
950
852
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -1019,26 +921,15 @@ class Dashboards(BaseSDK):
1019
921
  )
1020
922
 
1021
923
  if utils.match_response(http_res, "200", "application/json"):
1022
- return utils.unmarshal_json(http_res.text, models.Dashboard)
924
+ return unmarshal_json_response(models.Dashboard, http_res)
1023
925
  if utils.match_response(http_res, "4XX", "*"):
1024
926
  http_res_text = await utils.stream_to_text_async(http_res)
1025
- raise models.APIError(
1026
- "API error occurred", http_res.status_code, http_res_text, http_res
1027
- )
927
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1028
928
  if utils.match_response(http_res, "5XX", "*"):
1029
929
  http_res_text = await utils.stream_to_text_async(http_res)
1030
- raise models.APIError(
1031
- "API error occurred", http_res.status_code, http_res_text, http_res
1032
- )
930
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1033
931
 
1034
- content_type = http_res.headers.get("Content-Type")
1035
- http_res_text = await utils.stream_to_text_async(http_res)
1036
- raise models.APIError(
1037
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1038
- http_res.status_code,
1039
- http_res_text,
1040
- http_res,
1041
- )
932
+ raise errors.APIError("Unexpected response received", http_res)
1042
933
 
1043
934
  @deprecated(
1044
935
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -1113,26 +1004,15 @@ class Dashboards(BaseSDK):
1113
1004
  )
1114
1005
 
1115
1006
  if utils.match_response(http_res, "200", "application/json"):
1116
- return utils.unmarshal_json(http_res.text, models.Dashboard)
1007
+ return unmarshal_json_response(models.Dashboard, http_res)
1117
1008
  if utils.match_response(http_res, "4XX", "*"):
1118
1009
  http_res_text = utils.stream_to_text(http_res)
1119
- raise models.APIError(
1120
- "API error occurred", http_res.status_code, http_res_text, http_res
1121
- )
1010
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1122
1011
  if utils.match_response(http_res, "5XX", "*"):
1123
1012
  http_res_text = utils.stream_to_text(http_res)
1124
- raise models.APIError(
1125
- "API error occurred", http_res.status_code, http_res_text, http_res
1126
- )
1013
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1127
1014
 
1128
- content_type = http_res.headers.get("Content-Type")
1129
- http_res_text = utils.stream_to_text(http_res)
1130
- raise models.APIError(
1131
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1132
- http_res.status_code,
1133
- http_res_text,
1134
- http_res,
1135
- )
1015
+ raise errors.APIError("Unexpected response received", http_res)
1136
1016
 
1137
1017
  @deprecated(
1138
1018
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -1207,23 +1087,12 @@ class Dashboards(BaseSDK):
1207
1087
  )
1208
1088
 
1209
1089
  if utils.match_response(http_res, "200", "application/json"):
1210
- return utils.unmarshal_json(http_res.text, models.Dashboard)
1090
+ return unmarshal_json_response(models.Dashboard, http_res)
1211
1091
  if utils.match_response(http_res, "4XX", "*"):
1212
1092
  http_res_text = await utils.stream_to_text_async(http_res)
1213
- raise models.APIError(
1214
- "API error occurred", http_res.status_code, http_res_text, http_res
1215
- )
1093
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1216
1094
  if utils.match_response(http_res, "5XX", "*"):
1217
1095
  http_res_text = await utils.stream_to_text_async(http_res)
1218
- raise models.APIError(
1219
- "API error occurred", http_res.status_code, http_res_text, http_res
1220
- )
1096
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1221
1097
 
1222
- content_type = http_res.headers.get("Content-Type")
1223
- http_res_text = await utils.stream_to_text_async(http_res)
1224
- raise models.APIError(
1225
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1226
- http_res.status_code,
1227
- http_res_text,
1228
- http_res,
1229
- )
1098
+ raise errors.APIError("Unexpected response received", http_res)