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
syllable_sdk/roles.py CHANGED
@@ -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 BaseModel, 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, Union, cast
9
10
 
10
11
 
@@ -109,31 +110,20 @@ class Roles(BaseSDK):
109
110
 
110
111
  response_data: Any = None
111
112
  if utils.match_response(http_res, "200", "application/json"):
112
- return utils.unmarshal_json(http_res.text, models.ListResponseRoleResponse)
113
+ return unmarshal_json_response(models.ListResponseRoleResponse, http_res)
113
114
  if utils.match_response(http_res, "422", "application/json"):
114
- response_data = utils.unmarshal_json(
115
- http_res.text, models.HTTPValidationErrorData
115
+ response_data = unmarshal_json_response(
116
+ errors.HTTPValidationErrorData, http_res
116
117
  )
117
- raise models.HTTPValidationError(data=response_data)
118
+ raise errors.HTTPValidationError(response_data, http_res)
118
119
  if utils.match_response(http_res, "4XX", "*"):
119
120
  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
- )
121
+ raise errors.APIError("API error occurred", http_res, http_res_text)
123
122
  if utils.match_response(http_res, "5XX", "*"):
124
123
  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
- )
124
+ raise errors.APIError("API error occurred", http_res, http_res_text)
128
125
 
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
- )
126
+ raise errors.APIError("Unexpected response received", http_res)
137
127
 
138
128
  async def list_async(
139
129
  self,
@@ -233,31 +223,20 @@ class Roles(BaseSDK):
233
223
 
234
224
  response_data: Any = None
235
225
  if utils.match_response(http_res, "200", "application/json"):
236
- return utils.unmarshal_json(http_res.text, models.ListResponseRoleResponse)
226
+ return unmarshal_json_response(models.ListResponseRoleResponse, http_res)
237
227
  if utils.match_response(http_res, "422", "application/json"):
238
- response_data = utils.unmarshal_json(
239
- http_res.text, models.HTTPValidationErrorData
228
+ response_data = unmarshal_json_response(
229
+ errors.HTTPValidationErrorData, http_res
240
230
  )
241
- raise models.HTTPValidationError(data=response_data)
231
+ raise errors.HTTPValidationError(response_data, http_res)
242
232
  if utils.match_response(http_res, "4XX", "*"):
243
233
  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
- )
234
+ raise errors.APIError("API error occurred", http_res, http_res_text)
247
235
  if utils.match_response(http_res, "5XX", "*"):
248
236
  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
- )
237
+ raise errors.APIError("API error occurred", http_res, http_res_text)
252
238
 
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
- )
239
+ raise errors.APIError("Unexpected response received", http_res)
261
240
 
262
241
  def create(
263
242
  self,
@@ -336,31 +315,20 @@ class Roles(BaseSDK):
336
315
 
337
316
  response_data: Any = None
338
317
  if utils.match_response(http_res, "200", "application/json"):
339
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
318
+ return unmarshal_json_response(models.RoleResponse, http_res)
340
319
  if utils.match_response(http_res, "422", "application/json"):
341
- response_data = utils.unmarshal_json(
342
- http_res.text, models.HTTPValidationErrorData
320
+ response_data = unmarshal_json_response(
321
+ errors.HTTPValidationErrorData, http_res
343
322
  )
344
- raise models.HTTPValidationError(data=response_data)
323
+ raise errors.HTTPValidationError(response_data, http_res)
345
324
  if utils.match_response(http_res, "4XX", "*"):
346
325
  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
- )
326
+ raise errors.APIError("API error occurred", http_res, http_res_text)
350
327
  if utils.match_response(http_res, "5XX", "*"):
351
328
  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
- )
329
+ raise errors.APIError("API error occurred", http_res, http_res_text)
355
330
 
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
- )
331
+ raise errors.APIError("Unexpected response received", http_res)
364
332
 
