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.
- camb/__init__.py +335 -0
- camb/audio_separation/__init__.py +4 -0
- camb/audio_separation/client.py +406 -0
- camb/audio_separation/raw_client.py +534 -0
- camb/client.py +717 -0
- camb/core/__init__.py +105 -0
- camb/core/api_error.py +23 -0
- camb/core/client_wrapper.py +113 -0
- camb/core/datetime_utils.py +28 -0
- camb/core/file.py +67 -0
- camb/core/force_multipart.py +18 -0
- camb/core/http_client.py +663 -0
- camb/core/http_response.py +55 -0
- camb/core/http_sse/__init__.py +42 -0
- camb/core/http_sse/_api.py +112 -0
- camb/core/http_sse/_decoders.py +61 -0
- camb/core/http_sse/_exceptions.py +7 -0
- camb/core/http_sse/_models.py +17 -0
- camb/core/jsonable_encoder.py +100 -0
- camb/core/pydantic_utilities.py +260 -0
- camb/core/query_encoder.py +58 -0
- camb/core/remove_none_from_dict.py +11 -0
- camb/core/request_options.py +35 -0
- camb/core/serialization.py +276 -0
- camb/deprecated_streaming/__init__.py +4 -0
- camb/deprecated_streaming/client.py +532 -0
- camb/deprecated_streaming/raw_client.py +639 -0
- camb/dictionaries/__init__.py +4 -0
- camb/dictionaries/client.py +785 -0
- camb/dictionaries/raw_client.py +1048 -0
- camb/dub/__init__.py +49 -0
- camb/dub/client.py +846 -0
- camb/dub/raw_client.py +1194 -0
- camb/dub/types/__init__.py +53 -0
- camb/dub/types/dubbed_output_in_alt_format_request_payload_output_format.py +8 -0
- camb/dub/types/get_dubbed_output_in_alt_format_dub_alt_format_run_id_language_post_response.py +9 -0
- camb/dub/types/get_dubbed_run_info_dub_result_run_id_get_response.py +7 -0
- camb/dub/types/get_dubbing_runs_results_dubbing_results_post_response_value.py +7 -0
- camb/environment.py +7 -0
- camb/errors/__init__.py +34 -0
- camb/errors/unprocessable_entity_error.py +11 -0
- camb/folders/__init__.py +4 -0
- camb/folders/client.py +213 -0
- camb/folders/raw_client.py +278 -0
- camb/languages/__init__.py +4 -0
- camb/languages/client.py +168 -0
- camb/languages/raw_client.py +223 -0
- camb/project_setup/__init__.py +4 -0
- camb/project_setup/client.py +537 -0
- camb/project_setup/raw_client.py +655 -0
- camb/py.typed +0 -0
- camb/raw_client.py +236 -0
- camb/story/__init__.py +37 -0
- camb/story/client.py +579 -0
- camb/story/raw_client.py +743 -0
- camb/story/types/__init__.py +38 -0
- camb/story/types/create_story_story_post_response.py +8 -0
- camb/story/types/setup_story_story_setup_post_response.py +8 -0
- camb/streaming/__init__.py +4 -0
- camb/streaming/client.py +645 -0
- camb/streaming/raw_client.py +796 -0
- camb/text_to_audio/__init__.py +4 -0
- camb/text_to_audio/client.py +469 -0
- camb/text_to_audio/raw_client.py +610 -0
- camb/text_to_speech/__init__.py +49 -0
- camb/text_to_speech/baseten.py +214 -0
- camb/text_to_speech/client.py +742 -0
- camb/text_to_speech/raw_client.py +995 -0
- camb/text_to_speech/types/__init__.py +47 -0
- camb/text_to_speech/types/create_stream_tts_request_payload_language.py +71 -0
- camb/text_to_speech/types/create_stream_tts_request_payload_speech_model.py +7 -0
- camb/text_to_speech/types/get_tts_results_tts_results_post_response_value.py +7 -0
- camb/text_to_speech/types/get_tts_run_info_tts_result_run_id_get_response.py +7 -0
- camb/text_to_voice/__init__.py +4 -0
- camb/text_to_voice/client.py +329 -0
- camb/text_to_voice/raw_client.py +405 -0
- camb/transcription/__init__.py +4 -0
- camb/transcription/client.py +465 -0
- camb/transcription/raw_client.py +587 -0
- camb/translated_story/__init__.py +4 -0
- camb/translated_story/client.py +309 -0
- camb/translated_story/raw_client.py +381 -0
- camb/translated_tts/__init__.py +4 -0
- camb/translated_tts/client.py +313 -0
- camb/translated_tts/raw_client.py +357 -0
- camb/translation/__init__.py +4 -0
- camb/translation/client.py +631 -0
- camb/translation/raw_client.py +787 -0
- camb/types/__init__.py +236 -0
- camb/types/add_target_language_out.py +20 -0
- camb/types/audio_output_type.py +5 -0
- camb/types/audio_stream.py +31 -0
- camb/types/config_stream.py +22 -0
- camb/types/config_stream_pipeline.py +28 -0
- camb/types/create_custom_voice_out.py +19 -0
- camb/types/create_project_setup_out.py +19 -0
- camb/types/create_stream_out.py +22 -0
- camb/types/create_stream_request_payload.py +70 -0
- camb/types/create_translated_tts_out.py +19 -0
- camb/types/create_tts_out.py +19 -0
- camb/types/data_stream.py +24 -0
- camb/types/demixing_option.py +10 -0
- camb/types/dictionary_term.py +21 -0
- camb/types/dictionary_with_terms.py +28 -0
- camb/types/dubbing_result.py +22 -0
- camb/types/exception_reasons.py +30 -0
- camb/types/folder.py +20 -0
- camb/types/formalities.py +3 -0
- camb/types/gender.py +3 -0
- camb/types/get_audio_separation_result_out.py +20 -0
- camb/types/get_create_project_setup_response.py +21 -0
- camb/types/get_probe_stream_in.py +21 -0
- camb/types/get_probe_stream_out.py +24 -0
- camb/types/get_setup_story_result_response.py +21 -0
- camb/types/get_text_to_voice_result_out.py +19 -0
- camb/types/get_tts_result_out_file_url.py +19 -0
- camb/types/http_validation_error.py +20 -0
- camb/types/language_enums.py +154 -0
- camb/types/language_pydantic_model.py +21 -0
- camb/types/languages.py +3 -0
- camb/types/orchestrator_pipeline_call_result.py +19 -0
- camb/types/orchestrator_pipeline_result.py +25 -0
- camb/types/orchestrator_pipeline_result_exception_reason.py +7 -0
- camb/types/orchestrator_pipeline_result_message.py +5 -0
- camb/types/output_format.py +10 -0
- camb/types/overdub_config.py +37 -0
- camb/types/project_details.py +28 -0
- camb/types/revoicing_option.py +5 -0
- camb/types/run_i_ds_request_payload.py +19 -0
- camb/types/segmenting_option.py +5 -0
- camb/types/source_stream.py +30 -0
- camb/types/story_details.py +27 -0
- camb/types/stream_category.py +3 -0
- camb/types/stream_tts_inference_options.py +38 -0
- camb/types/stream_tts_output_configuration.py +33 -0
- camb/types/stream_tts_voice_settings.py +28 -0
- camb/types/stream_type.py +3 -0
- camb/types/stream_url_for_languages.py +21 -0
- camb/types/target_stream.py +34 -0
- camb/types/task_status.py +5 -0
- camb/types/term_translation_input.py +21 -0
- camb/types/term_translation_output.py +20 -0
- camb/types/text_to_audio_result.py +19 -0
- camb/types/text_to_audio_type.py +5 -0
- camb/types/transcribing_option.py +5 -0
- camb/types/transcript.py +22 -0
- camb/types/transcript_data_type.py +5 -0
- camb/types/transcript_file_format.py +5 -0
- camb/types/transcription_result.py +20 -0
- camb/types/translating_option.py +5 -0
- camb/types/translation_result.py +19 -0
- camb/types/tts_provider.py +3 -0
- camb/types/validation_error.py +22 -0
- camb/types/validation_error_loc_item.py +5 -0
- camb/types/video_output_type_without_avi.py +5 -0
- camb/types/video_stream.py +28 -0
- camb/types/voice.py +28 -0
- camb/voice_cloning/__init__.py +34 -0
- camb/voice_cloning/client.py +265 -0
- camb/voice_cloning/raw_client.py +320 -0
- camb/voice_cloning/types/__init__.py +36 -0
- camb/voice_cloning/types/list_voices_list_voices_get_response_item.py +7 -0
- camb_sdk-1.5.4.dist-info/METADATA +282 -0
- camb_sdk-1.5.4.dist-info/RECORD +167 -0
- camb_sdk-1.5.4.dist-info/WHEEL +5 -0
- camb_sdk-1.5.4.dist-info/licenses/LICENSE +21 -0
- camb_sdk-1.5.4.dist-info/top_level.txt +1 -0
camb/dub/raw_client.py
ADDED
|
@@ -0,0 +1,1194 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
10
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
11
|
+
from ..core.request_options import RequestOptions
|
|
12
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
13
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
14
|
+
from ..types.http_validation_error import HttpValidationError
|
|
15
|
+
from ..types.languages import Languages
|
|
16
|
+
from ..types.orchestrator_pipeline_call_result import OrchestratorPipelineCallResult
|
|
17
|
+
from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
|
|
18
|
+
from ..types.transcript_data_type import TranscriptDataType
|
|
19
|
+
from ..types.transcript_file_format import TranscriptFileFormat
|
|
20
|
+
from .types.dubbed_output_in_alt_format_request_payload_output_format import (
|
|
21
|
+
DubbedOutputInAltFormatRequestPayloadOutputFormat,
|
|
22
|
+
)
|
|
23
|
+
from .types.get_dubbed_output_in_alt_format_dub_alt_format_run_id_language_post_response import (
|
|
24
|
+
GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse,
|
|
25
|
+
)
|
|
26
|
+
from .types.get_dubbed_run_info_dub_result_run_id_get_response import GetDubbedRunInfoDubResultRunIdGetResponse
|
|
27
|
+
from .types.get_dubbing_runs_results_dubbing_results_post_response_value import (
|
|
28
|
+
GetDubbingRunsResultsDubbingResultsPostResponseValue,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# this is used as the default value for optional parameters
|
|
32
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class RawDubClient:
|
|
36
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
37
|
+
self._client_wrapper = client_wrapper
|
|
38
|
+
|
|
39
|
+
def end_to_end_dubbing(
|
|
40
|
+
self,
|
|
41
|
+
*,
|
|
42
|
+
video_url: str,
|
|
43
|
+
source_language: Languages,
|
|
44
|
+
run_id: typing.Optional[int] = None,
|
|
45
|
+
project_name: typing.Optional[str] = OMIT,
|
|
46
|
+
project_description: typing.Optional[str] = OMIT,
|
|
47
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
48
|
+
target_language: typing.Optional[Languages] = OMIT,
|
|
49
|
+
target_languages: typing.Optional[typing.Sequence[Languages]] = OMIT,
|
|
50
|
+
selected_audio_tracks: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
51
|
+
add_output_as_an_audio_track: typing.Optional[bool] = OMIT,
|
|
52
|
+
chosen_dictionaries: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
53
|
+
ai_optimization: typing.Optional[bool] = OMIT,
|
|
54
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
55
|
+
) -> HttpResponse[OrchestratorPipelineCallResult]:
|
|
56
|
+
"""
|
|
57
|
+
Parameters
|
|
58
|
+
----------
|
|
59
|
+
video_url : str
|
|
60
|
+
|
|
61
|
+
source_language : Languages
|
|
62
|
+
|
|
63
|
+
run_id : typing.Optional[int]
|
|
64
|
+
|
|
65
|
+
project_name : typing.Optional[str]
|
|
66
|
+
|
|
67
|
+
project_description : typing.Optional[str]
|
|
68
|
+
|
|
69
|
+
folder_id : typing.Optional[int]
|
|
70
|
+
|
|
71
|
+
target_language : typing.Optional[Languages]
|
|
72
|
+
|
|
73
|
+
target_languages : typing.Optional[typing.Sequence[Languages]]
|
|
74
|
+
|
|
75
|
+
selected_audio_tracks : typing.Optional[typing.Sequence[int]]
|
|
76
|
+
|
|
77
|
+
add_output_as_an_audio_track : typing.Optional[bool]
|
|
78
|
+
|
|
79
|
+
chosen_dictionaries : typing.Optional[typing.Sequence[int]]
|
|
80
|
+
|
|
81
|
+
ai_optimization : typing.Optional[bool]
|
|
82
|
+
|
|
83
|
+
request_options : typing.Optional[RequestOptions]
|
|
84
|
+
Request-specific configuration.
|
|
85
|
+
|
|
86
|
+
Returns
|
|
87
|
+
-------
|
|
88
|
+
HttpResponse[OrchestratorPipelineCallResult]
|
|
89
|
+
Successful Response
|
|
90
|
+
"""
|
|
91
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
92
|
+
"dub",
|
|
93
|
+
method="POST",
|
|
94
|
+
params={
|
|
95
|
+
"run_id": run_id,
|
|
96
|
+
},
|
|
97
|
+
json={
|
|
98
|
+
"project_name": project_name,
|
|
99
|
+
"project_description": project_description,
|
|
100
|
+
"folder_id": folder_id,
|
|
101
|
+
"video_url": video_url,
|
|
102
|
+
"source_language": source_language,
|
|
103
|
+
"target_language": target_language,
|
|
104
|
+
"target_languages": target_languages,
|
|
105
|
+
"selected_audio_tracks": selected_audio_tracks,
|
|
106
|
+
"add_output_as_an_audio_track": add_output_as_an_audio_track,
|
|
107
|
+
"chosen_dictionaries": chosen_dictionaries,
|
|
108
|
+
"ai_optimization": ai_optimization,
|
|
109
|
+
},
|
|
110
|
+
headers={
|
|
111
|
+
"content-type": "application/json",
|
|
112
|
+
},
|
|
113
|
+
request_options=request_options,
|
|
114
|
+
omit=OMIT,
|
|
115
|
+
)
|
|
116
|
+
try:
|
|
117
|
+
if 200 <= _response.status_code < 300:
|
|
118
|
+
_data = typing.cast(
|
|
119
|
+
OrchestratorPipelineCallResult,
|
|
120
|
+
parse_obj_as(
|
|
121
|
+
type_=OrchestratorPipelineCallResult, # type: ignore
|
|
122
|
+
object_=_response.json(),
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
return HttpResponse(response=_response, data=_data)
|
|
126
|
+
if _response.status_code == 422:
|
|
127
|
+
raise UnprocessableEntityError(
|
|
128
|
+
headers=dict(_response.headers),
|
|
129
|
+
body=typing.cast(
|
|
130
|
+
HttpValidationError,
|
|
131
|
+
parse_obj_as(
|
|
132
|
+
type_=HttpValidationError, # type: ignore
|
|
133
|
+
object_=_response.json(),
|
|
134
|
+
),
|
|
135
|
+
),
|
|
136
|
+
)
|
|
137
|
+
_response_json = _response.json()
|
|
138
|
+
except JSONDecodeError:
|
|
139
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
140
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
141
|
+
|
|
142
|
+
def get_end_to_end_dubbing_status(
|
|
143
|
+
self,
|
|
144
|
+
task_id: str,
|
|
145
|
+
*,
|
|
146
|
+
run_id: typing.Optional[int] = None,
|
|
147
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
148
|
+
) -> HttpResponse[OrchestratorPipelineResult]:
|
|
149
|
+
"""
|
|
150
|
+
Parameters
|
|
151
|
+
----------
|
|
152
|
+
task_id : str
|
|
153
|
+
|
|
154
|
+
run_id : typing.Optional[int]
|
|
155
|
+
|
|
156
|
+
request_options : typing.Optional[RequestOptions]
|
|
157
|
+
Request-specific configuration.
|
|
158
|
+
|
|
159
|
+
Returns
|
|
160
|
+
-------
|
|
161
|
+
HttpResponse[OrchestratorPipelineResult]
|
|
162
|
+
Successful Response
|
|
163
|
+
"""
|
|
164
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
165
|
+
f"dub/{jsonable_encoder(task_id)}",
|
|
166
|
+
method="GET",
|
|
167
|
+
params={
|
|
168
|
+
"run_id": run_id,
|
|
169
|
+
},
|
|
170
|
+
request_options=request_options,
|
|
171
|
+
)
|
|
172
|
+
try:
|
|
173
|
+
if 200 <= _response.status_code < 300:
|
|
174
|
+
_data = typing.cast(
|
|
175
|
+
OrchestratorPipelineResult,
|
|
176
|
+
parse_obj_as(
|
|
177
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
178
|
+
object_=_response.json(),
|
|
179
|
+
),
|
|
180
|
+
)
|
|
181
|
+
return HttpResponse(response=_response, data=_data)
|
|
182
|
+
if _response.status_code == 422:
|
|
183
|
+
raise UnprocessableEntityError(
|
|
184
|
+
headers=dict(_response.headers),
|
|
185
|
+
body=typing.cast(
|
|
186
|
+
HttpValidationError,
|
|
187
|
+
parse_obj_as(
|
|
188
|
+
type_=HttpValidationError, # type: ignore
|
|
189
|
+
object_=_response.json(),
|
|
190
|
+
),
|
|
191
|
+
),
|
|
192
|
+
)
|
|
193
|
+
_response_json = _response.json()
|
|
194
|
+
except JSONDecodeError:
|
|
195
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
196
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
197
|
+
|
|
198
|
+
def get_dubbed_run_info(
|
|
199
|
+
self, run_id: typing.Optional[int], *, request_options: typing.Optional[RequestOptions] = None
|
|
200
|
+
) -> HttpResponse[GetDubbedRunInfoDubResultRunIdGetResponse]:
|
|
201
|
+
"""
|
|
202
|
+
NOTE: This endpoint should be called only by the users to get values for their runs via API.
|
|
203
|
+
Further we need to validate if the user has access to the run_id, otherwise we should not return the output urls.
|
|
204
|
+
|
|
205
|
+
Parameters
|
|
206
|
+
----------
|
|
207
|
+
run_id : typing.Optional[int]
|
|
208
|
+
|
|
209
|
+
request_options : typing.Optional[RequestOptions]
|
|
210
|
+
Request-specific configuration.
|
|
211
|
+
|
|
212
|
+
Returns
|
|
213
|
+
-------
|
|
214
|
+
HttpResponse[GetDubbedRunInfoDubResultRunIdGetResponse]
|
|
215
|
+
Successful Response
|
|
216
|
+
"""
|
|
217
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
218
|
+
f"dub-result/{jsonable_encoder(run_id)}",
|
|
219
|
+
method="GET",
|
|
220
|
+
request_options=request_options,
|
|
221
|
+
)
|
|
222
|
+
try:
|
|
223
|
+
if 200 <= _response.status_code < 300:
|
|
224
|
+
_data = typing.cast(
|
|
225
|
+
GetDubbedRunInfoDubResultRunIdGetResponse,
|
|
226
|
+
parse_obj_as(
|
|
227
|
+
type_=GetDubbedRunInfoDubResultRunIdGetResponse, # type: ignore
|
|
228
|
+
object_=_response.json(),
|
|
229
|
+
),
|
|
230
|
+
)
|
|
231
|
+
return HttpResponse(response=_response, data=_data)
|
|
232
|
+
if _response.status_code == 422:
|
|
233
|
+
raise UnprocessableEntityError(
|
|
234
|
+
headers=dict(_response.headers),
|
|
235
|
+
body=typing.cast(
|
|
236
|
+
HttpValidationError,
|
|
237
|
+
parse_obj_as(
|
|
238
|
+
type_=HttpValidationError, # type: ignore
|
|
239
|
+
object_=_response.json(),
|
|
240
|
+
),
|
|
241
|
+
),
|
|
242
|
+
)
|
|
243
|
+
_response_json = _response.json()
|
|
244
|
+
except JSONDecodeError:
|
|
245
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
246
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
247
|
+
|
|
248
|
+
def get_dubbing_runs_results(
|
|
249
|
+
self,
|
|
250
|
+
*,
|
|
251
|
+
run_ids: typing.Sequence[int],
|
|
252
|
+
run_id: typing.Optional[int] = None,
|
|
253
|
+
traceparent: typing.Optional[str] = None,
|
|
254
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
255
|
+
) -> HttpResponse[typing.Dict[str, GetDubbingRunsResultsDubbingResultsPostResponseValue]]:
|
|
256
|
+
"""
|
|
257
|
+
Parameters
|
|
258
|
+
----------
|
|
259
|
+
run_ids : typing.Sequence[int]
|
|
260
|
+
|
|
261
|
+
run_id : typing.Optional[int]
|
|
262
|
+
|
|
263
|
+
traceparent : typing.Optional[str]
|
|
264
|
+
|
|
265
|
+
request_options : typing.Optional[RequestOptions]
|
|
266
|
+
Request-specific configuration.
|
|
267
|
+
|
|
268
|
+
Returns
|
|
269
|
+
-------
|
|
270
|
+
HttpResponse[typing.Dict[str, GetDubbingRunsResultsDubbingResultsPostResponseValue]]
|
|
271
|
+
Successful Response
|
|
272
|
+
"""
|
|
273
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
274
|
+
"dubbing-results",
|
|
275
|
+
method="POST",
|
|
276
|
+
params={
|
|
277
|
+
"run_id": run_id,
|
|
278
|
+
},
|
|
279
|
+
json={
|
|
280
|
+
"run_ids": run_ids,
|
|
281
|
+
},
|
|
282
|
+
headers={
|
|
283
|
+
"content-type": "application/json",
|
|
284
|
+
"traceparent": str(traceparent) if traceparent is not None else None,
|
|
285
|
+
},
|
|
286
|
+
request_options=request_options,
|
|
287
|
+
omit=OMIT,
|
|
288
|
+
)
|
|
289
|
+
try:
|
|
290
|
+
if 200 <= _response.status_code < 300:
|
|
291
|
+
_data = typing.cast(
|
|
292
|
+
typing.Dict[str, GetDubbingRunsResultsDubbingResultsPostResponseValue],
|
|
293
|
+
parse_obj_as(
|
|
294
|
+
type_=typing.Dict[str, GetDubbingRunsResultsDubbingResultsPostResponseValue], # type: ignore
|
|
295
|
+
object_=_response.json(),
|
|
296
|
+
),
|
|
297
|
+
)
|
|
298
|
+
return HttpResponse(response=_response, data=_data)
|
|
299
|
+
if _response.status_code == 422:
|
|
300
|
+
raise UnprocessableEntityError(
|
|
301
|
+
headers=dict(_response.headers),
|
|
302
|
+
body=typing.cast(
|
|
303
|
+
HttpValidationError,
|
|
304
|
+
parse_obj_as(
|
|
305
|
+
type_=HttpValidationError, # type: ignore
|
|
306
|
+
object_=_response.json(),
|
|
307
|
+
),
|
|
308
|
+
),
|
|
309
|
+
)
|
|
310
|
+
_response_json = _response.json()
|
|
311
|
+
except JSONDecodeError:
|
|
312
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
313
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
314
|
+
|
|
315
|
+
def get_dubbed_run_transcript(
|
|
316
|
+
self,
|
|
317
|
+
run_id: typing.Optional[int],
|
|
318
|
+
language: Languages,
|
|
319
|
+
*,
|
|
320
|
+
format_type: typing.Optional[TranscriptFileFormat] = None,
|
|
321
|
+
data_type: typing.Optional[TranscriptDataType] = None,
|
|
322
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
323
|
+
) -> HttpResponse[typing.Dict[str, str]]:
|
|
324
|
+
"""
|
|
325
|
+
Parameters
|
|
326
|
+
----------
|
|
327
|
+
run_id : typing.Optional[int]
|
|
328
|
+
|
|
329
|
+
language : Languages
|
|
330
|
+
|
|
331
|
+
format_type : typing.Optional[TranscriptFileFormat]
|
|
332
|
+
Format to use for the transcription. Either `srt`, `vtt` or `txt`. Defaults to `txt`.
|
|
333
|
+
|
|
334
|
+
data_type : typing.Optional[TranscriptDataType]
|
|
335
|
+
Data type for the transcription being returned. Returns the raw data of the transcription or a presigned url for the file that holds the transcription data.
|
|
336
|
+
|
|
337
|
+
request_options : typing.Optional[RequestOptions]
|
|
338
|
+
Request-specific configuration.
|
|
339
|
+
|
|
340
|
+
Returns
|
|
341
|
+
-------
|
|
342
|
+
HttpResponse[typing.Dict[str, str]]
|
|
343
|
+
Successful Response
|
|
344
|
+
"""
|
|
345
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
346
|
+
f"transcript/{jsonable_encoder(run_id)}/{jsonable_encoder(language)}",
|
|
347
|
+
method="GET",
|
|
348
|
+
params={
|
|
349
|
+
"format_type": format_type,
|
|
350
|
+
"data_type": data_type,
|
|
351
|
+
},
|
|
352
|
+
request_options=request_options,
|
|
353
|
+
)
|
|
354
|
+
try:
|
|
355
|
+
if 200 <= _response.status_code < 300:
|
|
356
|
+
_data = typing.cast(
|
|
357
|
+
typing.Dict[str, str],
|
|
358
|
+
parse_obj_as(
|
|
359
|
+
type_=typing.Dict[str, str], # type: ignore
|
|
360
|
+
object_=_response.json(),
|
|
361
|
+
),
|
|
362
|
+
)
|
|
363
|
+
return HttpResponse(response=_response, data=_data)
|
|
364
|
+
if _response.status_code == 422:
|
|
365
|
+
raise UnprocessableEntityError(
|
|
366
|
+
headers=dict(_response.headers),
|
|
367
|
+
body=typing.cast(
|
|
368
|
+
HttpValidationError,
|
|
369
|
+
parse_obj_as(
|
|
370
|
+
type_=HttpValidationError, # type: ignore
|
|
371
|
+
object_=_response.json(),
|
|
372
|
+
),
|
|
373
|
+
),
|
|
374
|
+
)
|
|
375
|
+
_response_json = _response.json()
|
|
376
|
+
except JSONDecodeError:
|
|
377
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
378
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
379
|
+
|
|
380
|
+
def get_dubbed_output_in_alt_format(
|
|
381
|
+
self,
|
|
382
|
+
run_id: typing.Optional[int],
|
|
383
|
+
language: Languages,
|
|
384
|
+
*,
|
|
385
|
+
output_format: DubbedOutputInAltFormatRequestPayloadOutputFormat,
|
|
386
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
387
|
+
) -> HttpResponse[GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse]:
|
|
388
|
+
"""
|
|
389
|
+
Parameters
|
|
390
|
+
----------
|
|
391
|
+
run_id : typing.Optional[int]
|
|
392
|
+
|
|
393
|
+
language : Languages
|
|
394
|
+
|
|
395
|
+
output_format : DubbedOutputInAltFormatRequestPayloadOutputFormat
|
|
396
|
+
|
|
397
|
+
request_options : typing.Optional[RequestOptions]
|
|
398
|
+
Request-specific configuration.
|
|
399
|
+
|
|
400
|
+
Returns
|
|
401
|
+
-------
|
|
402
|
+
HttpResponse[GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse]
|
|
403
|
+
Successful Response
|
|
404
|
+
"""
|
|
405
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
406
|
+
f"dub-alt-format/{jsonable_encoder(run_id)}/{jsonable_encoder(language)}",
|
|
407
|
+
method="POST",
|
|
408
|
+
json={
|
|
409
|
+
"output_format": convert_and_respect_annotation_metadata(
|
|
410
|
+
object_=output_format,
|
|
411
|
+
annotation=DubbedOutputInAltFormatRequestPayloadOutputFormat,
|
|
412
|
+
direction="write",
|
|
413
|
+
),
|
|
414
|
+
},
|
|
415
|
+
headers={
|
|
416
|
+
"content-type": "application/json",
|
|
417
|
+
},
|
|
418
|
+
request_options=request_options,
|
|
419
|
+
omit=OMIT,
|
|
420
|
+
)
|
|
421
|
+
try:
|
|
422
|
+
if 200 <= _response.status_code < 300:
|
|
423
|
+
_data = typing.cast(
|
|
424
|
+
GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse,
|
|
425
|
+
parse_obj_as(
|
|
426
|
+
type_=GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse, # type: ignore
|
|
427
|
+
object_=_response.json(),
|
|
428
|
+
),
|
|
429
|
+
)
|
|
430
|
+
return HttpResponse(response=_response, data=_data)
|
|
431
|
+
if _response.status_code == 422:
|
|
432
|
+
raise UnprocessableEntityError(
|
|
433
|
+
headers=dict(_response.headers),
|
|
434
|
+
body=typing.cast(
|
|
435
|
+
HttpValidationError,
|
|
436
|
+
parse_obj_as(
|
|
437
|
+
type_=HttpValidationError, # type: ignore
|
|
438
|
+
object_=_response.json(),
|
|
439
|
+
),
|
|
440
|
+
),
|
|
441
|
+
)
|
|
442
|
+
_response_json = _response.json()
|
|
443
|
+
except JSONDecodeError:
|
|
444
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
445
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
446
|
+
|
|
447
|
+
def get_dubbed_output_in_alt_format_status(
|
|
448
|
+
self,
|
|
449
|
+
task_id: str,
|
|
450
|
+
*,
|
|
451
|
+
run_id: typing.Optional[int] = None,
|
|
452
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
453
|
+
) -> HttpResponse[OrchestratorPipelineResult]:
|
|
454
|
+
"""
|
|
455
|
+
Parameters
|
|
456
|
+
----------
|
|
457
|
+
task_id : str
|
|
458
|
+
|
|
459
|
+
run_id : typing.Optional[int]
|
|
460
|
+
|
|
461
|
+
request_options : typing.Optional[RequestOptions]
|
|
462
|
+
Request-specific configuration.
|
|
463
|
+
|
|
464
|
+
Returns
|
|
465
|
+
-------
|
|
466
|
+
HttpResponse[OrchestratorPipelineResult]
|
|
467
|
+
Successful Response
|
|
468
|
+
"""
|
|
469
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
470
|
+
f"dub-alt-format/{jsonable_encoder(task_id)}",
|
|
471
|
+
method="GET",
|
|
472
|
+
params={
|
|
473
|
+
"run_id": run_id,
|
|
474
|
+
},
|
|
475
|
+
request_options=request_options,
|
|
476
|
+
)
|
|
477
|
+
try:
|
|
478
|
+
if 200 <= _response.status_code < 300:
|
|
479
|
+
_data = typing.cast(
|
|
480
|
+
OrchestratorPipelineResult,
|
|
481
|
+
parse_obj_as(
|
|
482
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
483
|
+
object_=_response.json(),
|
|
484
|
+
),
|
|
485
|
+
)
|
|
486
|
+
return HttpResponse(response=_response, data=_data)
|
|
487
|
+
if _response.status_code == 422:
|
|
488
|
+
raise UnprocessableEntityError(
|
|
489
|
+
headers=dict(_response.headers),
|
|
490
|
+
body=typing.cast(
|
|
491
|
+
HttpValidationError,
|
|
492
|
+
parse_obj_as(
|
|
493
|
+
type_=HttpValidationError, # type: ignore
|
|
494
|
+
object_=_response.json(),
|
|
495
|
+
),
|
|
496
|
+
),
|
|
497
|
+
)
|
|
498
|
+
_response_json = _response.json()
|
|
499
|
+
except JSONDecodeError:
|
|
500
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
501
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
502
|
+
|
|
503
|
+
def poll_discord_dub_task(
|
|
504
|
+
self,
|
|
505
|
+
task_id: str,
|
|
506
|
+
*,
|
|
507
|
+
run_id: typing.Optional[int] = None,
|
|
508
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
509
|
+
) -> HttpResponse[OrchestratorPipelineResult]:
|
|
510
|
+
"""
|
|
511
|
+
Parameters
|
|
512
|
+
----------
|
|
513
|
+
task_id : str
|
|
514
|
+
|
|
515
|
+
run_id : typing.Optional[int]
|
|
516
|
+
|
|
517
|
+
request_options : typing.Optional[RequestOptions]
|
|
518
|
+
Request-specific configuration.
|
|
519
|
+
|
|
520
|
+
Returns
|
|
521
|
+
-------
|
|
522
|
+
HttpResponse[OrchestratorPipelineResult]
|
|
523
|
+
Successful Response
|
|
524
|
+
"""
|
|
525
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
526
|
+
f"discord/dub/{jsonable_encoder(task_id)}",
|
|
527
|
+
method="GET",
|
|
528
|
+
params={
|
|
529
|
+
"run_id": run_id,
|
|
530
|
+
},
|
|
531
|
+
request_options=request_options,
|
|
532
|
+
)
|
|
533
|
+
try:
|
|
534
|
+
if 200 <= _response.status_code < 300:
|
|
535
|
+
_data = typing.cast(
|
|
536
|
+
OrchestratorPipelineResult,
|
|
537
|
+
parse_obj_as(
|
|
538
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
539
|
+
object_=_response.json(),
|
|
540
|
+
),
|
|
541
|
+
)
|
|
542
|
+
return HttpResponse(response=_response, data=_data)
|
|
543
|
+
if _response.status_code == 422:
|
|
544
|
+
raise UnprocessableEntityError(
|
|
545
|
+
headers=dict(_response.headers),
|
|
546
|
+
body=typing.cast(
|
|
547
|
+
HttpValidationError,
|
|
548
|
+
parse_obj_as(
|
|
549
|
+
type_=HttpValidationError, # type: ignore
|
|
550
|
+
object_=_response.json(),
|
|
551
|
+
),
|
|
552
|
+
),
|
|
553
|
+
)
|
|
554
|
+
_response_json = _response.json()
|
|
555
|
+
except JSONDecodeError:
|
|
556
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
557
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
558
|
+
|
|
559
|
+
def poll_twitter_dub_task(
|
|
560
|
+
self,
|
|
561
|
+
task_id: str,
|
|
562
|
+
*,
|
|
563
|
+
run_id: typing.Optional[int] = None,
|
|
564
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
565
|
+
) -> HttpResponse[OrchestratorPipelineResult]:
|
|
566
|
+
"""
|
|
567
|
+
Parameters
|
|
568
|
+
----------
|
|
569
|
+
task_id : str
|
|
570
|
+
|
|
571
|
+
run_id : typing.Optional[int]
|
|
572
|
+
|
|
573
|
+
request_options : typing.Optional[RequestOptions]
|
|
574
|
+
Request-specific configuration.
|
|
575
|
+
|
|
576
|
+
Returns
|
|
577
|
+
-------
|
|
578
|
+
HttpResponse[OrchestratorPipelineResult]
|
|
579
|
+
Successful Response
|
|
580
|
+
"""
|
|
581
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
582
|
+
f"twitter/dub/{jsonable_encoder(task_id)}",
|
|
583
|
+
method="GET",
|
|
584
|
+
params={
|
|
585
|
+
"run_id": run_id,
|
|
586
|
+
},
|
|
587
|
+
request_options=request_options,
|
|
588
|
+
)
|
|
589
|
+
try:
|
|
590
|
+
if 200 <= _response.status_code < 300:
|
|
591
|
+
_data = typing.cast(
|
|
592
|
+
OrchestratorPipelineResult,
|
|
593
|
+
parse_obj_as(
|
|
594
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
595
|
+
object_=_response.json(),
|
|
596
|
+
),
|
|
597
|
+
)
|
|
598
|
+
return HttpResponse(response=_response, data=_data)
|
|
599
|
+
if _response.status_code == 422:
|
|
600
|
+
raise UnprocessableEntityError(
|
|
601
|
+
headers=dict(_response.headers),
|
|
602
|
+
body=typing.cast(
|
|
603
|
+
HttpValidationError,
|
|
604
|
+
parse_obj_as(
|
|
605
|
+
type_=HttpValidationError, # type: ignore
|
|
606
|
+
object_=_response.json(),
|
|
607
|
+
),
|
|
608
|
+
),
|
|
609
|
+
)
|
|
610
|
+
_response_json = _response.json()
|
|
611
|
+
except JSONDecodeError:
|
|
612
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
613
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
class AsyncRawDubClient:
|
|
617
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
618
|
+
self._client_wrapper = client_wrapper
|
|
619
|
+
|
|
620
|
+
async def end_to_end_dubbing(
|
|
621
|
+
self,
|
|
622
|
+
*,
|
|
623
|
+
video_url: str,
|
|
624
|
+
source_language: Languages,
|
|
625
|
+
run_id: typing.Optional[int] = None,
|
|
626
|
+
project_name: typing.Optional[str] = OMIT,
|
|
627
|
+
project_description: typing.Optional[str] = OMIT,
|
|
628
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
629
|
+
target_language: typing.Optional[Languages] = OMIT,
|
|
630
|
+
target_languages: typing.Optional[typing.Sequence[Languages]] = OMIT,
|
|
631
|
+
selected_audio_tracks: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
632
|
+
add_output_as_an_audio_track: typing.Optional[bool] = OMIT,
|
|
633
|
+
chosen_dictionaries: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
634
|
+
ai_optimization: typing.Optional[bool] = OMIT,
|
|
635
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
636
|
+
) -> AsyncHttpResponse[OrchestratorPipelineCallResult]:
|
|
637
|
+
"""
|
|
638
|
+
Parameters
|
|
639
|
+
----------
|
|
640
|
+
video_url : str
|
|
641
|
+
|
|
642
|
+
source_language : Languages
|
|
643
|
+
|
|
644
|
+
run_id : typing.Optional[int]
|
|
645
|
+
|
|
646
|
+
project_name : typing.Optional[str]
|
|
647
|
+
|
|
648
|
+
project_description : typing.Optional[str]
|
|
649
|
+
|
|
650
|
+
folder_id : typing.Optional[int]
|
|
651
|
+
|
|
652
|
+
target_language : typing.Optional[Languages]
|
|
653
|
+
|
|
654
|
+
target_languages : typing.Optional[typing.Sequence[Languages]]
|
|
655
|
+
|
|
656
|
+
selected_audio_tracks : typing.Optional[typing.Sequence[int]]
|
|
657
|
+
|
|
658
|
+
add_output_as_an_audio_track : typing.Optional[bool]
|
|
659
|
+
|
|
660
|
+
chosen_dictionaries : typing.Optional[typing.Sequence[int]]
|
|
661
|
+
|
|
662
|
+
ai_optimization : typing.Optional[bool]
|
|
663
|
+
|
|
664
|
+
request_options : typing.Optional[RequestOptions]
|
|
665
|
+
Request-specific configuration.
|
|
666
|
+
|
|
667
|
+
Returns
|
|
668
|
+
-------
|
|
669
|
+
AsyncHttpResponse[OrchestratorPipelineCallResult]
|
|
670
|
+
Successful Response
|
|
671
|
+
"""
|
|
672
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
673
|
+
"dub",
|
|
674
|
+
method="POST",
|
|
675
|
+
params={
|
|
676
|
+
"run_id": run_id,
|
|
677
|
+
},
|
|
678
|
+
json={
|
|
679
|
+
"project_name": project_name,
|
|
680
|
+
"project_description": project_description,
|
|
681
|
+
"folder_id": folder_id,
|
|
682
|
+
"video_url": video_url,
|
|
683
|
+
"source_language": source_language,
|
|
684
|
+
"target_language": target_language,
|
|
685
|
+
"target_languages": target_languages,
|
|
686
|
+
"selected_audio_tracks": selected_audio_tracks,
|
|
687
|
+
"add_output_as_an_audio_track": add_output_as_an_audio_track,
|
|
688
|
+
"chosen_dictionaries": chosen_dictionaries,
|
|
689
|
+
"ai_optimization": ai_optimization,
|
|
690
|
+
},
|
|
691
|
+
headers={
|
|
692
|
+
"content-type": "application/json",
|
|
693
|
+
},
|
|
694
|
+
request_options=request_options,
|
|
695
|
+
omit=OMIT,
|
|
696
|
+
)
|
|
697
|
+
try:
|
|
698
|
+
if 200 <= _response.status_code < 300:
|
|
699
|
+
_data = typing.cast(
|
|
700
|
+
OrchestratorPipelineCallResult,
|
|
701
|
+
parse_obj_as(
|
|
702
|
+
type_=OrchestratorPipelineCallResult, # type: ignore
|
|
703
|
+
object_=_response.json(),
|
|
704
|
+
),
|
|
705
|
+
)
|
|
706
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
707
|
+
if _response.status_code == 422:
|
|
708
|
+
raise UnprocessableEntityError(
|
|
709
|
+
headers=dict(_response.headers),
|
|
710
|
+
body=typing.cast(
|
|
711
|
+
HttpValidationError,
|
|
712
|
+
parse_obj_as(
|
|
713
|
+
type_=HttpValidationError, # type: ignore
|
|
714
|
+
object_=_response.json(),
|
|
715
|
+
),
|
|
716
|
+
),
|
|
717
|
+
)
|
|
718
|
+
_response_json = _response.json()
|
|
719
|
+
except JSONDecodeError:
|
|
720
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
721
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
722
|
+
|
|
723
|
+
async def get_end_to_end_dubbing_status(
|
|
724
|
+
self,
|
|
725
|
+
task_id: str,
|
|
726
|
+
*,
|
|
727
|
+
run_id: typing.Optional[int] = None,
|
|
728
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
729
|
+
) -> AsyncHttpResponse[OrchestratorPipelineResult]:
|
|
730
|
+
"""
|
|
731
|
+
Parameters
|
|
732
|
+
----------
|
|
733
|
+
task_id : str
|
|
734
|
+
|
|
735
|
+
run_id : typing.Optional[int]
|
|
736
|
+
|
|
737
|
+
request_options : typing.Optional[RequestOptions]
|
|
738
|
+
Request-specific configuration.
|
|
739
|
+
|
|
740
|
+
Returns
|
|
741
|
+
-------
|
|
742
|
+
AsyncHttpResponse[OrchestratorPipelineResult]
|
|
743
|
+
Successful Response
|
|
744
|
+
"""
|
|
745
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
746
|
+
f"dub/{jsonable_encoder(task_id)}",
|
|
747
|
+
method="GET",
|
|
748
|
+
params={
|
|
749
|
+
"run_id": run_id,
|
|
750
|
+
},
|
|
751
|
+
request_options=request_options,
|
|
752
|
+
)
|
|
753
|
+
try:
|
|
754
|
+
if 200 <= _response.status_code < 300:
|
|
755
|
+
_data = typing.cast(
|
|
756
|
+
OrchestratorPipelineResult,
|
|
757
|
+
parse_obj_as(
|
|
758
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
759
|
+
object_=_response.json(),
|
|
760
|
+
),
|
|
761
|
+
)
|
|
762
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
763
|
+
if _response.status_code == 422:
|
|
764
|
+
raise UnprocessableEntityError(
|
|
765
|
+
headers=dict(_response.headers),
|
|
766
|
+
body=typing.cast(
|
|
767
|
+
HttpValidationError,
|
|
768
|
+
parse_obj_as(
|
|
769
|
+
type_=HttpValidationError, # type: ignore
|
|
770
|
+
object_=_response.json(),
|
|
771
|
+
),
|
|
772
|
+
),
|
|
773
|
+
)
|
|
774
|
+
_response_json = _response.json()
|
|
775
|
+
except JSONDecodeError:
|
|
776
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
777
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
778
|
+
|
|
779
|
+
async def get_dubbed_run_info(
|
|
780
|
+
self, run_id: typing.Optional[int], *, request_options: typing.Optional[RequestOptions] = None
|
|
781
|
+
) -> AsyncHttpResponse[GetDubbedRunInfoDubResultRunIdGetResponse]:
|
|
782
|
+
"""
|
|
783
|
+
NOTE: This endpoint should be called only by the users to get values for their runs via API.
|
|
784
|
+
Further we need to validate if the user has access to the run_id, otherwise we should not return the output urls.
|
|
785
|
+
|
|
786
|
+
Parameters
|
|
787
|
+
----------
|
|
788
|
+
run_id : typing.Optional[int]
|
|
789
|
+
|
|
790
|
+
request_options : typing.Optional[RequestOptions]
|
|
791
|
+
Request-specific configuration.
|
|
792
|
+
|
|
793
|
+
Returns
|
|
794
|
+
-------
|
|
795
|
+
AsyncHttpResponse[GetDubbedRunInfoDubResultRunIdGetResponse]
|
|
796
|
+
Successful Response
|
|
797
|
+
"""
|
|
798
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
799
|
+
f"dub-result/{jsonable_encoder(run_id)}",
|
|
800
|
+
method="GET",
|
|
801
|
+
request_options=request_options,
|
|
802
|
+
)
|
|
803
|
+
try:
|
|
804
|
+
if 200 <= _response.status_code < 300:
|
|
805
|
+
_data = typing.cast(
|
|
806
|
+
GetDubbedRunInfoDubResultRunIdGetResponse,
|
|
807
|
+
parse_obj_as(
|
|
808
|
+
type_=GetDubbedRunInfoDubResultRunIdGetResponse, # type: ignore
|
|
809
|
+
object_=_response.json(),
|
|
810
|
+
),
|
|
811
|
+
)
|
|
812
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
813
|
+
if _response.status_code == 422:
|
|
814
|
+
raise UnprocessableEntityError(
|
|
815
|
+
headers=dict(_response.headers),
|
|
816
|
+
body=typing.cast(
|
|
817
|
+
HttpValidationError,
|
|
818
|
+
parse_obj_as(
|
|
819
|
+
type_=HttpValidationError, # type: ignore
|
|
820
|
+
object_=_response.json(),
|
|
821
|
+
),
|
|
822
|
+
),
|
|
823
|
+
)
|
|
824
|
+
_response_json = _response.json()
|
|
825
|
+
except JSONDecodeError:
|
|
826
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
827
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
828
|
+
|
|
829
|
+
async def get_dubbing_runs_results(
|
|
830
|
+
self,
|
|
831
|
+
*,
|
|
832
|
+
run_ids: typing.Sequence[int],
|
|
833
|
+
run_id: typing.Optional[int] = None,
|
|
834
|
+
traceparent: typing.Optional[str] = None,
|
|
835
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
836
|
+
) -> AsyncHttpResponse[typing.Dict[str, GetDubbingRunsResultsDubbingResultsPostResponseValue]]:
|
|
837
|
+
"""
|
|
838
|
+
Parameters
|
|
839
|
+
----------
|
|
840
|
+
run_ids : typing.Sequence[int]
|
|
841
|
+
|
|
842
|
+
run_id : typing.Optional[int]
|
|
843
|
+
|
|
844
|
+
traceparent : typing.Optional[str]
|
|
845
|
+
|
|
846
|
+
request_options : typing.Optional[RequestOptions]
|
|
847
|
+
Request-specific configuration.
|
|
848
|
+
|
|
849
|
+
Returns
|
|
850
|
+
-------
|
|
851
|
+
AsyncHttpResponse[typing.Dict[str, GetDubbingRunsResultsDubbingResultsPostResponseValue]]
|
|
852
|
+
Successful Response
|
|
853
|
+
"""
|
|
854
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
855
|
+
"dubbing-results",
|
|
856
|
+
method="POST",
|
|
857
|
+
params={
|
|
858
|
+
"run_id": run_id,
|
|
859
|
+
},
|
|
860
|
+
json={
|
|
861
|
+
"run_ids": run_ids,
|
|
862
|
+
},
|
|
863
|
+
headers={
|
|
864
|
+
"content-type": "application/json",
|
|
865
|
+
"traceparent": str(traceparent) if traceparent is not None else None,
|
|
866
|
+
},
|
|
867
|
+
request_options=request_options,
|
|
868
|
+
omit=OMIT,
|
|
869
|
+
)
|
|
870
|
+
try:
|
|
871
|
+
if 200 <= _response.status_code < 300:
|
|
872
|
+
_data = typing.cast(
|
|
873
|
+
typing.Dict[str, GetDubbingRunsResultsDubbingResultsPostResponseValue],
|
|
874
|
+
parse_obj_as(
|
|
875
|
+
type_=typing.Dict[str, GetDubbingRunsResultsDubbingResultsPostResponseValue], # type: ignore
|
|
876
|
+
object_=_response.json(),
|
|
877
|
+
),
|
|
878
|
+
)
|
|
879
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
880
|
+
if _response.status_code == 422:
|
|
881
|
+
raise UnprocessableEntityError(
|
|
882
|
+
headers=dict(_response.headers),
|
|
883
|
+
body=typing.cast(
|
|
884
|
+
HttpValidationError,
|
|
885
|
+
parse_obj_as(
|
|
886
|
+
type_=HttpValidationError, # type: ignore
|
|
887
|
+
object_=_response.json(),
|
|
888
|
+
),
|
|
889
|
+
),
|
|
890
|
+
)
|
|
891
|
+
_response_json = _response.json()
|
|
892
|
+
except JSONDecodeError:
|
|
893
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
894
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
895
|
+
|
|
896
|
+
async def get_dubbed_run_transcript(
|
|
897
|
+
self,
|
|
898
|
+
run_id: typing.Optional[int],
|
|
899
|
+
language: Languages,
|
|
900
|
+
*,
|
|
901
|
+
format_type: typing.Optional[TranscriptFileFormat] = None,
|
|
902
|
+
data_type: typing.Optional[TranscriptDataType] = None,
|
|
903
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
904
|
+
) -> AsyncHttpResponse[typing.Dict[str, str]]:
|
|
905
|
+
"""
|
|
906
|
+
Parameters
|
|
907
|
+
----------
|
|
908
|
+
run_id : typing.Optional[int]
|
|
909
|
+
|
|
910
|
+
language : Languages
|
|
911
|
+
|
|
912
|
+
format_type : typing.Optional[TranscriptFileFormat]
|
|
913
|
+
Format to use for the transcription. Either `srt`, `vtt` or `txt`. Defaults to `txt`.
|
|
914
|
+
|
|
915
|
+
data_type : typing.Optional[TranscriptDataType]
|
|
916
|
+
Data type for the transcription being returned. Returns the raw data of the transcription or a presigned url for the file that holds the transcription data.
|
|
917
|
+
|
|
918
|
+
request_options : typing.Optional[RequestOptions]
|
|
919
|
+
Request-specific configuration.
|
|
920
|
+
|
|
921
|
+
Returns
|
|
922
|
+
-------
|
|
923
|
+
AsyncHttpResponse[typing.Dict[str, str]]
|
|
924
|
+
Successful Response
|
|
925
|
+
"""
|
|
926
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
927
|
+
f"transcript/{jsonable_encoder(run_id)}/{jsonable_encoder(language)}",
|
|
928
|
+
method="GET",
|
|
929
|
+
params={
|
|
930
|
+
"format_type": format_type,
|
|
931
|
+
"data_type": data_type,
|
|
932
|
+
},
|
|
933
|
+
request_options=request_options,
|
|
934
|
+
)
|
|
935
|
+
try:
|
|
936
|
+
if 200 <= _response.status_code < 300:
|
|
937
|
+
_data = typing.cast(
|
|
938
|
+
typing.Dict[str, str],
|
|
939
|
+
parse_obj_as(
|
|
940
|
+
type_=typing.Dict[str, str], # type: ignore
|
|
941
|
+
object_=_response.json(),
|
|
942
|
+
),
|
|
943
|
+
)
|
|
944
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
945
|
+
if _response.status_code == 422:
|
|
946
|
+
raise UnprocessableEntityError(
|
|
947
|
+
headers=dict(_response.headers),
|
|
948
|
+
body=typing.cast(
|
|
949
|
+
HttpValidationError,
|
|
950
|
+
parse_obj_as(
|
|
951
|
+
type_=HttpValidationError, # type: ignore
|
|
952
|
+
object_=_response.json(),
|
|
953
|
+
),
|
|
954
|
+
),
|
|
955
|
+
)
|
|
956
|
+
_response_json = _response.json()
|
|
957
|
+
except JSONDecodeError:
|
|
958
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
959
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
960
|
+
|
|
961
|
+
async def get_dubbed_output_in_alt_format(
|
|
962
|
+
self,
|
|
963
|
+
run_id: typing.Optional[int],
|
|
964
|
+
language: Languages,
|
|
965
|
+
*,
|
|
966
|
+
output_format: DubbedOutputInAltFormatRequestPayloadOutputFormat,
|
|
967
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
968
|
+
) -> AsyncHttpResponse[GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse]:
|
|
969
|
+
"""
|
|
970
|
+
Parameters
|
|
971
|
+
----------
|
|
972
|
+
run_id : typing.Optional[int]
|
|
973
|
+
|
|
974
|
+
language : Languages
|
|
975
|
+
|
|
976
|
+
output_format : DubbedOutputInAltFormatRequestPayloadOutputFormat
|
|
977
|
+
|
|
978
|
+
request_options : typing.Optional[RequestOptions]
|
|
979
|
+
Request-specific configuration.
|
|
980
|
+
|
|
981
|
+
Returns
|
|
982
|
+
-------
|
|
983
|
+
AsyncHttpResponse[GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse]
|
|
984
|
+
Successful Response
|
|
985
|
+
"""
|
|
986
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
987
|
+
f"dub-alt-format/{jsonable_encoder(run_id)}/{jsonable_encoder(language)}",
|
|
988
|
+
method="POST",
|
|
989
|
+
json={
|
|
990
|
+
"output_format": convert_and_respect_annotation_metadata(
|
|
991
|
+
object_=output_format,
|
|
992
|
+
annotation=DubbedOutputInAltFormatRequestPayloadOutputFormat,
|
|
993
|
+
direction="write",
|
|
994
|
+
),
|
|
995
|
+
},
|
|
996
|
+
headers={
|
|
997
|
+
"content-type": "application/json",
|
|
998
|
+
},
|
|
999
|
+
request_options=request_options,
|
|
1000
|
+
omit=OMIT,
|
|
1001
|
+
)
|
|
1002
|
+
try:
|
|
1003
|
+
if 200 <= _response.status_code < 300:
|
|
1004
|
+
_data = typing.cast(
|
|
1005
|
+
GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse,
|
|
1006
|
+
parse_obj_as(
|
|
1007
|
+
type_=GetDubbedOutputInAltFormatDubAltFormatRunIdLanguagePostResponse, # type: ignore
|
|
1008
|
+
object_=_response.json(),
|
|
1009
|
+
),
|
|
1010
|
+
)
|
|
1011
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1012
|
+
if _response.status_code == 422:
|
|
1013
|
+
raise UnprocessableEntityError(
|
|
1014
|
+
headers=dict(_response.headers),
|
|
1015
|
+
body=typing.cast(
|
|
1016
|
+
HttpValidationError,
|
|
1017
|
+
parse_obj_as(
|
|
1018
|
+
type_=HttpValidationError, # type: ignore
|
|
1019
|
+
object_=_response.json(),
|
|
1020
|
+
),
|
|
1021
|
+
),
|
|
1022
|
+
)
|
|
1023
|
+
_response_json = _response.json()
|
|
1024
|
+
except JSONDecodeError:
|
|
1025
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1026
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1027
|
+
|
|
1028
|
+
async def get_dubbed_output_in_alt_format_status(
|
|
1029
|
+
self,
|
|
1030
|
+
task_id: str,
|
|
1031
|
+
*,
|
|
1032
|
+
run_id: typing.Optional[int] = None,
|
|
1033
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1034
|
+
) -> AsyncHttpResponse[OrchestratorPipelineResult]:
|
|
1035
|
+
"""
|
|
1036
|
+
Parameters
|
|
1037
|
+
----------
|
|
1038
|
+
task_id : str
|
|
1039
|
+
|
|
1040
|
+
run_id : typing.Optional[int]
|
|
1041
|
+
|
|
1042
|
+
request_options : typing.Optional[RequestOptions]
|
|
1043
|
+
Request-specific configuration.
|
|
1044
|
+
|
|
1045
|
+
Returns
|
|
1046
|
+
-------
|
|
1047
|
+
AsyncHttpResponse[OrchestratorPipelineResult]
|
|
1048
|
+
Successful Response
|
|
1049
|
+
"""
|
|
1050
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1051
|
+
f"dub-alt-format/{jsonable_encoder(task_id)}",
|
|
1052
|
+
method="GET",
|
|
1053
|
+
params={
|
|
1054
|
+
"run_id": run_id,
|
|
1055
|
+
},
|
|
1056
|
+
request_options=request_options,
|
|
1057
|
+
)
|
|
1058
|
+
try:
|
|
1059
|
+
if 200 <= _response.status_code < 300:
|
|
1060
|
+
_data = typing.cast(
|
|
1061
|
+
OrchestratorPipelineResult,
|
|
1062
|
+
parse_obj_as(
|
|
1063
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
1064
|
+
object_=_response.json(),
|
|
1065
|
+
),
|
|
1066
|
+
)
|
|
1067
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1068
|
+
if _response.status_code == 422:
|
|
1069
|
+
raise UnprocessableEntityError(
|
|
1070
|
+
headers=dict(_response.headers),
|
|
1071
|
+
body=typing.cast(
|
|
1072
|
+
HttpValidationError,
|
|
1073
|
+
parse_obj_as(
|
|
1074
|
+
type_=HttpValidationError, # type: ignore
|
|
1075
|
+
object_=_response.json(),
|
|
1076
|
+
),
|
|
1077
|
+
),
|
|
1078
|
+
)
|
|
1079
|
+
_response_json = _response.json()
|
|
1080
|
+
except JSONDecodeError:
|
|
1081
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1082
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1083
|
+
|
|
1084
|
+
async def poll_discord_dub_task(
|
|
1085
|
+
self,
|
|
1086
|
+
task_id: str,
|
|
1087
|
+
*,
|
|
1088
|
+
run_id: typing.Optional[int] = None,
|
|
1089
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1090
|
+
) -> AsyncHttpResponse[OrchestratorPipelineResult]:
|
|
1091
|
+
"""
|
|
1092
|
+
Parameters
|
|
1093
|
+
----------
|
|
1094
|
+
task_id : str
|
|
1095
|
+
|
|
1096
|
+
run_id : typing.Optional[int]
|
|
1097
|
+
|
|
1098
|
+
request_options : typing.Optional[RequestOptions]
|
|
1099
|
+
Request-specific configuration.
|
|
1100
|
+
|
|
1101
|
+
Returns
|
|
1102
|
+
-------
|
|
1103
|
+
AsyncHttpResponse[OrchestratorPipelineResult]
|
|
1104
|
+
Successful Response
|
|
1105
|
+
"""
|
|
1106
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1107
|
+
f"discord/dub/{jsonable_encoder(task_id)}",
|
|
1108
|
+
method="GET",
|
|
1109
|
+
params={
|
|
1110
|
+
"run_id": run_id,
|
|
1111
|
+
},
|
|
1112
|
+
request_options=request_options,
|
|
1113
|
+
)
|
|
1114
|
+
try:
|
|
1115
|
+
if 200 <= _response.status_code < 300:
|
|
1116
|
+
_data = typing.cast(
|
|
1117
|
+
OrchestratorPipelineResult,
|
|
1118
|
+
parse_obj_as(
|
|
1119
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
1120
|
+
object_=_response.json(),
|
|
1121
|
+
),
|
|
1122
|
+
)
|
|
1123
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1124
|
+
if _response.status_code == 422:
|
|
1125
|
+
raise UnprocessableEntityError(
|
|
1126
|
+
headers=dict(_response.headers),
|
|
1127
|
+
body=typing.cast(
|
|
1128
|
+
HttpValidationError,
|
|
1129
|
+
parse_obj_as(
|
|
1130
|
+
type_=HttpValidationError, # type: ignore
|
|
1131
|
+
object_=_response.json(),
|
|
1132
|
+
),
|
|
1133
|
+
),
|
|
1134
|
+
)
|
|
1135
|
+
_response_json = _response.json()
|
|
1136
|
+
except JSONDecodeError:
|
|
1137
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1138
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1139
|
+
|
|
1140
|
+
async def poll_twitter_dub_task(
|
|
1141
|
+
self,
|
|
1142
|
+
task_id: str,
|
|
1143
|
+
*,
|
|
1144
|
+
run_id: typing.Optional[int] = None,
|
|
1145
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1146
|
+
) -> AsyncHttpResponse[OrchestratorPipelineResult]:
|
|
1147
|
+
"""
|
|
1148
|
+
Parameters
|
|
1149
|
+
----------
|
|
1150
|
+
task_id : str
|
|
1151
|
+
|
|
1152
|
+
run_id : typing.Optional[int]
|
|
1153
|
+
|
|
1154
|
+
request_options : typing.Optional[RequestOptions]
|
|
1155
|
+
Request-specific configuration.
|
|
1156
|
+
|
|
1157
|
+
Returns
|
|
1158
|
+
-------
|
|
1159
|
+
AsyncHttpResponse[OrchestratorPipelineResult]
|
|
1160
|
+
Successful Response
|
|
1161
|
+
"""
|
|
1162
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1163
|
+
f"twitter/dub/{jsonable_encoder(task_id)}",
|
|
1164
|
+
method="GET",
|
|
1165
|
+
params={
|
|
1166
|
+
"run_id": run_id,
|
|
1167
|
+
},
|
|
1168
|
+
request_options=request_options,
|
|
1169
|
+
)
|
|
1170
|
+
try:
|
|
1171
|
+
if 200 <= _response.status_code < 300:
|
|
1172
|
+
_data = typing.cast(
|
|
1173
|
+
OrchestratorPipelineResult,
|
|
1174
|
+
parse_obj_as(
|
|
1175
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
1176
|
+
object_=_response.json(),
|
|
1177
|
+
),
|
|
1178
|
+
)
|
|
1179
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1180
|
+
if _response.status_code == 422:
|
|
1181
|
+
raise UnprocessableEntityError(
|
|
1182
|
+
headers=dict(_response.headers),
|
|
1183
|
+
body=typing.cast(
|
|
1184
|
+
HttpValidationError,
|
|
1185
|
+
parse_obj_as(
|
|
1186
|
+
type_=HttpValidationError, # type: ignore
|
|
1187
|
+
object_=_response.json(),
|
|
1188
|
+
),
|
|
1189
|
+
),
|
|
1190
|
+
)
|
|
1191
|
+
_response_json = _response.json()
|
|
1192
|
+
except JSONDecodeError:
|
|
1193
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1194
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|