syllable-sdk 0.37.5__py3-none-any.whl → 0.38.16__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.
Files changed (63) hide show
  1. syllable_sdk/_version.py +3 -3
  2. syllable_sdk/agents.py +12 -12
  3. syllable_sdk/batches.py +18 -18
  4. syllable_sdk/campaigns.py +10 -10
  5. syllable_sdk/channels.py +8 -8
  6. syllable_sdk/conversations.py +2 -2
  7. syllable_sdk/custom_messages.py +10 -10
  8. syllable_sdk/dashboards.py +12 -12
  9. syllable_sdk/data_sources.py +10 -10
  10. syllable_sdk/errors/apierror.py +1 -1
  11. syllable_sdk/errors/httpvalidationerror.py +1 -1
  12. syllable_sdk/errors/no_response_error.py +1 -1
  13. syllable_sdk/errors/responsevalidationerror.py +1 -1
  14. syllable_sdk/errors/syllablesdkerror.py +1 -1
  15. syllable_sdk/events.py +2 -2
  16. syllable_sdk/folders.py +16 -16
  17. syllable_sdk/full_summary.py +2 -2
  18. syllable_sdk/incidents.py +12 -12
  19. syllable_sdk/insights_sdk.py +2 -2
  20. syllable_sdk/insights_tools.py +14 -14
  21. syllable_sdk/language_groups.py +12 -12
  22. syllable_sdk/latency.py +2 -2
  23. syllable_sdk/models/__init__.py +59 -0
  24. syllable_sdk/models/body_pronunciations_upload_csv.py +46 -0
  25. syllable_sdk/models/campaignproperties.py +1 -0
  26. syllable_sdk/models/dictionarymetadata.py +24 -0
  27. syllable_sdk/models/incidentcreaterequest.py +10 -4
  28. syllable_sdk/models/incidentresponse.py +10 -4
  29. syllable_sdk/models/incidentupdaterequest.py +12 -28
  30. syllable_sdk/models/matchtype.py +11 -0
  31. syllable_sdk/models/outboundcampaign.py +7 -0
  32. syllable_sdk/models/outboundcampaigninput.py +7 -0
  33. syllable_sdk/models/promptcreaterequest.py +7 -1
  34. syllable_sdk/models/pronunciationoverride.py +45 -0
  35. syllable_sdk/models/pronunciationoverridesdictionary.py +70 -0
  36. syllable_sdk/models/pronunciations_download_csvop.py +18 -0
  37. syllable_sdk/models/pronunciationscsvuploadresponse.py +31 -0
  38. syllable_sdk/models/toolproperties.py +1 -1
  39. syllable_sdk/models/voicedisplayinfo.py +20 -0
  40. syllable_sdk/models/voicesamplecreaterequest.py +17 -1
  41. syllable_sdk/numbers.py +6 -6
  42. syllable_sdk/organizations.py +8 -8
  43. syllable_sdk/permissions.py +2 -2
  44. syllable_sdk/prompts.py +14 -14
  45. syllable_sdk/pronunciations.py +805 -0
  46. syllable_sdk/roles.py +10 -10
  47. syllable_sdk/sdk.py +3 -0
  48. syllable_sdk/services.py +10 -10
  49. syllable_sdk/session_debug.py +6 -6
  50. syllable_sdk/session_labels.py +6 -6
  51. syllable_sdk/sessions.py +8 -8
  52. syllable_sdk/takeouts.py +6 -6
  53. syllable_sdk/targets.py +10 -10
  54. syllable_sdk/test.py +2 -2
  55. syllable_sdk/tools.py +10 -10
  56. syllable_sdk/transcript.py +2 -2
  57. syllable_sdk/twilio.py +6 -6
  58. syllable_sdk/users.py +14 -14
  59. syllable_sdk/v1.py +14 -14
  60. syllable_sdk/workflows.py +16 -16
  61. {syllable_sdk-0.37.5.dist-info → syllable_sdk-0.38.16.dist-info}/METADATA +9 -5
  62. {syllable_sdk-0.37.5.dist-info → syllable_sdk-0.38.16.dist-info}/RECORD +63 -54
  63. {syllable_sdk-0.37.5.dist-info → syllable_sdk-0.38.16.dist-info}/WHEEL +0 -0
