camb-sdk 1.5.4__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 (167) hide show
  1. camb/__init__.py +335 -0
  2. camb/audio_separation/__init__.py +4 -0
  3. camb/audio_separation/client.py +406 -0
  4. camb/audio_separation/raw_client.py +534 -0
  5. camb/client.py +717 -0
  6. camb/core/__init__.py +105 -0
  7. camb/core/api_error.py +23 -0
  8. camb/core/client_wrapper.py +113 -0
  9. camb/core/datetime_utils.py +28 -0
  10. camb/core/file.py +67 -0
  11. camb/core/force_multipart.py +18 -0
  12. camb/core/http_client.py +663 -0
  13. camb/core/http_response.py +55 -0
  14. camb/core/http_sse/__init__.py +42 -0
  15. camb/core/http_sse/_api.py +112 -0
  16. camb/core/http_sse/_decoders.py +61 -0
  17. camb/core/http_sse/_exceptions.py +7 -0
  18. camb/core/http_sse/_models.py +17 -0
  19. camb/core/jsonable_encoder.py +100 -0
  20. camb/core/pydantic_utilities.py +260 -0
  21. camb/core/query_encoder.py +58 -0
  22. camb/core/remove_none_from_dict.py +11 -0
  23. camb/core/request_options.py +35 -0
  24. camb/core/serialization.py +276 -0
  25. camb/deprecated_streaming/__init__.py +4 -0
  26. camb/deprecated_streaming/client.py +532 -0
  27. camb/deprecated_streaming/raw_client.py +639 -0
  28. camb/dictionaries/__init__.py +4 -0
  29. camb/dictionaries/client.py +785 -0
  30. camb/dictionaries/raw_client.py +1048 -0
  31. camb/dub/__init__.py +49 -0
  32. camb/dub/client.py +846 -0
  33. camb/dub/raw_client.py +1194 -0
  34. camb/dub/types/__init__.py +53 -0
  35. camb/dub/types/dubbed_output_in_alt_format_request_payload_output_format.py +8 -0
  36. camb/dub/types/get_dubbed_output_in_alt_format_dub_alt_format_run_id_language_post_response.py +9 -0
  37. camb/dub/types/get_dubbed_run_info_dub_result_run_id_get_response.py +7 -0
  38. camb/dub/types/get_dubbing_runs_results_dubbing_results_post_response_value.py +7 -0
  39. camb/environment.py +7 -0
  40. camb/errors/__init__.py +34 -0
  41. camb/errors/unprocessable_entity_error.py +11 -0
  42. camb/folders/__init__.py +4 -0
  43. camb/folders/client.py +213 -0
  44. camb/folders/raw_client.py +278 -0
  45. camb/languages/__init__.py +4 -0
  46. camb/languages/client.py +168 -0
  47. camb/languages/raw_client.py +223 -0
  48. camb/project_setup/__init__.py +4 -0
  49. camb/project_setup/client.py +537 -0
  50. camb/project_setup/raw_client.py +655 -0
  51. camb/py.typed +0 -0
  52. camb/raw_client.py +236 -0
  53. camb/story/__init__.py +37 -0
  54. camb/story/client.py +579 -0
  55. camb/story/raw_client.py +743 -0
  56. camb/story/types/__init__.py +38 -0
  57. camb/story/types/create_story_story_post_response.py +8 -0
  58. camb/story/types/setup_story_story_setup_post_response.py +8 -0
  59. camb/streaming/__init__.py +4 -0
  60. camb/streaming/client.py +645 -0
  61. camb/streaming/raw_client.py +796 -0
  62. camb/text_to_audio/__init__.py +4 -0
  63. camb/text_to_audio/client.py +469 -0
  64. camb/text_to_audio/raw_client.py +610 -0
  65. camb/text_to_speech/__init__.py +49 -0
  66. camb/text_to_speech/baseten.py +214 -0
  67. camb/text_to_speech/client.py +742 -0
  68. camb/text_to_speech/raw_client.py +995 -0
  69. camb/text_to_speech/types/__init__.py +47 -0
  70. camb/text_to_speech/types/create_stream_tts_request_payload_language.py +71 -0
  71. camb/text_to_speech/types/create_stream_tts_request_payload_speech_model.py +7 -0
  72. camb/text_to_speech/types/get_tts_results_tts_results_post_response_value.py +7 -0
  73. camb/text_to_speech/types/get_tts_run_info_tts_result_run_id_get_response.py +7 -0
  74. camb/text_to_voice/__init__.py +4 -0
  75. camb/text_to_voice/client.py +329 -0
  76. camb/text_to_voice/raw_client.py +405 -0
  77. camb/transcription/__init__.py +4 -0
  78. camb/transcription/client.py +465 -0
  79. camb/transcription/raw_client.py +587 -0
  80. camb/translated_story/__init__.py +4 -0
  81. camb/translated_story/client.py +309 -0
  82. camb/translated_story/raw_client.py +381 -0
  83. camb/translated_tts/__init__.py +4 -0
  84. camb/translated_tts/client.py +313 -0
  85. camb/translated_tts/raw_client.py +357 -0
  86. camb/translation/__init__.py +4 -0
  87. camb/translation/client.py +631 -0
  88. camb/translation/raw_client.py +787 -0
  89. camb/types/__init__.py +236 -0
  90. camb/types/add_target_language_out.py +20 -0
  91. camb/types/audio_output_type.py +5 -0
  92. camb/types/audio_stream.py +31 -0
  93. camb/types/config_stream.py +22 -0
  94. camb/types/config_stream_pipeline.py +28 -0
  95. camb/types/create_custom_voice_out.py +19 -0
  96. camb/types/create_project_setup_out.py +19 -0
  97. camb/types/create_stream_out.py +22 -0
  98. camb/types/create_stream_request_payload.py +70 -0
  99. camb/types/create_translated_tts_out.py +19 -0
  100. camb/types/create_tts_out.py +19 -0
  101. camb/types/data_stream.py +24 -0
  102. camb/types/demixing_option.py +10 -0
  103. camb/types/dictionary_term.py +21 -0
  104. camb/types/dictionary_with_terms.py +28 -0
  105. camb/types/dubbing_result.py +22 -0
  106. camb/types/exception_reasons.py +30 -0
  107. camb/types/folder.py +20 -0
  108. camb/types/formalities.py +3 -0
  109. camb/types/gender.py +3 -0
  110. camb/types/get_audio_separation_result_out.py +20 -0
  111. camb/types/get_create_project_setup_response.py +21 -0
  112. camb/types/get_probe_stream_in.py +21 -0
  113. camb/types/get_probe_stream_out.py +24 -0
  114. camb/types/get_setup_story_result_response.py +21 -0
  115. camb/types/get_text_to_voice_result_out.py +19 -0
  116. camb/types/get_tts_result_out_file_url.py +19 -0
  117. camb/types/http_validation_error.py +20 -0
  118. camb/types/language_enums.py +154 -0
  119. camb/types/language_pydantic_model.py +21 -0
  120. camb/types/languages.py +3 -0
  121. camb/types/orchestrator_pipeline_call_result.py +19 -0
  122. camb/types/orchestrator_pipeline_result.py +25 -0
  123. camb/types/orchestrator_pipeline_result_exception_reason.py +7 -0
  124. camb/types/orchestrator_pipeline_result_message.py +5 -0
  125. camb/types/output_format.py +10 -0
  126. camb/types/overdub_config.py +37 -0
  127. camb/types/project_details.py +28 -0
  128. camb/types/revoicing_option.py +5 -0
  129. camb/types/run_i_ds_request_payload.py +19 -0
  130. camb/types/segmenting_option.py +5 -0
  131. camb/types/source_stream.py +30 -0
  132. camb/types/story_details.py +27 -0
  133. camb/types/stream_category.py +3 -0
  134. camb/types/stream_tts_inference_options.py +38 -0
  135. camb/types/stream_tts_output_configuration.py +33 -0
  136. camb/types/stream_tts_voice_settings.py +28 -0
  137. camb/types/stream_type.py +3 -0
  138. camb/types/stream_url_for_languages.py +21 -0
  139. camb/types/target_stream.py +34 -0
  140. camb/types/task_status.py +5 -0
  141. camb/types/term_translation_input.py +21 -0
  142. camb/types/term_translation_output.py +20 -0
  143. camb/types/text_to_audio_result.py +19 -0
  144. camb/types/text_to_audio_type.py +5 -0
  145. camb/types/transcribing_option.py +5 -0
  146. camb/types/transcript.py +22 -0
  147. camb/types/transcript_data_type.py +5 -0
  148. camb/types/transcript_file_format.py +5 -0
  149. camb/types/transcription_result.py +20 -0
  150. camb/types/translating_option.py +5 -0
  151. camb/types/translation_result.py +19 -0
  152. camb/types/tts_provider.py +3 -0
  153. camb/types/validation_error.py +22 -0
  154. camb/types/validation_error_loc_item.py +5 -0
  155. camb/types/video_output_type_without_avi.py +5 -0
  156. camb/types/video_stream.py +28 -0
  157. camb/types/voice.py +28 -0
  158. camb/voice_cloning/__init__.py +34 -0
  159. camb/voice_cloning/client.py +265 -0
  160. camb/voice_cloning/raw_client.py +320 -0
  161. camb/voice_cloning/types/__init__.py +36 -0
  162. camb/voice_cloning/types/list_voices_list_voices_get_response_item.py +7 -0
  163. camb_sdk-1.5.4.dist-info/METADATA +282 -0
  164. camb_sdk-1.5.4.dist-info/RECORD +167 -0
  165. camb_sdk-1.5.4.dist-info/WHEEL +5 -0
  166. camb_sdk-1.5.4.dist-info/licenses/LICENSE +21 -0
  167. camb_sdk-1.5.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,796 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ..core.api_error import ApiError
