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
@@ -1,7 +1,7 @@
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
@@ -113,33 +113,22 @@ class Dashboards(BaseSDK):
113
113
 
114
114
  response_data: Any = None
115
115
  if utils.match_response(http_res, "200", "application/json"):
116
- return utils.unmarshal_json(
117
- http_res.text, models.ListResponseDashboardResponse
116
+ return utils.unmarshal_json_response(
117
+ models.ListResponseDashboardResponse, http_res
118
118
  )
119
119
  if utils.match_response(http_res, "422", "application/json"):
120
- response_data = utils.unmarshal_json(
121
- http_res.text, models.HTTPValidationErrorData
120
+ response_data = utils.unmarshal_json_response(
121
+ errors.HTTPValidationErrorData, http_res
122
122
  )
123
- raise models.HTTPValidationError(data=response_data)
123
+ raise errors.HTTPValidationError(response_data, http_res)
124
124
  if utils.match_response(http_res, "4XX", "*"):
125
125
  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
- )
126
+ raise errors.APIError("API error occurred", http_res, http_res_text)
129
127
  if utils.match_response(http_res, "5XX", "*"):
130
128
  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
- )
129
+ raise errors.APIError("API error occurred", http_res, http_res_text)
134
130
 
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
- )
131
+ raise errors.APIError("Unexpected response received", http_res)
143
132
 
144
133
  async def post_list_dashboard_async(
145
134
  self,
@@ -242,33 +231,22 @@ class Dashboards(BaseSDK):
242
231
 
243
232
  response_data: Any = None
244
233
  if utils.match_response(http_res, "200", "application/json"):
245
- return utils.unmarshal_json(
246
- http_res.text, models.ListResponseDashboardResponse
234
+ return utils.unmarshal_json_response(
235
+ models.ListResponseDashboardResponse, http_res
247
236
  )
248
237
  if utils.match_response(http_res, "422", "application/json"):
249
- response_data = utils.unmarshal_json(
250
- http_res.text, models.HTTPValidationErrorData
238
+ response_data = utils.unmarshal_json_response(
239
+ errors.HTTPValidationErrorData, http_res
251
240
  )
252
- raise models.HTTPValidationError(data=response_data)
241
+ raise errors.HTTPValidationError(response_data, http_res)
253
242
  if utils.match_response(http_res, "4XX", "*"):
254
243
  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
- )
244
+ raise errors.APIError("API error occurred", http_res, http_res_text)
258
245
  if utils.match_response(http_res, "5XX", "*"):
259
246
  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
- )
247
+ raise errors.APIError("API error occurred", http_res, http_res_text)
263
248
 
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
- )
249
+ raise errors.APIError("Unexpected response received", http_res)
272
250
 
273
251
  def post_get_dashboard(
274
252
  self,
@@ -347,31 +325,22 @@ class Dashboards(BaseSDK):
347
325
 
348
326
  response_data: Any = None
349
327
  if utils.match_response(http_res, "200", "application/json"):
350
- return utils.unmarshal_json(http_res.text, models.DashboardTokenResponse)
328
+ return utils.unmarshal_json_response(
329
+ models.DashboardTokenResponse, http_res
330
+ )
351
331
  if utils.match_response(http_res, "422", "application/json"):
352
- response_data = utils.unmarshal_json(
353
- http_res.text, models.HTTPValidationErrorData
332
+ response_data = utils.unmarshal_json_response(
333
+ errors.HTTPValidationErrorData, http_res
354
334
  )
355
- raise models.HTTPValidationError(data=response_data)
335
+ raise errors.HTTPValidationError(response_data, http_res)
356
336
  if utils.match_response(http_res, "4XX", "*"):
357
337
  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
- )
338
+ raise errors.APIError("API error occurred", http_res, http_res_text)
361
339
  if utils.match_response(http_res, "5XX", "*"):
362
340
  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
- )
341
+ raise errors.APIError("API error occurred", http_res, http_res_text)
366
342
 
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
- )
343
+ raise errors.APIError("Unexpected response received", http_res)
375
344
 
