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/campaigns.py
CHANGED
|
@@ -107,22 +107,33 @@ class Campaigns(BaseSDK):
|
|
|
107
107
|
|
|
108
108
|
response_data: Any = None
|
|
109
109
|
if utils.match_response(http_res, "200", "application/json"):
|
|
110
|
-
return utils.
|
|
111
|
-
models.ListResponseOutboundCampaign
|
|
110
|
+
return utils.unmarshal_json(
|
|
111
|
+
http_res.text, models.ListResponseOutboundCampaign
|
|
112
112
|
)
|
|
113
113
|
if utils.match_response(http_res, "422", "application/json"):
|
|
114
|
-
response_data = utils.
|
|
115
|
-
models.HTTPValidationErrorData
|
|
114
|
+
response_data = utils.unmarshal_json(
|
|
115
|
+
http_res.text, models.HTTPValidationErrorData
|
|
116
116
|
)
|
|
117
|
-
raise models.HTTPValidationError(response_data
|
|
117
|
+
raise models.HTTPValidationError(data=response_data)
|
|
118
118
|
if utils.match_response(http_res, "4XX", "*"):
|
|
119
119
|
http_res_text = utils.stream_to_text(http_res)
|
|
120
|
-
raise models.APIError(
|
|
120
|
+
raise models.APIError(
|
|
121
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
122
|
+
)
|
|
121
123
|
if utils.match_response(http_res, "5XX", "*"):
|
|
122
124
|
http_res_text = utils.stream_to_text(http_res)
|
|
123
|
-
raise models.APIError(
|
|
125
|
+
raise models.APIError(
|
|
126
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
127
|
+
)
|
|
124
128
|
|
|
125
|
-
|
|
129
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
137
|
|
|
127
138
|
async def list_async(
|
|
128
139
|
self,
|
|
@@ -220,22 +231,33 @@ class Campaigns(BaseSDK):
|
|
|
220
231
|
|
|
221
232
|
response_data: Any = None
|
|
222
233
|
if utils.match_response(http_res, "200", "application/json"):
|
|
223
|
-
return utils.
|
|
224
|
-
models.ListResponseOutboundCampaign
|
|
234
|
+
return utils.unmarshal_json(
|
|
235
|
+
http_res.text, models.ListResponseOutboundCampaign
|
|
225
236
|
)
|
|
226
237
|
if utils.match_response(http_res, "422", "application/json"):
|
|
227
|
-
response_data = utils.
|
|
228
|
-
models.HTTPValidationErrorData
|
|
238
|
+
response_data = utils.unmarshal_json(
|
|
239
|
+
http_res.text, models.HTTPValidationErrorData
|
|
229
240
|
)
|
|
230
|
-
raise models.HTTPValidationError(response_data
|
|
241
|
+
raise models.HTTPValidationError(data=response_data)
|
|
231
242
|
if utils.match_response(http_res, "4XX", "*"):
|
|
232
243
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
233
|
-
raise models.APIError(
|
|
244
|
+
raise models.APIError(
|
|
245
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
246
|
+
)
|
|
234
247
|
if utils.match_response(http_res, "5XX", "*"):
|
|
235
248
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
236
|
-
raise models.APIError(
|
|
249
|
+
raise models.APIError(
|
|
250
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
251
|
+
)
|
|
237
252
|
|
|
238
|
-
|
|
253
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
261
|
|
|
240
262
|
def create(
|
|
241
263
|
self,
|
|
@@ -314,20 +336,31 @@ class Campaigns(BaseSDK):
|
|
|
314
336
|
|
|
315
337
|
response_data: Any = None
|
|
316
338
|
if utils.match_response(http_res, "200", "application/json"):
|
|
317
|
-
return utils.
|
|
339
|
+
return utils.unmarshal_json(http_res.text, models.OutboundCampaign)
|
|
318
340
|
if utils.match_response(http_res, "422", "application/json"):
|
|
319
|
-
response_data = utils.
|
|
320
|
-
models.HTTPValidationErrorData
|
|
341
|
+
response_data = utils.unmarshal_json(
|
|
342
|
+
http_res.text, models.HTTPValidationErrorData
|
|
321
343
|
)
|
|
322
|
-
raise models.HTTPValidationError(response_data
|
|
344
|
+
raise models.HTTPValidationError(data=response_data)
|
|
323
345
|
if utils.match_response(http_res, "4XX", "*"):
|
|
324
346
|
http_res_text = utils.stream_to_text(http_res)
|
|
325
|
-
raise models.APIError(
|
|
347
|
+
raise models.APIError(
|
|
348
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
349
|
+
)
|
|
326
350
|
if utils.match_response(http_res, "5XX", "*"):
|
|
327
351
|
http_res_text = utils.stream_to_text(http_res)
|
|
328
|
-
raise models.APIError(
|
|
352
|
+
raise models.APIError(
|
|
353
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
354
|
+
)
|
|
329
355
|
|
|
330
|
-
|
|
356
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
364
|
|
|
332
365
|
async def create_async(
|
|
333
366
|
self,
|
|
@@ -406,20 +439,31 @@ class Campaigns(BaseSDK):
|
|
|
406
439
|
|
|
407
440
|
response_data: Any = None
|
|
408
441
|
if utils.match_response(http_res, "200", "application/json"):
|
|
409
|
-
return utils.
|
|
442
|
+
return utils.unmarshal_json(http_res.text, models.OutboundCampaign)
|
|
410
443
|
if utils.match_response(http_res, "422", "application/json"):
|
|
411
|
-
response_data = utils.
|
|
412
|
-
models.HTTPValidationErrorData
|
|
444
|
+
response_data = utils.unmarshal_json(
|
|
445
|
+
http_res.text, models.HTTPValidationErrorData
|
|
413
446
|
)
|
|
414
|
-
raise models.HTTPValidationError(response_data
|
|
447
|
+
raise models.HTTPValidationError(data=response_data)
|
|
415
448
|
if utils.match_response(http_res, "4XX", "*"):
|
|
416
449
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
417
|
-
raise models.APIError(
|
|
450
|
+
raise models.APIError(
|
|
451
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
452
|
+
)
|
|
418
453
|
if utils.match_response(http_res, "5XX", "*"):
|
|
419
454
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
420
|
-
raise models.APIError(
|
|
455
|
+
raise models.APIError(
|
|
456
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
457
|
+
)
|
|
421
458
|
|
|
422
|
-
|
|
459
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
467
|
|
|
424
468
|
def get_by_id(
|
|
425
469
|
self,
|
|
@@ -493,20 +537,31 @@ class Campaigns(BaseSDK):
|
|
|
493
537
|
|
|
494
538
|
response_data: Any = None
|
|
495
539
|
if utils.match_response(http_res, "200", "application/json"):
|
|
496
|
-
return utils.
|
|
540
|
+
return utils.unmarshal_json(http_res.text, models.OutboundCampaign)
|
|
497
541
|
if utils.match_response(http_res, "422", "application/json"):
|
|
498
|
-
response_data = utils.
|
|
499
|
-
models.HTTPValidationErrorData
|
|
542
|
+
response_data = utils.unmarshal_json(
|
|
543
|
+
http_res.text, models.HTTPValidationErrorData
|
|
500
544
|
)
|
|
501
|
-
raise models.HTTPValidationError(response_data
|
|
545
|
+
raise models.HTTPValidationError(data=response_data)
|
|
502
546
|
if utils.match_response(http_res, "4XX", "*"):
|
|
503
547
|
http_res_text = utils.stream_to_text(http_res)
|
|
504
|
-
raise models.APIError(
|
|
548
|
+
raise models.APIError(
|
|
549
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
550
|
+
)
|
|
505
551
|
if utils.match_response(http_res, "5XX", "*"):
|
|
506
552
|
http_res_text = utils.stream_to_text(http_res)
|
|
507
|
-
raise models.APIError(
|
|
553
|
+
raise models.APIError(
|
|
554
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
555
|
+
)
|
|
508
556
|
|
|
509
|
-
|
|
557
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
565
|
|
|
511
566
|
async def get_by_id_async(
|
|
512
567
|
self,
|
|
@@ -580,20 +635,31 @@ class Campaigns(BaseSDK):
|
|
|
580
635
|
|
|
581
636
|
response_data: Any = None
|
|
582
637
|
if utils.match_response(http_res, "200", "application/json"):
|
|
583
|
-
return utils.
|
|
638
|
+
return utils.unmarshal_json(http_res.text, models.OutboundCampaign)
|
|
584
639
|
if utils.match_response(http_res, "422", "application/json"):
|
|
585
|
-
response_data = utils.
|
|
586
|
-
models.HTTPValidationErrorData
|
|
640
|
+
response_data = utils.unmarshal_json(
|
|
641
|
+
http_res.text, models.HTTPValidationErrorData
|
|
587
642
|
)
|
|
588
|
-
raise models.HTTPValidationError(response_data
|
|
643
|
+
raise models.HTTPValidationError(data=response_data)
|
|
589
644
|
if utils.match_response(http_res, "4XX", "*"):
|
|
590
645
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
591
|
-
raise models.APIError(
|
|
646
|
+
raise models.APIError(
|
|
647
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
648
|
+
)
|
|
592
649
|
if utils.match_response(http_res, "5XX", "*"):
|
|
593
650
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
594
|
-
raise models.APIError(
|
|
651
|
+
raise models.APIError(
|
|
652
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
653
|
+
)
|
|
595
654
|
|
|
596
|
-
|
|
655
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
663
|
|
|
598
664
|
def update(
|
|
599
665
|
self,
|
|
@@ -681,20 +747,31 @@ class Campaigns(BaseSDK):
|
|
|
681
747
|
|
|
682
748
|
response_data: Any = None
|
|
683
749
|
if utils.match_response(http_res, "200", "application/json"):
|
|
684
|
-
return utils.
|
|
750
|
+
return utils.unmarshal_json(http_res.text, models.OutboundCampaign)
|
|
685
751
|
if utils.match_response(http_res, "422", "application/json"):
|
|
686
|
-
response_data = utils.
|
|
687
|
-
models.HTTPValidationErrorData
|
|
752
|
+
response_data = utils.unmarshal_json(
|
|
753
|
+
http_res.text, models.HTTPValidationErrorData
|
|
688
754
|
)
|
|
689
|
-
raise models.HTTPValidationError(response_data
|
|
755
|
+
raise models.HTTPValidationError(data=response_data)
|
|
690
756
|
if utils.match_response(http_res, "4XX", "*"):
|
|
691
757
|
http_res_text = utils.stream_to_text(http_res)
|
|
692
|
-
raise models.APIError(
|
|
758
|
+
raise models.APIError(
|
|
759
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
760
|
+
)
|
|
693
761
|
if utils.match_response(http_res, "5XX", "*"):
|
|
694
762
|
http_res_text = utils.stream_to_text(http_res)
|
|
695
|
-
raise models.APIError(
|
|
763
|
+
raise models.APIError(
|
|
764
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
765
|
+
)
|
|
696
766
|
|
|
697
|
-
|
|
767
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
775
|
|
|
699
776
|
async def update_async(
|
|
700
777
|
self,
|
|
@@ -782,20 +859,31 @@ class Campaigns(BaseSDK):
|
|
|
782
859
|
|
|
783
860
|
response_data: Any = None
|
|
784
861
|
if utils.match_response(http_res, "200", "application/json"):
|
|
785
|
-
return utils.
|
|
862
|
+
return utils.unmarshal_json(http_res.text, models.OutboundCampaign)
|
|
786
863
|
if utils.match_response(http_res, "422", "application/json"):
|
|
787
|
-
response_data = utils.
|
|
788
|
-
models.HTTPValidationErrorData
|
|
864
|
+
response_data = utils.unmarshal_json(
|
|
865
|
+
http_res.text, models.HTTPValidationErrorData
|
|
789
866
|
)
|
|
790
|
-
raise models.HTTPValidationError(response_data
|
|
867
|
+
raise models.HTTPValidationError(data=response_data)
|
|
791
868
|
if utils.match_response(http_res, "4XX", "*"):
|
|
792
869
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
793
|
-
raise models.APIError(
|
|
870
|
+
raise models.APIError(
|
|
871
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
872
|
+
)
|
|
794
873
|
if utils.match_response(http_res, "5XX", "*"):
|
|
795
874
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
796
|
-
raise models.APIError(
|
|
875
|
+
raise models.APIError(
|
|
876
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
877
|
+
)
|
|
797
878
|
|
|
798
|
-
|
|
879
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
887
|
|
|
800
888
|
def delete(
|
|
801
889
|
self,
|
|
@@ -869,20 +957,31 @@ class Campaigns(BaseSDK):
|
|
|
869
957
|
|
|
870
958
|
response_data: Any = None
|
|
871
959
|
if utils.match_response(http_res, "200", "application/json"):
|
|
872
|
-
return utils.
|
|
960
|
+
return utils.unmarshal_json(http_res.text, Any)
|
|
873
961
|
if utils.match_response(http_res, "422", "application/json"):
|
|
874
|
-
response_data = utils.
|
|
875
|
-
models.HTTPValidationErrorData
|
|
962
|
+
response_data = utils.unmarshal_json(
|
|
963
|
+
http_res.text, models.HTTPValidationErrorData
|
|
876
964
|
)
|
|
877
|
-
raise models.HTTPValidationError(response_data
|
|
965
|
+
raise models.HTTPValidationError(data=response_data)
|
|
878
966
|
if utils.match_response(http_res, "4XX", "*"):
|
|
879
967
|
http_res_text = utils.stream_to_text(http_res)
|
|
880
|
-
raise models.APIError(
|
|
968
|
+
raise models.APIError(
|
|
969
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
970
|
+
)
|
|
881
971
|
if utils.match_response(http_res, "5XX", "*"):
|
|
882
972
|
http_res_text = utils.stream_to_text(http_res)
|
|
883
|
-
raise models.APIError(
|
|
973
|
+
raise models.APIError(
|
|
974
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
975
|
+
)
|
|
884
976
|
|
|
885
|
-
|
|
977
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
985
|
|
|
887
986
|
async def delete_async(
|
|
888
987
|
self,
|
|
@@ -956,17 +1055,28 @@ class Campaigns(BaseSDK):
|
|
|
956
1055
|
|
|
957
1056
|
response_data: Any = None
|
|
958
1057
|
if utils.match_response(http_res, "200", "application/json"):
|
|
959
|
-
return utils.
|
|
1058
|
+
return utils.unmarshal_json(http_res.text, Any)
|
|
960
1059
|
if utils.match_response(http_res, "422", "application/json"):
|
|
961
|
-
response_data = utils.
|
|
962
|
-
models.HTTPValidationErrorData
|
|
1060
|
+
response_data = utils.unmarshal_json(
|
|
1061
|
+
http_res.text, models.HTTPValidationErrorData
|
|
963
1062
|
)
|
|
964
|
-
raise models.HTTPValidationError(response_data
|
|
1063
|
+
raise models.HTTPValidationError(data=response_data)
|
|
965
1064
|
if utils.match_response(http_res, "4XX", "*"):
|
|
966
1065
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
967
|
-
raise models.APIError(
|
|
1066
|
+
raise models.APIError(
|
|
1067
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1068
|
+
)
|
|
968
1069
|
if utils.match_response(http_res, "5XX", "*"):
|
|
969
1070
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
970
|
-
raise models.APIError(
|
|
1071
|
+
raise models.APIError(
|
|
1072
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1073
|
+
)
|
|
971
1074
|
|
|
972
|
-
|
|
1075
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
|
+
)
|
syllable_sdk/channels.py
CHANGED
|
@@ -124,20 +124,31 @@ class Channels(BaseSDK):
|
|
|
124
124
|
|
|
125
125
|
response_data: Any = None
|
|
126
126
|
if utils.match_response(http_res, "200", "application/json"):
|
|
127
|
-
return utils.
|
|
127
|
+
return utils.unmarshal_json(http_res.text, models.ListResponseChannel)
|
|
128
128
|
if utils.match_response(http_res, "422", "application/json"):
|
|
129
|
-
response_data = utils.
|
|
130
|
-
models.HTTPValidationErrorData
|
|
129
|
+
response_data = utils.unmarshal_json(
|
|
130
|
+
http_res.text, models.HTTPValidationErrorData
|
|
131
131
|
)
|
|
132
|
-
raise models.HTTPValidationError(response_data
|
|
132
|
+
raise models.HTTPValidationError(data=response_data)
|
|
133
133
|
if utils.match_response(http_res, "4XX", "*"):
|
|
134
134
|
http_res_text = utils.stream_to_text(http_res)
|
|
135
|
-
raise models.APIError(
|
|
135
|
+
raise models.APIError(
|
|
136
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
137
|
+
)
|
|
136
138
|
if utils.match_response(http_res, "5XX", "*"):
|
|
137
139
|
http_res_text = utils.stream_to_text(http_res)
|
|
138
|
-
raise models.APIError(
|
|
140
|
+
raise models.APIError(
|
|
141
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
142
|
+
)
|
|
139
143
|
|
|
140
|
-
|
|
144
|
+
content_type = http_res.headers.get("Content-Type")
|
|
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
152
|
|
|
142
153
|
async def list_async(
|
|
143
154
|
self,
|
|
@@ -235,20 +246,31 @@ class Channels(BaseSDK):
|
|
|
235
246
|
|
|
236
247
|
response_data: Any = None
|
|
237
248
|
if utils.match_response(http_res, "200", "application/json"):
|
|
238
|
-
return utils.
|
|
249
|
+
return utils.unmarshal_json(http_res.text, models.ListResponseChannel)
|
|
239
250
|
if utils.match_response(http_res, "422", "application/json"):
|
|
240
|
-
response_data = utils.
|
|
241
|
-
models.HTTPValidationErrorData
|
|
251
|
+
response_data = utils.unmarshal_json(
|
|
252
|
+
http_res.text, models.HTTPValidationErrorData
|
|
242
253
|
)
|
|
243
|
-
raise models.HTTPValidationError(response_data
|
|
254
|
+
raise models.HTTPValidationError(data=response_data)
|
|
244
255
|
if utils.match_response(http_res, "4XX", "*"):
|
|
245
256
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
246
|
-
raise models.APIError(
|
|
257
|
+
raise models.APIError(
|
|
258
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
259
|
+
)
|
|
247
260
|
if utils.match_response(http_res, "5XX", "*"):
|
|
248
261
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
249
|
-
raise models.APIError(
|
|
262
|
+
raise models.APIError(
|
|
263
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
264
|
+
)
|
|
250
265
|
|
|
251
|
-
|
|
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
|
+
)
|
|
252
274
|
|
|
253
275
|
def delete(
|
|
254
276
|
self,
|
|
@@ -327,20 +349,31 @@ class Channels(BaseSDK):
|
|
|
327
349
|
|
|
328
350
|
response_data: Any = None
|
|
329
351
|
if utils.match_response(http_res, "200", "application/json"):
|
|
330
|
-
return utils.
|
|
352
|
+
return utils.unmarshal_json(http_res.text, Any)
|
|
331
353
|
if utils.match_response(http_res, "422", "application/json"):
|
|
332
|
-
response_data = utils.
|
|
333
|
-
models.HTTPValidationErrorData
|
|
354
|
+
response_data = utils.unmarshal_json(
|
|
355
|
+
http_res.text, models.HTTPValidationErrorData
|
|
334
356
|
)
|
|
335
|
-
raise models.HTTPValidationError(response_data
|
|
357
|
+
raise models.HTTPValidationError(data=response_data)
|
|
336
358
|
if utils.match_response(http_res, "4XX", "*"):
|
|
337
359
|
http_res_text = utils.stream_to_text(http_res)
|
|
338
|
-
raise models.APIError(
|
|
360
|
+
raise models.APIError(
|
|
361
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
362
|
+
)
|
|
339
363
|
if utils.match_response(http_res, "5XX", "*"):
|
|
340
364
|
http_res_text = utils.stream_to_text(http_res)
|
|
341
|
-
raise models.APIError(
|
|
365
|
+
raise models.APIError(
|
|
366
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
367
|
+
)
|
|
342
368
|
|
|
343
|
-
|
|
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
|
+
)
|
|
344
377
|
|
|
345
378
|
async def delete_async(
|
|
346
379
|
self,
|
|
@@ -419,17 +452,28 @@ class Channels(BaseSDK):
|
|
|
419
452
|
|
|
420
453
|
response_data: Any = None
|
|
421
454
|
if utils.match_response(http_res, "200", "application/json"):
|
|
422
|
-
return utils.
|
|
455
|
+
return utils.unmarshal_json(http_res.text, Any)
|
|
423
456
|
if utils.match_response(http_res, "422", "application/json"):
|
|
424
|
-
response_data = utils.
|
|
425
|
-
models.HTTPValidationErrorData
|
|
457
|
+
response_data = utils.unmarshal_json(
|
|
458
|
+
http_res.text, models.HTTPValidationErrorData
|
|
426
459
|
)
|
|
427
|
-
raise models.HTTPValidationError(response_data
|
|
460
|
+
raise models.HTTPValidationError(data=response_data)
|
|
428
461
|
if utils.match_response(http_res, "4XX", "*"):
|
|
429
462
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
430
|
-
raise models.APIError(
|
|
463
|
+
raise models.APIError(
|
|
464
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
465
|
+
)
|
|
431
466
|
if utils.match_response(http_res, "5XX", "*"):
|
|
432
467
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
433
|
-
raise models.APIError(
|
|
468
|
+
raise models.APIError(
|
|
469
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
470
|
+
)
|
|
434
471
|
|
|
435
|
-
|
|
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
|
+
)
|
syllable_sdk/conversations.py
CHANGED
|
@@ -107,22 +107,31 @@ class Conversations(BaseSDK):
|
|
|
107
107
|
|
|
108
108
|
response_data: Any = None
|
|
109
109
|
if utils.match_response(http_res, "200", "application/json"):
|
|
110
|
-
return utils.
|
|
111
|
-
models.ListResponseConversation, http_res
|
|
112
|
-
)
|
|
110
|
+
return utils.unmarshal_json(http_res.text, models.ListResponseConversation)
|
|
113
111
|
if utils.match_response(http_res, "422", "application/json"):
|
|
114
|
-
response_data = utils.
|
|
115
|
-
models.HTTPValidationErrorData
|
|
112
|
+
response_data = utils.unmarshal_json(
|
|
113
|
+
http_res.text, models.HTTPValidationErrorData
|
|
116
114
|
)
|
|
117
|
-
raise models.HTTPValidationError(response_data
|
|
115
|
+
raise models.HTTPValidationError(data=response_data)
|
|
118
116
|
if utils.match_response(http_res, "4XX", "*"):
|
|
119
117
|
http_res_text = utils.stream_to_text(http_res)
|
|
120
|
-
raise models.APIError(
|
|
118
|
+
raise models.APIError(
|
|
119
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
120
|
+
)
|
|
121
121
|
if utils.match_response(http_res, "5XX", "*"):
|
|
122
122
|
http_res_text = utils.stream_to_text(http_res)
|
|
123
|
-
raise models.APIError(
|
|
123
|
+
raise models.APIError(
|
|
124
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
125
|
+
)
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
content_type = http_res.headers.get("Content-Type")
|
|
128
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
129
|
+
raise models.APIError(
|
|
130
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
131
|
+
http_res.status_code,
|
|
132
|
+
http_res_text,
|
|
133
|
+
http_res,
|
|
134
|
+
)
|
|
126
135
|
|
|
127
136
|
async def list_async(
|
|
128
137
|
self,
|
|
@@ -220,19 +229,28 @@ class Conversations(BaseSDK):
|
|
|
220
229
|
|
|
221
230
|
response_data: Any = None
|
|
222
231
|
if utils.match_response(http_res, "200", "application/json"):
|
|
223
|
-
return utils.
|
|
224
|
-
models.ListResponseConversation, http_res
|
|
225
|
-
)
|
|
232
|
+
return utils.unmarshal_json(http_res.text, models.ListResponseConversation)
|
|
226
233
|
if utils.match_response(http_res, "422", "application/json"):
|
|
227
|
-
response_data = utils.
|
|
228
|
-
models.HTTPValidationErrorData
|
|
234
|
+
response_data = utils.unmarshal_json(
|
|
235
|
+
http_res.text, models.HTTPValidationErrorData
|
|
229
236
|
)
|
|
230
|
-
raise models.HTTPValidationError(response_data
|
|
237
|
+
raise models.HTTPValidationError(data=response_data)
|
|
231
238
|
if utils.match_response(http_res, "4XX", "*"):
|
|
232
239
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
233
|
-
raise models.APIError(
|
|
240
|
+
raise models.APIError(
|
|
241
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
242
|
+
)
|
|
234
243
|
if utils.match_response(http_res, "5XX", "*"):
|
|
235
244
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
236
|
-
raise models.APIError(
|
|
245
|
+
raise models.APIError(
|
|
246
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
247
|
+
)
|
|
237
248
|
|
|
238
|
-
|
|
249
|
+
content_type = http_res.headers.get("Content-Type")
|
|
250
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
251
|
+
raise models.APIError(
|
|
252
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
253
|
+
http_res.status_code,
|
|
254
|
+
http_res_text,
|
|
255
|
+
http_res,
|
|
256
|
+
)
|