365
333
  async def create_async(
366
334
  self,
@@ -439,31 +407,20 @@ class Roles(BaseSDK):
439
407
 
440
408
  response_data: Any = None
441
409
  if utils.match_response(http_res, "200", "application/json"):
442
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
410
+ return unmarshal_json_response(models.RoleResponse, http_res)
443
411
  if utils.match_response(http_res, "422", "application/json"):
444
- response_data = utils.unmarshal_json(
445
- http_res.text, models.HTTPValidationErrorData
412
+ response_data = unmarshal_json_response(
413
+ errors.HTTPValidationErrorData, http_res
446
414
  )
447
- raise models.HTTPValidationError(data=response_data)
415
+ raise errors.HTTPValidationError(response_data, http_res)
448
416
  if utils.match_response(http_res, "4XX", "*"):
449
417
  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
- )
418
+ raise errors.APIError("API error occurred", http_res, http_res_text)
453
419
  if utils.match_response(http_res, "5XX", "*"):
454
420
  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
- )
421
+ raise errors.APIError("API error occurred", http_res, http_res_text)
458
422
 
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
- )
423
+ raise errors.APIError("Unexpected response received", http_res)
467
424
 
468
425
  def update(
469
426
  self,
@@ -542,31 +499,20 @@ class Roles(BaseSDK):
542
499
 
543
500
  response_data: Any = None
544
501
  if utils.match_response(http_res, "200", "application/json"):
545
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
502
+ return unmarshal_json_response(models.RoleResponse, http_res)
546
503
  if utils.match_response(http_res, "422", "application/json"):
547
- response_data = utils.unmarshal_json(
548
- http_res.text, models.HTTPValidationErrorData
504
+ response_data = unmarshal_json_response(
505
+ errors.HTTPValidationErrorData, http_res
549
506
  )
550
- raise models.HTTPValidationError(data=response_data)
507
+ raise errors.HTTPValidationError(response_data, http_res)
551
508
  if utils.match_response(http_res, "4XX", "*"):
552
509
  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
- )
510
+ raise errors.APIError("API error occurred", http_res, http_res_text)
556
511
  if utils.match_response(http_res, "5XX", "*"):
557
512
  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
- )
513
+ raise errors.APIError("API error occurred", http_res, http_res_text)
561
514
 
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
- )
515
+ raise errors.APIError("Unexpected response received", http_res)
570
516
 
571
517
  async def update_async(
572
518
  self,
@@ -645,31 +591,20 @@ class Roles(BaseSDK):
645
591
 
646
592
  response_data: Any = None
647
593
  if utils.match_response(http_res, "200", "application/json"):
648
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
594
+ return unmarshal_json_response(models.RoleResponse, http_res)
649
595
  if utils.match_response(http_res, "422", "application/json"):
650
- response_data = utils.unmarshal_json(
651
- http_res.text, models.HTTPValidationErrorData
596
+ response_data = unmarshal_json_response(
597
+ errors.HTTPValidationErrorData, http_res
652
598
  )
653
- raise models.HTTPValidationError(data=response_data)
599
+ raise errors.HTTPValidationError(response_data, http_res)
654
600
  if utils.match_response(http_res, "4XX", "*"):
655
601
  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
- )
602
+ raise errors.APIError("API error occurred", http_res, http_res_text)
659
603
  if utils.match_response(http_res, "5XX", "*"):
660
604
  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
- )
605
+ raise errors.APIError("API error occurred", http_res, http_res_text)
664
606
 
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
- )
607
+ raise errors.APIError("Unexpected response received", http_res)
673
608
 
674
609
  def get_by_id(
675
610
  self,
@@ -745,31 +680,20 @@ class Roles(BaseSDK):
745
680
 
746
681
  response_data: Any = None
747
682
  if utils.match_response(http_res, "200", "application/json"):
748
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
683
+ return unmarshal_json_response(models.RoleResponse, http_res)
749
684
  if utils.match_response(http_res, "422", "application/json"):
750
- response_data = utils.unmarshal_json(
751
- http_res.text, models.HTTPValidationErrorData
685
+ response_data = unmarshal_json_response(
686
+ errors.HTTPValidationErrorData, http_res
752
687
  )
753
- raise models.HTTPValidationError(data=response_data)
688
+ raise errors.HTTPValidationError(response_data, http_res)
754
689
  if utils.match_response(http_res, "4XX", "*"):
755
690
  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
- )
691
+ raise errors.APIError("API error occurred", http_res, http_res_text)
759
692
  if utils.match_response(http_res, "5XX", "*"):
760
693
  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
- )
694
+ raise errors.APIError("API error occurred", http_res, http_res_text)
764
695
 
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
- )
696
+ raise errors.APIError("Unexpected response received", http_res)
773
697
 
