syllable-sdk 0.35.31__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.31.dist-info → syllable_sdk-0.35.33.dist-info}/METADATA +58 -45
  48. {syllable_sdk-0.35.31.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.31.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 BaseModel, OptionalNullable, UNSET
7
7
  from syllable_sdk.utils import get_security_from_env
@@ -109,33 +109,22 @@ class CustomMessages(BaseSDK):
109
109
 
110
110
  response_data: Any = None
111
111
  if utils.match_response(http_res, "200", "application/json"):
112
- return utils.unmarshal_json(
113
- http_res.text, models.ListResponseCustomMessageResponse
112
+ return utils.unmarshal_json_response(
113
+ models.ListResponseCustomMessageResponse, http_res
114
114
  )
115
115
  if utils.match_response(http_res, "422", "application/json"):
116
- response_data = utils.unmarshal_json(
117
- http_res.text, models.HTTPValidationErrorData
116
+ response_data = utils.unmarshal_json_response(
117
+ errors.HTTPValidationErrorData, http_res
118
118
  )
119
- raise models.HTTPValidationError(data=response_data)
119
+ raise errors.HTTPValidationError(response_data, http_res)
120
120
  if utils.match_response(http_res, "4XX", "*"):
121
121
  http_res_text = utils.stream_to_text(http_res)
122
- raise models.APIError(
123
- "API error occurred", http_res.status_code, http_res_text, http_res
124
- )
122
+ raise errors.APIError("API error occurred", http_res, http_res_text)
125
123
  if utils.match_response(http_res, "5XX", "*"):
126
124
  http_res_text = utils.stream_to_text(http_res)
127
- raise models.APIError(
128
- "API error occurred", http_res.status_code, http_res_text, http_res
129
- )
125
+ raise errors.APIError("API error occurred", http_res, http_res_text)
130
126
 
131
- content_type = http_res.headers.get("Content-Type")
132
- http_res_text = utils.stream_to_text(http_res)
133
- raise models.APIError(
134
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
135
- http_res.status_code,
136
- http_res_text,
137
- http_res,
138
- )
127
+ raise errors.APIError("Unexpected response received", http_res)
139
128
 
140
129
  async def list_async(
141
130
  self,
@@ -235,33 +224,22 @@ class CustomMessages(BaseSDK):
235
224
 
236
225
  response_data: Any = None
237
226
  if utils.match_response(http_res, "200", "application/json"):
238
- return utils.unmarshal_json(
239
- http_res.text, models.ListResponseCustomMessageResponse
227
+ return utils.unmarshal_json_response(
228
+ models.ListResponseCustomMessageResponse, http_res
240
229
  )
241
230
  if utils.match_response(http_res, "422", "application/json"):
242
- response_data = utils.unmarshal_json(
243
- http_res.text, models.HTTPValidationErrorData
231
+ response_data = utils.unmarshal_json_response(
232
+ errors.HTTPValidationErrorData, http_res
244
233
  )
245
- raise models.HTTPValidationError(data=response_data)
234
+ raise errors.HTTPValidationError(response_data, http_res)
246
235
  if utils.match_response(http_res, "4XX", "*"):
247
236
  http_res_text = await utils.stream_to_text_async(http_res)
248
- raise models.APIError(
249
- "API error occurred", http_res.status_code, http_res_text, http_res
250
- )
237
+ raise errors.APIError("API error occurred", http_res, http_res_text)
251
238
  if utils.match_response(http_res, "5XX", "*"):
252
239
  http_res_text = await utils.stream_to_text_async(http_res)
253
- raise models.APIError(
254
- "API error occurred", http_res.status_code, http_res_text, http_res
255
- )
240
+ raise errors.APIError("API error occurred", http_res, http_res_text)
256
241
 
257
- content_type = http_res.headers.get("Content-Type")
258
- http_res_text = await utils.stream_to_text_async(http_res)
259
- raise models.APIError(
260
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
261
- http_res.status_code,
262
- http_res_text,
263
- http_res,
264
- )
242
+ raise errors.APIError("Unexpected response received", http_res)
265
243
 
266
244
  def create(
267
245
  self,
@@ -343,31 +321,20 @@ class CustomMessages(BaseSDK):
343
321
 
344
322
  response_data: Any = None
345
323
  if utils.match_response(http_res, "200", "application/json"):
346
- return utils.unmarshal_json(http_res.text, models.CustomMessageResponse)
324
+ return utils.unmarshal_json_response(models.CustomMessageResponse, http_res)
347
325
  if utils.match_response(http_res, "422", "application/json"):
348
- response_data = utils.unmarshal_json(
349
- http_res.text, models.HTTPValidationErrorData
326
+ response_data = utils.unmarshal_json_response(
327
+ errors.HTTPValidationErrorData, http_res
350
328
  )
351
- raise models.HTTPValidationError(data=response_data)
329
+ raise errors.HTTPValidationError(response_data, http_res)
352
330
  if utils.match_response(http_res, "4XX", "*"):
353
331
  http_res_text = utils.stream_to_text(http_res)
354
- raise models.APIError(
355
- "API error occurred", http_res.status_code, http_res_text, http_res
356
- )
332
+ raise errors.APIError("API error occurred", http_res, http_res_text)
357
333
  if utils.match_response(http_res, "5XX", "*"):
358
334
  http_res_text = utils.stream_to_text(http_res)
359
- raise models.APIError(
360
- "API error occurred", http_res.status_code, http_res_text, http_res
361
- )
335
+ raise errors.APIError("API error occurred", http_res, http_res_text)
362
336
 
363
- content_type = http_res.headers.get("Content-Type")
364
- http_res_text = utils.stream_to_text(http_res)
365
- raise models.APIError(
366
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
367
- http_res.status_code,
368
- http_res_text,
369
- http_res,
370
- )
337
+ raise errors.APIError("Unexpected response received", http_res)
371
338
 
372
339
  async def create_async(
373
340
  self,
@@ -449,31 +416,20 @@ class CustomMessages(BaseSDK):
449
416
 
450
417
  response_data: Any = None
451
418
  if utils.match_response(http_res, "200", "application/json"):
452
- return utils.unmarshal_json(http_res.text, models.CustomMessageResponse)
419
+ return utils.unmarshal_json_response(models.CustomMessageResponse, http_res)
453
420
  if utils.match_response(http_res, "422", "application/json"):
454
- response_data = utils.unmarshal_json(
455
- http_res.text, models.HTTPValidationErrorData
421
+ response_data = utils.unmarshal_json_response(
422
+ errors.HTTPValidationErrorData, http_res
456
423
  )
457
- raise models.HTTPValidationError(data=response_data)
424
+ raise errors.HTTPValidationError(response_data, http_res)
458
425
  if utils.match_response(http_res, "4XX", "*"):
459
426
  http_res_text = await utils.stream_to_text_async(http_res)
460
- raise models.APIError(
461
- "API error occurred", http_res.status_code, http_res_text, http_res
462
- )
427
+ raise errors.APIError("API error occurred", http_res, http_res_text)
463
428
  if utils.match_response(http_res, "5XX", "*"):
464
429
  http_res_text = await utils.stream_to_text_async(http_res)
465
- raise models.APIError(
466
- "API error occurred", http_res.status_code, http_res_text, http_res
467
- )
430
+ raise errors.APIError("API error occurred", http_res, http_res_text)
468
431
 
469
- content_type = http_res.headers.get("Content-Type")
470
- http_res_text = await utils.stream_to_text_async(http_res)
471
- raise models.APIError(
472
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
473
- http_res.status_code,
474
- http_res_text,
475
- http_res,
476
- )
432
+ raise errors.APIError("Unexpected response received", http_res)
477
433
 
478
434
  def update(
479
435
  self,
@@ -555,31 +511,20 @@ class CustomMessages(BaseSDK):
555
511
 
556
512
  response_data: Any = None
557
513
  if utils.match_response(http_res, "200", "application/json"):
558
- return utils.unmarshal_json(http_res.text, models.CustomMessageResponse)
514
+ return utils.unmarshal_json_response(models.CustomMessageResponse, http_res)
559
515
  if utils.match_response(http_res, "422", "application/json"):
560
- response_data = utils.unmarshal_json(
561
- http_res.text, models.HTTPValidationErrorData
516
+ response_data = utils.unmarshal_json_response(
517
+ errors.HTTPValidationErrorData, http_res
562
518
  )
563
- raise models.HTTPValidationError(data=response_data)
519
+ raise errors.HTTPValidationError(response_data, http_res)
564
520
  if utils.match_response(http_res, "4XX", "*"):
565
521
  http_res_text = utils.stream_to_text(http_res)
566
- raise models.APIError(
567
- "API error occurred", http_res.status_code, http_res_text, http_res
568
- )
522
+ raise errors.APIError("API error occurred", http_res, http_res_text)
569
523
  if utils.match_response(http_res, "5XX", "*"):
570
524
  http_res_text = utils.stream_to_text(http_res)
571
- raise models.APIError(
572
- "API error occurred", http_res.status_code, http_res_text, http_res
573
- )
525
+ raise errors.APIError("API error occurred", http_res, http_res_text)
574
526
 
575
- content_type = http_res.headers.get("Content-Type")
576
- http_res_text = utils.stream_to_text(http_res)
577
- raise models.APIError(
578
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
579
- http_res.status_code,
580
- http_res_text,
581
- http_res,
582
- )
527
+ raise errors.APIError("Unexpected response received", http_res)
583
528
 
584
529
  async def update_async(
585
530
  self,
@@ -661,31 +606,20 @@ class CustomMessages(BaseSDK):
661
606
 
662
607
  response_data: Any = None
663
608
  if utils.match_response(http_res, "200", "application/json"):
664
- return utils.unmarshal_json(http_res.text, models.CustomMessageResponse)
609
+ return utils.unmarshal_json_response(models.CustomMessageResponse, http_res)
665
610
  if utils.match_response(http_res, "422", "application/json"):
666
- response_data = utils.unmarshal_json(
667
- http_res.text, models.HTTPValidationErrorData
611
+ response_data = utils.unmarshal_json_response(
612
+ errors.HTTPValidationErrorData, http_res
668
613
  )
669
- raise models.HTTPValidationError(data=response_data)
614
+ raise errors.HTTPValidationError(response_data, http_res)
670
615
  if utils.match_response(http_res, "4XX", "*"):
671
616
  http_res_text = await utils.stream_to_text_async(http_res)
672
- raise models.APIError(
673
- "API error occurred", http_res.status_code, http_res_text, http_res
674
- )
617
+ raise errors.APIError("API error occurred", http_res, http_res_text)
675
618
  if utils.match_response(http_res, "5XX", "*"):
676
619
  http_res_text = await utils.stream_to_text_async(http_res)
677
- raise models.APIError(
678
- "API error occurred", http_res.status_code, http_res_text, http_res
679
- )
620
+ raise errors.APIError("API error occurred", http_res, http_res_text)
680
621
 
681
- content_type = http_res.headers.get("Content-Type")
682
- http_res_text = await utils.stream_to_text_async(http_res)
683
- raise models.APIError(
684
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
685
- http_res.status_code,
686
- http_res_text,
687
- http_res,
688
- )
622
+ raise errors.APIError("Unexpected response received", http_res)
689
623
 
690
624
  def get_by_id(
691
625
  self,
@@ -761,31 +695,20 @@ class CustomMessages(BaseSDK):
761
695
 
762
696
  response_data: Any = None
763
697
  if utils.match_response(http_res, "200", "application/json"):
764
- return utils.unmarshal_json(http_res.text, models.CustomMessageResponse)
698
+ return utils.unmarshal_json_response(models.CustomMessageResponse, http_res)
765
699
  if utils.match_response(http_res, "422", "application/json"):
766
- response_data = utils.unmarshal_json(
767
- http_res.text, models.HTTPValidationErrorData
700
+ response_data = utils.unmarshal_json_response(
701
+ errors.HTTPValidationErrorData, http_res
768
702
  )
769
- raise models.HTTPValidationError(data=response_data)
703
+ raise errors.HTTPValidationError(response_data, http_res)
770
704
  if utils.match_response(http_res, "4XX", "*"):
771
705
  http_res_text = utils.stream_to_text(http_res)
772
- raise models.APIError(
773
- "API error occurred", http_res.status_code, http_res_text, http_res
774
- )
706
+ raise errors.APIError("API error occurred", http_res, http_res_text)
775
707
  if utils.match_response(http_res, "5XX", "*"):
776
708
  http_res_text = utils.stream_to_text(http_res)
777
- raise models.APIError(
778
- "API error occurred", http_res.status_code, http_res_text, http_res
779
- )
709
+ raise errors.APIError("API error occurred", http_res, http_res_text)
780
710
 
781
- content_type = http_res.headers.get("Content-Type")
782
- http_res_text = utils.stream_to_text(http_res)
783
- raise models.APIError(
784
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
785
- http_res.status_code,
786
- http_res_text,
787
- http_res,
788
- )
711
+ raise errors.APIError("Unexpected response received", http_res)
789
712
 
790
713
  async def get_by_id_async(
791
714
  self,
@@ -861,31 +784,20 @@ class CustomMessages(BaseSDK):
861
784
 
862
785
  response_data: Any = None
863
786
  if utils.match_response(http_res, "200", "application/json"):
864
- return utils.unmarshal_json(http_res.text, models.CustomMessageResponse)
787
+ return utils.unmarshal_json_response(models.CustomMessageResponse, http_res)
865
788
  if utils.match_response(http_res, "422", "application/json"):
866
- response_data = utils.unmarshal_json(
867
- http_res.text, models.HTTPValidationErrorData
789
+ response_data = utils.unmarshal_json_response(
790
+ errors.HTTPValidationErrorData, http_res
868
791
  )
869
- raise models.HTTPValidationError(data=response_data)
792
+ raise errors.HTTPValidationError(response_data, http_res)
870
793
  if utils.match_response(http_res, "4XX", "*"):
871
794
  http_res_text = await utils.stream_to_text_async(http_res)
872
- raise models.APIError(
873
- "API error occurred", http_res.status_code, http_res_text, http_res
874
- )
795
+ raise errors.APIError("API error occurred", http_res, http_res_text)
875
796
  if utils.match_response(http_res, "5XX", "*"):
876
797
  http_res_text = await utils.stream_to_text_async(http_res)
877
- raise models.APIError(
878
- "API error occurred", http_res.status_code, http_res_text, http_res
879
- )
798
+ raise errors.APIError("API error occurred", http_res, http_res_text)
880
799
 
881
- content_type = http_res.headers.get("Content-Type")
882
- http_res_text = await utils.stream_to_text_async(http_res)
883
- raise models.APIError(
884
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
885
- http_res.status_code,
886
- http_res_text,
887
- http_res,
888
- )
800
+ raise errors.APIError("Unexpected response received", http_res)
889
801
 
890
802
  def delete(
891
803
  self,
@@ -964,31 +876,20 @@ class CustomMessages(BaseSDK):
964
876
 
965
877
  response_data: Any = None
966
878
  if utils.match_response(http_res, "200", "application/json"):
967
- return utils.unmarshal_json(http_res.text, Any)
879
+ return utils.unmarshal_json_response(Any, http_res)
968
880
  if utils.match_response(http_res, "422", "application/json"):
969
- response_data = utils.unmarshal_json(
970
- http_res.text, models.HTTPValidationErrorData
881
+ response_data = utils.unmarshal_json_response(
882
+ errors.HTTPValidationErrorData, http_res
971
883
  )
972
- raise models.HTTPValidationError(data=response_data)
884
+ raise errors.HTTPValidationError(response_data, http_res)
973
885
  if utils.match_response(http_res, "4XX", "*"):
974
886
  http_res_text = utils.stream_to_text(http_res)
975
- raise models.APIError(
976
- "API error occurred", http_res.status_code, http_res_text, http_res
977
- )
887
+ raise errors.APIError("API error occurred", http_res, http_res_text)
978
888
  if utils.match_response(http_res, "5XX", "*"):
979
889
  http_res_text = utils.stream_to_text(http_res)
980
- raise models.APIError(
981
- "API error occurred", http_res.status_code, http_res_text, http_res
982
- )
890
+ raise errors.APIError("API error occurred", http_res, http_res_text)
983
891
 
984
- content_type = http_res.headers.get("Content-Type")
985
- http_res_text = utils.stream_to_text(http_res)
986
- raise models.APIError(
987
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
988
- http_res.status_code,
989
- http_res_text,
990
- http_res,
991
- )
892
+ raise errors.APIError("Unexpected response received", http_res)
992
893
 
993
894
  async def delete_async(
994
895
  self,
@@ -1067,28 +968,17 @@ class CustomMessages(BaseSDK):
1067
968
 
1068
969
  response_data: Any = None
1069
970
  if utils.match_response(http_res, "200", "application/json"):
1070
- return utils.unmarshal_json(http_res.text, Any)
971
+ return utils.unmarshal_json_response(Any, http_res)
1071
972
  if utils.match_response(http_res, "422", "application/json"):
1072
- response_data = utils.unmarshal_json(
1073
- http_res.text, models.HTTPValidationErrorData
973
+ response_data = utils.unmarshal_json_response(
974
+ errors.HTTPValidationErrorData, http_res
1074
975
  )
1075
- raise models.HTTPValidationError(data=response_data)
976
+ raise errors.HTTPValidationError(response_data, http_res)
1076
977
  if utils.match_response(http_res, "4XX", "*"):
1077
978
  http_res_text = await utils.stream_to_text_async(http_res)
1078
- raise models.APIError(
1079
- "API error occurred", http_res.status_code, http_res_text, http_res
1080
- )
979
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1081
980
  if utils.match_response(http_res, "5XX", "*"):
1082
981
  http_res_text = await utils.stream_to_text_async(http_res)
1083
- raise models.APIError(
1084
- "API error occurred", http_res.status_code, http_res_text, http_res
1085
- )
982
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1086
983
 
1087
- content_type = http_res.headers.get("Content-Type")
1088
- http_res_text = await utils.stream_to_text_async(http_res)
1089
- raise models.APIError(
1090
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1091
- http_res.status_code,
1092
- http_res_text,
1093
- http_res,
1094
- )
984
+ raise errors.APIError("Unexpected response received", http_res)