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/__init__.py
CHANGED
syllable_sdk/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "syllable-sdk"
|
|
6
|
-
__version__: str = "0.35.
|
|
6
|
+
__version__: str = "0.35.34"
|
|
7
7
|
__openapi_doc_version__: str = "0.0.2"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.35.
|
|
8
|
+
__gen_version__: str = "2.653.0"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.35.34 2.653.0 0.0.2 syllable-sdk"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
syllable_sdk/agents.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.test import Test
|
|
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, List, Mapping, Optional, Union, cast
|
|
11
12
|
|
|
12
13
|
|
|
@@ -122,31 +123,20 @@ class Agents(BaseSDK):
|
|
|
122
123
|
|
|
123
124
|
response_data: Any = None
|
|
124
125
|
if utils.match_response(http_res, "200", "application/json"):
|
|
125
|
-
return
|
|
126
|
+
return unmarshal_json_response(models.ListResponseAgentResponse, http_res)
|
|
126
127
|
if utils.match_response(http_res, "422", "application/json"):
|
|
127
|
-
response_data =
|
|
128
|
-
|
|
128
|
+
response_data = unmarshal_json_response(
|
|
129
|
+
errors.HTTPValidationErrorData, http_res
|
|
129
130
|
)
|
|
130
|
-
raise
|
|
131
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
131
132
|
if utils.match_response(http_res, "4XX", "*"):
|
|
132
133
|
http_res_text = utils.stream_to_text(http_res)
|
|
133
|
-
raise
|
|
134
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
135
|
-
)
|
|
134
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
136
135
|
if utils.match_response(http_res, "5XX", "*"):
|
|
137
136
|
http_res_text = utils.stream_to_text(http_res)
|
|
138
|
-
raise
|
|
139
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
140
|
-
)
|
|
137
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
141
138
|
|
|
142
|
-
|
|
143
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
144
|
-
raise models.APIError(
|
|
145
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
146
|
-
http_res.status_code,
|
|
147
|
-
http_res_text,
|
|
148
|
-
http_res,
|
|
149
|
-
)
|
|
139
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
150
140
|
|
|
151
141
|
async def list_async(
|
|
152
142
|
self,
|
|
@@ -246,31 +236,20 @@ class Agents(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.ListResponseAgentResponse, 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 create(
|
|
276
255
|
self,
|
|
@@ -349,31 +328,20 @@ class Agents(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(models.AgentResponse, 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, ["400", "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, ["500", "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 create_async(
|
|
379
347
|
self,
|
|
@@ -452,31 +420,20 @@ class Agents(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(models.AgentResponse, 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, ["400", "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, ["500", "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)
|
|
480
437
|
|
|
481
438
|
def update(
|
|
482
439
|
self,
|
|
@@ -555,31 +512,20 @@ class Agents(BaseSDK):
|
|
|
555
512
|
|
|
556
513
|
response_data: Any = None
|
|
557
514
|
if utils.match_response(http_res, "200", "application/json"):
|
|
558
|
-
return
|
|
515
|
+
return unmarshal_json_response(models.AgentResponse, http_res)
|
|
559
516
|
if utils.match_response(http_res, "422", "application/json"):
|
|
560
|
-
response_data =
|
|
561
|
-
|
|
517
|
+
response_data = unmarshal_json_response(
|
|
518
|
+
errors.HTTPValidationErrorData, http_res
|
|
562
519
|
)
|
|
563
|
-
raise
|
|
520
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
564
521
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
565
522
|
http_res_text = utils.stream_to_text(http_res)
|
|
566
|
-
raise
|
|
567
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
568
|
-
)
|
|
523
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
569
524
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
570
525
|
http_res_text = utils.stream_to_text(http_res)
|
|
571
|
-
raise
|
|
572
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
573
|
-
)
|
|
526
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
574
527
|
|
|
575
|
-
|
|
576
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
577
|
-
raise models.APIError(
|
|
578
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
579
|
-
http_res.status_code,
|
|
580
|
-
http_res_text,
|
|
581
|
-
http_res,
|
|
582
|
-
)
|
|
528
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
583
529
|
|
|
584
530
|
async def update_async(
|
|
585
531
|
self,
|
|
@@ -658,31 +604,20 @@ class Agents(BaseSDK):
|
|
|
658
604
|
|
|
659
605
|
response_data: Any = None
|
|
660
606
|
if utils.match_response(http_res, "200", "application/json"):
|
|
661
|
-
return
|
|
607
|
+
return unmarshal_json_response(models.AgentResponse, http_res)
|
|
662
608
|
if utils.match_response(http_res, "422", "application/json"):
|
|
663
|
-
response_data =
|
|
664
|
-
|
|
609
|
+
response_data = unmarshal_json_response(
|
|
610
|
+
errors.HTTPValidationErrorData, http_res
|
|
665
611
|
)
|
|
666
|
-
raise
|
|
612
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
667
613
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
668
614
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
669
|
-
raise
|
|
670
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
671
|
-
)
|
|
615
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
672
616
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
673
617
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
674
|
-
raise
|
|
675
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
676
|
-
)
|
|
618
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
677
619
|
|
|
678
|
-
|
|
679
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
680
|
-
raise models.APIError(
|
|
681
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
682
|
-
http_res.status_code,
|
|
683
|
-
http_res_text,
|
|
684
|
-
http_res,
|
|
685
|
-
)
|
|
620
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
686
621
|
|
|
687
622
|
def get_by_id(
|
|
688
623
|
self,
|
|
@@ -758,31 +693,20 @@ class Agents(BaseSDK):
|
|
|
758
693
|
|
|
759
694
|
response_data: Any = None
|
|
760
695
|
if utils.match_response(http_res, "200", "application/json"):
|
|
761
|
-
return
|
|
696
|
+
return unmarshal_json_response(models.AgentResponse, http_res)
|
|
762
697
|
if utils.match_response(http_res, "422", "application/json"):
|
|
763
|
-
response_data =
|
|
764
|
-
|
|
698
|
+
response_data = unmarshal_json_response(
|
|
699
|
+
errors.HTTPValidationErrorData, http_res
|
|
765
700
|
)
|
|
766
|
-
raise
|
|
701
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
767
702
|
if utils.match_response(http_res, "4XX", "*"):
|
|
768
703
|
http_res_text = utils.stream_to_text(http_res)
|
|
769
|
-
raise
|
|
770
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
771
|
-
)
|
|
704
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
772
705
|
if utils.match_response(http_res, "5XX", "*"):
|
|
773
706
|
http_res_text = utils.stream_to_text(http_res)
|
|
774
|
-
raise
|
|
775
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
776
|
-
)
|
|
707
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
777
708
|
|
|
778
|
-
|
|
779
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
780
|
-
raise models.APIError(
|
|
781
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
782
|
-
http_res.status_code,
|
|
783
|
-
http_res_text,
|
|
784
|
-
http_res,
|
|
785
|
-
)
|
|
709
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
786
710
|
|
|
787
711
|
async def get_by_id_async(
|
|
788
712
|
self,
|
|
@@ -858,31 +782,20 @@ class Agents(BaseSDK):
|
|
|
858
782
|
|
|
859
783
|
response_data: Any = None
|
|
860
784
|
if utils.match_response(http_res, "200", "application/json"):
|
|
861
|
-
return
|
|
785
|
+
return unmarshal_json_response(models.AgentResponse, http_res)
|
|
862
786
|
if utils.match_response(http_res, "422", "application/json"):
|
|
863
|
-
response_data =
|
|
864
|
-
|
|
787
|
+
response_data = unmarshal_json_response(
|
|
788
|
+
errors.HTTPValidationErrorData, http_res
|
|
865
789
|
)
|
|
866
|
-
raise
|
|
790
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
867
791
|
if utils.match_response(http_res, "4XX", "*"):
|
|
868
792
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
869
|
-
raise
|
|
870
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
871
|
-
)
|
|
793
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
872
794
|
if utils.match_response(http_res, "5XX", "*"):
|
|
873
795
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
874
|
-
raise
|
|
875
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
876
|
-
)
|
|
796
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
877
797
|
|
|
878
|
-
|
|
879
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
880
|
-
raise models.APIError(
|
|
881
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
882
|
-
http_res.status_code,
|
|
883
|
-
http_res_text,
|
|
884
|
-
http_res,
|
|
885
|
-
)
|
|
798
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
886
799
|
|
|
887
800
|
def delete(
|
|
888
801
|
self,
|
|
@@ -959,31 +872,20 @@ class Agents(BaseSDK):
|
|
|
959
872
|
|
|
960
873
|
response_data: Any = None
|
|
961
874
|
if utils.match_response(http_res, "200", "application/json"):
|
|
962
|
-
return
|
|
875
|
+
return unmarshal_json_response(Any, http_res)
|
|
963
876
|
if utils.match_response(http_res, "422", "application/json"):
|
|
964
|
-
response_data =
|
|
965
|
-
|
|
877
|
+
response_data = unmarshal_json_response(
|
|
878
|
+
errors.HTTPValidationErrorData, http_res
|
|
966
879
|
)
|
|
967
|
-
raise
|
|
880
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
968
881
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
969
882
|
http_res_text = utils.stream_to_text(http_res)
|
|
970
|
-
raise
|
|
971
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
972
|
-
)
|
|
883
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
973
884
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
974
885
|
http_res_text = utils.stream_to_text(http_res)
|
|
975
|
-
raise
|
|
976
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
977
|
-
)
|
|
886
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
978
887
|
|
|
979
|
-
|
|
980
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
981
|
-
raise models.APIError(
|
|
982
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
983
|
-
http_res.status_code,
|
|
984
|
-
http_res_text,
|
|
985
|
-
http_res,
|
|
986
|
-
)
|
|
888
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
987
889
|
|
|
988
890
|
async def delete_async(
|
|
989
891
|
self,
|
|
@@ -1060,31 +962,20 @@ class Agents(BaseSDK):
|
|
|
1060
962
|
|
|
1061
963
|
response_data: Any = None
|
|
1062
964
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1063
|
-
return
|
|
965
|
+
return unmarshal_json_response(Any, http_res)
|
|
1064
966
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1065
|
-
response_data =
|
|
1066
|
-
|
|
967
|
+
response_data = unmarshal_json_response(
|
|
968
|
+
errors.HTTPValidationErrorData, http_res
|
|
1067
969
|
)
|
|
1068
|
-
raise
|
|
970
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1069
971
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
1070
972
|
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
|
-
)
|
|
973
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1074
974
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
1075
975
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1076
|
-
raise
|
|
1077
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1078
|
-
)
|
|
976
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1079
977
|
|
|
1080
|
-
|
|
1081
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1082
|
-
raise models.APIError(
|
|
1083
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1084
|
-
http_res.status_code,
|
|
1085
|
-
http_res_text,
|
|
1086
|
-
http_res,
|
|
1087
|
-
)
|
|
978
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1088
979
|
|
|
1089
980
|
def agent_get_available_voices(
|
|
1090
981
|
self,
|
|
@@ -1152,26 +1043,15 @@ class Agents(BaseSDK):
|
|
|
1152
1043
|
)
|
|
1153
1044
|
|
|
1154
1045
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1155
|
-
return
|
|
1046
|
+
return unmarshal_json_response(List[models.AgentVoice], http_res)
|
|
1156
1047
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1157
1048
|
http_res_text = utils.stream_to_text(http_res)
|
|
1158
|
-
raise
|
|
1159
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1160
|
-
)
|
|
1049
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1161
1050
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1162
1051
|
http_res_text = utils.stream_to_text(http_res)
|
|
1163
|
-
raise
|
|
1164
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1165
|
-
)
|
|
1052
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1166
1053
|
|
|
1167
|
-
|
|
1168
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1169
|
-
raise models.APIError(
|
|
1170
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1171
|
-
http_res.status_code,
|
|
1172
|
-
http_res_text,
|
|
1173
|
-
http_res,
|
|
1174
|
-
)
|
|
1054
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1175
1055
|
|
|
1176
1056
|
async def agent_get_available_voices_async(
|
|
1177
1057
|
self,
|
|
@@ -1239,23 +1119,12 @@ class Agents(BaseSDK):
|
|
|
1239
1119
|
)
|
|
1240
1120
|
|
|
1241
1121
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1242
|
-
return
|
|
1122
|
+
return unmarshal_json_response(List[models.AgentVoice], http_res)
|
|
1243
1123
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1244
1124
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1245
|
-
raise
|
|
1246
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1247
|
-
)
|
|
1125
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1248
1126
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1249
1127
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1250
|
-
raise
|
|
1251
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1252
|
-
)
|
|
1128
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1253
1129
|
|
|
1254
|
-
|
|
1255
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1256
|
-
raise models.APIError(
|
|
1257
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1258
|
-
http_res.status_code,
|
|
1259
|
-
http_res_text,
|
|
1260
|
-
http_res,
|
|
1261
|
-
)
|
|
1130
|
+
raise errors.APIError("Unexpected response received", http_res)
|
syllable_sdk/basesdk.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from .sdkconfiguration import SDKConfiguration
|
|
4
4
|
import httpx
|
|
5
|
-
from syllable_sdk import models, utils
|
|
5
|
+
from syllable_sdk import errors, models, utils
|
|
6
6
|
from syllable_sdk._hooks import (
|
|
7
7
|
AfterErrorContext,
|
|
8
8
|
AfterSuccessContext,
|
|
@@ -244,7 +244,7 @@ class BaseSDK:
|
|
|
244
244
|
|
|
245
245
|
if http_res is None:
|
|
246
246
|
logger.debug("Raising no response SDK error")
|
|
247
|
-
raise
|
|
247
|
+
raise errors.NoResponseError("No response received")
|
|
248
248
|
|
|
249
249
|
logger.debug(
|
|
250
250
|
"Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
@@ -265,7 +265,7 @@ class BaseSDK:
|
|
|
265
265
|
http_res = result
|
|
266
266
|
else:
|
|
267
267
|
logger.debug("Raising unexpected SDK error")
|
|
268
|
-
raise
|
|
268
|
+
raise errors.APIError("Unexpected error occurred", http_res)
|
|
269
269
|
|
|
270
270
|
return http_res
|
|
271
271
|
|
|
@@ -316,7 +316,7 @@ class BaseSDK:
|
|
|
316
316
|
|
|
317
317
|
if http_res is None:
|
|
318
318
|
logger.debug("Raising no response SDK error")
|
|
319
|
-
raise
|
|
319
|
+
raise errors.NoResponseError("No response received")
|
|
320
320
|
|
|
321
321
|
logger.debug(
|
|
322
322
|
"Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
@@ -337,7 +337,7 @@ class BaseSDK:
|
|
|
337
337
|
http_res = result
|
|
338
338
|
else:
|
|
339
339
|
logger.debug("Raising unexpected SDK error")
|
|
340
|
-
raise
|
|
340
|
+
raise errors.APIError("Unexpected error occurred", http_res)
|
|
341
341
|
|
|
342
342
|
return http_res
|
|
343
343
|
|