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,655 @@
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 ..errors.unprocessable_entity_error import UnprocessableEntityError
13
+ from ..types.create_project_setup_out import CreateProjectSetupOut
14
+ from ..types.get_create_project_setup_response import GetCreateProjectSetupResponse
15
+ from ..types.http_validation_error import HttpValidationError
16
+ from ..types.languages import Languages
17
+
18
+ # this is used as the default value for optional parameters
19
+ OMIT = typing.cast(typing.Any, ...)
20
+
21
+
22
+ class RawProjectSetupClient:
23
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
24
+ self._client_wrapper = client_wrapper
25
+
26
+ def create_project(
27
+ self,
28
+ *,
29
+ media_url: str,
30
+ source_language: Languages,
31
+ target_languages: typing.Sequence[Languages],
32
+ run_id: typing.Optional[int] = None,
33
+ project_name: typing.Optional[str] = OMIT,
34
+ project_description: typing.Optional[str] = OMIT,
35
+ folder_id: typing.Optional[int] = OMIT,
36
+ selected_audio_tracks: typing.Optional[typing.Sequence[int]] = OMIT,
37
+ add_output_as_an_audio_track: typing.Optional[bool] = OMIT,
38
+ chosen_dictionaries: typing.Optional[typing.Sequence[int]] = OMIT,
39
+ request_options: typing.Optional[RequestOptions] = None,
40
+ ) -> HttpResponse[CreateProjectSetupOut]:
41
+ """
42
+ Creates a new project setup with transcription capabilities.
43
+
44
+ This endpoint allows users to create a new project by providing media content
45
+ (either as a file upload or URL), specifying source and target languages, and
46
+ other project metadata. The function validates inputs, checks file size limitations,
47
+ and initiates the project setup process.
48
+
49
+ Args:
50
+ request_payload (CreateProjectSetupRequestPayload): Complete project configuration
51
+ including media URL, source/target languages, project metadata, and
52
+ processing preferences such as audio track selection and dictionary choices.
53
+ api_key_obj_and_subscription: Dependency injection providing validated API key
54
+ object and associated subscription details for authorization and usage
55
+ limit enforcement.
56
+ traceparent (str | None, optional): OpenTelemetry trace parent header for
57
+ distributed tracing across microservices. Enables request correlation
58
+ and performance monitoring throughout the processing pipeline.
59
+
60
+ Returns:
61
+ Project setup response with project details and processing status.
62
+
63
+ Raises:
64
+ HTTPException:
65
+ - 400: If neither media_file nor media_url is provided
66
+ - 400: If uploaded file has no filename
67
+ - 413: If uploaded file exceeds size limit
68
+
69
+ Parameters
70
+ ----------
71
+ media_url : str
72
+
73
+ source_language : Languages
74
+
75
+ target_languages : typing.Sequence[Languages]
76
+
77
+ run_id : typing.Optional[int]
78
+
79
+ project_name : typing.Optional[str]
80
+
81
+ project_description : typing.Optional[str]
82
+
83
+ folder_id : typing.Optional[int]
84
+
85
+ selected_audio_tracks : typing.Optional[typing.Sequence[int]]
86
+
87
+ add_output_as_an_audio_track : typing.Optional[bool]
88
+
89
+ chosen_dictionaries : typing.Optional[typing.Sequence[int]]
90
+
91
+ request_options : typing.Optional[RequestOptions]
92
+ Request-specific configuration.
93
+
94
+ Returns
95
+ -------
96
+ HttpResponse[CreateProjectSetupOut]
97
+ Successful Response
98
+ """
99
+ _response = self._client_wrapper.httpx_client.request(
100
+ "project-setup",
101
+ method="POST",
102
+ params={
103
+ "run_id": run_id,
104
+ },
105
+ json={
106
+ "project_name": project_name,
107
+ "project_description": project_description,
108
+ "folder_id": folder_id,
109
+ "media_url": media_url,
110
+ "source_language": source_language,
111
+ "target_languages": target_languages,
112
+ "selected_audio_tracks": selected_audio_tracks,
113
+ "add_output_as_an_audio_track": add_output_as_an_audio_track,
114
+ "chosen_dictionaries": chosen_dictionaries,
115
+ },
116
+ headers={
117
+ "content-type": "application/json",
118
+ },
119
+ request_options=request_options,
120
+ omit=OMIT,
121
+ )
122
+ try:
123
+ if 200 <= _response.status_code < 300:
124
+ _data = typing.cast(
125
+ CreateProjectSetupOut,
126
+ parse_obj_as(
127
+ type_=CreateProjectSetupOut, # type: ignore
128
+ object_=_response.json(),
129
+ ),
130
+ )
131
+ return HttpResponse(response=_response, data=_data)
132
+ if _response.status_code == 422:
133
+ raise UnprocessableEntityError(
134
+ headers=dict(_response.headers),
135
+ body=typing.cast(
136
+ HttpValidationError,
137
+ parse_obj_as(
138
+ type_=HttpValidationError, # type: ignore
139
+ object_=_response.json(),
140
+ ),
141
+ ),
142
+ )
143
+ _response_json = _response.json()
144
+ except JSONDecodeError:
145
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
146
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
147
+
148
+ def create_project_setup_task_status(
149
+ self,
150
+ task_id: str,
151
+ *,
152
+ run_id: typing.Optional[int] = None,
153
+ request_options: typing.Optional[RequestOptions] = None,
154
+ ) -> HttpResponse[typing.List[GetCreateProjectSetupResponse]]:
155
+ """
156
+ Parameters
157
+ ----------
158
+ task_id : str
159
+
160
+ run_id : typing.Optional[int]
161
+
162
+ request_options : typing.Optional[RequestOptions]
163
+ Request-specific configuration.
164
+
165
+ Returns
166
+ -------
167
+ HttpResponse[typing.List[GetCreateProjectSetupResponse]]
168
+ Successful Response
169
+ """
170
+ _response = self._client_wrapper.httpx_client.request(
171
+ f"project-setup/{jsonable_encoder(task_id)}",
172
+ method="GET",
173
+ params={
174
+ "run_id": run_id,
175
+ },
176
+ request_options=request_options,
177
+ )
178
+ try:
179
+ if 200 <= _response.status_code < 300:
180
+ _data = typing.cast(
181
+ typing.List[GetCreateProjectSetupResponse],
182
+ parse_obj_as(
183
+ type_=typing.List[GetCreateProjectSetupResponse], # type: ignore
184
+ object_=_response.json(),
185
+ ),
186
+ )
187
+ return HttpResponse(response=_response, data=_data)
188
+ if _response.status_code == 422:
189
+ raise UnprocessableEntityError(
190
+ headers=dict(_response.headers),
191
+ body=typing.cast(
192
+ HttpValidationError,
193
+ parse_obj_as(
194
+ type_=HttpValidationError, # type: ignore
195
+ object_=_response.json(),
196
+ ),
197
+ ),
198
+ )
199
+ _response_json = _response.json()
200
+ except JSONDecodeError:
201
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
202
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
203
+
204
+ def get_project_setup_result(
205
+ self, run_id: typing.Optional[int], *, request_options: typing.Optional[RequestOptions] = None
206
+ ) -> HttpResponse[typing.Optional[GetCreateProjectSetupResponse]]:
207
+ """
208
+ Retrieves the final result of a completed project setup.
209
+
210
+ This endpoint provides access to the final results of a completed project setup.
211
+ It verifies that the authenticated user has access to the requested run_id and
212
+ validates that the run is of the correct type (`DUB_PROJECT`) before returning results.
213
+
214
+ Note:
215
+ This endpoint should only be called by users to retrieve their run results via API.
216
+ Access validation is performed to ensure users can only access their own runs.
217
+
218
+ Args:
219
+ run_id: Positive integer ID of the project setup run.
220
+ api_key_obj: API key authentication data from dependency.
221
+ traceparent: OpenTelemetry trace header for distributed tracing.
222
+
223
+ Returns:
224
+ GetCreateProjectSetupResponse: Project setup results including run details.
225
+
226
+ Raises:
227
+ HTTPException:
228
+ - 404: If the run_id is not found
229
+ - 400: If the run type is not valid for this endpoint (must be DUB_PROJECT)
230
+
231
+ Parameters
232
+ ----------
233
+ run_id : typing.Optional[int]
234
+
235
+ request_options : typing.Optional[RequestOptions]
236
+ Request-specific configuration.
237
+
238
+ Returns
239
+ -------
240
+ HttpResponse[typing.Optional[GetCreateProjectSetupResponse]]
241
+ Successful Response
242
+ """
243
+ _response = self._client_wrapper.httpx_client.request(
244
+ f"project-setup-result/{jsonable_encoder(run_id)}",
245
+ method="GET",
246
+ request_options=request_options,
247
+ )
248
+ try:
249
+ if _response is None or not _response.text.strip():
250
+ return HttpResponse(response=_response, data=None)
251
+ if 200 <= _response.status_code < 300:
252
+ _data = typing.cast(
253
+ typing.Optional[GetCreateProjectSetupResponse],
254
+ parse_obj_as(
255
+ type_=typing.Optional[GetCreateProjectSetupResponse], # type: ignore
256
+ object_=_response.json(),
257
+ ),
258
+ )
259
+ return HttpResponse(response=_response, data=_data)
260
+ if _response.status_code == 422:
261
+ raise UnprocessableEntityError(
262
+ headers=dict(_response.headers),
263
+ body=typing.cast(
264
+ HttpValidationError,
265
+ parse_obj_as(
266
+ type_=HttpValidationError, # type: ignore
267
+ object_=_response.json(),
268
+ ),
269
+ ),
270
+ )
271
+ _response_json = _response.json()
272
+ except JSONDecodeError:
273
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
274
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
275
+
276
+ def get_project_setup_runs_results(
277
+ self,
278
+ *,
279
+ run_ids: typing.Sequence[int],
280
+ run_id: typing.Optional[int] = None,
281
+ request_options: typing.Optional[RequestOptions] = None,
282
+ ) -> HttpResponse[typing.List[GetCreateProjectSetupResponse]]:
283
+ """
284
+ Parameters
285
+ ----------
286
+ run_ids : typing.Sequence[int]
287
+
288
+ run_id : typing.Optional[int]
289
+
290
+ request_options : typing.Optional[RequestOptions]
291
+ Request-specific configuration.
292
+
293
+ Returns
294
+ -------
295
+ HttpResponse[typing.List[GetCreateProjectSetupResponse]]
296
+ Successful Response
297
+ """
298
+ _response = self._client_wrapper.httpx_client.request(
299
+ "project-setup-results",
300
+ method="POST",
301
+ params={
302
+ "run_id": run_id,
303
+ },
304
+ json={
305
+ "run_ids": run_ids,
306
+ },
307
+ headers={
308
+ "content-type": "application/json",
309
+ },
310
+ request_options=request_options,
311
+ omit=OMIT,
312
+ )
313
+ try:
314
+ if 200 <= _response.status_code < 300:
315
+ _data = typing.cast(
316
+ typing.List[GetCreateProjectSetupResponse],
317
+ parse_obj_as(
318
+ type_=typing.List[GetCreateProjectSetupResponse], # type: ignore
319
+ object_=_response.json(),
320
+ ),
321
+ )
322
+ return HttpResponse(response=_response, data=_data)
323
+ if _response.status_code == 422:
324
+ raise UnprocessableEntityError(
325
+ headers=dict(_response.headers),
326
+ body=typing.cast(
327
+ HttpValidationError,
328
+ parse_obj_as(
329
+ type_=HttpValidationError, # type: ignore
330
+ object_=_response.json(),
331
+ ),
332
+ ),
333
+ )
334
+ _response_json = _response.json()
335
+ except JSONDecodeError:
336
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
337
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
338
+
339
+
340
+ class AsyncRawProjectSetupClient:
341
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
342
+ self._client_wrapper = client_wrapper
343
+
344
+ async def create_project(
345
+ self,
346
+ *,
347
+ media_url: str,
348
+ source_language: Languages,
349
+ target_languages: typing.Sequence[Languages],
350
+ run_id: typing.Optional[int] = None,
351
+ project_name: typing.Optional[str] = OMIT,
352
+ project_description: typing.Optional[str] = OMIT,
353
+ folder_id: typing.Optional[int] = OMIT,
354
+ selected_audio_tracks: typing.Optional[typing.Sequence[int]] = OMIT,
355
+ add_output_as_an_audio_track: typing.Optional[bool] = OMIT,
356
+ chosen_dictionaries: typing.Optional[typing.Sequence[int]] = OMIT,
357
+ request_options: typing.Optional[RequestOptions] = None,
358
+ ) -> AsyncHttpResponse[CreateProjectSetupOut]:
359
+ """
360
+ Creates a new project setup with transcription capabilities.
361
+
362
+ This endpoint allows users to create a new project by providing media content
363
+ (either as a file upload or URL), specifying source and target languages, and
364
+ other project metadata. The function validates inputs, checks file size limitations,
365
+ and initiates the project setup process.
366
+
367
+ Args:
368
+ request_payload (CreateProjectSetupRequestPayload): Complete project configuration
369
+ including media URL, source/target languages, project metadata, and
370
+ processing preferences such as audio track selection and dictionary choices.
371
+ api_key_obj_and_subscription: Dependency injection providing validated API key
372
+ object and associated subscription details for authorization and usage
373
+ limit enforcement.
374
+ traceparent (str | None, optional): OpenTelemetry trace parent header for
375
+ distributed tracing across microservices. Enables request correlation
376
+ and performance monitoring throughout the processing pipeline.
377
+
378
+ Returns:
379
+ Project setup response with project details and processing status.
380
+
381
+ Raises:
382
+ HTTPException:
383
+ - 400: If neither media_file nor media_url is provided
384
+ - 400: If uploaded file has no filename
385
+ - 413: If uploaded file exceeds size limit
386
+
387
+ Parameters
388
+ ----------
389
+ media_url : str
390
+
391
+ source_language : Languages
392
+
393
+ target_languages : typing.Sequence[Languages]
394
+
395
+ run_id : typing.Optional[int]
396
+
397
+ project_name : typing.Optional[str]
398
+
399
+ project_description : typing.Optional[str]
400
+
401
+ folder_id : typing.Optional[int]
402
+
403
+ selected_audio_tracks : typing.Optional[typing.Sequence[int]]
404
+
405
+ add_output_as_an_audio_track : typing.Optional[bool]
406
+
407
+ chosen_dictionaries : typing.Optional[typing.Sequence[int]]
408
+
409
+ request_options : typing.Optional[RequestOptions]
410
+ Request-specific configuration.
411
+
412
+ Returns
413
+ -------
414
+ AsyncHttpResponse[CreateProjectSetupOut]
415
+ Successful Response
416
+ """
417
+ _response = await self._client_wrapper.httpx_client.request(
418
+ "project-setup",
419
+ method="POST",
420
+ params={
421
+ "run_id": run_id,
422
+ },
423
+ json={
424
+ "project_name": project_name,
425
+ "project_description": project_description,
426
+ "folder_id": folder_id,
427
+ "media_url": media_url,
428
+ "source_language": source_language,
429
+ "target_languages": target_languages,
430
+ "selected_audio_tracks": selected_audio_tracks,
431
+ "add_output_as_an_audio_track": add_output_as_an_audio_track,
432
+ "chosen_dictionaries": chosen_dictionaries,
433
+ },
434
+ headers={
435
+ "content-type": "application/json",
436
+ },
437
+ request_options=request_options,
438
+ omit=OMIT,
439
+ )
440
+ try:
441
+ if 200 <= _response.status_code < 300:
442
+ _data = typing.cast(
443
+ CreateProjectSetupOut,
444
+ parse_obj_as(
445
+ type_=CreateProjectSetupOut, # type: ignore
446
+ object_=_response.json(),
447
+ ),
448
+ )
449
+ return AsyncHttpResponse(response=_response, data=_data)
450
+ if _response.status_code == 422:
451
+ raise UnprocessableEntityError(
452
+ headers=dict(_response.headers),
453
+ body=typing.cast(
454
+ HttpValidationError,
455
+ parse_obj_as(
456
+ type_=HttpValidationError, # type: ignore
457
+ object_=_response.json(),
458
+ ),
459
+ ),
460
+ )
461
+ _response_json = _response.json()
462
+ except JSONDecodeError:
463
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
464
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
465
+
466
+ async def create_project_setup_task_status(
467
+ self,
468
+ task_id: str,
469
+ *,
470
+ run_id: typing.Optional[int] = None,
471
+ request_options: typing.Optional[RequestOptions] = None,
472
+ ) -> AsyncHttpResponse[typing.List[GetCreateProjectSetupResponse]]:
473
+ """
474
+ Parameters
475
+ ----------
476
+ task_id : str
477
+
478
+ run_id : typing.Optional[int]
479
+
480
+ request_options : typing.Optional[RequestOptions]
481
+ Request-specific configuration.
482
+
483
+ Returns
484
+ -------
485
+ AsyncHttpResponse[typing.List[GetCreateProjectSetupResponse]]
486
+ Successful Response
487
+ """
488
+ _response = await self._client_wrapper.httpx_client.request(
489
+ f"project-setup/{jsonable_encoder(task_id)}",
490
+ method="GET",
491
+ params={
492
+ "run_id": run_id,
493
+ },
494
+ request_options=request_options,
495
+ )
496
+ try:
497
+ if 200 <= _response.status_code < 300:
498
+ _data = typing.cast(
499
+ typing.List[GetCreateProjectSetupResponse],
500
+ parse_obj_as(
501
+ type_=typing.List[GetCreateProjectSetupResponse], # type: ignore
502
+ object_=_response.json(),
503
+ ),
504
+ )
505
+ return AsyncHttpResponse(response=_response, data=_data)
506
+ if _response.status_code == 422:
507
+ raise UnprocessableEntityError(
508
+ headers=dict(_response.headers),
509
+ body=typing.cast(
510
+ HttpValidationError,
511
+ parse_obj_as(
512
+ type_=HttpValidationError, # type: ignore
513
+ object_=_response.json(),
514
+ ),
515
+ ),
516
+ )
517
+ _response_json = _response.json()
518
+ except JSONDecodeError:
519
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
520
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
521
+
522
+ async def get_project_setup_result(
523
+ self, run_id: typing.Optional[int], *, request_options: typing.Optional[RequestOptions] = None
524
+ ) -> AsyncHttpResponse[typing.Optional[GetCreateProjectSetupResponse]]:
525
+ """
526
+ Retrieves the final result of a completed project setup.
527
+
528
+ This endpoint provides access to the final results of a completed project setup.
529
+ It verifies that the authenticated user has access to the requested run_id and
530
+ validates that the run is of the correct type (`DUB_PROJECT`) before returning results.
531
+
532
+ Note:
533
+ This endpoint should only be called by users to retrieve their run results via API.
534
+ Access validation is performed to ensure users can only access their own runs.
535
+
536
+ Args:
537
+ run_id: Positive integer ID of the project setup run.
538
+ api_key_obj: API key authentication data from dependency.
539
+ traceparent: OpenTelemetry trace header for distributed tracing.
540
+
541
+ Returns:
542
+ GetCreateProjectSetupResponse: Project setup results including run details.
543
+
544
+ Raises:
545
+ HTTPException:
546
+ - 404: If the run_id is not found
547
+ - 400: If the run type is not valid for this endpoint (must be DUB_PROJECT)
548
+
549
+ Parameters
550
+ ----------
551
+ run_id : typing.Optional[int]
552
+
553
+ request_options : typing.Optional[RequestOptions]
554
+ Request-specific configuration.
555
+
556
+ Returns
557
+ -------
558
+ AsyncHttpResponse[typing.Optional[GetCreateProjectSetupResponse]]
559
+ Successful Response
560
+ """
561
+ _response = await self._client_wrapper.httpx_client.request(
562
+ f"project-setup-result/{jsonable_encoder(run_id)}",
563
+ method="GET",
564
+ request_options=request_options,
565
+ )
566
+ try:
567
+ if _response is None or not _response.text.strip():
568
+ return AsyncHttpResponse(response=_response, data=None)
569
+ if 200 <= _response.status_code < 300:
570
+ _data = typing.cast(
571
+ typing.Optional[GetCreateProjectSetupResponse],
572
+ parse_obj_as(
573
+ type_=typing.Optional[GetCreateProjectSetupResponse], # type: ignore
574
+ object_=_response.json(),
575
+ ),
576
+ )
577
+ return AsyncHttpResponse(response=_response, data=_data)
578
+ if _response.status_code == 422:
579
+ raise UnprocessableEntityError(
580
+ headers=dict(_response.headers),
581
+ body=typing.cast(
582
+ HttpValidationError,
583
+ parse_obj_as(
584
+ type_=HttpValidationError, # type: ignore
585
+ object_=_response.json(),
586
+ ),
587
+ ),
588
+ )
589
+ _response_json = _response.json()
590
+ except JSONDecodeError:
591
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
592
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
593
+
594
+ async def get_project_setup_runs_results(
595
+ self,
596
+ *,
597
+ run_ids: typing.Sequence[int],
598
+ run_id: typing.Optional[int] = None,
599
+ request_options: typing.Optional[RequestOptions] = None,
600
+ ) -> AsyncHttpResponse[typing.List[GetCreateProjectSetupResponse]]:
601
+ """
602
+ Parameters
603
+ ----------
604
+ run_ids : typing.Sequence[int]
605
+
606
+ run_id : typing.Optional[int]
607
+
608
+ request_options : typing.Optional[RequestOptions]
609
+ Request-specific configuration.
610
+
611
+ Returns
612
+ -------
613
+ AsyncHttpResponse[typing.List[GetCreateProjectSetupResponse]]
614
+ Successful Response
615
+ """
616
+ _response = await self._client_wrapper.httpx_client.request(
617
+ "project-setup-results",
618
+ method="POST",
619
+ params={
620
+ "run_id": run_id,
621
+ },
622
+ json={
623
+ "run_ids": run_ids,
624
+ },
625
+ headers={
626
+ "content-type": "application/json",
627
+ },
628
+ request_options=request_options,
629
+ omit=OMIT,
630
+ )
631
+ try:
632
+ if 200 <= _response.status_code < 300:
633
+ _data = typing.cast(
634
+ typing.List[GetCreateProjectSetupResponse],
635
+ parse_obj_as(
636
+ type_=typing.List[GetCreateProjectSetupResponse], # type: ignore
637
+ object_=_response.json(),
638
+ ),
639
+ )
640
+ return AsyncHttpResponse(response=_response, data=_data)
641
+ if _response.status_code == 422:
642
+ raise UnprocessableEntityError(
643
+ headers=dict(_response.headers),
644
+ body=typing.cast(
645
+ HttpValidationError,
646
+ parse_obj_as(
647
+ type_=HttpValidationError, # type: ignore
648
+ object_=_response.json(),
649
+ ),
650
+ ),
651
+ )
652
+ _response_json = _response.json()
653
+ except JSONDecodeError:
654
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
655
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
camb/py.typed ADDED
File without changes