376
345
  async def post_get_dashboard_async(
377
346
  self,
@@ -450,31 +419,22 @@ class Dashboards(BaseSDK):
450
419
 
451
420
  response_data: Any = None
452
421
  if utils.match_response(http_res, "200", "application/json"):
453
- return utils.unmarshal_json(http_res.text, models.DashboardTokenResponse)
422
+ return utils.unmarshal_json_response(
423
+ models.DashboardTokenResponse, http_res
424
+ )
454
425
  if utils.match_response(http_res, "422", "application/json"):
455
- response_data = utils.unmarshal_json(
456
- http_res.text, models.HTTPValidationErrorData
426
+ response_data = utils.unmarshal_json_response(
427
+ errors.HTTPValidationErrorData, http_res
457
428
  )
458
- raise models.HTTPValidationError(data=response_data)
429
+ raise errors.HTTPValidationError(response_data, http_res)
459
430
  if utils.match_response(http_res, "4XX", "*"):
460
431
  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
- )
432
+ raise errors.APIError("API error occurred", http_res, http_res_text)
464
433
  if utils.match_response(http_res, "5XX", "*"):
465
434
  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
- )
435
+ raise errors.APIError("API error occurred", http_res, http_res_text)
469
436
 
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
- )
437
+ raise errors.APIError("Unexpected response received", http_res)
478
438
 
479
439
  @deprecated(
480
440
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -549,26 +509,15 @@ class Dashboards(BaseSDK):
549
509
  )
550
510
 
551
511
  if utils.match_response(http_res, "200", "application/json"):
552
- return utils.unmarshal_json(http_res.text, models.Dashboard)
512
+ return utils.unmarshal_json_response(models.Dashboard, http_res)
553
513
  if utils.match_response(http_res, "4XX", "*"):
554
514
  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
- )
515
+ raise errors.APIError("API error occurred", http_res, http_res_text)
558
516
  if utils.match_response(http_res, "5XX", "*"):
559
517
  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
- )
518
+ raise errors.APIError("API error occurred", http_res, http_res_text)
563
519
 
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
- )
520
+ raise errors.APIError("Unexpected response received", http_res)
572
521
 
573
522
  @deprecated(
574
523
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -643,26 +592,15 @@ class Dashboards(BaseSDK):
643
592
  )
644
593
 
645
594
  if utils.match_response(http_res, "200", "application/json"):
646
- return utils.unmarshal_json(http_res.text, models.Dashboard)
595
+ return utils.unmarshal_json_response(models.Dashboard, http_res)
647
596
  if utils.match_response(http_res, "4XX", "*"):
648
597
  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
- )
598
+ raise errors.APIError("API error occurred", http_res, http_res_text)
652
599
  if utils.match_response(http_res, "5XX", "*"):
653
600
  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
- )
601
+ raise errors.APIError("API error occurred", http_res, http_res_text)
657
602
 
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
- )
603
+ raise errors.APIError("Unexpected response received", http_res)
666
604
 
667
605
  @deprecated(
668
606
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -737,26 +675,15 @@ class Dashboards(BaseSDK):
737
675
  )
738
676
 
739
677
  if utils.match_response(http_res, "200", "application/json"):
740
- return utils.unmarshal_json(http_res.text, models.Dashboard)
678
+ return utils.unmarshal_json_response(models.Dashboard, http_res)
741
679
  if utils.match_response(http_res, "4XX", "*"):
742
680
  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
- )
681
+ raise errors.APIError("API error occurred", http_res, http_res_text)
746
682
  if utils.match_response(http_res, "5XX", "*"):
747
683
  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
- )
684
+ raise errors.APIError("API error occurred", http_res, http_res_text)
751
685
 
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
- )
686
+ raise errors.APIError("Unexpected response received", http_res)
760
687
 