@@ -0,0 +1,805 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from syllable_sdk import errors, models, utils
5
+ from syllable_sdk._hooks import HookContext
6
+ from syllable_sdk.types import BaseModel, OptionalNullable, UNSET
7
+ from syllable_sdk.utils import get_security_from_env
8
+ from syllable_sdk.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Any, Mapping, Optional, Union, cast
10
+
11
+
12
+ class Pronunciations(BaseSDK):
13
+ def pronunciations_get(
14
+ self,
15
+ *,
16
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
17
+ server_url: Optional[str] = None,
18
+ timeout_ms: Optional[int] = None,
19
+ http_headers: Optional[Mapping[str, str]] = None,
20
+ ) -> models.PronunciationOverridesDictionary:
21
+ r"""Get Pronunciations Dictionary
22
+
23
+ :param retries: Override the default retry configuration for this method
24
+ :param server_url: Override the default server URL for this method
25
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
26
+ :param http_headers: Additional headers to set or replace on requests.
27
+ """
28
+ base_url = None
29
+ url_variables = None
30
+ if timeout_ms is None:
31
+ timeout_ms = self.sdk_configuration.timeout_ms
32
+
33
+ if server_url is not None:
34
+ base_url = server_url
35
+ else:
36
+ base_url = self._get_url(base_url, url_variables)
37
+ req = self._build_request(
38
+ method="GET",
39
+ path="/api/v1/pronunciations",
40
+ base_url=base_url,
41
+ url_variables=url_variables,
42
+ request=None,
43
+ request_body_required=False,
44
+ request_has_path_params=False,
45
+ request_has_query_params=True,
46
+ user_agent_header="user-agent",
47
+ accept_header_value="application/json",
48
+ http_headers=http_headers,
49
+ security=self.sdk_configuration.security,
50
+ timeout_ms=timeout_ms,
51
+ )
52
+
53
+ if retries == UNSET:
54
+ if self.sdk_configuration.retry_config is not UNSET:
55
+ retries = self.sdk_configuration.retry_config
56
+
57
+ retry_config = None
58
+ if isinstance(retries, utils.RetryConfig):
59
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
60
+
61
+ http_res = self.do_request(
62
+ hook_ctx=HookContext(
63
+ config=self.sdk_configuration,
64
+ base_url=base_url or "",
65
+ operation_id="pronunciations_get",
66
+ oauth2_scopes=None,
67
+ security_source=get_security_from_env(
68
+ self.sdk_configuration.security, models.Security
69
+ ),
70
+ ),
71
+ request=req,
72
+ error_status_codes=["4XX", "5XX"],
73
+ retry_config=retry_config,
74
+ )
75
+
76
+ if utils.match_response(http_res, "200", "application/json"):
77
+ return unmarshal_json_response(
78
+ models.PronunciationOverridesDictionary, http_res
79
+ )
80
+ if utils.match_response(http_res, "4XX", "*"):
81
+ http_res_text = utils.stream_to_text(http_res)
82
+ raise errors.APIError("API error occurred", http_res, http_res_text)
83
+ if utils.match_response(http_res, "5XX", "*"):
84
+ http_res_text = utils.stream_to_text(http_res)
85
+ raise errors.APIError("API error occurred", http_res, http_res_text)
86
+
87
+ raise errors.APIError("Unexpected response received", http_res)
88
+
89
+ async def pronunciations_get_async(
90
+ self,
91
+ *,
92
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
93
+ server_url: Optional[str] = None,
94
+ timeout_ms: Optional[int] = None,
95
+ http_headers: Optional[Mapping[str, str]] = None,
96
+ ) -> models.PronunciationOverridesDictionary:
97
+ r"""Get Pronunciations Dictionary
98
+
99
+ :param retries: Override the default retry configuration for this method
100
+ :param server_url: Override the default server URL for this method
101
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
102
+ :param http_headers: Additional headers to set or replace on requests.
103
+ """
104
+ base_url = None
105
+ url_variables = None
106
+ if timeout_ms is None:
107
+ timeout_ms = self.sdk_configuration.timeout_ms
108
+
109
+ if server_url is not None:
110
+ base_url = server_url
111
+ else:
112
+ base_url = self._get_url(base_url, url_variables)
113
+ req = self._build_request_async(
114
+ method="GET",
115
+ path="/api/v1/pronunciations",
116
+ base_url=base_url,
117
+ url_variables=url_variables,
118
+ request=None,
119
+ request_body_required=False,
120
+ request_has_path_params=False,
121
+ request_has_query_params=True,
122
+ user_agent_header="user-agent",
123
+ accept_header_value="application/json",
124
+ http_headers=http_headers,
125
+ security=self.sdk_configuration.security,
126
+ timeout_ms=timeout_ms,
127
+ )
128
+
129
+ if retries == UNSET:
130
+ if self.sdk_configuration.retry_config is not UNSET:
131
+ retries = self.sdk_configuration.retry_config
132
+
133
+ retry_config = None
134
+ if isinstance(retries, utils.RetryConfig):
135
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
136
+
137
+ http_res = await self.do_request_async(
138
+ hook_ctx=HookContext(
139
+ config=self.sdk_configuration,
140
+ base_url=base_url or "",
141
+ operation_id="pronunciations_get",
142
+ oauth2_scopes=None,
143
+ security_source=get_security_from_env(
144
+ self.sdk_configuration.security, models.Security
145
+ ),
146
+ ),
147
+ request=req,
148
+ error_status_codes=["4XX", "5XX"],
149
+ retry_config=retry_config,
150
+ )
151
+
152
+ if utils.match_response(http_res, "200", "application/json"):
153
+ return unmarshal_json_response(
154
+ models.PronunciationOverridesDictionary, http_res
155
+ )
156
+ if utils.match_response(http_res, "4XX", "*"):
157
+ http_res_text = await utils.stream_to_text_async(http_res)
158
+ raise errors.APIError("API error occurred", http_res, http_res_text)
159
+ if utils.match_response(http_res, "5XX", "*"):
160
+ http_res_text = await utils.stream_to_text_async(http_res)
161
+ raise errors.APIError("API error occurred", http_res, http_res_text)
162
+
163
+ raise errors.APIError("Unexpected response received", http_res)
164
+
165
+ def pronunciations_get_metadata(
166
+ self,
167
+ *,
168
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
169
+ server_url: Optional[str] = None,
170
+ timeout_ms: Optional[int] = None,
171
+ http_headers: Optional[Mapping[str, str]] = None,
172
+ ) -> models.DictionaryMetadata:
173
+ r"""Get Pronunciations Metadata
174
+
175
+ :param retries: Override the default retry configuration for this method
176
+ :param server_url: Override the default server URL for this method
177
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
178
+ :param http_headers: Additional headers to set or replace on requests.
179
+ """
180
+ base_url = None
181
+ url_variables = None
182
+ if timeout_ms is None:
183
+ timeout_ms = self.sdk_configuration.timeout_ms
184
+
185
+ if server_url is not None:
186
+ base_url = server_url
187
+ else:
188
+ base_url = self._get_url(base_url, url_variables)
189
+ req = self._build_request(
190
+ method="GET",
191
+ path="/api/v1/pronunciations/metadata",
192
+ base_url=base_url,
193
+ url_variables=url_variables,
194
+ request=None,
195
+ request_body_required=False,
196
+ request_has_path_params=False,
197
+ request_has_query_params=True,
198
+ user_agent_header="user-agent",
199
+ accept_header_value="application/json",
200
+ http_headers=http_headers,
201
+ security=self.sdk_configuration.security,
202
+ timeout_ms=timeout_ms,
203
+ )
204
+
205
+ if retries == UNSET:
206
+ if self.sdk_configuration.retry_config is not UNSET:
207
+ retries = self.sdk_configuration.retry_config
208
+
209
+ retry_config = None
210
+ if isinstance(retries, utils.RetryConfig):
211
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
212
+
213
+ http_res = self.do_request(
214
+ hook_ctx=HookContext(
215
+ config=self.sdk_configuration,
216
+ base_url=base_url or "",
217
+ operation_id="pronunciations_get_metadata",
218
+ oauth2_scopes=None,
219
+ security_source=get_security_from_env(
220
+ self.sdk_configuration.security, models.Security
221
+ ),
222
+ ),
223
+ request=req,
224
+ error_status_codes=["4XX", "5XX"],
225
+ retry_config=retry_config,
226
+ )
227
+
228
+ if utils.match_response(http_res, "200", "application/json"):
229
+ return unmarshal_json_response(models.DictionaryMetadata, http_res)
230
+ if utils.match_response(http_res, "4XX", "*"):
231
+ http_res_text = utils.stream_to_text(http_res)
232
+ raise errors.APIError("API error occurred", http_res, http_res_text)
233
+ if utils.match_response(http_res, "5XX", "*"):
234
+ http_res_text = utils.stream_to_text(http_res)
235
+ raise errors.APIError("API error occurred", http_res, http_res_text)
236
+
237
+ raise errors.APIError("Unexpected response received", http_res)
238
+
239
+ async def pronunciations_get_metadata_async(
240
+ self,
241
+ *,
242
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
243
+ server_url: Optional[str] = None,
244
+ timeout_ms: Optional[int] = None,
245
+ http_headers: Optional[Mapping[str, str]] = None,
246
+ ) -> models.DictionaryMetadata:
247
+ r"""Get Pronunciations Metadata
248
+
249
+ :param retries: Override the default retry configuration for this method
250
+ :param server_url: Override the default server URL for this method
251
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
252
+ :param http_headers: Additional headers to set or replace on requests.
253
+ """
254
+ base_url = None
255
+ url_variables = None
256
+ if timeout_ms is None:
257
+ timeout_ms = self.sdk_configuration.timeout_ms
258
+
259
+ if server_url is not None:
260
+ base_url = server_url
261
+ else:
262
+ base_url = self._get_url(base_url, url_variables)
263
+ req = self._build_request_async(
264
+ method="GET",
265
+ path="/api/v1/pronunciations/metadata",
266
+ base_url=base_url,
267
+ url_variables=url_variables,
268
+ request=None,
269
+ request_body_required=False,
270
+ request_has_path_params=False,
271
+ request_has_query_params=True,
272
+ user_agent_header="user-agent",
273
+ accept_header_value="application/json",
274
+ http_headers=http_headers,
275
+ security=self.sdk_configuration.security,
276
+ timeout_ms=timeout_ms,
277
+ )
278
+
279
+ if retries == UNSET:
280
+ if self.sdk_configuration.retry_config is not UNSET:
281
+ retries = self.sdk_configuration.retry_config
282
+
283
+ retry_config = None
284
+ if isinstance(retries, utils.RetryConfig):
285
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
286
+
287
+ http_res = await self.do_request_async(
288
+ hook_ctx=HookContext(
289
+ config=self.sdk_configuration,
290
+ base_url=base_url or "",
291
+ operation_id="pronunciations_get_metadata",
292
+ oauth2_scopes=None,
293
+ security_source=get_security_from_env(
294
+ self.sdk_configuration.security, models.Security
295
+ ),
296
+ ),
297
+ request=req,
298
+ error_status_codes=["4XX", "5XX"],
299
+ retry_config=retry_config,
300
+ )
301
+
302
+ if utils.match_response(http_res, "200", "application/json"):
303
+ return unmarshal_json_response(models.DictionaryMetadata, http_res)
304
+ if utils.match_response(http_res, "4XX", "*"):
305
+ http_res_text = await utils.stream_to_text_async(http_res)
306
+ raise errors.APIError("API error occurred", http_res, http_res_text)
307
+ if utils.match_response(http_res, "5XX", "*"):
308
+ http_res_text = await utils.stream_to_text_async(http_res)
309
+ raise errors.APIError("API error occurred", http_res, http_res_text)
310
+
311
+ raise errors.APIError("Unexpected response received", http_res)
312
+
313
+ def pronunciations_download_csv(
314
+ self,
315
+ *,
316
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
317
+ server_url: Optional[str] = None,
318
+ timeout_ms: Optional[int] = None,
319
+ http_headers: Optional[Mapping[str, str]] = None,
320
+ ) -> models.PronunciationsDownloadCsvResponse:
321
+ r"""Download Pronunciations Csv
322
+
323
+ :param retries: Override the default retry configuration for this method
324
+ :param server_url: Override the default server URL for this method
325
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
326
+ :param http_headers: Additional headers to set or replace on requests.
327
+ """
328
+ base_url = None
329
+ url_variables = None
330
+ if timeout_ms is None:
331
+ timeout_ms = self.sdk_configuration.timeout_ms
332
+
333
+ if server_url is not None:
334
+ base_url = server_url
335
+ else:
336
+ base_url = self._get_url(base_url, url_variables)
337
+ req = self._build_request(
338
+ method="GET",
339
+ path="/api/v1/pronunciations/csv",
340
+ base_url=base_url,
341
+ url_variables=url_variables,
342
+ request=None,
343
+ request_body_required=False,
344
+ request_has_path_params=False,
345
+ request_has_query_params=True,
346
+ user_agent_header="user-agent",
347
+ accept_header_value="text/csv",
348
+ http_headers=http_headers,
349
+ security=self.sdk_configuration.security,
350
+ timeout_ms=timeout_ms,
351
+ )
352
+
353
+ if retries == UNSET:
354
+ if self.sdk_configuration.retry_config is not UNSET:
355
+ retries = self.sdk_configuration.retry_config
356
+
357
+ retry_config = None
358
+ if isinstance(retries, utils.RetryConfig):
359
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
360
+
361
+ http_res = self.do_request(
362
+ hook_ctx=HookContext(
363
+ config=self.sdk_configuration,
364
+ base_url=base_url or "",
365
+ operation_id="pronunciations_download_csv",
366
+ oauth2_scopes=None,
367
+ security_source=get_security_from_env(
368
+ self.sdk_configuration.security, models.Security
369
+ ),
370
+ ),
371
+ request=req,
372
+ error_status_codes=["4XX", "5XX"],
373
+ stream=True,
374
+ retry_config=retry_config,
375
+ )
376
+
377
+ if utils.match_response(http_res, "200", "text/csv"):
378
+ return models.PronunciationsDownloadCsvResponse(
379
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
380
+ )
381
+ if utils.match_response(http_res, "4XX", "*"):
382
+ http_res_text = utils.stream_to_text(http_res)
383
+ raise errors.APIError("API error occurred", http_res, http_res_text)
384
+ if utils.match_response(http_res, "5XX", "*"):
385
+ http_res_text = utils.stream_to_text(http_res)
386
+ raise errors.APIError("API error occurred", http_res, http_res_text)
387
+
388
+ http_res_text = utils.stream_to_text(http_res)
389
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)
390
+
391
+ async def pronunciations_download_csv_async(
392
+ self,
393
+ *,
394
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
395
+ server_url: Optional[str] = None,
396
+ timeout_ms: Optional[int] = None,
397
+ http_headers: Optional[Mapping[str, str]] = None,
398
+ ) -> models.PronunciationsDownloadCsvResponse:
399
+ r"""Download Pronunciations Csv
400
+
401
+ :param retries: Override the default retry configuration for this method
402
+ :param server_url: Override the default server URL for this method
403
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
404
+ :param http_headers: Additional headers to set or replace on requests.
405
+ """
406
+ base_url = None
407
+ url_variables = None
408
+ if timeout_ms is None:
409
+ timeout_ms = self.sdk_configuration.timeout_ms
410
+
411
+ if server_url is not None:
412
+ base_url = server_url
413
+ else:
414
+ base_url = self._get_url(base_url, url_variables)
415
+ req = self._build_request_async(
416
+ method="GET",
417
+ path="/api/v1/pronunciations/csv",
418
+ base_url=base_url,
419
+ url_variables=url_variables,
420
+ request=None,
421
+ request_body_required=False,
422
+ request_has_path_params=False,
423
+ request_has_query_params=True,
424
+ user_agent_header="user-agent",
425
+ accept_header_value="text/csv",
426
+ http_headers=http_headers,
427
+ security=self.sdk_configuration.security,
428
+ timeout_ms=timeout_ms,
429
+ )
430
+
431
+ if retries == UNSET:
432
+ if self.sdk_configuration.retry_config is not UNSET:
433
+ retries = self.sdk_configuration.retry_config
434
+
435
+ retry_config = None
436
+ if isinstance(retries, utils.RetryConfig):
437
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
438
+
439
+ http_res = await self.do_request_async(
440
+ hook_ctx=HookContext(
441
+ config=self.sdk_configuration,
442
+ base_url=base_url or "",
443
+ operation_id="pronunciations_download_csv",
444
+ oauth2_scopes=None,
445
+ security_source=get_security_from_env(
446
+ self.sdk_configuration.security, models.Security
447
+ ),
448
+ ),
449
+ request=req,
450
+ error_status_codes=["4XX", "5XX"],
451
+ stream=True,
452
+ retry_config=retry_config,
453
+ )
454
+
455
+ if utils.match_response(http_res, "200", "text/csv"):
456
+ return models.PronunciationsDownloadCsvResponse(
457
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
458
+ )
459
+ if utils.match_response(http_res, "4XX", "*"):
460
+ http_res_text = await utils.stream_to_text_async(http_res)
461
+ raise errors.APIError("API error occurred", http_res, http_res_text)
462
+ if utils.match_response(http_res, "5XX", "*"):
463
+ http_res_text = await utils.stream_to_text_async(http_res)
464
+ raise errors.APIError("API error occurred", http_res, http_res_text)
465
+
466
+ http_res_text = await utils.stream_to_text_async(http_res)
467
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)
468
+
469
+ def pronunciations_upload_csv(
470
+ self,
471
+ *,
472
+ request: Union[
473
+ models.BodyPronunciationsUploadCsv,
474
+ models.BodyPronunciationsUploadCsvTypedDict,
475
+ ],
476
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
477
+ server_url: Optional[str] = None,
478
+ timeout_ms: Optional[int] = None,
479
+ http_headers: Optional[Mapping[str, str]] = None,
480
+ ) -> models.PronunciationsCsvUploadResponse:
481
+ r"""Upload Pronunciations Csv
482
+
483
+ :param request: The request object to send.
484
+ :param retries: Override the default retry configuration for this method
485
+ :param server_url: Override the default server URL for this method
486
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
487
+ :param http_headers: Additional headers to set or replace on requests.
488
+ """
489
+ base_url = None
490
+ url_variables = None
491
+ if timeout_ms is None:
492
+ timeout_ms = self.sdk_configuration.timeout_ms
493
+
494
+ if server_url is not None:
495
+ base_url = server_url
496
+ else:
497
+ base_url = self._get_url(base_url, url_variables)
498
+
499
+ if not isinstance(request, BaseModel):
500
+ request = utils.unmarshal(request, models.BodyPronunciationsUploadCsv)
501
+ request = cast(models.BodyPronunciationsUploadCsv, request)
502
+
503
+ req = self._build_request(
504
+ method="POST",
505
+ path="/api/v1/pronunciations/csv",
506
+ base_url=base_url,
507
+ url_variables=url_variables,
508
+ request=request,
509
+ request_body_required=True,
510
+ request_has_path_params=False,
511
+ request_has_query_params=True,
512
+ user_agent_header="user-agent",
513
+ accept_header_value="application/json",
514
+ http_headers=http_headers,
515
+ security=self.sdk_configuration.security,
516
+ get_serialized_body=lambda: utils.serialize_request_body(
517
+ request, False, False, "multipart", models.BodyPronunciationsUploadCsv
518
+ ),
519
+ timeout_ms=timeout_ms,
520
+ )
521
+
522
+ if retries == UNSET:
523
+ if self.sdk_configuration.retry_config is not UNSET:
524
+ retries = self.sdk_configuration.retry_config
525
+
526
+ retry_config = None
527
+ if isinstance(retries, utils.RetryConfig):
528
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
529
+
530
+ http_res = self.do_request(
531
+ hook_ctx=HookContext(
532
+ config=self.sdk_configuration,
533
+ base_url=base_url or "",
534
+ operation_id="pronunciations_upload_csv",
535
+ oauth2_scopes=None,
536
+ security_source=get_security_from_env(
537
+ self.sdk_configuration.security, models.Security
538
+ ),
539
+ ),
540
+ request=req,
541
+ error_status_codes=["422", "4XX", "5XX"],
542
+ retry_config=retry_config,
543
+ )
544
+
545
+ response_data: Any = None
546
+ if utils.match_response(http_res, "202", "application/json"):
547
+ return unmarshal_json_response(
548
+ models.PronunciationsCsvUploadResponse, http_res
549
+ )
550
+ if utils.match_response(http_res, "422", "application/json"):
551
+ response_data = unmarshal_json_response(
552
+ errors.HTTPValidationErrorData, http_res
553
+ )
554
+ raise errors.HTTPValidationError(response_data, http_res)
555
+ if utils.match_response(http_res, "4XX", "*"):
556
+ http_res_text = utils.stream_to_text(http_res)
557
+ raise errors.APIError("API error occurred", http_res, http_res_text)
558
+ if utils.match_response(http_res, "5XX", "*"):
559
+ http_res_text = utils.stream_to_text(http_res)
560
+ raise errors.APIError("API error occurred", http_res, http_res_text)
561
+
562
+ raise errors.APIError("Unexpected response received", http_res)
563
+
564
+ async def pronunciations_upload_csv_async(
565
+ self,
566
+ *,
567
+ request: Union[
568
+ models.BodyPronunciationsUploadCsv,
569
+ models.BodyPronunciationsUploadCsvTypedDict,
570
+ ],
571
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
572
+ server_url: Optional[str] = None,
573
+ timeout_ms: Optional[int] = None,
574
+ http_headers: Optional[Mapping[str, str]] = None,
575
+ ) -> models.PronunciationsCsvUploadResponse:
576
+ r"""Upload Pronunciations Csv
577
+
578
+ :param request: The request object to send.
579
+ :param retries: Override the default retry configuration for this method
580
+ :param server_url: Override the default server URL for this method
581
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
582
+ :param http_headers: Additional headers to set or replace on requests.
583
+ """
584
+ base_url = None
585
+ url_variables = None
586
+ if timeout_ms is None:
587
+ timeout_ms = self.sdk_configuration.timeout_ms
588
+
589
+ if server_url is not None:
590
+ base_url = server_url
591
+ else:
592
+ base_url = self._get_url(base_url, url_variables)
593
+
594
+ if not isinstance(request, BaseModel):
595
+ request = utils.unmarshal(request, models.BodyPronunciationsUploadCsv)
596
+ request = cast(models.BodyPronunciationsUploadCsv, request)
597
+
598
+ req = self._build_request_async(
599
+ method="POST",
600
+ path="/api/v1/pronunciations/csv",
601
+ base_url=base_url,
602
+ url_variables=url_variables,
603
+ request=request,
604
+ request_body_required=True,
605
+ request_has_path_params=False,
606
+ request_has_query_params=True,
607
+ user_agent_header="user-agent",
608
+ accept_header_value="application/json",
609
+ http_headers=http_headers,
610
+ security=self.sdk_configuration.security,
611
+ get_serialized_body=lambda: utils.serialize_request_body(
612
+ request, False, False, "multipart", models.BodyPronunciationsUploadCsv
613
+ ),
614
+ timeout_ms=timeout_ms,
615
+ )
616
+
617
+ if retries == UNSET:
618
+ if self.sdk_configuration.retry_config is not UNSET:
619
+ retries = self.sdk_configuration.retry_config
620
+
621
+ retry_config = None
622
+ if isinstance(retries, utils.RetryConfig):
623
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
624
+
625
+ http_res = await self.do_request_async(
626
+ hook_ctx=HookContext(
627
+ config=self.sdk_configuration,
628
+ base_url=base_url or "",
629
+ operation_id="pronunciations_upload_csv",
630
+ oauth2_scopes=None,
631
+ security_source=get_security_from_env(
632
+ self.sdk_configuration.security, models.Security
633
+ ),
634
+ ),
635
+ request=req,
636
+ error_status_codes=["422", "4XX", "5XX"],
637
+ retry_config=retry_config,
638
+ )
639
+
640
+ response_data: Any = None
641
+ if utils.match_response(http_res, "202", "application/json"):
642
+ return unmarshal_json_response(
643
+ models.PronunciationsCsvUploadResponse, http_res
644
+ )
645
+ if utils.match_response(http_res, "422", "application/json"):
646
+ response_data = unmarshal_json_response(
647
+ errors.HTTPValidationErrorData, http_res
648
+ )
649
+ raise errors.HTTPValidationError(response_data, http_res)
650
+ if utils.match_response(http_res, "4XX", "*"):
651
+ http_res_text = await utils.stream_to_text_async(http_res)
652
+ raise errors.APIError("API error occurred", http_res, http_res_text)
653
+ if utils.match_response(http_res, "5XX", "*"):
654
+ http_res_text = await utils.stream_to_text_async(http_res)
655
+ raise errors.APIError("API error occurred", http_res, http_res_text)
656
+
657
+ raise errors.APIError("Unexpected response received", http_res)
658
+
659
+ def pronunciations_delete_csv(
660
+ self,
661
+ *,
662
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
663
+ server_url: Optional[str] = None,
664
+ timeout_ms: Optional[int] = None,
665
+ http_headers: Optional[Mapping[str, str]] = None,
666
+ ):
667
+ r"""Delete Pronunciations Dictionary
668
+
669
+ :param retries: Override the default retry configuration for this method
670
+ :param server_url: Override the default server URL for this method
671
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
672
+ :param http_headers: Additional headers to set or replace on requests.
673
+ """
674
+ base_url = None
675
+ url_variables = None
676
+ if timeout_ms is None:
677
+ timeout_ms = self.sdk_configuration.timeout_ms
678
+
679
+ if server_url is not None:
680
+ base_url = server_url
681
+ else:
682
+ base_url = self._get_url(base_url, url_variables)
683
+ req = self._build_request(
684
+ method="DELETE",
685
+ path="/api/v1/pronunciations/csv",
686
+ base_url=base_url,
687
+ url_variables=url_variables,
688
+ request=None,
689
+ request_body_required=False,
690
+ request_has_path_params=False,
691
+ request_has_query_params=True,
692
+ user_agent_header="user-agent",
693
+ accept_header_value="*/*",
694
+ http_headers=http_headers,
695
+ security=self.sdk_configuration.security,
696
+ timeout_ms=timeout_ms,
697
+ )
698
+
699
+ if retries == UNSET:
700
+ if self.sdk_configuration.retry_config is not UNSET:
701
+ retries = self.sdk_configuration.retry_config
702
+
703
+ retry_config = None
704
+ if isinstance(retries, utils.RetryConfig):
705
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
706
+
707
+ http_res = self.do_request(
708
+ hook_ctx=HookContext(
709
+ config=self.sdk_configuration,
710
+ base_url=base_url or "",
711
+ operation_id="pronunciations_delete_csv",
712
+ oauth2_scopes=None,
713
+ security_source=get_security_from_env(
714
+ self.sdk_configuration.security, models.Security
715
+ ),
716
+ ),
717
+ request=req,
718
+ error_status_codes=["4XX", "5XX"],
719
+ retry_config=retry_config,
720
+ )
721
+
722
+ if utils.match_response(http_res, "204", "*"):
723
+ return
724
+ if utils.match_response(http_res, "4XX", "*"):
725
+ http_res_text = utils.stream_to_text(http_res)
726
+ raise errors.APIError("API error occurred", http_res, http_res_text)
727
+ if utils.match_response(http_res, "5XX", "*"):
728
+ http_res_text = utils.stream_to_text(http_res)
729
+ raise errors.APIError("API error occurred", http_res, http_res_text)
730
+
731
+ raise errors.APIError("Unexpected response received", http_res)
732
+
733
+ async def pronunciations_delete_csv_async(
734
+ self,
735
+ *,
736
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
737
+ server_url: Optional[str] = None,
738
+ timeout_ms: Optional[int] = None,
739
+ http_headers: Optional[Mapping[str, str]] = None,
740
+ ):
741
+ r"""Delete Pronunciations Dictionary
742
+
743
+ :param retries: Override the default retry configuration for this method
744
+ :param server_url: Override the default server URL for this method
745
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
746
+ :param http_headers: Additional headers to set or replace on requests.
747
+ """
748
+ base_url = None
749
+ url_variables = None
750
+ if timeout_ms is None:
751
+ timeout_ms = self.sdk_configuration.timeout_ms
752
+
753
+ if server_url is not None:
754
+ base_url = server_url
755
+ else:
756
+ base_url = self._get_url(base_url, url_variables)
757
+ req = self._build_request_async(
758
+ method="DELETE",
759
+ path="/api/v1/pronunciations/csv",
760
+ base_url=base_url,
761
+ url_variables=url_variables,
762
+ request=None,
763
+ request_body_required=False,
764
+ request_has_path_params=False,
765
+ request_has_query_params=True,
766
+ user_agent_header="user-agent",
767
+ accept_header_value="*/*",
768
+ http_headers=http_headers,
769
+ security=self.sdk_configuration.security,
770
+ timeout_ms=timeout_ms,
771
+ )
772
+
773
+ if retries == UNSET:
774
+ if self.sdk_configuration.retry_config is not UNSET:
775
+ retries = self.sdk_configuration.retry_config
776
+
777
+ retry_config = None
778
+ if isinstance(retries, utils.RetryConfig):
779
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
780
+
781
+ http_res = await self.do_request_async(
782
+ hook_ctx=HookContext(
783
+ config=self.sdk_configuration,
784
+ base_url=base_url or "",
785
+ operation_id="pronunciations_delete_csv",
786
+ oauth2_scopes=None,
787
+ security_source=get_security_from_env(
788
+ self.sdk_configuration.security, models.Security
789
+ ),
790
+ ),
791
+ request=req,
792
+ error_status_codes=["4XX", "5XX"],
793
+ retry_config=retry_config,
794
+ )
795
+
796
+ if utils.match_response(http_res, "204", "*"):
797
+ return
798
+ if utils.match_response(http_res, "4XX", "*"):
799
+ http_res_text = await utils.stream_to_text_async(http_res)
800
+ raise errors.APIError("API error occurred", http_res, http_res_text)
801
+ if utils.match_response(http_res, "5XX", "*"):
802
+ http_res_text = await utils.stream_to_text_async(http_res)
803
+ raise errors.APIError("API error occurred", http_res, http_res_text)
804
+
805
+ raise errors.APIError("Unexpected response received", http_res)