syllable-sdk 0.35.30__py3-none-any.whl → 0.35.32__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/_version.py +3 -3
- syllable_sdk/agents.py +210 -82
- syllable_sdk/basesdk.py +4 -4
- syllable_sdk/batches.py +328 -130
- syllable_sdk/campaigns.py +182 -72
- syllable_sdk/channels.py +72 -28
- syllable_sdk/conversations.py +36 -18
- syllable_sdk/custom_messages.py +182 -72
- syllable_sdk/dashboards.py +194 -66
- syllable_sdk/data_sources.py +182 -84
- syllable_sdk/events.py +36 -14
- syllable_sdk/folders.py +292 -120
- syllable_sdk/full_summary.py +36 -18
- syllable_sdk/incidents.py +214 -82
- syllable_sdk/insights_sdk.py +38 -16
- syllable_sdk/insights_tools.py +250 -96
- syllable_sdk/language_groups.py +214 -84
- syllable_sdk/latency.py +36 -18
- syllable_sdk/models/__init__.py +0 -9
- syllable_sdk/models/apierror.py +14 -30
- syllable_sdk/models/httpvalidationerror.py +6 -11
- syllable_sdk/numbers.py +110 -52
- syllable_sdk/organizations.py +138 -50
- syllable_sdk/permissions.py +32 -10
- syllable_sdk/prompts.py +248 -94
- syllable_sdk/roles.py +180 -74
- syllable_sdk/services.py +182 -72
- syllable_sdk/session_debug.py +108 -42
- syllable_sdk/session_labels.py +108 -46
- syllable_sdk/sessions.py +140 -58
- syllable_sdk/takeouts.py +98 -34
- syllable_sdk/targets.py +184 -74
- syllable_sdk/test.py +36 -14
- syllable_sdk/tools.py +180 -74
- syllable_sdk/transcript.py +38 -16
- syllable_sdk/twilio.py +108 -42
- syllable_sdk/users.py +246 -96
- syllable_sdk/utils/__init__.py +0 -3
- syllable_sdk/utils/serializers.py +4 -20
- syllable_sdk/v1.py +246 -96
- syllable_sdk/workflows.py +290 -114
- {syllable_sdk-0.35.30.dist-info → syllable_sdk-0.35.32.dist-info}/METADATA +24 -44
- {syllable_sdk-0.35.30.dist-info → syllable_sdk-0.35.32.dist-info}/RECORD +44 -47
- syllable_sdk/models/no_response_error.py +0 -13
- syllable_sdk/models/responsevalidationerror.py +0 -25
- syllable_sdk/models/syllablesdkerror.py +0 -26
- {syllable_sdk-0.35.30.dist-info → syllable_sdk-0.35.32.dist-info}/WHEEL +0 -0
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.32"
|
|
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.644.1"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.35.32 2.644.1 0.0.2 syllable-sdk"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
syllable_sdk/agents.py
CHANGED
|
@@ -122,22 +122,31 @@ 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.
|
|
126
|
-
models.ListResponseAgentResponse, http_res
|
|
127
|
-
)
|
|
125
|
+
return utils.unmarshal_json(http_res.text, models.ListResponseAgentResponse)
|
|
128
126
|
if utils.match_response(http_res, "422", "application/json"):
|
|
129
|
-
response_data = utils.
|
|
130
|
-
models.HTTPValidationErrorData
|
|
127
|
+
response_data = utils.unmarshal_json(
|
|
128
|
+
http_res.text, models.HTTPValidationErrorData
|
|
131
129
|
)
|
|
132
|
-
raise models.HTTPValidationError(response_data
|
|
130
|
+
raise models.HTTPValidationError(data=response_data)
|
|
133
131
|
if utils.match_response(http_res, "4XX", "*"):
|
|
134
132
|
http_res_text = utils.stream_to_text(http_res)
|
|
135
|
-
raise models.APIError(
|
|
133
|
+
raise models.APIError(
|
|
134
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
135
|
+
)
|
|
136
136
|
if utils.match_response(http_res, "5XX", "*"):
|
|
137
137
|
http_res_text = utils.stream_to_text(http_res)
|
|
138
|
-
raise models.APIError(
|
|
138
|
+
raise models.APIError(
|
|
139
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
140
|
+
)
|
|
139
141
|
|
|
140
|
-
|
|
142
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
141
150
|
|
|
142
151
|
async def list_async(
|
|
143
152
|
self,
|
|
@@ -237,22 +246,31 @@ class Agents(BaseSDK):
|
|
|
237
246
|
|
|
238
247
|
response_data: Any = None
|
|
239
248
|
if utils.match_response(http_res, "200", "application/json"):
|
|
240
|
-
return utils.
|
|
241
|
-
models.ListResponseAgentResponse, http_res
|
|
242
|
-
)
|
|
249
|
+
return utils.unmarshal_json(http_res.text, models.ListResponseAgentResponse)
|
|
243
250
|
if utils.match_response(http_res, "422", "application/json"):
|
|
244
|
-
response_data = utils.
|
|
245
|
-
models.HTTPValidationErrorData
|
|
251
|
+
response_data = utils.unmarshal_json(
|
|
252
|
+
http_res.text, models.HTTPValidationErrorData
|
|
246
253
|
)
|
|
247
|
-
raise models.HTTPValidationError(response_data
|
|
254
|
+
raise models.HTTPValidationError(data=response_data)
|
|
248
255
|
if utils.match_response(http_res, "4XX", "*"):
|
|
249
256
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
250
|
-
raise models.APIError(
|
|
257
|
+
raise models.APIError(
|
|
258
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
259
|
+
)
|
|
251
260
|
if utils.match_response(http_res, "5XX", "*"):
|
|
252
261
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
253
|
-
raise models.APIError(
|
|
262
|
+
raise models.APIError(
|
|
263
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
264
|
+
)
|
|
254
265
|
|
|
255
|
-
|
|
266
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
256
274
|
|
|
257
275
|
def create(
|
|
258
276
|
self,
|
|
@@ -331,20 +349,31 @@ class Agents(BaseSDK):
|
|
|
331
349
|
|
|
332
350
|
response_data: Any = None
|
|
333
351
|
if utils.match_response(http_res, "200", "application/json"):
|
|
334
|
-
return utils.
|
|
352
|
+
return utils.unmarshal_json(http_res.text, models.AgentResponse)
|
|
335
353
|
if utils.match_response(http_res, "422", "application/json"):
|
|
336
|
-
response_data = utils.
|
|
337
|
-
models.HTTPValidationErrorData
|
|
354
|
+
response_data = utils.unmarshal_json(
|
|
355
|
+
http_res.text, models.HTTPValidationErrorData
|
|
338
356
|
)
|
|
339
|
-
raise models.HTTPValidationError(response_data
|
|
357
|
+
raise models.HTTPValidationError(data=response_data)
|
|
340
358
|
if utils.match_response(http_res, ["400", "4XX"], "*"):
|
|
341
359
|
http_res_text = utils.stream_to_text(http_res)
|
|
342
|
-
raise models.APIError(
|
|
360
|
+
raise models.APIError(
|
|
361
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
362
|
+
)
|
|
343
363
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
344
364
|
http_res_text = utils.stream_to_text(http_res)
|
|
345
|
-
raise models.APIError(
|
|
365
|
+
raise models.APIError(
|
|
366
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
367
|
+
)
|
|
346
368
|
|
|
347
|
-
|
|
369
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
348
377
|
|
|
349
378
|
async def create_async(
|
|
350
379
|
self,
|
|
@@ -423,20 +452,31 @@ class Agents(BaseSDK):
|
|
|
423
452
|
|
|
424
453
|
response_data: Any = None
|
|
425
454
|
if utils.match_response(http_res, "200", "application/json"):
|
|
426
|
-
return utils.
|
|
455
|
+
return utils.unmarshal_json(http_res.text, models.AgentResponse)
|
|
427
456
|
if utils.match_response(http_res, "422", "application/json"):
|
|
428
|
-
response_data = utils.
|
|
429
|
-
models.HTTPValidationErrorData
|
|
457
|
+
response_data = utils.unmarshal_json(
|
|
458
|
+
http_res.text, models.HTTPValidationErrorData
|
|
430
459
|
)
|
|
431
|
-
raise models.HTTPValidationError(response_data
|
|
460
|
+
raise models.HTTPValidationError(data=response_data)
|
|
432
461
|
if utils.match_response(http_res, ["400", "4XX"], "*"):
|
|
433
462
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
434
|
-
raise models.APIError(
|
|
463
|
+
raise models.APIError(
|
|
464
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
465
|
+
)
|
|
435
466
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
436
467
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
437
|
-
raise models.APIError(
|
|
468
|
+
raise models.APIError(
|
|
469
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
470
|
+
)
|
|
438
471
|
|
|
439
|
-
|
|
472
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
440
480
|
|
|
441
481
|
def update(
|
|
442
482
|
self,
|
|
@@ -515,20 +555,31 @@ class Agents(BaseSDK):
|
|
|
515
555
|
|
|
516
556
|
response_data: Any = None
|
|
517
557
|
if utils.match_response(http_res, "200", "application/json"):
|
|
518
|
-
return utils.
|
|
558
|
+
return utils.unmarshal_json(http_res.text, models.AgentResponse)
|
|
519
559
|
if utils.match_response(http_res, "422", "application/json"):
|
|
520
|
-
response_data = utils.
|
|
521
|
-
models.HTTPValidationErrorData
|
|
560
|
+
response_data = utils.unmarshal_json(
|
|
561
|
+
http_res.text, models.HTTPValidationErrorData
|
|
522
562
|
)
|
|
523
|
-
raise models.HTTPValidationError(response_data
|
|
563
|
+
raise models.HTTPValidationError(data=response_data)
|
|
524
564
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
525
565
|
http_res_text = utils.stream_to_text(http_res)
|
|
526
|
-
raise models.APIError(
|
|
566
|
+
raise models.APIError(
|
|
567
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
568
|
+
)
|
|
527
569
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
528
570
|
http_res_text = utils.stream_to_text(http_res)
|
|
529
|
-
raise models.APIError(
|
|
571
|
+
raise models.APIError(
|
|
572
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
573
|
+
)
|
|
530
574
|
|
|
531
|
-
|
|
575
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
532
583
|
|
|
533
584
|
async def update_async(
|
|
534
585
|
self,
|
|
@@ -607,20 +658,31 @@ class Agents(BaseSDK):
|
|
|
607
658
|
|
|
608
659
|
response_data: Any = None
|
|
609
660
|
if utils.match_response(http_res, "200", "application/json"):
|
|
610
|
-
return utils.
|
|
661
|
+
return utils.unmarshal_json(http_res.text, models.AgentResponse)
|
|
611
662
|
if utils.match_response(http_res, "422", "application/json"):
|
|
612
|
-
response_data = utils.
|
|
613
|
-
models.HTTPValidationErrorData
|
|
663
|
+
response_data = utils.unmarshal_json(
|
|
664
|
+
http_res.text, models.HTTPValidationErrorData
|
|
614
665
|
)
|
|
615
|
-
raise models.HTTPValidationError(response_data
|
|
666
|
+
raise models.HTTPValidationError(data=response_data)
|
|
616
667
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
617
668
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
618
|
-
raise models.APIError(
|
|
669
|
+
raise models.APIError(
|
|
670
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
671
|
+
)
|
|
619
672
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
620
673
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
621
|
-
raise models.APIError(
|
|
674
|
+
raise models.APIError(
|
|
675
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
676
|
+
)
|
|
622
677
|
|
|
623
|
-
|
|
678
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
624
686
|
|
|
625
687
|
def get_by_id(
|
|
626
688
|
self,
|
|
@@ -696,20 +758,31 @@ class Agents(BaseSDK):
|
|
|
696
758
|
|
|
697
759
|
response_data: Any = None
|
|
698
760
|
if utils.match_response(http_res, "200", "application/json"):
|
|
699
|
-
return utils.
|
|
761
|
+
return utils.unmarshal_json(http_res.text, models.AgentResponse)
|
|
700
762
|
if utils.match_response(http_res, "422", "application/json"):
|
|
701
|
-
response_data = utils.
|
|
702
|
-
models.HTTPValidationErrorData
|
|
763
|
+
response_data = utils.unmarshal_json(
|
|
764
|
+
http_res.text, models.HTTPValidationErrorData
|
|
703
765
|
)
|
|
704
|
-
raise models.HTTPValidationError(response_data
|
|
766
|
+
raise models.HTTPValidationError(data=response_data)
|
|
705
767
|
if utils.match_response(http_res, "4XX", "*"):
|
|
706
768
|
http_res_text = utils.stream_to_text(http_res)
|
|
707
|
-
raise models.APIError(
|
|
769
|
+
raise models.APIError(
|
|
770
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
771
|
+
)
|
|
708
772
|
if utils.match_response(http_res, "5XX", "*"):
|
|
709
773
|
http_res_text = utils.stream_to_text(http_res)
|
|
710
|
-
raise models.APIError(
|
|
774
|
+
raise models.APIError(
|
|
775
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
776
|
+
)
|
|
711
777
|
|
|
712
|
-
|
|
778
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
713
786
|
|
|
714
787
|
async def get_by_id_async(
|
|
715
788
|
self,
|
|
@@ -785,20 +858,31 @@ class Agents(BaseSDK):
|
|
|
785
858
|
|
|
786
859
|
response_data: Any = None
|
|
787
860
|
if utils.match_response(http_res, "200", "application/json"):
|
|
788
|
-
return utils.
|
|
861
|
+
return utils.unmarshal_json(http_res.text, models.AgentResponse)
|
|
789
862
|
if utils.match_response(http_res, "422", "application/json"):
|
|
790
|
-
response_data = utils.
|
|
791
|
-
models.HTTPValidationErrorData
|
|
863
|
+
response_data = utils.unmarshal_json(
|
|
864
|
+
http_res.text, models.HTTPValidationErrorData
|
|
792
865
|
)
|
|
793
|
-
raise models.HTTPValidationError(response_data
|
|
866
|
+
raise models.HTTPValidationError(data=response_data)
|
|
794
867
|
if utils.match_response(http_res, "4XX", "*"):
|
|
795
868
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
796
|
-
raise models.APIError(
|
|
869
|
+
raise models.APIError(
|
|
870
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
871
|
+
)
|
|
797
872
|
if utils.match_response(http_res, "5XX", "*"):
|
|
798
873
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
799
|
-
raise models.APIError(
|
|
874
|
+
raise models.APIError(
|
|
875
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
876
|
+
)
|
|
800
877
|
|
|
801
|
-
|
|
878
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
802
886
|
|
|
803
887
|
def delete(
|
|
804
888
|
self,
|
|
@@ -875,20 +959,31 @@ class Agents(BaseSDK):
|
|
|
875
959
|
|
|
876
960
|
response_data: Any = None
|
|
877
961
|
if utils.match_response(http_res, "200", "application/json"):
|
|
878
|
-
return utils.
|
|
962
|
+
return utils.unmarshal_json(http_res.text, Any)
|
|
879
963
|
if utils.match_response(http_res, "422", "application/json"):
|
|
880
|
-
response_data = utils.
|
|
881
|
-
models.HTTPValidationErrorData
|
|
964
|
+
response_data = utils.unmarshal_json(
|
|
965
|
+
http_res.text, models.HTTPValidationErrorData
|
|
882
966
|
)
|
|
883
|
-
raise models.HTTPValidationError(response_data
|
|
967
|
+
raise models.HTTPValidationError(data=response_data)
|
|
884
968
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
885
969
|
http_res_text = utils.stream_to_text(http_res)
|
|
886
|
-
raise models.APIError(
|
|
970
|
+
raise models.APIError(
|
|
971
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
972
|
+
)
|
|
887
973
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
888
974
|
http_res_text = utils.stream_to_text(http_res)
|
|
889
|
-
raise models.APIError(
|
|
975
|
+
raise models.APIError(
|
|
976
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
977
|
+
)
|
|
890
978
|
|
|
891
|
-
|
|
979
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
892
987
|
|
|
893
988
|
async def delete_async(
|
|
894
989
|
self,
|
|
@@ -965,20 +1060,31 @@ class Agents(BaseSDK):
|
|
|
965
1060
|
|
|
966
1061
|
response_data: Any = None
|
|
967
1062
|
if utils.match_response(http_res, "200", "application/json"):
|
|
968
|
-
return utils.
|
|
1063
|
+
return utils.unmarshal_json(http_res.text, Any)
|
|
969
1064
|
if utils.match_response(http_res, "422", "application/json"):
|
|
970
|
-
response_data = utils.
|
|
971
|
-
models.HTTPValidationErrorData
|
|
1065
|
+
response_data = utils.unmarshal_json(
|
|
1066
|
+
http_res.text, models.HTTPValidationErrorData
|
|
972
1067
|
)
|
|
973
|
-
raise models.HTTPValidationError(response_data
|
|
1068
|
+
raise models.HTTPValidationError(data=response_data)
|
|
974
1069
|
if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
|
|
975
1070
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
976
|
-
raise models.APIError(
|
|
1071
|
+
raise models.APIError(
|
|
1072
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1073
|
+
)
|
|
977
1074
|
if utils.match_response(http_res, ["500", "5XX"], "*"):
|
|
978
1075
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
979
|
-
raise models.APIError(
|
|
1076
|
+
raise models.APIError(
|
|
1077
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1078
|
+
)
|
|
980
1079
|
|
|
981
|
-
|
|
1080
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
982
1088
|
|
|
983
1089
|
def agent_get_available_voices(
|
|
984
1090
|
self,
|
|
@@ -1046,15 +1152,26 @@ class Agents(BaseSDK):
|
|
|
1046
1152
|
)
|
|
1047
1153
|
|
|
1048
1154
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1049
|
-
return utils.
|
|
1155
|
+
return utils.unmarshal_json(http_res.text, List[models.AgentVoice])
|
|
1050
1156
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1051
1157
|
http_res_text = utils.stream_to_text(http_res)
|
|
1052
|
-
raise models.APIError(
|
|
1158
|
+
raise models.APIError(
|
|
1159
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1160
|
+
)
|
|
1053
1161
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1054
1162
|
http_res_text = utils.stream_to_text(http_res)
|
|
1055
|
-
raise models.APIError(
|
|
1163
|
+
raise models.APIError(
|
|
1164
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1165
|
+
)
|
|
1056
1166
|
|
|
1057
|
-
|
|
1167
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
|
1058
1175
|
|
|
1059
1176
|
async def agent_get_available_voices_async(
|
|
1060
1177
|
self,
|
|
@@ -1122,12 +1239,23 @@ class Agents(BaseSDK):
|
|
|
1122
1239
|
)
|
|
1123
1240
|
|
|
1124
1241
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1125
|
-
return utils.
|
|
1242
|
+
return utils.unmarshal_json(http_res.text, List[models.AgentVoice])
|
|
1126
1243
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1127
1244
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1128
|
-
raise models.APIError(
|
|
1245
|
+
raise models.APIError(
|
|
1246
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1247
|
+
)
|
|
1129
1248
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1130
1249
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1131
|
-
raise models.APIError(
|
|
1250
|
+
raise models.APIError(
|
|
1251
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1252
|
+
)
|
|
1132
1253
|
|
|
1133
|
-
|
|
1254
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
syllable_sdk/basesdk.py
CHANGED
|
@@ -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 models.
|
|
247
|
+
raise models.APIError("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 models.APIError("Unexpected error occurred"
|
|
268
|
+
raise models.APIError("Unexpected error occurred")
|
|
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 models.
|
|
319
|
+
raise models.APIError("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 models.APIError("Unexpected error occurred"
|
|
340
|
+
raise models.APIError("Unexpected error occurred")
|
|
341
341
|
|
|
342
342
|
return http_res
|
|
343
343
|
|