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/events.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 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
 
10
11
 
@@ -107,31 +108,20 @@ class Events(BaseSDK):
107
108
 
108
109
  response_data: Any = None
109
110
  if utils.match_response(http_res, "200", "application/json"):
110
- return utils.unmarshal_json(http_res.text, models.ListResponseEvent)
111
+ return unmarshal_json_response(models.ListResponseEvent, http_res)
111
112
  if utils.match_response(http_res, "422", "application/json"):
112
- response_data = utils.unmarshal_json(
113
- http_res.text, models.HTTPValidationErrorData
113
+ response_data = unmarshal_json_response(
114
+ errors.HTTPValidationErrorData, http_res
114
115
  )
115
- raise models.HTTPValidationError(data=response_data)
116
+ raise errors.HTTPValidationError(response_data, http_res)
116
117
  if utils.match_response(http_res, "4XX", "*"):
117
118
  http_res_text = utils.stream_to_text(http_res)
118
- raise models.APIError(
119
- "API error occurred", http_res.status_code, http_res_text, http_res
120
- )
119
+ raise errors.APIError("API error occurred", http_res, http_res_text)
121
120
  if utils.match_response(http_res, "5XX", "*"):
122
121
  http_res_text = utils.stream_to_text(http_res)
123
- raise models.APIError(
124
- "API error occurred", http_res.status_code, http_res_text, http_res
125
- )
122
+ raise errors.APIError("API error occurred", http_res, http_res_text)
126
123
 
127
- content_type = http_res.headers.get("Content-Type")
128
- http_res_text = utils.stream_to_text(http_res)
129
- raise models.APIError(
130
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
131
- http_res.status_code,
132
- http_res_text,
133
- http_res,
134
- )
124
+ raise errors.APIError("Unexpected response received", http_res)
135
125
 
136
126
  async def list_async(
137
127
  self,
@@ -229,28 +219,17 @@ class Events(BaseSDK):
229
219
 
230
220
  response_data: Any = None
231
221
  if utils.match_response(http_res, "200", "application/json"):
232
- return utils.unmarshal_json(http_res.text, models.ListResponseEvent)
222
+ return unmarshal_json_response(models.ListResponseEvent, http_res)
233
223
  if utils.match_response(http_res, "422", "application/json"):
234
- response_data = utils.unmarshal_json(
235
- http_res.text, models.HTTPValidationErrorData
224
+ response_data = unmarshal_json_response(
225
+ errors.HTTPValidationErrorData, http_res
236
226
  )
237
- raise models.HTTPValidationError(data=response_data)
227
+ raise errors.HTTPValidationError(response_data, http_res)
238
228
  if utils.match_response(http_res, "4XX", "*"):
239
229
  http_res_text = await utils.stream_to_text_async(http_res)
240
- raise models.APIError(
241
- "API error occurred", http_res.status_code, http_res_text, http_res
242
- )
230
+ raise errors.APIError("API error occurred", http_res, http_res_text)
243
231
  if utils.match_response(http_res, "5XX", "*"):
244
232
  http_res_text = await utils.stream_to_text_async(http_res)
245
- raise models.APIError(
246
- "API error occurred", http_res.status_code, http_res_text, http_res
247
- )
233
+ raise errors.APIError("API error occurred", http_res, http_res_text)
248
234
 
249
- content_type = http_res.headers.get("Content-Type")
250
- http_res_text = await utils.stream_to_text_async(http_res)
251
- raise models.APIError(
252
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
253
- http_res.status_code,
254
- http_res_text,
255
- http_res,
256
- )
235
+ raise errors.APIError("Unexpected response received", http_res)