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
syllable_sdk/roles.py CHANGED
@@ -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,31 +109,22 @@ class Roles(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(http_res.text, models.ListResponseRoleResponse)
112
+ return utils.unmarshal_json_response(
113
+ models.ListResponseRoleResponse, http_res
114
+ )
113
115
  if utils.match_response(http_res, "422", "application/json"):
114
- response_data = utils.unmarshal_json(
115
- http_res.text, models.HTTPValidationErrorData
116
+ response_data = utils.unmarshal_json_response(
117
+ errors.HTTPValidationErrorData, http_res
116
118
  )
117
- raise models.HTTPValidationError(data=response_data)
119
+ raise errors.HTTPValidationError(response_data, http_res)
118
120
  if utils.match_response(http_res, "4XX", "*"):
119
121
  http_res_text = utils.stream_to_text(http_res)
120
- raise models.APIError(
121
- "API error occurred", http_res.status_code, http_res_text, http_res
122
- )
122
+ raise errors.APIError("API error occurred", http_res, http_res_text)
123
123
  if utils.match_response(http_res, "5XX", "*"):
124
124
  http_res_text = utils.stream_to_text(http_res)
125
- raise models.APIError(
126
- "API error occurred", http_res.status_code, http_res_text, http_res
127
- )
125
+ raise errors.APIError("API error occurred", http_res, http_res_text)
128
126
 
129
- content_type = http_res.headers.get("Content-Type")
130
- http_res_text = utils.stream_to_text(http_res)
131
- raise models.APIError(
132
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
133
- http_res.status_code,
134
- http_res_text,
135
- http_res,
136
- )
127
+ raise errors.APIError("Unexpected response received", http_res)
137
128
 
138
129
  async def list_async(
139
130
  self,
@@ -233,31 +224,22 @@ class Roles(BaseSDK):
233
224
 
234
225
  response_data: Any = None
235
226
  if utils.match_response(http_res, "200", "application/json"):
236
- return utils.unmarshal_json(http_res.text, models.ListResponseRoleResponse)
227
+ return utils.unmarshal_json_response(
228
+ models.ListResponseRoleResponse, http_res
229
+ )
237
230
  if utils.match_response(http_res, "422", "application/json"):
238
- response_data = utils.unmarshal_json(
239
- http_res.text, models.HTTPValidationErrorData
231
+ response_data = utils.unmarshal_json_response(
232
+ errors.HTTPValidationErrorData, http_res
240
233
  )
241
- raise models.HTTPValidationError(data=response_data)
234
+ raise errors.HTTPValidationError(response_data, http_res)
242
235
  if utils.match_response(http_res, "4XX", "*"):
243
236
  http_res_text = await utils.stream_to_text_async(http_res)
244
- raise models.APIError(
245
- "API error occurred", http_res.status_code, http_res_text, http_res
246
- )
237
+ raise errors.APIError("API error occurred", http_res, http_res_text)
247
238
  if utils.match_response(http_res, "5XX", "*"):
248
239
  http_res_text = await utils.stream_to_text_async(http_res)
249
- raise models.APIError(
250
- "API error occurred", http_res.status_code, http_res_text, http_res
251
- )
240
+ raise errors.APIError("API error occurred", http_res, http_res_text)
252
241
 
253
- content_type = http_res.headers.get("Content-Type")
254
- http_res_text = await utils.stream_to_text_async(http_res)
255
- raise models.APIError(
256
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
257
- http_res.status_code,
258
- http_res_text,
259
- http_res,
260
- )
242
+ raise errors.APIError("Unexpected response received", http_res)
261
243
 
262
244
  def create(
263
245
  self,
@@ -336,31 +318,20 @@ class Roles(BaseSDK):
336
318
 
337
319
  response_data: Any = None
338
320
  if utils.match_response(http_res, "200", "application/json"):
339
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
321
+ return utils.unmarshal_json_response(models.RoleResponse, http_res)
340
322
  if utils.match_response(http_res, "422", "application/json"):
341
- response_data = utils.unmarshal_json(
342
- http_res.text, models.HTTPValidationErrorData
323
+ response_data = utils.unmarshal_json_response(
324
+ errors.HTTPValidationErrorData, http_res
343
325
  )
344
- raise models.HTTPValidationError(data=response_data)
326
+ raise errors.HTTPValidationError(response_data, http_res)
345
327
  if utils.match_response(http_res, "4XX", "*"):
346
328
  http_res_text = utils.stream_to_text(http_res)
347
- raise models.APIError(
348
- "API error occurred", http_res.status_code, http_res_text, http_res
349
- )
329
+ raise errors.APIError("API error occurred", http_res, http_res_text)
350
330
  if utils.match_response(http_res, "5XX", "*"):
351
331
  http_res_text = utils.stream_to_text(http_res)
352
- raise models.APIError(
353
- "API error occurred", http_res.status_code, http_res_text, http_res
354
- )
332
+ raise errors.APIError("API error occurred", http_res, http_res_text)
355
333
 
356
- content_type = http_res.headers.get("Content-Type")
357
- http_res_text = utils.stream_to_text(http_res)
358
- raise models.APIError(
359
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
360
- http_res.status_code,
361
- http_res_text,
362
- http_res,
363
- )
334
+ raise errors.APIError("Unexpected response received", http_res)
364
335
 
365
336
  async def create_async(
366
337
  self,
@@ -439,31 +410,20 @@ class Roles(BaseSDK):
439
410
 
440
411
  response_data: Any = None
441
412
  if utils.match_response(http_res, "200", "application/json"):
442
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
413
+ return utils.unmarshal_json_response(models.RoleResponse, http_res)
443
414
  if utils.match_response(http_res, "422", "application/json"):
444
- response_data = utils.unmarshal_json(
445
- http_res.text, models.HTTPValidationErrorData
415
+ response_data = utils.unmarshal_json_response(
416
+ errors.HTTPValidationErrorData, http_res
446
417
  )
447
- raise models.HTTPValidationError(data=response_data)
418
+ raise errors.HTTPValidationError(response_data, http_res)
448
419
  if utils.match_response(http_res, "4XX", "*"):
449
420
  http_res_text = await utils.stream_to_text_async(http_res)
450
- raise models.APIError(
451
- "API error occurred", http_res.status_code, http_res_text, http_res
452
- )
421
+ raise errors.APIError("API error occurred", http_res, http_res_text)
453
422
  if utils.match_response(http_res, "5XX", "*"):
454
423
  http_res_text = await utils.stream_to_text_async(http_res)
455
- raise models.APIError(
456
- "API error occurred", http_res.status_code, http_res_text, http_res
457
- )
424
+ raise errors.APIError("API error occurred", http_res, http_res_text)
458
425
 
459
- content_type = http_res.headers.get("Content-Type")
460
- http_res_text = await utils.stream_to_text_async(http_res)
461
- raise models.APIError(
462
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
463
- http_res.status_code,
464
- http_res_text,
465
- http_res,
466
- )
426
+ raise errors.APIError("Unexpected response received", http_res)
467
427
 
468
428
  def update(
469
429
  self,
@@ -542,31 +502,20 @@ class Roles(BaseSDK):
542
502
 
543
503
  response_data: Any = None
544
504
  if utils.match_response(http_res, "200", "application/json"):
545
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
505
+ return utils.unmarshal_json_response(models.RoleResponse, http_res)
546
506
  if utils.match_response(http_res, "422", "application/json"):
547
- response_data = utils.unmarshal_json(
548
- http_res.text, models.HTTPValidationErrorData
507
+ response_data = utils.unmarshal_json_response(
508
+ errors.HTTPValidationErrorData, http_res
549
509
  )
550
- raise models.HTTPValidationError(data=response_data)
510
+ raise errors.HTTPValidationError(response_data, http_res)
551
511
  if utils.match_response(http_res, "4XX", "*"):
552
512
  http_res_text = utils.stream_to_text(http_res)
553
- raise models.APIError(
554
- "API error occurred", http_res.status_code, http_res_text, http_res
555
- )
513
+ raise errors.APIError("API error occurred", http_res, http_res_text)
556
514
  if utils.match_response(http_res, "5XX", "*"):
557
515
  http_res_text = utils.stream_to_text(http_res)
558
- raise models.APIError(
559
- "API error occurred", http_res.status_code, http_res_text, http_res
560
- )
516
+ raise errors.APIError("API error occurred", http_res, http_res_text)
561
517
 
562
- content_type = http_res.headers.get("Content-Type")
563
- http_res_text = utils.stream_to_text(http_res)
564
- raise models.APIError(
565
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
566
- http_res.status_code,
567
- http_res_text,
568
- http_res,
569
- )
518
+ raise errors.APIError("Unexpected response received", http_res)
570
519
 
571
520
  async def update_async(
572
521
  self,
@@ -645,31 +594,20 @@ class Roles(BaseSDK):
645
594
 
646
595
  response_data: Any = None
647
596
  if utils.match_response(http_res, "200", "application/json"):
648
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
597
+ return utils.unmarshal_json_response(models.RoleResponse, http_res)
649
598
  if utils.match_response(http_res, "422", "application/json"):
650
- response_data = utils.unmarshal_json(
651
- http_res.text, models.HTTPValidationErrorData
599
+ response_data = utils.unmarshal_json_response(
600
+ errors.HTTPValidationErrorData, http_res
652
601
  )
653
- raise models.HTTPValidationError(data=response_data)
602
+ raise errors.HTTPValidationError(response_data, http_res)
654
603
  if utils.match_response(http_res, "4XX", "*"):
655
604
  http_res_text = await utils.stream_to_text_async(http_res)
656
- raise models.APIError(
657
- "API error occurred", http_res.status_code, http_res_text, http_res
658
- )
605
+ raise errors.APIError("API error occurred", http_res, http_res_text)
659
606
  if utils.match_response(http_res, "5XX", "*"):
660
607
  http_res_text = await utils.stream_to_text_async(http_res)
661
- raise models.APIError(
662
- "API error occurred", http_res.status_code, http_res_text, http_res
663
- )
608
+ raise errors.APIError("API error occurred", http_res, http_res_text)
664
609
 
665
- content_type = http_res.headers.get("Content-Type")
666
- http_res_text = await utils.stream_to_text_async(http_res)
667
- raise models.APIError(
668
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
669
- http_res.status_code,
670
- http_res_text,
671
- http_res,
672
- )
610
+ raise errors.APIError("Unexpected response received", http_res)
673
611
 
674
612
  def get_by_id(
675
613
  self,
@@ -745,31 +683,20 @@ class Roles(BaseSDK):
745
683
 
746
684
  response_data: Any = None
747
685
  if utils.match_response(http_res, "200", "application/json"):
748
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
686
+ return utils.unmarshal_json_response(models.RoleResponse, http_res)
749
687
  if utils.match_response(http_res, "422", "application/json"):
750
- response_data = utils.unmarshal_json(
751
- http_res.text, models.HTTPValidationErrorData
688
+ response_data = utils.unmarshal_json_response(
689
+ errors.HTTPValidationErrorData, http_res
752
690
  )
753
- raise models.HTTPValidationError(data=response_data)
691
+ raise errors.HTTPValidationError(response_data, http_res)
754
692
  if utils.match_response(http_res, "4XX", "*"):
755
693
  http_res_text = utils.stream_to_text(http_res)
756
- raise models.APIError(
757
- "API error occurred", http_res.status_code, http_res_text, http_res
758
- )
694
+ raise errors.APIError("API error occurred", http_res, http_res_text)
759
695
  if utils.match_response(http_res, "5XX", "*"):
760
696
  http_res_text = utils.stream_to_text(http_res)
761
- raise models.APIError(
762
- "API error occurred", http_res.status_code, http_res_text, http_res
763
- )
697
+ raise errors.APIError("API error occurred", http_res, http_res_text)
764
698
 
765
- content_type = http_res.headers.get("Content-Type")
766
- http_res_text = utils.stream_to_text(http_res)
767
- raise models.APIError(
768
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
769
- http_res.status_code,
770
- http_res_text,
771
- http_res,
772
- )
699
+ raise errors.APIError("Unexpected response received", http_res)
773
700
 
774
701
  async def get_by_id_async(
775
702
  self,
@@ -845,31 +772,20 @@ class Roles(BaseSDK):
845
772
 
846
773
  response_data: Any = None
847
774
  if utils.match_response(http_res, "200", "application/json"):
848
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
775
+ return utils.unmarshal_json_response(models.RoleResponse, http_res)
849
776
  if utils.match_response(http_res, "422", "application/json"):
850
- response_data = utils.unmarshal_json(
851
- http_res.text, models.HTTPValidationErrorData
777
+ response_data = utils.unmarshal_json_response(
778
+ errors.HTTPValidationErrorData, http_res
852
779
  )
853
- raise models.HTTPValidationError(data=response_data)
780
+ raise errors.HTTPValidationError(response_data, http_res)
854
781
  if utils.match_response(http_res, "4XX", "*"):
855
782
  http_res_text = await utils.stream_to_text_async(http_res)
856
- raise models.APIError(
857
- "API error occurred", http_res.status_code, http_res_text, http_res
858
- )
783
+ raise errors.APIError("API error occurred", http_res, http_res_text)
859
784
  if utils.match_response(http_res, "5XX", "*"):
860
785
  http_res_text = await utils.stream_to_text_async(http_res)
861
- raise models.APIError(
862
- "API error occurred", http_res.status_code, http_res_text, http_res
863
- )
786
+ raise errors.APIError("API error occurred", http_res, http_res_text)
864
787
 
865
- content_type = http_res.headers.get("Content-Type")
866
- http_res_text = await utils.stream_to_text_async(http_res)
867
- raise models.APIError(
868
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
869
- http_res.status_code,
870
- http_res_text,
871
- http_res,
872
- )
788
+ raise errors.APIError("Unexpected response received", http_res)
873
789
 
874
790
  def delete(
875
791
  self,
@@ -951,31 +867,20 @@ class Roles(BaseSDK):
951
867
 
952
868
  response_data: Any = None
953
869
  if utils.match_response(http_res, "200", "application/json"):
954
- return utils.unmarshal_json(http_res.text, Any)
870
+ return utils.unmarshal_json_response(Any, http_res)
955
871
  if utils.match_response(http_res, "422", "application/json"):
956
- response_data = utils.unmarshal_json(
957
- http_res.text, models.HTTPValidationErrorData
872
+ response_data = utils.unmarshal_json_response(
873
+ errors.HTTPValidationErrorData, http_res
958
874
  )
959
- raise models.HTTPValidationError(data=response_data)
875
+ raise errors.HTTPValidationError(response_data, http_res)
960
876
  if utils.match_response(http_res, "4XX", "*"):
961
877
  http_res_text = utils.stream_to_text(http_res)
962
- raise models.APIError(
963
- "API error occurred", http_res.status_code, http_res_text, http_res
964
- )
878
+ raise errors.APIError("API error occurred", http_res, http_res_text)
965
879
  if utils.match_response(http_res, "5XX", "*"):
966
880
  http_res_text = utils.stream_to_text(http_res)
967
- raise models.APIError(
968
- "API error occurred", http_res.status_code, http_res_text, http_res
969
- )
881
+ raise errors.APIError("API error occurred", http_res, http_res_text)
970
882
 
971
- content_type = http_res.headers.get("Content-Type")
972
- http_res_text = utils.stream_to_text(http_res)
973
- raise models.APIError(
974
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
975
- http_res.status_code,
976
- http_res_text,
977
- http_res,
978
- )
883
+ raise errors.APIError("Unexpected response received", http_res)
979
884
 
980
885
  async def delete_async(
981
886
  self,
@@ -1057,28 +962,17 @@ class Roles(BaseSDK):
1057
962
 
1058
963
  response_data: Any = None
1059
964
  if utils.match_response(http_res, "200", "application/json"):
1060
- return utils.unmarshal_json(http_res.text, Any)
965
+ return utils.unmarshal_json_response(Any, http_res)
1061
966
  if utils.match_response(http_res, "422", "application/json"):
1062
- response_data = utils.unmarshal_json(
1063
- http_res.text, models.HTTPValidationErrorData
967
+ response_data = utils.unmarshal_json_response(
968
+ errors.HTTPValidationErrorData, http_res
1064
969
  )
1065
- raise models.HTTPValidationError(data=response_data)
970
+ raise errors.HTTPValidationError(response_data, http_res)
1066
971
  if utils.match_response(http_res, "4XX", "*"):
1067
972
  http_res_text = await utils.stream_to_text_async(http_res)
1068
- raise models.APIError(
1069
- "API error occurred", http_res.status_code, http_res_text, http_res
1070
- )
973
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1071
974
  if utils.match_response(http_res, "5XX", "*"):
1072
975
  http_res_text = await utils.stream_to_text_async(http_res)
1073
- raise models.APIError(
1074
- "API error occurred", http_res.status_code, http_res_text, http_res
1075
- )
976
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1076
977
 
1077
- content_type = http_res.headers.get("Content-Type")
1078
- http_res_text = await utils.stream_to_text_async(http_res)
1079
- raise models.APIError(
1080
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1081
- http_res.status_code,
1082
- http_res_text,
1083
- http_res,
1084
- )
978
+ raise errors.APIError("Unexpected response received", http_res)