8
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
10
+ from ..core.jsonable_encoder import jsonable_encoder
11
+ from ..core.pydantic_utilities import parse_obj_as
12
+ from ..core.request_options import RequestOptions
13
+ from ..core.serialization import convert_and_respect_annotation_metadata
14
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
15
+ from ..types.config_stream import ConfigStream
16
+ from ..types.create_stream_out import CreateStreamOut
17
+ from ..types.get_probe_stream_out import GetProbeStreamOut
18
+ from ..types.http_validation_error import HttpValidationError
19
+ from ..types.languages import Languages
20
+ from ..types.source_stream import SourceStream
21
+ from ..types.target_stream import TargetStream
22
+
23
+ # this is used as the default value for optional parameters
24
+ OMIT = typing.cast(typing.Any, ...)
25
+
26
+
27
+ class RawStreamingClient:
28
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
29
+ self._client_wrapper = client_wrapper
30
+
31
+ def create_stream(
32
+ self,
33
+ *,
34
+ voices: typing.Sequence[int],
35
+ dictionaries: typing.Sequence[int],
36
+ config: ConfigStream,
37
+ source_stream: SourceStream,
38
+ target_streams: typing.Sequence[TargetStream],
39
+ name: typing.Optional[str] = OMIT,
40
+ description: typing.Optional[str] = OMIT,
41
+ initial_delay: typing.Optional[int] = OMIT,
42
+ timeout_in_mins: typing.Optional[int] = OMIT,
43
+ start_time: typing.Optional[dt.datetime] = OMIT,
44
+ end_time: typing.Optional[dt.datetime] = OMIT,
45
+ timezone: typing.Optional[str] = OMIT,
46
+ request_options: typing.Optional[RequestOptions] = None,
47
+ ) -> HttpResponse[CreateStreamOut]:
48
+ """
49
+ Parameters
50
+ ----------
51
+ voices : typing.Sequence[int]
52
+ List of voice identifiers to be used in the stream.
53
+
54
+ dictionaries : typing.Sequence[int]
55
+ List of dictionary identifiers to be used in the stream.
56
+
57
+ config : ConfigStream
58
+ The shared configuration for the streaming pipeline.
59
+
60
+ source_stream : SourceStream
61
+ The source stream configuration details.
62
+
63
+ target_streams : typing.Sequence[TargetStream]
64
+ List of target stream configurations.
65
+
66
+ name : typing.Optional[str]
67
+ The name of the stream.
68
+
69
+ description : typing.Optional[str]
70
+ The description of the stream.
71
+
72
+ initial_delay : typing.Optional[int]
73
+ The initial delay in seconds before starting the stream creation process.
74
+
75
+ timeout_in_mins : typing.Optional[int]
76
+ The maximum duration in minutes for the stream creation process before timing out.
77
+
78
+ start_time : typing.Optional[dt.datetime]
79
+
80
+ end_time : typing.Optional[dt.datetime]
81
+
82
+ timezone : typing.Optional[str]
83
+
84
+ request_options : typing.Optional[RequestOptions]
85
+ Request-specific configuration.
86
+
87
+ Returns
88
+ -------
89
+ HttpResponse[CreateStreamOut]
90
+ Successful Response
91
+ """
92
+ _response = self._client_wrapper.httpx_client.request(
93
+ "stream",
94
+ method="POST",
95
+ json={
96
+ "name": name,
97
+ "description": description,
98
+ "initial_delay": initial_delay,
99
+ "timeout_in_mins": timeout_in_mins,
100
+ "voices": voices,
101
+ "dictionaries": dictionaries,
102
+ "config": convert_and_respect_annotation_metadata(
103
+ object_=config, annotation=ConfigStream, direction="write"
104
+ ),
105
+ "source_stream": convert_and_respect_annotation_metadata(
106
+ object_=source_stream, annotation=SourceStream, direction="write"
107
+ ),
108
+ "target_streams": convert_and_respect_annotation_metadata(
109
+ object_=target_streams, annotation=typing.Sequence[TargetStream], direction="write"
110
+ ),
111
+ "start_time": start_time,
112
+ "end_time": end_time,
113
+ "timezone": timezone,
114
+ },
115
+ headers={
116
+ "content-type": "application/json",
117
+ },
118
+ request_options=request_options,
119
+ omit=OMIT,
120
+ )
121
+ try:
122
+ if 200 <= _response.status_code < 300:
123
+ _data = typing.cast(
124
+ CreateStreamOut,
125
+ parse_obj_as(
126
+ type_=CreateStreamOut, # type: ignore
127
+ object_=_response.json(),
128
+ ),
129
+ )
130
+ return HttpResponse(response=_response, data=_data)
131
+ if _response.status_code == 422:
132
+ raise UnprocessableEntityError(
133
+ headers=dict(_response.headers),
134
+ body=typing.cast(
135
+ HttpValidationError,
136
+ parse_obj_as(
137
+ type_=HttpValidationError, # type: ignore
138
+ object_=_response.json(),
139
+ ),
140
+ ),
141
+ )
142
+ _response_json = _response.json()
143
+ except JSONDecodeError:
144
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
145
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
146
+
147
+ def get_stream_result(
148
+ self,
149
+ stream_id: int,
150
+ *,
151
+ run_id: typing.Optional[int] = None,
152
+ request_options: typing.Optional[RequestOptions] = None,
153
+ ) -> HttpResponse[typing.Dict[str, typing.Any]]:
154
+ """
155
+ Parameters
156
+ ----------
157
+ stream_id : int
158
+
159
+ run_id : typing.Optional[int]
160
+
161
+ request_options : typing.Optional[RequestOptions]
162
+ Request-specific configuration.
163
+
164
+ Returns
165
+ -------
166
+ HttpResponse[typing.Dict[str, typing.Any]]
167
+ Successful Response
168
+ """
169
+ _response = self._client_wrapper.httpx_client.request(
170
+ f"stream/{jsonable_encoder(stream_id)}",
171
+ method="GET",
172
+ params={
173
+ "run_id": run_id,
174
+ },
175
+ request_options=request_options,
176
+ )
177
+ try:
178
+ if 200 <= _response.status_code < 300:
179
+ _data = typing.cast(
180
+ typing.Dict[str, typing.Any],
181
+ parse_obj_as(
182
+ type_=typing.Dict[str, typing.Any], # type: ignore
183
+ object_=_response.json(),
184
+ ),
185
+ )
186
+ return HttpResponse(response=_response, data=_data)
187
+ if _response.status_code == 422:
188
+ raise UnprocessableEntityError(
189
+ headers=dict(_response.headers),
190
+ body=typing.cast(
191
+ HttpValidationError,
192
+ parse_obj_as(
193
+ type_=HttpValidationError, # type: ignore
194
+ object_=_response.json(),
195
+ ),
196
+ ),
197
+ )
198
+ _response_json = _response.json()
199
+ except JSONDecodeError:
200
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
201
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
202
+
203
+ def destroy_stream(
204
+ self,
205
+ stream_id: int,
206
+ *,
207
+ run_id: typing.Optional[int] = None,
208
+ request_options: typing.Optional[RequestOptions] = None,
209
+ ) -> HttpResponse[typing.Dict[str, typing.Any]]:
210
+ """
211
+ Parameters
212
+ ----------
213
+ stream_id : int
214
+
215
+ run_id : typing.Optional[int]
216
+
217
+ request_options : typing.Optional[RequestOptions]
218
+ Request-specific configuration.
219
+
220
+ Returns
221
+ -------
222
+ HttpResponse[typing.Dict[str, typing.Any]]
223
+ Successful Response
224
+ """
225
+ _response = self._client_wrapper.httpx_client.request(
226
+ f"stream/{jsonable_encoder(stream_id)}",
227
+ method="DELETE",
228
+ params={
229
+ "run_id": run_id,
230
+ },
231
+ request_options=request_options,
232
+ )
233
+ try:
234
+ if 200 <= _response.status_code < 300:
235
+ _data = typing.cast(
236
+ typing.Dict[str, typing.Any],
237
+ parse_obj_as(
238
+ type_=typing.Dict[str, typing.Any], # type: ignore
239
+ object_=_response.json(),
240
+ ),
241
+ )
242
+ return HttpResponse(response=_response, data=_data)
243
+ if _response.status_code == 422:
244
+ raise UnprocessableEntityError(
245
+ headers=dict(_response.headers),
246
+ body=typing.cast(
247
+ HttpValidationError,
248
+ parse_obj_as(
249
+ type_=HttpValidationError, # type: ignore
250
+ object_=_response.json(),
251
+ ),
252
+ ),
253
+ )
254
+ _response_json = _response.json()
255
+ except JSONDecodeError:
256
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
257
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
258
+
259
+ def patch_stream_data(
260
+ self,
261
+ stream_id: int,
262
+ *,
263
+ run_id: typing.Optional[int] = None,
264
+ start_time: typing.Optional[dt.datetime] = OMIT,
265
+ end_time: typing.Optional[dt.datetime] = OMIT,
266
+ payload: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
267
+ target_languages: typing.Optional[typing.Sequence[Languages]] = OMIT,
268
+ timezone: typing.Optional[str] = OMIT,
269
+ request_options: typing.Optional[RequestOptions] = None,
270
+ ) -> HttpResponse[typing.Dict[str, typing.Any]]:
271
+ """
272
+ Parameters
273
+ ----------
274
+ stream_id : int
275
+
276
+ run_id : typing.Optional[int]
277
+
278
+ start_time : typing.Optional[dt.datetime]
279
+
280
+ end_time : typing.Optional[dt.datetime]
281
+
282
+ payload : typing.Optional[typing.Dict[str, typing.Any]]
283
+
284
+ target_languages : typing.Optional[typing.Sequence[Languages]]
285
+
286
+ timezone : typing.Optional[str]
287
+
288
+ request_options : typing.Optional[RequestOptions]
289
+ Request-specific configuration.
290
+
291
+ Returns
292
+ -------
293
+ HttpResponse[typing.Dict[str, typing.Any]]
294
+ Successful Response
295
+ """
296
+ _response = self._client_wrapper.httpx_client.request(
297
+ f"stream/{jsonable_encoder(stream_id)}",
298
+ method="PATCH",
299
+ params={
300
+ "run_id": run_id,
301
+ },
302
+ json={
303
+ "start_time": start_time,
304
+ "end_time": end_time,
305
+ "payload": payload,
306
+ "target_languages": target_languages,
307
+ "timezone": timezone,
308
+ },
309
+ headers={
310
+ "content-type": "application/json",
311
+ },
312
+ request_options=request_options,
313
+ omit=OMIT,
314
+ )
315
+ try:
316
+ if 200 <= _response.status_code < 300:
317
+ _data = typing.cast(
318
+ typing.Dict[str, typing.Any],
319
+ parse_obj_as(
320
+ type_=typing.Dict[str, typing.Any], # type: ignore
321
+ object_=_response.json(),
322
+ ),
323
+ )
324
+ return HttpResponse(response=_response, data=_data)
325
+ if _response.status_code == 422:
326
+ raise UnprocessableEntityError(
327
+ headers=dict(_response.headers),
328
+ body=typing.cast(
329
+ HttpValidationError,
330
+ parse_obj_as(
331
+ type_=HttpValidationError, # type: ignore
332
+ object_=_response.json(),
333
+ ),
334
+ ),
335
+ )
336
+ _response_json = _response.json()
337
+ except JSONDecodeError:
338
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
339
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
340
+
341
+ def get_probe_stream(
342
+ self,
343
+ *,
344
+ url: str,
345
+ run_id: typing.Optional[int] = None,
346
+ passphrase: typing.Optional[str] = OMIT,
347
+ stream_id: typing.Optional[str] = OMIT,
348
+ request_options: typing.Optional[RequestOptions] = None,
349
+ ) -> HttpResponse[GetProbeStreamOut]:
350
+ """
351
+ Parameters
352
+ ----------
353
+ url : str
354
+
355
+ run_id : typing.Optional[int]
356
+
357
+ passphrase : typing.Optional[str]
358
+
359
+ stream_id : typing.Optional[str]
360
+
361
+ request_options : typing.Optional[RequestOptions]
362
+ Request-specific configuration.
363
+
364
+ Returns
365
+ -------
366
+ HttpResponse[GetProbeStreamOut]
367
+ Successful Response
368
+ """
369
+ _response = self._client_wrapper.httpx_client.request(
370
+ "stream/probe",
371
+ method="POST",
372
+ params={
373
+ "run_id": run_id,
374
+ },
375
+ json={
376
+ "url": url,
377
+ "passphrase": passphrase,
378
+ "stream_id": stream_id,
379
+ },
380
+ headers={
381
+ "content-type": "application/json",
382
+ },
383
+ request_options=request_options,
384
+ omit=OMIT,
385
+ )
386
+ try:
387
+ if 200 <= _response.status_code < 300:
388
+ _data = typing.cast(
389
+ GetProbeStreamOut,
390
+ parse_obj_as(
391
+ type_=GetProbeStreamOut, # type: ignore
392
+ object_=_response.json(),
393
+ ),
394
+ )
395
+ return HttpResponse(response=_response, data=_data)
396
+ if _response.status_code == 422:
397
+ raise UnprocessableEntityError(
398
+ headers=dict(_response.headers),
399
+ body=typing.cast(
400
+ HttpValidationError,
401
+ parse_obj_as(
402
+ type_=HttpValidationError, # type: ignore
403
+ object_=_response.json(),
404
+ ),
405
+ ),
406
+ )
407
+ _response_json = _response.json()
408
+ except JSONDecodeError:
409
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
410
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
411
+
412
+
413
+ class AsyncRawStreamingClient:
414
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
415
+ self._client_wrapper = client_wrapper
416
+
417
+ async def create_stream(
418
+ self,
419
+ *,
420
+ voices: typing.Sequence[int],
421
+ dictionaries: typing.Sequence[int],
422
+ config: ConfigStream,
423
+ source_stream: SourceStream,
424
+ target_streams: typing.Sequence[TargetStream],
425
+ name: typing.Optional[str] = OMIT,
426
+ description: typing.Optional[str] = OMIT,
427
+ initial_delay: typing.Optional[int] = OMIT,
428
+ timeout_in_mins: typing.Optional[int] = OMIT,
429
+ start_time: typing.Optional[dt.datetime] = OMIT,
430
+ end_time: typing.Optional[dt.datetime] = OMIT,
431
+ timezone: typing.Optional[str] = OMIT,
432
+ request_options: typing.Optional[RequestOptions] = None,
433
+ ) -> AsyncHttpResponse[CreateStreamOut]:
434
+ """
435
+ Parameters
436
+ ----------
437
+ voices : typing.Sequence[int]
438
+ List of voice identifiers to be used in the stream.
439
+
440
+ dictionaries : typing.Sequence[int]
441
+ List of dictionary identifiers to be used in the stream.
442
+
443
+ config : ConfigStream
444
+ The shared configuration for the streaming pipeline.
445
+
446
+ source_stream : SourceStream
447
+ The source stream configuration details.
448
+
449
+ target_streams : typing.Sequence[TargetStream]
450
+ List of target stream configurations.
451
+
452
+ name : typing.Optional[str]
453
+ The name of the stream.
454
+
455
+ description : typing.Optional[str]
456
+ The description of the stream.
457
+
458
+ initial_delay : typing.Optional[int]
459
+ The initial delay in seconds before starting the stream creation process.
460
+
461
+ timeout_in_mins : typing.Optional[int]
462
+ The maximum duration in minutes for the stream creation process before timing out.
463
+
464
+ start_time : typing.Optional[dt.datetime]
465
+
466
+ end_time : typing.Optional[dt.datetime]
467
+
468
+ timezone : typing.Optional[str]
469
+
470
+ request_options : typing.Optional[RequestOptions]
471
+ Request-specific configuration.
472
+
473
+ Returns
474
+ -------
475
+ AsyncHttpResponse[CreateStreamOut]
476
+ Successful Response
477
+ """
478
+ _response = await self._client_wrapper.httpx_client.request(
479
+ "stream",
480
+ method="POST",
481
+ json={
482
+ "name": name,
483
+ "description": description,
484
+ "initial_delay": initial_delay,
485
+ "timeout_in_mins": timeout_in_mins,
486
+ "voices": voices,
487
+ "dictionaries": dictionaries,
488
+ "config": convert_and_respect_annotation_metadata(
489
+ object_=config, annotation=ConfigStream, direction="write"
490
+ ),
491
+ "source_stream": convert_and_respect_annotation_metadata(
492
+ object_=source_stream, annotation=SourceStream, direction="write"
493
+ ),
494
+ "target_streams": convert_and_respect_annotation_metadata(
495
+ object_=target_streams, annotation=typing.Sequence[TargetStream], direction="write"
496
+ ),
497
+ "start_time": start_time,
498
+ "end_time": end_time,
499
+ "timezone": timezone,
500
+ },
501
+ headers={
502
+ "content-type": "application/json",
503
+ },
504
+ request_options=request_options,
505
+ omit=OMIT,
506
+ )
507
+ try:
508
+ if 200 <= _response.status_code < 300:
509
+ _data = typing.cast(
510
+ CreateStreamOut,
511
+ parse_obj_as(
512
+ type_=CreateStreamOut, # type: ignore
513
+ object_=_response.json(),
514
+ ),
515
+ )
516
+ return AsyncHttpResponse(response=_response, data=_data)
517
+ if _response.status_code == 422:
518
+ raise UnprocessableEntityError(
519
+ headers=dict(_response.headers),
520
+ body=typing.cast(
521
+ HttpValidationError,
522
+ parse_obj_as(
523
+ type_=HttpValidationError, # type: ignore
524
+ object_=_response.json(),
525
+ ),
526
+ ),
527
+ )
528
+ _response_json = _response.json()
529
+ except JSONDecodeError:
530
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
531
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
532
+
533
+ async def get_stream_result(
534
+ self,
535
+ stream_id: int,
536
+ *,
537
+ run_id: typing.Optional[int] = None,
538
+ request_options: typing.Optional[RequestOptions] = None,
539
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
540
+ """
541
+ Parameters
542
+ ----------
543
+ stream_id : int
544
+
545
+ run_id : typing.Optional[int]
546
+
547
+ request_options : typing.Optional[RequestOptions]
548
+ Request-specific configuration.
549
+
550
+ Returns
551
+ -------
552
+ AsyncHttpResponse[typing.Dict[str, typing.Any]]
553
+ Successful Response
554
+ """
555
+ _response = await self._client_wrapper.httpx_client.request(
556
+ f"stream/{jsonable_encoder(stream_id)}",
557
+ method="GET",
558
+ params={
559
+ "run_id": run_id,
560
+ },
561
+ request_options=request_options,
562
+ )
563
+ try:
564
+ if 200 <= _response.status_code < 300:
565
+ _data = typing.cast(
566
+ typing.Dict[str, typing.Any],
567
+ parse_obj_as(
568
+ type_=typing.Dict[str, typing.Any], # type: ignore
569
+ object_=_response.json(),
570
+ ),
571
+ )
572
+ return AsyncHttpResponse(response=_response, data=_data)
573
+ if _response.status_code == 422:
574
+ raise UnprocessableEntityError(
575
+ headers=dict(_response.headers),
576
+ body=typing.cast(
577
+ HttpValidationError,
578
+ parse_obj_as(
579
+ type_=HttpValidationError, # type: ignore
580
+ object_=_response.json(),
581
+ ),
582
+ ),
583
+ )
584
+ _response_json = _response.json()
585
+ except JSONDecodeError:
586
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
587
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
588
+
589
+ async def destroy_stream(
590
+ self,
591
+ stream_id: int,
592
+ *,
593
+ run_id: typing.Optional[int] = None,
594
+ request_options: typing.Optional[RequestOptions] = None,
595
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
596
+ """
597
+ Parameters
598
+ ----------
599
+ stream_id : int
600
+
601
+ run_id : typing.Optional[int]
602
+
603
+ request_options : typing.Optional[RequestOptions]
604
+ Request-specific configuration.
605
+
606
+ Returns
607
+ -------
608
+ AsyncHttpResponse[typing.Dict[str, typing.Any]]
609
+ Successful Response
610
+ """
611
+ _response = await self._client_wrapper.httpx_client.request(
612
+ f"stream/{jsonable_encoder(stream_id)}",
613
+ method="DELETE",
614
+ params={
615
+ "run_id": run_id,
616
+ },
617
+ request_options=request_options,
618
+ )
619
+ try:
620
+ if 200 <= _response.status_code < 300:
621
+ _data = typing.cast(
622
+ typing.Dict[str, typing.Any],
623
+ parse_obj_as(
624
+ type_=typing.Dict[str, typing.Any], # type: ignore
625
+ object_=_response.json(),
626
+ ),
627
+ )
628
+ return AsyncHttpResponse(response=_response, data=_data)
629
+ if _response.status_code == 422:
630
+ raise UnprocessableEntityError(
631
+ headers=dict(_response.headers),
632
+ body=typing.cast(
633
+ HttpValidationError,
634
+ parse_obj_as(
635
+ type_=HttpValidationError, # type: ignore
636
+ object_=_response.json(),
637
+ ),
638
+ ),
639
+ )
640
+ _response_json = _response.json()
641
+ except JSONDecodeError:
642
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
643
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
644
+
645
+ async def patch_stream_data(
646
+ self,
647
+ stream_id: int,
648
+ *,
649
+ run_id: typing.Optional[int] = None,
650
+ start_time: typing.Optional[dt.datetime] = OMIT,
651
+ end_time: typing.Optional[dt.datetime] = OMIT,
652
+ payload: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
653
+ target_languages: typing.Optional[typing.Sequence[Languages]] = OMIT,
654
+ timezone: typing.Optional[str] = OMIT,
655
+ request_options: typing.Optional[RequestOptions] = None,
656
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
657
+ """
658
+ Parameters
659
+ ----------
660
+ stream_id : int
661
+
662
+ run_id : typing.Optional[int]
663
+
664
+ start_time : typing.Optional[dt.datetime]
665
+
666
+ end_time : typing.Optional[dt.datetime]
667
+
668
+ payload : typing.Optional[typing.Dict[str, typing.Any]]
669
+
670
+ target_languages : typing.Optional[typing.Sequence[Languages]]
671
+
672
+ timezone : typing.Optional[str]
673
+
674
+ request_options : typing.Optional[RequestOptions]
675
+ Request-specific configuration.
676
+
677
+ Returns
678
+ -------
679
+ AsyncHttpResponse[typing.Dict[str, typing.Any]]
680
+ Successful Response
681
+ """
682
+ _response = await self._client_wrapper.httpx_client.request(
683
+ f"stream/{jsonable_encoder(stream_id)}",
684
+ method="PATCH",
685
+ params={
686
+ "run_id": run_id,
687
+ },
688
+ json={
689
+ "start_time": start_time,
690
+ "end_time": end_time,
691
+ "payload": payload,
692
+ "target_languages": target_languages,
693
+ "timezone": timezone,
694
+ },
695
+ headers={
696
+ "content-type": "application/json",
697
+ },
698
+ request_options=request_options,
699
+ omit=OMIT,
700
+ )
701
+ try:
702
+ if 200 <= _response.status_code < 300:
703
+ _data = typing.cast(
704
+ typing.Dict[str, typing.Any],
705
+ parse_obj_as(
706
+ type_=typing.Dict[str, typing.Any], # type: ignore
707
+ object_=_response.json(),
708
+ ),
709
+ )
710
+ return AsyncHttpResponse(response=_response, data=_data)
711
+ if _response.status_code == 422:
712
+ raise UnprocessableEntityError(
713
+ headers=dict(_response.headers),
714
+ body=typing.cast(
715
+ HttpValidationError,
716
+ parse_obj_as(
717
+ type_=HttpValidationError, # type: ignore
718
+ object_=_response.json(),
719
+ ),
720
+ ),
721
+ )
722
+ _response_json = _response.json()
723
+ except JSONDecodeError:
724
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
725
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
726
+
727
+ async def get_probe_stream(
728
+ self,
729
+ *,
730
+ url: str,
731
+ run_id: typing.Optional[int] = None,
732
+ passphrase: typing.Optional[str] = OMIT,
733
+ stream_id: typing.Optional[str] = OMIT,
734
+ request_options: typing.Optional[RequestOptions] = None,
735
+ ) -> AsyncHttpResponse[GetProbeStreamOut]:
736
+ """
737
+ Parameters
738
+ ----------
739
+ url : str
740
+
741
+ run_id : typing.Optional[int]
742
+
743
+ passphrase : typing.Optional[str]
744
+
745
+ stream_id : typing.Optional[str]
746
+
747
+ request_options : typing.Optional[RequestOptions]
748
+ Request-specific configuration.
749
+
750
+ Returns
751
+ -------
752
+ AsyncHttpResponse[GetProbeStreamOut]
753
+ Successful Response
754
+ """
755
+ _response = await self._client_wrapper.httpx_client.request(
756
+ "stream/probe",
757
+ method="POST",
758
+ params={
759
+ "run_id": run_id,
760
+ },
761
+ json={
762
+ "url": url,
763
+ "passphrase": passphrase,
764
+ "stream_id": stream_id,
765
+ },
766
+ headers={
767
+ "content-type": "application/json",
768
+ },
769
+ request_options=request_options,
770
+ omit=OMIT,
771
+ )
772
+ try:
773
+ if 200 <= _response.status_code < 300:
774
+ _data = typing.cast(
775
+ GetProbeStreamOut,
776
+ parse_obj_as(
777
+ type_=GetProbeStreamOut, # type: ignore
778
+ object_=_response.json(),
779
+ ),
780
+ )
781
+ return AsyncHttpResponse(response=_response, data=_data)
782
+ if _response.status_code == 422:
783
+ raise UnprocessableEntityError(
784
+ headers=dict(_response.headers),
785
+ body=typing.cast(
786
+ HttpValidationError,
787
+ parse_obj_as(
788
+ type_=HttpValidationError, # type: ignore
789
+ object_=_response.json(),
790
+ ),
791
+ ),
792
+ )
793
+ _response_json = _response.json()
794
+ except JSONDecodeError:
795
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
796
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)