774
698
  async def get_by_id_async(
775
699
  self,
@@ -845,31 +769,20 @@ class Roles(BaseSDK):
845
769
 
846
770
  response_data: Any = None
847
771
  if utils.match_response(http_res, "200", "application/json"):
848
- return utils.unmarshal_json(http_res.text, models.RoleResponse)
772
+ return unmarshal_json_response(models.RoleResponse, http_res)
849
773
  if utils.match_response(http_res, "422", "application/json"):
850
- response_data = utils.unmarshal_json(
851
- http_res.text, models.HTTPValidationErrorData
774
+ response_data = unmarshal_json_response(
775
+ errors.HTTPValidationErrorData, http_res
852
776
  )
853
- raise models.HTTPValidationError(data=response_data)
777
+ raise errors.HTTPValidationError(response_data, http_res)
854
778
  if utils.match_response(http_res, "4XX", "*"):
855
779
  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
- )
780
+ raise errors.APIError("API error occurred", http_res, http_res_text)
859
781
  if utils.match_response(http_res, "5XX", "*"):
860
782
  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
- )
783
+ raise errors.APIError("API error occurred", http_res, http_res_text)
864
784
 
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
- )
785
+ raise errors.APIError("Unexpected response received", http_res)
873
786
 
874
787
  def delete(
875
788
  self,
@@ -951,31 +864,20 @@ class Roles(BaseSDK):
951
864
 
952
865
  response_data: Any = None
953
866
  if utils.match_response(http_res, "200", "application/json"):
954
- return utils.unmarshal_json(http_res.text, Any)
867
+ return unmarshal_json_response(Any, http_res)
955
868
  if utils.match_response(http_res, "422", "application/json"):
956
- response_data = utils.unmarshal_json(
957
- http_res.text, models.HTTPValidationErrorData
869
+ response_data = unmarshal_json_response(
870
+ errors.HTTPValidationErrorData, http_res
958
871
  )
959
- raise models.HTTPValidationError(data=response_data)
872
+ raise errors.HTTPValidationError(response_data, http_res)
960
873
  if utils.match_response(http_res, "4XX", "*"):
961
874
  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
- )
875
+ raise errors.APIError("API error occurred", http_res, http_res_text)
965
876
  if utils.match_response(http_res, "5XX", "*"):
966
877
  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
- )
878
+ raise errors.APIError("API error occurred", http_res, http_res_text)
970
879
 
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
- )
880
+ raise errors.APIError("Unexpected response received", http_res)
979
881
 
980
882
  async def delete_async(
981
883
  self,
@@ -1057,28 +959,17 @@ class Roles(BaseSDK):
1057
959
 
1058
960
  response_data: Any = None
1059
961
  if utils.match_response(http_res, "200", "application/json"):
1060
- return utils.unmarshal_json(http_res.text, Any)
962
+ return unmarshal_json_response(Any, http_res)
1061
963
  if utils.match_response(http_res, "422", "application/json"):
1062
- response_data = utils.unmarshal_json(
1063
- http_res.text, models.HTTPValidationErrorData
964
+ response_data = unmarshal_json_response(
965
+ errors.HTTPValidationErrorData, http_res
1064
966
  )
1065
- raise models.HTTPValidationError(data=response_data)
967
+ raise errors.HTTPValidationError(response_data, http_res)
1066
968
  if utils.match_response(http_res, "4XX", "*"):
1067
969
  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
- )
970
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1071
971
  if utils.match_response(http_res, "5XX", "*"):
1072
972
  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
- )
973
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1076
974
 
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
- )
975
+ raise errors.APIError("Unexpected response received", http_res)