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.
- syllable_sdk/__init__.py +0 -1
- syllable_sdk/_version.py +3 -3
- syllable_sdk/agents.py +80 -211
- syllable_sdk/basesdk.py +5 -5
- syllable_sdk/batches.py +132 -329
- syllable_sdk/campaigns.py +74 -183
- syllable_sdk/channels.py +30 -73
- syllable_sdk/conversations.py +16 -37
- syllable_sdk/custom_messages.py +74 -183
- syllable_sdk/dashboards.py +64 -195
- syllable_sdk/data_sources.py +74 -183
- syllable_sdk/errors/__init__.py +55 -0
- syllable_sdk/errors/apierror.py +38 -0
- syllable_sdk/errors/httpvalidationerror.py +26 -0
- syllable_sdk/errors/no_response_error.py +13 -0
- syllable_sdk/errors/responsevalidationerror.py +25 -0
- syllable_sdk/errors/syllablesdkerror.py +26 -0
- syllable_sdk/events.py +16 -37
- syllable_sdk/folders.py +116 -295
- syllable_sdk/full_summary.py +16 -37
- syllable_sdk/incidents.py +84 -215
- syllable_sdk/insights_sdk.py +16 -41
- syllable_sdk/insights_tools.py +96 -253
- syllable_sdk/language_groups.py +86 -215
- syllable_sdk/latency.py +16 -37
- syllable_sdk/models/__init__.py +0 -8
- syllable_sdk/numbers.py +44 -113
- syllable_sdk/organizations.py +52 -139
- syllable_sdk/permissions.py +12 -33
- syllable_sdk/prompts.py +94 -251
- syllable_sdk/roles.py +72 -181
- syllable_sdk/services.py +72 -185
- syllable_sdk/session_debug.py +44 -109
- syllable_sdk/session_labels.py +44 -109
- syllable_sdk/sessions.py +56 -141
- syllable_sdk/takeouts.py +36 -99
- syllable_sdk/targets.py +74 -187
- syllable_sdk/test.py +16 -37
- syllable_sdk/tools.py +72 -181
- syllable_sdk/transcript.py +18 -39
- syllable_sdk/twilio.py +44 -109
- syllable_sdk/users.py +94 -247
- syllable_sdk/utils/serializers.py +3 -2
- syllable_sdk/utils/unmarshal_json_response.py +24 -0
- syllable_sdk/v1.py +94 -247
- syllable_sdk/workflows.py +116 -291
- {syllable_sdk-0.35.32.dist-info → syllable_sdk-0.35.34.dist-info}/METADATA +58 -45
- {syllable_sdk-0.35.32.dist-info → syllable_sdk-0.35.34.dist-info}/RECORD +49 -44
- syllable_sdk/models/apierror.py +0 -22
- syllable_sdk/models/httpvalidationerror.py +0 -21
- {syllable_sdk-0.35.32.dist-info → syllable_sdk-0.35.34.dist-info}/WHEEL +0 -0
syllable_sdk/twilio.py
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
4
|
from .sdkconfiguration import SDKConfiguration
|
|
5
|
-
from syllable_sdk import models, utils
|
|
5
|
+
from syllable_sdk import errors, models, utils
|
|
6
6
|
from syllable_sdk._hooks import HookContext
|
|
7
7
|
from syllable_sdk.numbers import Numbers
|
|
8
8
|
from syllable_sdk.types import BaseModel, OptionalNullable, UNSET
|
|
9
9
|
from syllable_sdk.utils import get_security_from_env
|
|
10
|
+
from syllable_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
10
11
|
from typing import Any, Mapping, Optional, Union, cast
|
|
11
12
|
|
|
12
13
|
|
|
@@ -96,31 +97,20 @@ class Twilio(BaseSDK):
|
|
|
96
97
|
|
|
97
98
|
response_data: Any = None
|
|
98
99
|
if utils.match_response(http_res, "200", "application/json"):
|
|
99
|
-
return
|
|
100
|
+
return unmarshal_json_response(models.Channel, http_res)
|
|
100
101
|
if utils.match_response(http_res, "422", "application/json"):
|
|
101
|
-
response_data =
|
|
102
|
-
|
|
102
|
+
response_data = unmarshal_json_response(
|
|
103
|
+
errors.HTTPValidationErrorData, http_res
|
|
103
104
|
)
|
|
104
|
-
raise
|
|
105
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
105
106
|
if utils.match_response(http_res, "4XX", "*"):
|
|
106
107
|
http_res_text = utils.stream_to_text(http_res)
|
|
107
|
-
raise
|
|
108
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
109
|
-
)
|
|
108
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
110
109
|
if utils.match_response(http_res, "5XX", "*"):
|
|
111
110
|
http_res_text = utils.stream_to_text(http_res)
|
|
112
|
-
raise
|
|
113
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
114
|
-
)
|
|
111
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
115
112
|
|
|
116
|
-
|
|
117
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
118
|
-
raise models.APIError(
|
|
119
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
120
|
-
http_res.status_code,
|
|
121
|
-
http_res_text,
|
|
122
|
-
http_res,
|
|
123
|
-
)
|
|
113
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
124
114
|
|
|
125
115
|
async def get_by_id_async(
|
|
126
116
|
self,
|
|
@@ -194,31 +184,20 @@ class Twilio(BaseSDK):
|
|
|
194
184
|
|
|
195
185
|
response_data: Any = None
|
|
196
186
|
if utils.match_response(http_res, "200", "application/json"):
|
|
197
|
-
return
|
|
187
|
+
return unmarshal_json_response(models.Channel, http_res)
|
|
198
188
|
if utils.match_response(http_res, "422", "application/json"):
|
|
199
|
-
response_data =
|
|
200
|
-
|
|
189
|
+
response_data = unmarshal_json_response(
|
|
190
|
+
errors.HTTPValidationErrorData, http_res
|
|
201
191
|
)
|
|
202
|
-
raise
|
|
192
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
203
193
|
if utils.match_response(http_res, "4XX", "*"):
|
|
204
194
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
205
|
-
raise
|
|
206
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
207
|
-
)
|
|
195
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
208
196
|
if utils.match_response(http_res, "5XX", "*"):
|
|
209
197
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
210
|
-
raise
|
|
211
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
212
|
-
)
|
|
198
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
213
199
|
|
|
214
|
-
|
|
215
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
216
|
-
raise models.APIError(
|
|
217
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
218
|
-
http_res.status_code,
|
|
219
|
-
http_res_text,
|
|
220
|
-
http_res,
|
|
221
|
-
)
|
|
200
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
222
201
|
|
|
223
202
|
def update(
|
|
224
203
|
self,
|
|
@@ -298,31 +277,20 @@ class Twilio(BaseSDK):
|
|
|
298
277
|
|
|
299
278
|
response_data: Any = None
|
|
300
279
|
if utils.match_response(http_res, "200", "application/json"):
|
|
301
|
-
return
|
|
280
|
+
return unmarshal_json_response(models.Channel, http_res)
|
|
302
281
|
if utils.match_response(http_res, "422", "application/json"):
|
|
303
|
-
response_data =
|
|
304
|
-
|
|
282
|
+
response_data = unmarshal_json_response(
|
|
283
|
+
errors.HTTPValidationErrorData, http_res
|
|
305
284
|
)
|
|
306
|
-
raise
|
|
285
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
307
286
|
if utils.match_response(http_res, "4XX", "*"):
|
|
308
287
|
http_res_text = utils.stream_to_text(http_res)
|
|
309
|
-
raise
|
|
310
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
311
|
-
)
|
|
288
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
312
289
|
if utils.match_response(http_res, "5XX", "*"):
|
|
313
290
|
http_res_text = utils.stream_to_text(http_res)
|
|
314
|
-
raise
|
|
315
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
316
|
-
)
|
|
291
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
317
292
|
|
|
318
|
-
|
|
319
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
320
|
-
raise models.APIError(
|
|
321
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
322
|
-
http_res.status_code,
|
|
323
|
-
http_res_text,
|
|
324
|
-
http_res,
|
|
325
|
-
)
|
|
293
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
326
294
|
|
|
327
295
|
async def update_async(
|
|
328
296
|
self,
|
|
@@ -402,31 +370,20 @@ class Twilio(BaseSDK):
|
|
|
402
370
|
|
|
403
371
|
response_data: Any = None
|
|
404
372
|
if utils.match_response(http_res, "200", "application/json"):
|
|
405
|
-
return
|
|
373
|
+
return unmarshal_json_response(models.Channel, http_res)
|
|
406
374
|
if utils.match_response(http_res, "422", "application/json"):
|
|
407
|
-
response_data =
|
|
408
|
-
|
|
375
|
+
response_data = unmarshal_json_response(
|
|
376
|
+
errors.HTTPValidationErrorData, http_res
|
|
409
377
|
)
|
|
410
|
-
raise
|
|
378
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
411
379
|
if utils.match_response(http_res, "4XX", "*"):
|
|
412
380
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
413
|
-
raise
|
|
414
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
415
|
-
)
|
|
381
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
416
382
|
if utils.match_response(http_res, "5XX", "*"):
|
|
417
383
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
418
|
-
raise
|
|
419
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
420
|
-
)
|
|
384
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
421
385
|
|
|
422
|
-
|
|
423
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
424
|
-
raise models.APIError(
|
|
425
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
426
|
-
http_res.status_code,
|
|
427
|
-
http_res_text,
|
|
428
|
-
http_res,
|
|
429
|
-
)
|
|
386
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
430
387
|
|
|
431
388
|
def create(
|
|
432
389
|
self,
|
|
@@ -506,31 +463,20 @@ class Twilio(BaseSDK):
|
|
|
506
463
|
|
|
507
464
|
response_data: Any = None
|
|
508
465
|
if utils.match_response(http_res, "200", "application/json"):
|
|
509
|
-
return
|
|
466
|
+
return unmarshal_json_response(models.Channel, http_res)
|
|
510
467
|
if utils.match_response(http_res, "422", "application/json"):
|
|
511
|
-
response_data =
|
|
512
|
-
|
|
468
|
+
response_data = unmarshal_json_response(
|
|
469
|
+
errors.HTTPValidationErrorData, http_res
|
|
513
470
|
)
|
|
514
|
-
raise
|
|
471
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
515
472
|
if utils.match_response(http_res, "4XX", "*"):
|
|
516
473
|
http_res_text = utils.stream_to_text(http_res)
|
|
517
|
-
raise
|
|
518
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
519
|
-
)
|
|
474
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
520
475
|
if utils.match_response(http_res, "5XX", "*"):
|
|
521
476
|
http_res_text = utils.stream_to_text(http_res)
|
|
522
|
-
raise
|
|
523
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
524
|
-
)
|
|
477
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
525
478
|
|
|
526
|
-
|
|
527
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
528
|
-
raise models.APIError(
|
|
529
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
530
|
-
http_res.status_code,
|
|
531
|
-
http_res_text,
|
|
532
|
-
http_res,
|
|
533
|
-
)
|
|
479
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
534
480
|
|
|
535
481
|
async def create_async(
|
|
536
482
|
self,
|
|
@@ -610,28 +556,17 @@ class Twilio(BaseSDK):
|
|
|
610
556
|
|
|
611
557
|
response_data: Any = None
|
|
612
558
|
if utils.match_response(http_res, "200", "application/json"):
|
|
613
|
-
return
|
|
559
|
+
return unmarshal_json_response(models.Channel, http_res)
|
|
614
560
|
if utils.match_response(http_res, "422", "application/json"):
|
|
615
|
-
response_data =
|
|
616
|
-
|
|
561
|
+
response_data = unmarshal_json_response(
|
|
562
|
+
errors.HTTPValidationErrorData, http_res
|
|
617
563
|
)
|
|
618
|
-
raise
|
|
564
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
619
565
|
if utils.match_response(http_res, "4XX", "*"):
|
|
620
566
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
621
|
-
raise
|
|
622
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
623
|
-
)
|
|
567
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
624
568
|
if utils.match_response(http_res, "5XX", "*"):
|
|
625
569
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
626
|
-
raise
|
|
627
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
628
|
-
)
|
|
570
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
629
571
|
|
|
630
|
-
|
|
631
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
632
|
-
raise models.APIError(
|
|
633
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
634
|
-
http_res.status_code,
|
|
635
|
-
http_res_text,
|
|
636
|
-
http_res,
|
|
637
|
-
)
|
|
572
|
+
raise errors.APIError("Unexpected response received", http_res)
|