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,639 @@
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.source_stream import SourceStream
20
+ from ..types.target_stream import TargetStream
21
+
22
+ # this is used as the default value for optional parameters
23
+ OMIT = typing.cast(typing.Any, ...)
24
+
25
+
26
+ class RawDeprecatedStreamingClient:
27
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
28
+ self._client_wrapper = client_wrapper
29
+
30
+ def create_stream(
31
+ self,
32
+ *,
33
+ voices: typing.Sequence[int],
34
+ dictionaries: typing.Sequence[int],
35
+ config: ConfigStream,
36
+ source_stream: SourceStream,
37
+ target_streams: typing.Sequence[TargetStream],
38
+ name: typing.Optional[str] = OMIT,
39
+ description: typing.Optional[str] = OMIT,
40
+ initial_delay: typing.Optional[int] = OMIT,
41
+ timeout_in_mins: typing.Optional[int] = OMIT,
42
+ start_time: typing.Optional[dt.datetime] = OMIT,
43
+ end_time: typing.Optional[dt.datetime] = OMIT,
44
+ timezone: typing.Optional[str] = OMIT,
45
+ request_options: typing.Optional[RequestOptions] = None,
46
+ ) -> HttpResponse[CreateStreamOut]:
47
+ """
48
+ Parameters
49
+ ----------
50
+ voices : typing.Sequence[int]
51
+ List of voice identifiers to be used in the stream.
52
+
53
+ dictionaries : typing.Sequence[int]
54
+ List of dictionary identifiers to be used in the stream.
55
+
56
+ config : ConfigStream
57
+ The shared configuration for the streaming pipeline.
58
+
59
+ source_stream : SourceStream
60
+ The source stream configuration details.
61
+
62
+ target_streams : typing.Sequence[TargetStream]
63
+ List of target stream configurations.
64
+
65
+ name : typing.Optional[str]
66
+ The name of the stream.
67
+
68
+ description : typing.Optional[str]
69
+ The description of the stream.
70
+
71
+ initial_delay : typing.Optional[int]
72
+ The initial delay in seconds before starting the stream creation process.
73
+
74
+ timeout_in_mins : typing.Optional[int]
75
+ The maximum duration in minutes for the stream creation process before timing out.
76
+
77
+ start_time : typing.Optional[dt.datetime]
78
+
79
+ end_time : typing.Optional[dt.datetime]
80
+
81
+ timezone : typing.Optional[str]
82
+
83
+ request_options : typing.Optional[RequestOptions]
84
+ Request-specific configuration.
85
+
86
+ Returns
87
+ -------
88
+ HttpResponse[CreateStreamOut]
89
+ Successful Response
90
+ """
91
+ _response = self._client_wrapper.httpx_client.request(
92
+ "v1/stream",
93
+ method="POST",
94
+ json={
95
+ "name": name,
96
+ "description": description,
97
+ "initial_delay": initial_delay,
98
+ "timeout_in_mins": timeout_in_mins,
99
+ "voices": voices,
100
+ "dictionaries": dictionaries,
101
+ "config": convert_and_respect_annotation_metadata(
102
+ object_=config, annotation=ConfigStream, direction="write"
103
+ ),
104
+ "source_stream": convert_and_respect_annotation_metadata(
105
+ object_=source_stream, annotation=SourceStream, direction="write"
106
+ ),
107
+ "target_streams": convert_and_respect_annotation_metadata(
108
+ object_=target_streams, annotation=typing.Sequence[TargetStream], direction="write"
109
+ ),
110
+ "start_time": start_time,
111
+ "end_time": end_time,
112
+ "timezone": timezone,
113
+ },
114
+ headers={
115
+ "content-type": "application/json",
116
+ },
117
+ request_options=request_options,
118
+ omit=OMIT,
119
+ )
120
+ try:
121
+ if 200 <= _response.status_code < 300:
122
+ _data = typing.cast(
123
+ CreateStreamOut,
124
+ parse_obj_as(
125
+ type_=CreateStreamOut, # type: ignore
126
+ object_=_response.json(),
127
+ ),
128
+ )
129
+ return HttpResponse(response=_response, data=_data)
130
+ if _response.status_code == 422:
131
+ raise UnprocessableEntityError(
132
+ headers=dict(_response.headers),
133
+ body=typing.cast(
134
+ HttpValidationError,
135
+ parse_obj_as(
136
+ type_=HttpValidationError, # type: ignore
137
+ object_=_response.json(),
138
+ ),
139
+ ),
140
+ )
141
+ _response_json = _response.json()
142
+ except JSONDecodeError:
143
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
144
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
145
+
146
+ def get_stream_result(
147
+ self,
148
+ stream_id: int,
149
+ *,
150
+ run_id: typing.Optional[int] = None,
151
+ request_options: typing.Optional[RequestOptions] = None,
152
+ ) -> HttpResponse[typing.Dict[str, typing.Any]]:
153
+ """
154
+ Parameters
155
+ ----------
156
+ stream_id : int
157
+
158
+ run_id : typing.Optional[int]
159
+
160
+ request_options : typing.Optional[RequestOptions]
161
+ Request-specific configuration.
162
+
163
+ Returns
164
+ -------
165
+ HttpResponse[typing.Dict[str, typing.Any]]
166
+ Successful Response
167
+ """
168
+ _response = self._client_wrapper.httpx_client.request(
169
+ f"v1/stream/{jsonable_encoder(stream_id)}",
170
+ method="GET",
171
+ params={
172
+ "run_id": run_id,
173
+ },
174
+ request_options=request_options,
175
+ )
176
+ try:
177
+ if 200 <= _response.status_code < 300:
178
+ _data = typing.cast(
179
+ typing.Dict[str, typing.Any],
180
+ parse_obj_as(
181
+ type_=typing.Dict[str, typing.Any], # type: ignore
182
+ object_=_response.json(),
183
+ ),
184
+ )
185
+ return HttpResponse(response=_response, data=_data)
186
+ if _response.status_code == 422:
187
+ raise UnprocessableEntityError(
188
+ headers=dict(_response.headers),
189
+ body=typing.cast(
190
+ HttpValidationError,
191
+ parse_obj_as(
192
+ type_=HttpValidationError, # type: ignore
193
+ object_=_response.json(),
194
+ ),
195
+ ),
196
+ )
197
+ _response_json = _response.json()
198
+ except JSONDecodeError:
199
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
200
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
201
+
202
+ def stop_stream(
203
+ self,
204
+ stream_id: int,
205
+ *,
206
+ run_id: typing.Optional[int] = None,
207
+ request_options: typing.Optional[RequestOptions] = None,
208
+ ) -> HttpResponse[typing.Dict[str, typing.Any]]:
209
+ """
210
+ Parameters
211
+ ----------
212
+ stream_id : int
213
+
214
+ run_id : typing.Optional[int]
215
+
216
+ request_options : typing.Optional[RequestOptions]
217
+ Request-specific configuration.
218
+
219
+ Returns
220
+ -------
221
+ HttpResponse[typing.Dict[str, typing.Any]]
222
+ Successful Response
223
+ """
224
+ _response = self._client_wrapper.httpx_client.request(
225
+ f"v1/stream/{jsonable_encoder(stream_id)}/stop",
226
+ method="GET",
227
+ params={
228
+ "run_id": run_id,
229
+ },
230
+ request_options=request_options,
231
+ )
232
+ try:
233
+ if 200 <= _response.status_code < 300:
234
+ _data = typing.cast(
235
+ typing.Dict[str, typing.Any],
236
+ parse_obj_as(
237
+ type_=typing.Dict[str, typing.Any], # type: ignore
238
+ object_=_response.json(),
239
+ ),
240
+ )
241
+ return HttpResponse(response=_response, data=_data)
242
+ if _response.status_code == 422:
243
+ raise UnprocessableEntityError(
244
+ headers=dict(_response.headers),
245
+ body=typing.cast(
246
+ HttpValidationError,
247
+ parse_obj_as(
248
+ type_=HttpValidationError, # type: ignore
249
+ object_=_response.json(),
250
+ ),
251
+ ),
252
+ )
253
+ _response_json = _response.json()
254
+ except JSONDecodeError:
255
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
256
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
257
+
258
+ def get_probe_stream(
259
+ self,
260
+ *,
261
+ url: str,
262
+ run_id: typing.Optional[int] = None,
263
+ traceparent: typing.Optional[str] = None,
264
+ passphrase: typing.Optional[str] = OMIT,
265
+ stream_id: typing.Optional[str] = OMIT,
266
+ request_options: typing.Optional[RequestOptions] = None,
267
+ ) -> HttpResponse[GetProbeStreamOut]:
268
+ """
269
+ Parameters
270
+ ----------
271
+ url : str
272
+
273
+ run_id : typing.Optional[int]
274
+
275
+ traceparent : typing.Optional[str]
276
+
277
+ passphrase : typing.Optional[str]
278
+
279
+ stream_id : typing.Optional[str]
280
+
281
+ request_options : typing.Optional[RequestOptions]
282
+ Request-specific configuration.
283
+
284
+ Returns
285
+ -------
286
+ HttpResponse[GetProbeStreamOut]
287
+ Successful Response
288
+ """
289
+ _response = self._client_wrapper.httpx_client.request(
290
+ "v1/stream/probe",
291
+ method="POST",
292
+ params={
293
+ "run_id": run_id,
294
+ },
295
+ json={
296
+ "url": url,
297
+ "passphrase": passphrase,
298
+ "stream_id": stream_id,
299
+ },
300
+ headers={
301
+ "content-type": "application/json",
302
+ "traceparent": str(traceparent) if traceparent is not None else None,
303
+ },
304
+ request_options=request_options,
305
+ omit=OMIT,
306
+ )
307
+ try:
308
+ if 200 <= _response.status_code < 300:
309
+ _data = typing.cast(
310
+ GetProbeStreamOut,
311
+ parse_obj_as(
312
+ type_=GetProbeStreamOut, # type: ignore
313
+ object_=_response.json(),
314
+ ),
315
+ )
316
+ return HttpResponse(response=_response, data=_data)
317
+ if _response.status_code == 422:
318
+ raise UnprocessableEntityError(
319
+ headers=dict(_response.headers),
320
+ body=typing.cast(
321
+ HttpValidationError,
322
+ parse_obj_as(
323
+ type_=HttpValidationError, # type: ignore
324
+ object_=_response.json(),
325
+ ),
326
+ ),
327
+ )
328
+ _response_json = _response.json()
329
+ except JSONDecodeError:
330
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
331
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
332
+
333
+
334
+ class AsyncRawDeprecatedStreamingClient:
335
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
336
+ self._client_wrapper = client_wrapper
337
+
338
+ async def create_stream(
339
+ self,
340
+ *,
341
+ voices: typing.Sequence[int],
342
+ dictionaries: typing.Sequence[int],
343
+ config: ConfigStream,
344
+ source_stream: SourceStream,
345
+ target_streams: typing.Sequence[TargetStream],
346
+ name: typing.Optional[str] = OMIT,
347
+ description: typing.Optional[str] = OMIT,
348
+ initial_delay: typing.Optional[int] = OMIT,
349
+ timeout_in_mins: typing.Optional[int] = OMIT,
350
+ start_time: typing.Optional[dt.datetime] = OMIT,
351
+ end_time: typing.Optional[dt.datetime] = OMIT,
352
+ timezone: typing.Optional[str] = OMIT,
353
+ request_options: typing.Optional[RequestOptions] = None,
354
+ ) -> AsyncHttpResponse[CreateStreamOut]:
355
+ """
356
+ Parameters
357
+ ----------
358
+ voices : typing.Sequence[int]
359
+ List of voice identifiers to be used in the stream.
360
+
361
+ dictionaries : typing.Sequence[int]
362
+ List of dictionary identifiers to be used in the stream.
363
+
364
+ config : ConfigStream
365
+ The shared configuration for the streaming pipeline.
366
+
367
+ source_stream : SourceStream
368
+ The source stream configuration details.
369
+
370
+ target_streams : typing.Sequence[TargetStream]
371
+ List of target stream configurations.
372
+
373
+ name : typing.Optional[str]
374
+ The name of the stream.
375
+
376
+ description : typing.Optional[str]
377
+ The description of the stream.
378
+
379
+ initial_delay : typing.Optional[int]
380
+ The initial delay in seconds before starting the stream creation process.
381
+
382
+ timeout_in_mins : typing.Optional[int]
383
+ The maximum duration in minutes for the stream creation process before timing out.
384
+
385
+ start_time : typing.Optional[dt.datetime]
386
+
387
+ end_time : typing.Optional[dt.datetime]
388
+
389
+ timezone : typing.Optional[str]
390
+
391
+ request_options : typing.Optional[RequestOptions]
392
+ Request-specific configuration.
393
+
394
+ Returns
395
+ -------
396
+ AsyncHttpResponse[CreateStreamOut]
397
+ Successful Response
398
+ """
399
+ _response = await self._client_wrapper.httpx_client.request(
400
+ "v1/stream",
401
+ method="POST",
402
+ json={
403
+ "name": name,
404
+ "description": description,
405
+ "initial_delay": initial_delay,
406
+ "timeout_in_mins": timeout_in_mins,
407
+ "voices": voices,
408
+ "dictionaries": dictionaries,
409
+ "config": convert_and_respect_annotation_metadata(
410
+ object_=config, annotation=ConfigStream, direction="write"
411
+ ),
412
+ "source_stream": convert_and_respect_annotation_metadata(
413
+ object_=source_stream, annotation=SourceStream, direction="write"
414
+ ),
415
+ "target_streams": convert_and_respect_annotation_metadata(
416
+ object_=target_streams, annotation=typing.Sequence[TargetStream], direction="write"
417
+ ),
418
+ "start_time": start_time,
419
+ "end_time": end_time,
420
+ "timezone": timezone,
421
+ },
422
+ headers={
423
+ "content-type": "application/json",
424
+ },
425
+ request_options=request_options,
426
+ omit=OMIT,
427
+ )
428
+ try:
429
+ if 200 <= _response.status_code < 300:
430
+ _data = typing.cast(
431
+ CreateStreamOut,
432
+ parse_obj_as(
433
+ type_=CreateStreamOut, # type: ignore
434
+ object_=_response.json(),
435
+ ),
436
+ )
437
+ return AsyncHttpResponse(response=_response, data=_data)
438
+ if _response.status_code == 422:
439
+ raise UnprocessableEntityError(
440
+ headers=dict(_response.headers),
441
+ body=typing.cast(
442
+ HttpValidationError,
443
+ parse_obj_as(
444
+ type_=HttpValidationError, # type: ignore
445
+ object_=_response.json(),
446
+ ),
447
+ ),
448
+ )
449
+ _response_json = _response.json()
450
+ except JSONDecodeError:
451
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
452
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
453
+
454
+ async def get_stream_result(
455
+ self,
456
+ stream_id: int,
457
+ *,
458
+ run_id: typing.Optional[int] = None,
459
+ request_options: typing.Optional[RequestOptions] = None,
460
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
461
+ """
462
+ Parameters
463
+ ----------
464
+ stream_id : int
465
+
466
+ run_id : typing.Optional[int]
467
+
468
+ request_options : typing.Optional[RequestOptions]
469
+ Request-specific configuration.
470
+
471
+ Returns
472
+ -------
473
+ AsyncHttpResponse[typing.Dict[str, typing.Any]]
474
+ Successful Response
475
+ """
476
+ _response = await self._client_wrapper.httpx_client.request(
477
+ f"v1/stream/{jsonable_encoder(stream_id)}",
478
+ method="GET",
479
+ params={
480
+ "run_id": run_id,
481
+ },
482
+ request_options=request_options,
483
+ )
484
+ try:
485
+ if 200 <= _response.status_code < 300:
486
+ _data = typing.cast(
487
+ typing.Dict[str, typing.Any],
488
+ parse_obj_as(
489
+ type_=typing.Dict[str, typing.Any], # type: ignore
490
+ object_=_response.json(),
491
+ ),
492
+ )
493
+ return AsyncHttpResponse(response=_response, data=_data)
494
+ if _response.status_code == 422:
495
+ raise UnprocessableEntityError(
496
+ headers=dict(_response.headers),
497
+ body=typing.cast(
498
+ HttpValidationError,
499
+ parse_obj_as(
500
+ type_=HttpValidationError, # type: ignore
501
+ object_=_response.json(),
502
+ ),
503
+ ),
504
+ )
505
+ _response_json = _response.json()
506
+ except JSONDecodeError:
507
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
508
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
509
+
510
+ async def stop_stream(
511
+ self,
512
+ stream_id: int,
513
+ *,
514
+ run_id: typing.Optional[int] = None,
515
+ request_options: typing.Optional[RequestOptions] = None,
516
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Any]]:
517
+ """
518
+ Parameters
519
+ ----------
520
+ stream_id : int
521
+
522
+ run_id : typing.Optional[int]
523
+
524
+ request_options : typing.Optional[RequestOptions]
525
+ Request-specific configuration.
526
+
527
+ Returns
528
+ -------
529
+ AsyncHttpResponse[typing.Dict[str, typing.Any]]
530
+ Successful Response
531
+ """
532
+ _response = await self._client_wrapper.httpx_client.request(
533
+ f"v1/stream/{jsonable_encoder(stream_id)}/stop",
534
+ method="GET",
535
+ params={
536
+ "run_id": run_id,
537
+ },
538
+ request_options=request_options,
539
+ )
540
+ try:
541
+ if 200 <= _response.status_code < 300:
542
+ _data = typing.cast(
543
+ typing.Dict[str, typing.Any],
544
+ parse_obj_as(
545
+ type_=typing.Dict[str, typing.Any], # type: ignore
546
+ object_=_response.json(),
547
+ ),
548
+ )
549
+ return AsyncHttpResponse(response=_response, data=_data)
550
+ if _response.status_code == 422:
551
+ raise UnprocessableEntityError(
552
+ headers=dict(_response.headers),
553
+ body=typing.cast(
554
+ HttpValidationError,
555
+ parse_obj_as(
556
+ type_=HttpValidationError, # type: ignore
557
+ object_=_response.json(),
558
+ ),
559
+ ),
560
+ )
561
+ _response_json = _response.json()
562
+ except JSONDecodeError:
563
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
564
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
565
+
566
+ async def get_probe_stream(
567
+ self,
568
+ *,
569
+ url: str,
570
+ run_id: typing.Optional[int] = None,
571
+ traceparent: typing.Optional[str] = None,
572
+ passphrase: typing.Optional[str] = OMIT,
573
+ stream_id: typing.Optional[str] = OMIT,
574
+ request_options: typing.Optional[RequestOptions] = None,
575
+ ) -> AsyncHttpResponse[GetProbeStreamOut]:
576
+ """
577
+ Parameters
578
+ ----------
579
+ url : str
580
+
581
+ run_id : typing.Optional[int]
582
+
583
+ traceparent : typing.Optional[str]
584
+
585
+ passphrase : typing.Optional[str]
586
+
587
+ stream_id : typing.Optional[str]
588
+
589
+ request_options : typing.Optional[RequestOptions]
590
+ Request-specific configuration.
591
+
592
+ Returns
593
+ -------
594
+ AsyncHttpResponse[GetProbeStreamOut]
595
+ Successful Response
596
+ """
597
+ _response = await self._client_wrapper.httpx_client.request(
598
+ "v1/stream/probe",
599
+ method="POST",
600
+ params={
601
+ "run_id": run_id,
602
+ },
603
+ json={
604
+ "url": url,
605
+ "passphrase": passphrase,
606
+ "stream_id": stream_id,
607
+ },
608
+ headers={
609
+ "content-type": "application/json",
610
+ "traceparent": str(traceparent) if traceparent is not None else None,
611
+ },
612
+ request_options=request_options,
613
+ omit=OMIT,
614
+ )
615
+ try:
616
+ if 200 <= _response.status_code < 300:
617
+ _data = typing.cast(
618
+ GetProbeStreamOut,
619
+ parse_obj_as(
620
+ type_=GetProbeStreamOut, # type: ignore
621
+ object_=_response.json(),
622
+ ),
623
+ )
624
+ return AsyncHttpResponse(response=_response, data=_data)
625
+ if _response.status_code == 422:
626
+ raise UnprocessableEntityError(
627
+ headers=dict(_response.headers),
628
+ body=typing.cast(
629
+ HttpValidationError,
630
+ parse_obj_as(
631
+ type_=HttpValidationError, # type: ignore
632
+ object_=_response.json(),
633
+ ),
634
+ ),
635
+ )
636
+ _response_json = _response.json()
637
+ except JSONDecodeError:
638
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
639
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,4 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+