761
688
  @deprecated(
762
689
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -831,26 +758,15 @@ class Dashboards(BaseSDK):
831
758
  )
832
759
 
833
760
  if utils.match_response(http_res, "200", "application/json"):
834
- return utils.unmarshal_json(http_res.text, models.Dashboard)
761
+ return utils.unmarshal_json_response(models.Dashboard, http_res)
835
762
  if utils.match_response(http_res, "4XX", "*"):
836
763
  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
- )
764
+ raise errors.APIError("API error occurred", http_res, http_res_text)
840
765
  if utils.match_response(http_res, "5XX", "*"):
841
766
  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
- )
767
+ raise errors.APIError("API error occurred", http_res, http_res_text)
845
768
 
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
- )
769
+ raise errors.APIError("Unexpected response received", http_res)
854
770
 
855
771
  @deprecated(
856
772
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -925,26 +841,15 @@ class Dashboards(BaseSDK):
925
841
  )
926
842
 
927
843
  if utils.match_response(http_res, "200", "application/json"):
928
- return utils.unmarshal_json(http_res.text, models.Dashboard)
844
+ return utils.unmarshal_json_response(models.Dashboard, http_res)
929
845
  if utils.match_response(http_res, "4XX", "*"):
930
846
  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
- )
847
+ raise errors.APIError("API error occurred", http_res, http_res_text)
934
848
  if utils.match_response(http_res, "5XX", "*"):
935
849
  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
- )
850
+ raise errors.APIError("API error occurred", http_res, http_res_text)
939
851
 
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
- )
852
+ raise errors.APIError("Unexpected response received", http_res)
948
853
 
949
854
  @deprecated(
950
855
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -1019,26 +924,15 @@ class Dashboards(BaseSDK):
1019
924
  )
1020
925
 
1021
926
  if utils.match_response(http_res, "200", "application/json"):
1022
- return utils.unmarshal_json(http_res.text, models.Dashboard)
927
+ return utils.unmarshal_json_response(models.Dashboard, http_res)
1023
928
  if utils.match_response(http_res, "4XX", "*"):
1024
929
  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
- )
930
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1028
931
  if utils.match_response(http_res, "5XX", "*"):
1029
932
  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
- )
933
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1033
934
 
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
- )
935
+ raise errors.APIError("Unexpected response received", http_res)
1042
936
 
1043
937
  @deprecated(
1044
938
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -1113,26 +1007,15 @@ class Dashboards(BaseSDK):
1113
1007
  )
1114
1008
 
1115
1009
  if utils.match_response(http_res, "200", "application/json"):
1116
- return utils.unmarshal_json(http_res.text, models.Dashboard)
1010
+ return utils.unmarshal_json_response(models.Dashboard, http_res)
1117
1011
  if utils.match_response(http_res, "4XX", "*"):
1118
1012
  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
- )
1013
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1122
1014
  if utils.match_response(http_res, "5XX", "*"):
1123
1015
  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
- )
1016
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1127
1017
 
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
- )
1018
+ raise errors.APIError("Unexpected response received", http_res)
1136
1019
 
1137
1020
  @deprecated(
1138
1021
  "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
@@ -1207,23 +1090,12 @@ class Dashboards(BaseSDK):
1207
1090
  )
1208
1091
 
1209
1092
  if utils.match_response(http_res, "200", "application/json"):
1210
- return utils.unmarshal_json(http_res.text, models.Dashboard)
1093
+ return utils.unmarshal_json_response(models.Dashboard, http_res)
1211
1094
  if utils.match_response(http_res, "4XX", "*"):
1212
1095
  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
- )
1096
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1216
1097
  if utils.match_response(http_res, "5XX", "*"):
1217
1098
  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
- )
1099
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1221
1100
 
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
- )
1101
+ raise errors.APIError("Unexpected response received", http_res)