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/full_summary.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
|
-
from syllable_sdk import models, utils
|
|
4
|
+
from syllable_sdk import errors, models, utils
|
|
5
5
|
from syllable_sdk._hooks import HookContext
|
|
6
6
|
from syllable_sdk.types import OptionalNullable, UNSET
|
|
7
7
|
from syllable_sdk.utils import get_security_from_env
|
|
8
|
+
from syllable_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
9
|
from typing import Any, Mapping, Optional
|
|
9
10
|
|
|
10
11
|
|
|
@@ -81,31 +82,20 @@ class FullSummary(BaseSDK):
|
|
|
81
82
|
|
|
82
83
|
response_data: Any = None
|
|
83
84
|
if utils.match_response(http_res, "200", "application/json"):
|
|
84
|
-
return
|
|
85
|
+
return unmarshal_json_response(models.SessionSummaryResponse, http_res)
|
|
85
86
|
if utils.match_response(http_res, "422", "application/json"):
|
|
86
|
-
response_data =
|
|
87
|
-
|
|
87
|
+
response_data = unmarshal_json_response(
|
|
88
|
+
errors.HTTPValidationErrorData, http_res
|
|
88
89
|
)
|
|
89
|
-
raise
|
|
90
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
90
91
|
if utils.match_response(http_res, "4XX", "*"):
|
|
91
92
|
http_res_text = utils.stream_to_text(http_res)
|
|
92
|
-
raise
|
|
93
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
94
|
-
)
|
|
93
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
95
94
|
if utils.match_response(http_res, "5XX", "*"):
|
|
96
95
|
http_res_text = utils.stream_to_text(http_res)
|
|
97
|
-
raise
|
|
98
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
99
|
-
)
|
|
96
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
100
97
|
|
|
101
|
-
|
|
102
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
103
|
-
raise models.APIError(
|
|
104
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
105
|
-
http_res.status_code,
|
|
106
|
-
http_res_text,
|
|
107
|
-
http_res,
|
|
108
|
-
)
|
|
98
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
109
99
|
|
|
110
100
|
async def get_by_id_async(
|
|
111
101
|
self,
|
|
@@ -179,28 +169,17 @@ class FullSummary(BaseSDK):
|
|
|
179
169
|
|
|
180
170
|
response_data: Any = None
|
|
181
171
|
if utils.match_response(http_res, "200", "application/json"):
|
|
182
|
-
return
|
|
172
|
+
return unmarshal_json_response(models.SessionSummaryResponse, http_res)
|
|
183
173
|
if utils.match_response(http_res, "422", "application/json"):
|
|
184
|
-
response_data =
|
|
185
|
-
|
|
174
|
+
response_data = unmarshal_json_response(
|
|
175
|
+
errors.HTTPValidationErrorData, http_res
|
|
186
176
|
)
|
|
187
|
-
raise
|
|
177
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
188
178
|
if utils.match_response(http_res, "4XX", "*"):
|
|
189
179
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
190
|
-
raise
|
|
191
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
192
|
-
)
|
|
180
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
193
181
|
if utils.match_response(http_res, "5XX", "*"):
|
|
194
182
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
195
|
-
raise
|
|
196
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
197
|
-
)
|
|
183
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
198
184
|
|
|
199
|
-
|
|
200
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
201
|
-
raise models.APIError(
|
|
202
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
203
|
-
http_res.status_code,
|
|
204
|
-
http_res_text,
|
|
205
|
-
http_res,
|
|
206
|
-
)
|
|
185
|
+
raise errors.APIError("Unexpected response received", http_res)
|
syllable_sdk/incidents.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
|
-
from syllable_sdk import models, utils
|
|
4
|
+
from syllable_sdk import errors, models, utils
|
|
5
5
|
from syllable_sdk._hooks import HookContext
|
|
6
6
|
from syllable_sdk.types import BaseModel, OptionalNullable, UNSET
|
|
7
7
|
from syllable_sdk.utils import get_security_from_env
|
|
8
|
+
from syllable_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
9
|
from typing import Any, List, Mapping, Optional, Union, cast
|
|
9
10
|
|
|
10
11
|
|
|
@@ -109,33 +110,22 @@ class Incidents(BaseSDK):
|
|
|
109
110
|
|
|
110
111
|
response_data: Any = None
|
|
111
112
|
if utils.match_response(http_res, "200", "application/json"):
|
|
112
|
-
return
|
|
113
|
-
|
|
113
|
+
return unmarshal_json_response(
|
|
114
|
+
models.ListResponseIncidentResponse, http_res
|
|
114
115
|
)
|
|
115
116
|
if utils.match_response(http_res, "422", "application/json"):
|
|
116
|
-
response_data =
|
|
117
|
-
|
|
117
|
+
response_data = unmarshal_json_response(
|
|
118
|
+
errors.HTTPValidationErrorData, http_res
|
|
118
119
|
)
|
|
119
|
-
raise
|
|
120
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
120
121
|
if utils.match_response(http_res, "4XX", "*"):
|
|
121
122
|
http_res_text = utils.stream_to_text(http_res)
|
|
122
|
-
raise
|
|
123
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
124
|
-
)
|
|
123
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
125
124
|
if utils.match_response(http_res, "5XX", "*"):
|
|
126
125
|
http_res_text = utils.stream_to_text(http_res)
|
|
127
|
-
raise
|
|
128
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
129
|
-
)
|
|
126
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
130
127
|
|
|
131
|
-
|
|
132
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
133
|
-
raise models.APIError(
|
|
134
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
135
|
-
http_res.status_code,
|
|
136
|
-
http_res_text,
|
|
137
|
-
http_res,
|
|
138
|
-
)
|
|
128
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
139
129
|
|
|
140
130
|
async def list_async(
|
|
141
131
|
self,
|
|
@@ -235,33 +225,22 @@ class Incidents(BaseSDK):
|
|
|
235
225
|
|
|
236
226
|
response_data: Any = None
|
|
237
227
|
if utils.match_response(http_res, "200", "application/json"):
|
|
238
|
-
return
|
|
239
|
-
|
|
228
|
+
return unmarshal_json_response(
|
|
229
|
+
models.ListResponseIncidentResponse, http_res
|
|
240
230
|
)
|
|
241
231
|
if utils.match_response(http_res, "422", "application/json"):
|
|
242
|
-
response_data =
|
|
243
|
-
|
|
232
|
+
response_data = unmarshal_json_response(
|
|
233
|
+
errors.HTTPValidationErrorData, http_res
|
|
244
234
|
)
|
|
245
|
-
raise
|
|
235
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
246
236
|
if utils.match_response(http_res, "4XX", "*"):
|
|
247
237
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
248
|
-
raise
|
|
249
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
250
|
-
)
|
|
238
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
251
239
|
if utils.match_response(http_res, "5XX", "*"):
|
|
252
240
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
253
|
-
raise
|
|
254
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
255
|
-
)
|
|
241
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
256
242
|
|
|
257
|
-
|
|
258
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
259
|
-
raise models.APIError(
|
|
260
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
261
|
-
http_res.status_code,
|
|
262
|
-
http_res_text,
|
|
263
|
-
http_res,
|
|
264
|
-
)
|
|
243
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
265
244
|
|
|
266
245
|
def create(
|
|
267
246
|
self,
|
|
@@ -342,31 +321,20 @@ class Incidents(BaseSDK):
|
|
|
342
321
|
|
|
343
322
|
response_data: Any = None
|
|
344
323
|
if utils.match_response(http_res, "200", "application/json"):
|
|
345
|
-
return
|
|
324
|
+
return unmarshal_json_response(models.IncidentResponse, http_res)
|
|
346
325
|
if utils.match_response(http_res, "422", "application/json"):
|
|
347
|
-
response_data =
|
|
348
|
-
|
|
326
|
+
response_data = unmarshal_json_response(
|
|
327
|
+
errors.HTTPValidationErrorData, http_res
|
|
349
328
|
)
|
|
350
|
-
raise
|
|
329
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
351
330
|
if utils.match_response(http_res, "4XX", "*"):
|
|
352
331
|
http_res_text = utils.stream_to_text(http_res)
|
|
353
|
-
raise
|
|
354
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
355
|
-
)
|
|
332
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
356
333
|
if utils.match_response(http_res, "5XX", "*"):
|
|
357
334
|
http_res_text = utils.stream_to_text(http_res)
|
|
358
|
-
raise
|
|
359
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
360
|
-
)
|
|
335
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
361
336
|
|
|
362
|
-
|
|
363
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
364
|
-
raise models.APIError(
|
|
365
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
366
|
-
http_res.status_code,
|
|
367
|
-
http_res_text,
|
|
368
|
-
http_res,
|
|
369
|
-
)
|
|
337
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
370
338
|
|
|
371
339
|
async def create_async(
|
|
372
340
|
self,
|
|
@@ -447,31 +415,20 @@ class Incidents(BaseSDK):
|
|
|
447
415
|
|
|
448
416
|
response_data: Any = None
|
|
449
417
|
if utils.match_response(http_res, "200", "application/json"):
|
|
450
|
-
return
|
|
418
|
+
return unmarshal_json_response(models.IncidentResponse, http_res)
|
|
451
419
|
if utils.match_response(http_res, "422", "application/json"):
|
|
452
|
-
response_data =
|
|
453
|
-
|
|
420
|
+
response_data = unmarshal_json_response(
|
|
421
|
+
errors.HTTPValidationErrorData, http_res
|
|
454
422
|
)
|
|
455
|
-
raise
|
|
423
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
456
424
|
if utils.match_response(http_res, "4XX", "*"):
|
|
457
425
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
458
|
-
raise
|
|
459
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
460
|
-
)
|
|
426
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
461
427
|
if utils.match_response(http_res, "5XX", "*"):
|
|
462
428
|
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
|
-
)
|
|
429
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
466
430
|
|
|
467
|
-
|
|
468
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
469
|
-
raise models.APIError(
|
|
470
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
471
|
-
http_res.status_code,
|
|
472
|
-
http_res_text,
|
|
473
|
-
http_res,
|
|
474
|
-
)
|
|
431
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
475
432
|
|
|
476
433
|
def update(
|
|
477
434
|
self,
|
|
@@ -552,31 +509,20 @@ class Incidents(BaseSDK):
|
|
|
552
509
|
|
|
553
510
|
response_data: Any = None
|
|
554
511
|
if utils.match_response(http_res, "200", "application/json"):
|
|
555
|
-
return
|
|
512
|
+
return unmarshal_json_response(models.IncidentResponse, http_res)
|
|
556
513
|
if utils.match_response(http_res, "422", "application/json"):
|
|
557
|
-
response_data =
|
|
558
|
-
|
|
514
|
+
response_data = unmarshal_json_response(
|
|
515
|
+
errors.HTTPValidationErrorData, http_res
|
|
559
516
|
)
|
|
560
|
-
raise
|
|
517
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
561
518
|
if utils.match_response(http_res, "4XX", "*"):
|
|
562
519
|
http_res_text = utils.stream_to_text(http_res)
|
|
563
|
-
raise
|
|
564
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
565
|
-
)
|
|
520
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
566
521
|
if utils.match_response(http_res, "5XX", "*"):
|
|
567
522
|
http_res_text = utils.stream_to_text(http_res)
|
|
568
|
-
raise
|
|
569
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
570
|
-
)
|
|
523
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
571
524
|
|
|
572
|
-
|
|
573
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
574
|
-
raise models.APIError(
|
|
575
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
576
|
-
http_res.status_code,
|
|
577
|
-
http_res_text,
|
|
578
|
-
http_res,
|
|
579
|
-
)
|
|
525
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
580
526
|
|
|
581
527
|
async def update_async(
|
|
582
528
|
self,
|
|
@@ -657,31 +603,20 @@ class Incidents(BaseSDK):
|
|
|
657
603
|
|
|
658
604
|
response_data: Any = None
|
|
659
605
|
if utils.match_response(http_res, "200", "application/json"):
|
|
660
|
-
return
|
|
606
|
+
return unmarshal_json_response(models.IncidentResponse, http_res)
|
|
661
607
|
if utils.match_response(http_res, "422", "application/json"):
|
|
662
|
-
response_data =
|
|
663
|
-
|
|
608
|
+
response_data = unmarshal_json_response(
|
|
609
|
+
errors.HTTPValidationErrorData, http_res
|
|
664
610
|
)
|
|
665
|
-
raise
|
|
611
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
666
612
|
if utils.match_response(http_res, "4XX", "*"):
|
|
667
613
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
668
|
-
raise
|
|
669
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
670
|
-
)
|
|
614
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
671
615
|
if utils.match_response(http_res, "5XX", "*"):
|
|
672
616
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
673
|
-
raise
|
|
674
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
675
|
-
)
|
|
617
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
676
618
|
|
|
677
|
-
|
|
678
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
679
|
-
raise models.APIError(
|
|
680
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
681
|
-
http_res.status_code,
|
|
682
|
-
http_res_text,
|
|
683
|
-
http_res,
|
|
684
|
-
)
|
|
619
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
685
620
|
|
|
686
621
|
def incident_get_organizations(
|
|
687
622
|
self,
|
|
@@ -749,28 +684,17 @@ class Incidents(BaseSDK):
|
|
|
749
684
|
)
|
|
750
685
|
|
|
751
686
|
if utils.match_response(http_res, "200", "application/json"):
|
|
752
|
-
return
|
|
753
|
-
|
|
687
|
+
return unmarshal_json_response(
|
|
688
|
+
List[models.IncidentOrganizationResponse], http_res
|
|
754
689
|
)
|
|
755
690
|
if utils.match_response(http_res, "4XX", "*"):
|
|
756
691
|
http_res_text = utils.stream_to_text(http_res)
|
|
757
|
-
raise
|
|
758
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
759
|
-
)
|
|
692
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
760
693
|
if utils.match_response(http_res, "5XX", "*"):
|
|
761
694
|
http_res_text = utils.stream_to_text(http_res)
|
|
762
|
-
raise
|
|
763
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
764
|
-
)
|
|
695
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
765
696
|
|
|
766
|
-
|
|
767
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
768
|
-
raise models.APIError(
|
|
769
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
770
|
-
http_res.status_code,
|
|
771
|
-
http_res_text,
|
|
772
|
-
http_res,
|
|
773
|
-
)
|
|
697
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
774
698
|
|
|
775
699
|
async def incident_get_organizations_async(
|
|
776
700
|
self,
|
|
@@ -838,28 +762,17 @@ class Incidents(BaseSDK):
|
|
|
838
762
|
)
|
|
839
763
|
|
|
840
764
|
if utils.match_response(http_res, "200", "application/json"):
|
|
841
|
-
return
|
|
842
|
-
|
|
765
|
+
return unmarshal_json_response(
|
|
766
|
+
List[models.IncidentOrganizationResponse], http_res
|
|
843
767
|
)
|
|
844
768
|
if utils.match_response(http_res, "4XX", "*"):
|
|
845
769
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
846
|
-
raise
|
|
847
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
848
|
-
)
|
|
770
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
849
771
|
if utils.match_response(http_res, "5XX", "*"):
|
|
850
772
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
851
|
-
raise
|
|
852
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
853
|
-
)
|
|
773
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
854
774
|
|
|
855
|
-
|
|
856
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
857
|
-
raise models.APIError(
|
|
858
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
859
|
-
http_res.status_code,
|
|
860
|
-
http_res_text,
|
|
861
|
-
http_res,
|
|
862
|
-
)
|
|
775
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
863
776
|
|
|
864
777
|
def get_by_id(
|
|
865
778
|
self,
|
|
@@ -935,31 +848,20 @@ class Incidents(BaseSDK):
|
|
|
935
848
|
|
|
936
849
|
response_data: Any = None
|
|
937
850
|
if utils.match_response(http_res, "200", "application/json"):
|
|
938
|
-
return
|
|
851
|
+
return unmarshal_json_response(models.IncidentResponse, http_res)
|
|
939
852
|
if utils.match_response(http_res, "422", "application/json"):
|
|
940
|
-
response_data =
|
|
941
|
-
|
|
853
|
+
response_data = unmarshal_json_response(
|
|
854
|
+
errors.HTTPValidationErrorData, http_res
|
|
942
855
|
)
|
|
943
|
-
raise
|
|
856
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
944
857
|
if utils.match_response(http_res, "4XX", "*"):
|
|
945
858
|
http_res_text = utils.stream_to_text(http_res)
|
|
946
|
-
raise
|
|
947
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
948
|
-
)
|
|
859
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
949
860
|
if utils.match_response(http_res, "5XX", "*"):
|
|
950
861
|
http_res_text = utils.stream_to_text(http_res)
|
|
951
|
-
raise
|
|
952
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
953
|
-
)
|
|
862
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
954
863
|
|
|
955
|
-
|
|
956
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
957
|
-
raise models.APIError(
|
|
958
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
959
|
-
http_res.status_code,
|
|
960
|
-
http_res_text,
|
|
961
|
-
http_res,
|
|
962
|
-
)
|
|
864
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
963
865
|
|
|
964
866
|
async def get_by_id_async(
|
|
965
867
|
self,
|
|
@@ -1035,31 +937,20 @@ class Incidents(BaseSDK):
|
|
|
1035
937
|
|
|
1036
938
|
response_data: Any = None
|
|
1037
939
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1038
|
-
return
|
|
940
|
+
return unmarshal_json_response(models.IncidentResponse, http_res)
|
|
1039
941
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1040
|
-
response_data =
|
|
1041
|
-
|
|
942
|
+
response_data = unmarshal_json_response(
|
|
943
|
+
errors.HTTPValidationErrorData, http_res
|
|
1042
944
|
)
|
|
1043
|
-
raise
|
|
945
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1044
946
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1045
947
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1046
|
-
raise
|
|
1047
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1048
|
-
)
|
|
948
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1049
949
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1050
950
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1051
|
-
raise
|
|
1052
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1053
|
-
)
|
|
951
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1054
952
|
|
|
1055
|
-
|
|
1056
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1057
|
-
raise models.APIError(
|
|
1058
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1059
|
-
http_res.status_code,
|
|
1060
|
-
http_res_text,
|
|
1061
|
-
http_res,
|
|
1062
|
-
)
|
|
953
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1063
954
|
|
|
1064
955
|
def delete(
|
|
1065
956
|
self,
|
|
@@ -1138,31 +1029,20 @@ class Incidents(BaseSDK):
|
|
|
1138
1029
|
|
|
1139
1030
|
response_data: Any = None
|
|
1140
1031
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1141
|
-
return
|
|
1032
|
+
return unmarshal_json_response(Any, http_res)
|
|
1142
1033
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1143
|
-
response_data =
|
|
1144
|
-
|
|
1034
|
+
response_data = unmarshal_json_response(
|
|
1035
|
+
errors.HTTPValidationErrorData, http_res
|
|
1145
1036
|
)
|
|
1146
|
-
raise
|
|
1037
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1147
1038
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1148
1039
|
http_res_text = utils.stream_to_text(http_res)
|
|
1149
|
-
raise
|
|
1150
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1151
|
-
)
|
|
1040
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1152
1041
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1153
1042
|
http_res_text = utils.stream_to_text(http_res)
|
|
1154
|
-
raise
|
|
1155
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1156
|
-
)
|
|
1043
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1157
1044
|
|
|
1158
|
-
|
|
1159
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1160
|
-
raise models.APIError(
|
|
1161
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1162
|
-
http_res.status_code,
|
|
1163
|
-
http_res_text,
|
|
1164
|
-
http_res,
|
|
1165
|
-
)
|
|
1045
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1166
1046
|
|
|
1167
1047
|
async def delete_async(
|
|
1168
1048
|
self,
|
|
@@ -1241,28 +1121,17 @@ class Incidents(BaseSDK):
|
|
|
1241
1121
|
|
|
1242
1122
|
response_data: Any = None
|
|
1243
1123
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1244
|
-
return
|
|
1124
|
+
return unmarshal_json_response(Any, http_res)
|
|
1245
1125
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1246
|
-
response_data =
|
|
1247
|
-
|
|
1126
|
+
response_data = unmarshal_json_response(
|
|
1127
|
+
errors.HTTPValidationErrorData, http_res
|
|
1248
1128
|
)
|
|
1249
|
-
raise
|
|
1129
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1250
1130
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1251
1131
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1252
|
-
raise
|
|
1253
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1254
|
-
)
|
|
1132
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1255
1133
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1256
1134
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1257
|
-
raise
|
|
1258
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1259
|
-
)
|
|
1135
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1260
1136
|
|
|
1261
|
-
|
|
1262
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1263
|
-
raise models.APIError(
|
|
1264
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1265
|
-
http_res.status_code,
|
|
1266
|
-
http_res_text,
|
|
1267
|
-
http_res,
|
|
1268
|
-
)
|
|
1137
|
+
raise errors.APIError("Unexpected response received", http_res)
|
syllable_sdk/insights_sdk.py
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
4
|
from .sdkconfiguration import SDKConfiguration
|
|
5
|
-
from syllable_sdk import models, utils
|
|
5
|
+
from syllable_sdk import errors, models, utils
|
|
6
6
|
from syllable_sdk._hooks import HookContext
|
|
7
7
|
from syllable_sdk.folders import Folders
|
|
8
8
|
from syllable_sdk.insights_tools import InsightsTools
|
|
9
9
|
from syllable_sdk.types import OptionalNullable, UNSET
|
|
10
10
|
from syllable_sdk.utils import get_security_from_env
|
|
11
|
+
from syllable_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
11
12
|
from syllable_sdk.workflows import Workflows
|
|
12
13
|
from typing import Any, List, Mapping, Optional
|
|
13
14
|
|
|
@@ -130,33 +131,20 @@ class InsightsSDK(BaseSDK):
|
|
|
130
131
|
|
|
131
132
|
response_data: Any = None
|
|
132
133
|
if utils.match_response(http_res, "200", "application/json"):
|
|
133
|
-
return
|
|
134
|
-
http_res.text, models.ListResponseInsightsOutput
|
|
135
|
-
)
|
|
134
|
+
return unmarshal_json_response(models.ListResponseInsightsOutput, http_res)
|
|
136
135
|
if utils.match_response(http_res, "422", "application/json"):
|
|
137
|
-
response_data =
|
|
138
|
-
|
|
136
|
+
response_data = unmarshal_json_response(
|
|
137
|
+
errors.HTTPValidationErrorData, http_res
|
|
139
138
|
)
|
|
140
|
-
raise
|
|
139
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
141
140
|
if utils.match_response(http_res, "4XX", "*"):
|
|
142
141
|
http_res_text = utils.stream_to_text(http_res)
|
|
143
|
-
raise
|
|
144
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
145
|
-
)
|
|
142
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
146
143
|
if utils.match_response(http_res, "5XX", "*"):
|
|
147
144
|
http_res_text = utils.stream_to_text(http_res)
|
|
148
|
-
raise
|
|
149
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
150
|
-
)
|
|
145
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
151
146
|
|
|
152
|
-
|
|
153
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
154
|
-
raise models.APIError(
|
|
155
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
156
|
-
http_res.status_code,
|
|
157
|
-
http_res_text,
|
|
158
|
-
http_res,
|
|
159
|
-
)
|
|
147
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
160
148
|
|
|
161
149
|
async def list_async(
|
|
162
150
|
self,
|
|
@@ -256,30 +244,17 @@ class InsightsSDK(BaseSDK):
|
|
|
256
244
|
|
|
257
245
|
response_data: Any = None
|
|
258
246
|
if utils.match_response(http_res, "200", "application/json"):
|
|
259
|
-
return
|
|
260
|
-
http_res.text, models.ListResponseInsightsOutput
|
|
261
|
-
)
|
|
247
|
+
return unmarshal_json_response(models.ListResponseInsightsOutput, http_res)
|
|
262
248
|
if utils.match_response(http_res, "422", "application/json"):
|
|
263
|
-
response_data =
|
|
264
|
-
|
|
249
|
+
response_data = unmarshal_json_response(
|
|
250
|
+
errors.HTTPValidationErrorData, http_res
|
|
265
251
|
)
|
|
266
|
-
raise
|
|
252
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
267
253
|
if utils.match_response(http_res, "4XX", "*"):
|
|
268
254
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
269
|
-
raise
|
|
270
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
271
|
-
)
|
|
255
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
272
256
|
if utils.match_response(http_res, "5XX", "*"):
|
|
273
257
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
274
|
-
raise
|
|
275
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
276
|
-
)
|
|
258
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
277
259
|
|
|
278
|
-
|
|
279
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
280
|
-
raise models.APIError(
|
|
281
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
282
|
-
http_res.status_code,
|
|
283
|
-
http_res_text,
|
|
284
|
-
http_res,
|
|
285
|
-
)
|
|
260
|
+
raise errors.APIError("Unexpected response received", http_res)
|