syllable-sdk 0.35.31__py3-none-any.whl → 0.35.33__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 +83 -211
- syllable_sdk/basesdk.py +5 -5
- syllable_sdk/batches.py +131 -329
- syllable_sdk/campaigns.py +73 -183
- syllable_sdk/channels.py +29 -73
- syllable_sdk/conversations.py +19 -37
- syllable_sdk/custom_messages.py +73 -183
- syllable_sdk/dashboards.py +67 -195
- syllable_sdk/data_sources.py +85 -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 +15 -37
- syllable_sdk/folders.py +121 -293
- syllable_sdk/full_summary.py +19 -37
- syllable_sdk/incidents.py +83 -215
- syllable_sdk/insights_sdk.py +17 -39
- syllable_sdk/insights_tools.py +97 -251
- syllable_sdk/language_groups.py +85 -215
- syllable_sdk/latency.py +19 -37
- syllable_sdk/models/__init__.py +0 -8
- syllable_sdk/numbers.py +53 -111
- syllable_sdk/organizations.py +51 -139
- syllable_sdk/permissions.py +11 -33
- syllable_sdk/prompts.py +95 -249
- syllable_sdk/roles.py +75 -181
- syllable_sdk/services.py +73 -183
- syllable_sdk/session_debug.py +43 -109
- syllable_sdk/session_labels.py +47 -109
- syllable_sdk/sessions.py +59 -141
- syllable_sdk/takeouts.py +35 -99
- syllable_sdk/targets.py +75 -185
- syllable_sdk/test.py +15 -37
- syllable_sdk/tools.py +75 -181
- syllable_sdk/transcript.py +17 -39
- syllable_sdk/twilio.py +43 -109
- syllable_sdk/users.py +97 -247
- syllable_sdk/utils/__init__.py +3 -0
- syllable_sdk/utils/serializers.py +21 -3
- syllable_sdk/v1.py +97 -247
- syllable_sdk/workflows.py +115 -291
- {syllable_sdk-0.35.31.dist-info → syllable_sdk-0.35.33.dist-info}/METADATA +58 -45
- {syllable_sdk-0.35.31.dist-info → syllable_sdk-0.35.33.dist-info}/RECORD +49 -45
- syllable_sdk/models/apierror.py +0 -22
- syllable_sdk/models/httpvalidationerror.py +0 -21
- {syllable_sdk-0.35.31.dist-info → syllable_sdk-0.35.33.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.33"
|
|
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.651.2"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.35.33 2.651.2 0.0.2 syllable-sdk"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
syllable_sdk/agents.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
|
@@ -122,31 +122,22 @@ class Agents(BaseSDK):
|
|
|
122
122
|
|
|
123
123
|
response_data: Any = None
|
|
124
124
|
if utils.match_response(http_res, "200", "application/json"):
|
|
125
|
-
return utils.
|
|
125
|
+
return utils.unmarshal_json_response(
|
|
126
|
+
models.ListResponseAgentResponse, http_res
|
|
127
|
+
)
|
|
126
128
|
if utils.match_response(http_res, "422", "application/json"):
|
|
127
|
-
response_data = utils.
|
|
128
|
-
|
|
129
|
+
response_data = utils.unmarshal_json_response(
|
|
130
|
+
errors.HTTPValidationErrorData, http_res
|
|
129
131
|
)
|
|
130
|
-
raise
|
|
132
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
131
133
|
if utils.match_response(http_res, "4XX", "*"):
|
|
132
134
|
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
|
-
)
|
|
135
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
136
136
|
if utils.match_response(http_res, "5XX", "*"):
|
|
137
137
|
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
|
-
)
|
|
138
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
141
139
|
|
|
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
|
-
)
|
|
140
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
150
141
|
|
|
151
142
|
async def list_async(
|
|
152
143
|
self,
|
|
@@ -246,31 +237,22 @@ class Agents(BaseSDK):
|
|
|
246
237
|
|
|
247
238
|
response_data: Any = None
|
|
248
239
|
if utils.match_response(http_res, "200", "application/json"):
|
|
249
|
-
return utils.
|
|
240
|
+
return utils.unmarshal_json_response(
|
|
241
|
+
models.ListResponseAgentResponse, http_res
|
|
242
|
+
)
|
|
250
243
|
if utils.match_response(http_res, "422", "application/json"):
|
|
251
|
-
response_data = utils.
|
|
252
|
-
|
|
244
|
+
response_data = utils.unmarshal_json_response(
|
|
245
|
+
errors.HTTPValidationErrorData, http_res
|
|
253
246
|
)
|
|
254
|
-
raise
|
|
247
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
255
248
|
if utils.match_response(http_res, "4XX", "*"):
|
|
256
249
|
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
|
-
)
|
|
250
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
260
251
|
if utils.match_response(http_res, "5XX", "*"):
|
|
261
252
|
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
|
-
)
|
|
253
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
265
254
|
|
|
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
|
-
)
|
|
255
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
274
256
|
|
|
275
257
|
def create(
|
|
276
258
|
self,
|
|
@@ -349,31 +331,20 @@ class Agents(BaseSDK):
|
|
|
349
331
|
|
|
350
332
|
response_data: Any = None
|
|
351
333
|
if utils.match_response(http_res, "200", "application/json"):
|
|
352
|
-
return utils.
|
|
334
|
+
return utils.unmarshal_json_response(models.AgentResponse, http_res)
|
|
353
335
|
if utils.match_response(http_res, "422", "application/json"):
|
|
354
|
-
response_data = utils.
|
|
355
|
-
|
|
336
|
+
response_data = utils.unmarshal_json_response(
|
|
337
|
+
errors.HTTPValidationErrorData, http_res
|
|
356
338
|
)
|
|
357
|
-
raise
|
|
339
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
358
340
|
if utils.match_response(http_res, ["400", "4XX"], "*"):
|
|
359
341
|
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
|
-
)
|
|
342
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
363
343
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
364
344
|
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
|
-
)
|
|
345
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
368
346
|
|
|
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
|
-
)
|
|
347
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
377
348
|
|
|
378
349
|
async def create_async(
|
|
379
350
|
self,
|
|
@@ -452,31 +423,20 @@ class Agents(BaseSDK):
|
|
|
452
423
|
|
|
453
424
|
response_data: Any = None
|
|
454
425
|
if utils.match_response(http_res, "200", "application/json"):
|
|
455
|
-
return utils.
|
|
426
|
+
return utils.unmarshal_json_response(models.AgentResponse, http_res)
|
|
456
427
|
if utils.match_response(http_res, "422", "application/json"):
|
|
457
|
-
response_data = utils.
|
|
458
|
-
|
|
428
|
+
response_data = utils.unmarshal_json_response(
|
|
429
|
+
errors.HTTPValidationErrorData, http_res
|
|
459
430
|
)
|
|
460
|
-
raise
|
|
431
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
461
432
|
if utils.match_response(http_res, ["400", "4XX"], "*"):
|
|
462
433
|
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
|
-
)
|
|
434
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
466
435
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
467
436
|
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
|
-
)
|
|
437
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
471
438
|
|
|
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
|
-
)
|
|
439
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
480
440
|
|
|
481
441
|
def update(
|
|
482
442
|
self,
|
|
@@ -555,31 +515,20 @@ class Agents(BaseSDK):
|
|
|
555
515
|
|
|
556
516
|
response_data: Any = None
|
|
557
517
|
if utils.match_response(http_res, "200", "application/json"):
|
|
558
|
-
return utils.
|
|
518
|
+
return utils.unmarshal_json_response(models.AgentResponse, http_res)
|
|
559
519
|
if utils.match_response(http_res, "422", "application/json"):
|
|
560
|
-
response_data = utils.
|
|
561
|
-
|
|
520
|
+
response_data = utils.unmarshal_json_response(
|
|
521
|
+
errors.HTTPValidationErrorData, http_res
|
|
562
522
|
)
|
|
563
|
-
raise
|
|
523
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
564
524
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
565
525
|
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
|
-
)
|
|
526
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
569
527
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
570
528
|
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
|
-
)
|
|
529
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
574
530
|
|
|
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
|
-
)
|
|
531
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
583
532
|
|
|
584
533
|
async def update_async(
|
|
585
534
|
self,
|
|
@@ -658,31 +607,20 @@ class Agents(BaseSDK):
|
|
|
658
607
|
|
|
659
608
|
response_data: Any = None
|
|
660
609
|
if utils.match_response(http_res, "200", "application/json"):
|
|
661
|
-
return utils.
|
|
610
|
+
return utils.unmarshal_json_response(models.AgentResponse, http_res)
|
|
662
611
|
if utils.match_response(http_res, "422", "application/json"):
|
|
663
|
-
response_data = utils.
|
|
664
|
-
|
|
612
|
+
response_data = utils.unmarshal_json_response(
|
|
613
|
+
errors.HTTPValidationErrorData, http_res
|
|
665
614
|
)
|
|
666
|
-
raise
|
|
615
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
667
616
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
668
617
|
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
|
-
)
|
|
618
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
672
619
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
673
620
|
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
|
-
)
|
|
621
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
677
622
|
|
|
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
|
-
)
|
|
623
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
686
624
|
|
|
687
625
|
def get_by_id(
|
|
688
626
|
self,
|
|
@@ -758,31 +696,20 @@ class Agents(BaseSDK):
|
|
|
758
696
|
|
|
759
697
|
response_data: Any = None
|
|
760
698
|
if utils.match_response(http_res, "200", "application/json"):
|
|
761
|
-
return utils.
|
|
699
|
+
return utils.unmarshal_json_response(models.AgentResponse, http_res)
|
|
762
700
|
if utils.match_response(http_res, "422", "application/json"):
|
|
763
|
-
response_data = utils.
|
|
764
|
-
|
|
701
|
+
response_data = utils.unmarshal_json_response(
|
|
702
|
+
errors.HTTPValidationErrorData, http_res
|
|
765
703
|
)
|
|
766
|
-
raise
|
|
704
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
767
705
|
if utils.match_response(http_res, "4XX", "*"):
|
|
768
706
|
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
|
-
)
|
|
707
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
772
708
|
if utils.match_response(http_res, "5XX", "*"):
|
|
773
709
|
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
|
-
)
|
|
710
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
777
711
|
|
|
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
|
-
)
|
|
712
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
786
713
|
|
|
787
714
|
async def get_by_id_async(
|
|
788
715
|
self,
|
|
@@ -858,31 +785,20 @@ class Agents(BaseSDK):
|
|
|
858
785
|
|
|
859
786
|
response_data: Any = None
|
|
860
787
|
if utils.match_response(http_res, "200", "application/json"):
|
|
861
|
-
return utils.
|
|
788
|
+
return utils.unmarshal_json_response(models.AgentResponse, http_res)
|
|
862
789
|
if utils.match_response(http_res, "422", "application/json"):
|
|
863
|
-
response_data = utils.
|
|
864
|
-
|
|
790
|
+
response_data = utils.unmarshal_json_response(
|
|
791
|
+
errors.HTTPValidationErrorData, http_res
|
|
865
792
|
)
|
|
866
|
-
raise
|
|
793
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
867
794
|
if utils.match_response(http_res, "4XX", "*"):
|
|
868
795
|
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
|
-
)
|
|
796
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
872
797
|
if utils.match_response(http_res, "5XX", "*"):
|
|
873
798
|
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
|
-
)
|
|
799
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
877
800
|
|
|
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
|
-
)
|
|
801
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
886
802
|
|
|
887
803
|
def delete(
|
|
888
804
|
self,
|
|
@@ -959,31 +875,20 @@ class Agents(BaseSDK):
|
|
|
959
875
|
|
|
960
876
|
response_data: Any = None
|
|
961
877
|
if utils.match_response(http_res, "200", "application/json"):
|
|
962
|
-
return utils.
|
|
878
|
+
return utils.unmarshal_json_response(Any, http_res)
|
|
963
879
|
if utils.match_response(http_res, "422", "application/json"):
|
|
964
|
-
response_data = utils.
|
|
965
|
-
|
|
880
|
+
response_data = utils.unmarshal_json_response(
|
|
881
|
+
errors.HTTPValidationErrorData, http_res
|
|
966
882
|
)
|
|
967
|
-
raise
|
|
883
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
968
884
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
969
885
|
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
|
-
)
|
|
886
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
973
887
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
974
888
|
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
|
-
)
|
|
889
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
978
890
|
|
|
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
|
-
)
|
|
891
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
987
892
|
|
|
988
893
|
async def delete_async(
|
|
989
894
|
self,
|
|
@@ -1060,31 +965,20 @@ class Agents(BaseSDK):
|
|
|
1060
965
|
|
|
1061
966
|
response_data: Any = None
|
|
1062
967
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1063
|
-
return utils.
|
|
968
|
+
return utils.unmarshal_json_response(Any, http_res)
|
|
1064
969
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1065
|
-
response_data = utils.
|
|
1066
|
-
|
|
970
|
+
response_data = utils.unmarshal_json_response(
|
|
971
|
+
errors.HTTPValidationErrorData, http_res
|
|
1067
972
|
)
|
|
1068
|
-
raise
|
|
973
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1069
974
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
1070
975
|
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
|
-
)
|
|
976
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1074
977
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
1075
978
|
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
|
-
)
|
|
979
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1079
980
|
|
|
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
|
-
)
|
|
981
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1088
982
|
|
|
1089
983
|
def agent_get_available_voices(
|
|
1090
984
|
self,
|
|
@@ -1152,26 +1046,15 @@ class Agents(BaseSDK):
|
|
|
1152
1046
|
)
|
|
1153
1047
|
|
|
1154
1048
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1155
|
-
return utils.
|
|
1049
|
+
return utils.unmarshal_json_response(List[models.AgentVoice], http_res)
|
|
1156
1050
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1157
1051
|
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
|
-
)
|
|
1052
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1161
1053
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1162
1054
|
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
|
-
)
|
|
1055
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1166
1056
|
|
|
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
|
-
)
|
|
1057
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1175
1058
|
|
|
1176
1059
|
async def agent_get_available_voices_async(
|
|
1177
1060
|
self,
|
|
@@ -1239,23 +1122,12 @@ class Agents(BaseSDK):
|
|
|
1239
1122
|
)
|
|
1240
1123
|
|
|
1241
1124
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1242
|
-
return utils.
|
|
1125
|
+
return utils.unmarshal_json_response(List[models.AgentVoice], http_res)
|
|
1243
1126
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1244
1127
|
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
|
-
)
|
|
1128
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1248
1129
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1249
1130
|
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
|
-
)
|
|
1131
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1253
1132
|
|
|
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
|
-
)
|
|
1133
|
+
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
|
|