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/campaigns.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
|
|
|
@@ -107,33 +108,22 @@ class Campaigns(BaseSDK):
|
|
|
107
108
|
|
|
108
109
|
response_data: Any = None
|
|
109
110
|
if utils.match_response(http_res, "200", "application/json"):
|
|
110
|
-
return
|
|
111
|
-
|
|
111
|
+
return unmarshal_json_response(
|
|
112
|
+
models.ListResponseOutboundCampaign, http_res
|
|
112
113
|
)
|
|
113
114
|
if utils.match_response(http_res, "422", "application/json"):
|
|
114
|
-
response_data =
|
|
115
|
-
|
|
115
|
+
response_data = unmarshal_json_response(
|
|
116
|
+
errors.HTTPValidationErrorData, http_res
|
|
116
117
|
)
|
|
117
|
-
raise
|
|
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
|
|
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
|
|
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
|
-
|
|
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,
|
|
@@ -231,33 +221,22 @@ class Campaigns(BaseSDK):
|
|
|
231
221
|
|
|
232
222
|
response_data: Any = None
|
|
233
223
|
if utils.match_response(http_res, "200", "application/json"):
|
|
234
|
-
return
|
|
235
|
-
|
|
224
|
+
return unmarshal_json_response(
|
|
225
|
+
models.ListResponseOutboundCampaign, http_res
|
|
236
226
|
)
|
|
237
227
|
if utils.match_response(http_res, "422", "application/json"):
|
|
238
|
-
response_data =
|
|
239
|
-
|
|
228
|
+
response_data = unmarshal_json_response(
|
|
229
|
+
errors.HTTPValidationErrorData, http_res
|
|
240
230
|
)
|
|
241
|
-
raise
|
|
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
|
|
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
|
|
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
|
-
|
|
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 Campaigns(BaseSDK):
|
|
|
336
315
|
|
|
337
316
|
response_data: Any = None
|
|
338
317
|
if utils.match_response(http_res, "200", "application/json"):
|
|
339
|
-
return
|
|
318
|
+
return unmarshal_json_response(models.OutboundCampaign, http_res)
|
|
340
319
|
if utils.match_response(http_res, "422", "application/json"):
|
|
341
|
-
response_data =
|
|
342
|
-
|
|
320
|
+
response_data = unmarshal_json_response(
|
|
321
|
+
errors.HTTPValidationErrorData, http_res
|
|
343
322
|
)
|
|
344
|
-
raise
|
|
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
|
|
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
|
|
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
|
-
|
|
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 Campaigns(BaseSDK):
|
|
|
439
407
|
|
|
440
408
|
response_data: Any = None
|
|
441
409
|
if utils.match_response(http_res, "200", "application/json"):
|
|
442
|
-
return
|
|
410
|
+
return unmarshal_json_response(models.OutboundCampaign, http_res)
|
|
443
411
|
if utils.match_response(http_res, "422", "application/json"):
|
|
444
|
-
response_data =
|
|
445
|
-
|
|
412
|
+
response_data = unmarshal_json_response(
|
|
413
|
+
errors.HTTPValidationErrorData, http_res
|
|
446
414
|
)
|
|
447
|
-
raise
|
|
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
|
|
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
|
|
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
|
-
|
|
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 get_by_id(
|
|
469
426
|
self,
|
|
@@ -537,31 +494,20 @@ class Campaigns(BaseSDK):
|
|
|
537
494
|
|
|
538
495
|
response_data: Any = None
|
|
539
496
|
if utils.match_response(http_res, "200", "application/json"):
|
|
540
|
-
return
|
|
497
|
+
return unmarshal_json_response(models.OutboundCampaign, http_res)
|
|
541
498
|
if utils.match_response(http_res, "422", "application/json"):
|
|
542
|
-
response_data =
|
|
543
|
-
|
|
499
|
+
response_data = unmarshal_json_response(
|
|
500
|
+
errors.HTTPValidationErrorData, http_res
|
|
544
501
|
)
|
|
545
|
-
raise
|
|
502
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
546
503
|
if utils.match_response(http_res, "4XX", "*"):
|
|
547
504
|
http_res_text = utils.stream_to_text(http_res)
|
|
548
|
-
raise
|
|
549
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
550
|
-
)
|
|
505
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
551
506
|
if utils.match_response(http_res, "5XX", "*"):
|
|
552
507
|
http_res_text = utils.stream_to_text(http_res)
|
|
553
|
-
raise
|
|
554
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
555
|
-
)
|
|
508
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
556
509
|
|
|
557
|
-
|
|
558
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
559
|
-
raise models.APIError(
|
|
560
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
561
|
-
http_res.status_code,
|
|
562
|
-
http_res_text,
|
|
563
|
-
http_res,
|
|
564
|
-
)
|
|
510
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
565
511
|
|
|
566
512
|
async def get_by_id_async(
|
|
567
513
|
self,
|
|
@@ -635,31 +581,20 @@ class Campaigns(BaseSDK):
|
|
|
635
581
|
|
|
636
582
|
response_data: Any = None
|
|
637
583
|
if utils.match_response(http_res, "200", "application/json"):
|
|
638
|
-
return
|
|
584
|
+
return unmarshal_json_response(models.OutboundCampaign, http_res)
|
|
639
585
|
if utils.match_response(http_res, "422", "application/json"):
|
|
640
|
-
response_data =
|
|
641
|
-
|
|
586
|
+
response_data = unmarshal_json_response(
|
|
587
|
+
errors.HTTPValidationErrorData, http_res
|
|
642
588
|
)
|
|
643
|
-
raise
|
|
589
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
644
590
|
if utils.match_response(http_res, "4XX", "*"):
|
|
645
591
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
646
|
-
raise
|
|
647
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
648
|
-
)
|
|
592
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
649
593
|
if utils.match_response(http_res, "5XX", "*"):
|
|
650
594
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
651
|
-
raise
|
|
652
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
653
|
-
)
|
|
595
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
654
596
|
|
|
655
|
-
|
|
656
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
657
|
-
raise models.APIError(
|
|
658
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
659
|
-
http_res.status_code,
|
|
660
|
-
http_res_text,
|
|
661
|
-
http_res,
|
|
662
|
-
)
|
|
597
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
663
598
|
|
|
664
599
|
def update(
|
|
665
600
|
self,
|
|
@@ -747,31 +682,20 @@ class Campaigns(BaseSDK):
|
|
|
747
682
|
|
|
748
683
|
response_data: Any = None
|
|
749
684
|
if utils.match_response(http_res, "200", "application/json"):
|
|
750
|
-
return
|
|
685
|
+
return unmarshal_json_response(models.OutboundCampaign, http_res)
|
|
751
686
|
if utils.match_response(http_res, "422", "application/json"):
|
|
752
|
-
response_data =
|
|
753
|
-
|
|
687
|
+
response_data = unmarshal_json_response(
|
|
688
|
+
errors.HTTPValidationErrorData, http_res
|
|
754
689
|
)
|
|
755
|
-
raise
|
|
690
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
756
691
|
if utils.match_response(http_res, "4XX", "*"):
|
|
757
692
|
http_res_text = utils.stream_to_text(http_res)
|
|
758
|
-
raise
|
|
759
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
760
|
-
)
|
|
693
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
761
694
|
if utils.match_response(http_res, "5XX", "*"):
|
|
762
695
|
http_res_text = utils.stream_to_text(http_res)
|
|
763
|
-
raise
|
|
764
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
765
|
-
)
|
|
696
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
766
697
|
|
|
767
|
-
|
|
768
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
769
|
-
raise models.APIError(
|
|
770
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
771
|
-
http_res.status_code,
|
|
772
|
-
http_res_text,
|
|
773
|
-
http_res,
|
|
774
|
-
)
|
|
698
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
775
699
|
|
|
776
700
|
async def update_async(
|
|
777
701
|
self,
|
|
@@ -859,31 +783,20 @@ class Campaigns(BaseSDK):
|
|
|
859
783
|
|
|
860
784
|
response_data: Any = None
|
|
861
785
|
if utils.match_response(http_res, "200", "application/json"):
|
|
862
|
-
return
|
|
786
|
+
return unmarshal_json_response(models.OutboundCampaign, http_res)
|
|
863
787
|
if utils.match_response(http_res, "422", "application/json"):
|
|
864
|
-
response_data =
|
|
865
|
-
|
|
788
|
+
response_data = unmarshal_json_response(
|
|
789
|
+
errors.HTTPValidationErrorData, http_res
|
|
866
790
|
)
|
|
867
|
-
raise
|
|
791
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
868
792
|
if utils.match_response(http_res, "4XX", "*"):
|
|
869
793
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
870
|
-
raise
|
|
871
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
872
|
-
)
|
|
794
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
873
795
|
if utils.match_response(http_res, "5XX", "*"):
|
|
874
796
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
875
|
-
raise
|
|
876
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
877
|
-
)
|
|
797
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
878
798
|
|
|
879
|
-
|
|
880
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
881
|
-
raise models.APIError(
|
|
882
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
883
|
-
http_res.status_code,
|
|
884
|
-
http_res_text,
|
|
885
|
-
http_res,
|
|
886
|
-
)
|
|
799
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
887
800
|
|
|
888
801
|
def delete(
|
|
889
802
|
self,
|
|
@@ -957,31 +870,20 @@ class Campaigns(BaseSDK):
|
|
|
957
870
|
|
|
958
871
|
response_data: Any = None
|
|
959
872
|
if utils.match_response(http_res, "200", "application/json"):
|
|
960
|
-
return
|
|
873
|
+
return unmarshal_json_response(Any, http_res)
|
|
961
874
|
if utils.match_response(http_res, "422", "application/json"):
|
|
962
|
-
response_data =
|
|
963
|
-
|
|
875
|
+
response_data = unmarshal_json_response(
|
|
876
|
+
errors.HTTPValidationErrorData, http_res
|
|
964
877
|
)
|
|
965
|
-
raise
|
|
878
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
966
879
|
if utils.match_response(http_res, "4XX", "*"):
|
|
967
880
|
http_res_text = utils.stream_to_text(http_res)
|
|
968
|
-
raise
|
|
969
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
970
|
-
)
|
|
881
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
971
882
|
if utils.match_response(http_res, "5XX", "*"):
|
|
972
883
|
http_res_text = utils.stream_to_text(http_res)
|
|
973
|
-
raise
|
|
974
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
975
|
-
)
|
|
884
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
976
885
|
|
|
977
|
-
|
|
978
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
979
|
-
raise models.APIError(
|
|
980
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
981
|
-
http_res.status_code,
|
|
982
|
-
http_res_text,
|
|
983
|
-
http_res,
|
|
984
|
-
)
|
|
886
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
985
887
|
|
|
986
888
|
async def delete_async(
|
|
987
889
|
self,
|
|
@@ -1055,28 +957,17 @@ class Campaigns(BaseSDK):
|
|
|
1055
957
|
|
|
1056
958
|
response_data: Any = None
|
|
1057
959
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1058
|
-
return
|
|
960
|
+
return unmarshal_json_response(Any, http_res)
|
|
1059
961
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1060
|
-
response_data =
|
|
1061
|
-
|
|
962
|
+
response_data = unmarshal_json_response(
|
|
963
|
+
errors.HTTPValidationErrorData, http_res
|
|
1062
964
|
)
|
|
1063
|
-
raise
|
|
965
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1064
966
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1065
967
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1066
|
-
raise
|
|
1067
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1068
|
-
)
|
|
968
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1069
969
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1070
970
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1071
|
-
raise
|
|
1072
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1073
|
-
)
|
|
971
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1074
972
|
|
|
1075
|
-
|
|
1076
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1077
|
-
raise models.APIError(
|
|
1078
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1079
|
-
http_res.status_code,
|
|
1080
|
-
http_res_text,
|
|
1081
|
-
http_res,
|
|
1082
|
-
)
|
|
973
|
+
raise errors.APIError("Unexpected response received", http_res)
|
syllable_sdk/channels.py
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
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.targets import Targets
|
|
8
8
|
from syllable_sdk.twilio import Twilio
|
|
9
9
|
from syllable_sdk.types import OptionalNullable, UNSET
|
|
10
10
|
from syllable_sdk.utils import get_security_from_env
|
|
11
|
+
from syllable_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
11
12
|
from typing import Any, List, Mapping, Optional
|
|
12
13
|
|
|
13
14
|
|
|
@@ -124,31 +125,20 @@ class Channels(BaseSDK):
|
|
|
124
125
|
|
|
125
126
|
response_data: Any = None
|
|
126
127
|
if utils.match_response(http_res, "200", "application/json"):
|
|
127
|
-
return
|
|
128
|
+
return unmarshal_json_response(models.ListResponseChannel, http_res)
|
|
128
129
|
if utils.match_response(http_res, "422", "application/json"):
|
|
129
|
-
response_data =
|
|
130
|
-
|
|
130
|
+
response_data = unmarshal_json_response(
|
|
131
|
+
errors.HTTPValidationErrorData, http_res
|
|
131
132
|
)
|
|
132
|
-
raise
|
|
133
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
133
134
|
if utils.match_response(http_res, "4XX", "*"):
|
|
134
135
|
http_res_text = utils.stream_to_text(http_res)
|
|
135
|
-
raise
|
|
136
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
137
|
-
)
|
|
136
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
138
137
|
if utils.match_response(http_res, "5XX", "*"):
|
|
139
138
|
http_res_text = utils.stream_to_text(http_res)
|
|
140
|
-
raise
|
|
141
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
142
|
-
)
|
|
139
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
143
140
|
|
|
144
|
-
|
|
145
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
146
|
-
raise models.APIError(
|
|
147
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
148
|
-
http_res.status_code,
|
|
149
|
-
http_res_text,
|
|
150
|
-
http_res,
|
|
151
|
-
)
|
|
141
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
152
142
|
|
|
153
143
|
async def list_async(
|
|
154
144
|
self,
|
|
@@ -246,31 +236,20 @@ class Channels(BaseSDK):
|
|
|
246
236
|
|
|
247
237
|
response_data: Any = None
|
|
248
238
|
if utils.match_response(http_res, "200", "application/json"):
|
|
249
|
-
return
|
|
239
|
+
return unmarshal_json_response(models.ListResponseChannel, http_res)
|
|
250
240
|
if utils.match_response(http_res, "422", "application/json"):
|
|
251
|
-
response_data =
|
|
252
|
-
|
|
241
|
+
response_data = unmarshal_json_response(
|
|
242
|
+
errors.HTTPValidationErrorData, http_res
|
|
253
243
|
)
|
|
254
|
-
raise
|
|
244
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
255
245
|
if utils.match_response(http_res, "4XX", "*"):
|
|
256
246
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
257
|
-
raise
|
|
258
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
259
|
-
)
|
|
247
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
260
248
|
if utils.match_response(http_res, "5XX", "*"):
|
|
261
249
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
262
|
-
raise
|
|
263
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
264
|
-
)
|
|
250
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
265
251
|
|
|
266
|
-
|
|
267
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
268
|
-
raise models.APIError(
|
|
269
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
270
|
-
http_res.status_code,
|
|
271
|
-
http_res_text,
|
|
272
|
-
http_res,
|
|
273
|
-
)
|
|
252
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
274
253
|
|
|
275
254
|
def delete(
|
|
276
255
|
self,
|
|
@@ -349,31 +328,20 @@ class Channels(BaseSDK):
|
|
|
349
328
|
|
|
350
329
|
response_data: Any = None
|
|
351
330
|
if utils.match_response(http_res, "200", "application/json"):
|
|
352
|
-
return
|
|
331
|
+
return unmarshal_json_response(Any, http_res)
|
|
353
332
|
if utils.match_response(http_res, "422", "application/json"):
|
|
354
|
-
response_data =
|
|
355
|
-
|
|
333
|
+
response_data = unmarshal_json_response(
|
|
334
|
+
errors.HTTPValidationErrorData, http_res
|
|
356
335
|
)
|
|
357
|
-
raise
|
|
336
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
358
337
|
if utils.match_response(http_res, "4XX", "*"):
|
|
359
338
|
http_res_text = utils.stream_to_text(http_res)
|
|
360
|
-
raise
|
|
361
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
362
|
-
)
|
|
339
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
363
340
|
if utils.match_response(http_res, "5XX", "*"):
|
|
364
341
|
http_res_text = utils.stream_to_text(http_res)
|
|
365
|
-
raise
|
|
366
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
367
|
-
)
|
|
342
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
368
343
|
|
|
369
|
-
|
|
370
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
371
|
-
raise models.APIError(
|
|
372
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
373
|
-
http_res.status_code,
|
|
374
|
-
http_res_text,
|
|
375
|
-
http_res,
|
|
376
|
-
)
|
|
344
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
377
345
|
|
|
378
346
|
async def delete_async(
|
|
379
347
|
self,
|
|
@@ -452,28 +420,17 @@ class Channels(BaseSDK):
|
|
|
452
420
|
|
|
453
421
|
response_data: Any = None
|
|
454
422
|
if utils.match_response(http_res, "200", "application/json"):
|
|
455
|
-
return
|
|
423
|
+
return unmarshal_json_response(Any, http_res)
|
|
456
424
|
if utils.match_response(http_res, "422", "application/json"):
|
|
457
|
-
response_data =
|
|
458
|
-
|
|
425
|
+
response_data = unmarshal_json_response(
|
|
426
|
+
errors.HTTPValidationErrorData, http_res
|
|
459
427
|
)
|
|
460
|
-
raise
|
|
428
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
461
429
|
if utils.match_response(http_res, "4XX", "*"):
|
|
462
430
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
463
|
-
raise
|
|
464
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
465
|
-
)
|
|
431
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
466
432
|
if utils.match_response(http_res, "5XX", "*"):
|
|
467
433
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
468
|
-
raise
|
|
469
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
470
|
-
)
|
|
434
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
471
435
|
|
|
472
|
-
|
|
473
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
474
|
-
raise models.APIError(
|
|
475
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
476
|
-
http_res.status_code,
|
|
477
|
-
http_res_text,
|
|
478
|
-
http_res,
|
|
479
|
-
)
|
|
436
|
+
raise errors.APIError("Unexpected response received", http_res)
|