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
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from .. import core
|
|
6
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
|
+
from ..core.request_options import RequestOptions
|
|
8
|
+
from ..types.dictionary_with_terms import DictionaryWithTerms
|
|
9
|
+
from ..types.term_translation_input import TermTranslationInput
|
|
10
|
+
from .raw_client import AsyncRawDictionariesClient, RawDictionariesClient
|
|
11
|
+
|
|
12
|
+
# this is used as the default value for optional parameters
|
|
13
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DictionariesClient:
|
|
17
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
+
self._raw_client = RawDictionariesClient(client_wrapper=client_wrapper)
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def with_raw_response(self) -> RawDictionariesClient:
|
|
22
|
+
"""
|
|
23
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
RawDictionariesClient
|
|
28
|
+
"""
|
|
29
|
+
return self._raw_client
|
|
30
|
+
|
|
31
|
+
def get_dictionaries(
|
|
32
|
+
self, *, run_id: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
33
|
+
) -> typing.List[DictionaryWithTerms]:
|
|
34
|
+
"""
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
run_id : typing.Optional[int]
|
|
38
|
+
|
|
39
|
+
request_options : typing.Optional[RequestOptions]
|
|
40
|
+
Request-specific configuration.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
typing.List[DictionaryWithTerms]
|
|
45
|
+
Successful Response
|
|
46
|
+
|
|
47
|
+
Examples
|
|
48
|
+
--------
|
|
49
|
+
from camb import CambApi
|
|
50
|
+
|
|
51
|
+
client = CambApi(
|
|
52
|
+
api_key="YOUR_API_KEY",
|
|
53
|
+
)
|
|
54
|
+
client.dictionaries.get_dictionaries()
|
|
55
|
+
"""
|
|
56
|
+
_response = self._raw_client.get_dictionaries(run_id=run_id, request_options=request_options)
|
|
57
|
+
return _response.data
|
|
58
|
+
|
|
59
|
+
def create_dictionary_from_file(
|
|
60
|
+
self,
|
|
61
|
+
*,
|
|
62
|
+
dictionary_file: core.File,
|
|
63
|
+
dictionary_name: str,
|
|
64
|
+
run_id: typing.Optional[int] = None,
|
|
65
|
+
dictionary_description: typing.Optional[str] = OMIT,
|
|
66
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
67
|
+
) -> typing.Any:
|
|
68
|
+
"""
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
dictionary_file : core.File
|
|
72
|
+
See core.File for more documentation
|
|
73
|
+
|
|
74
|
+
dictionary_name : str
|
|
75
|
+
The name of the dictonary to be created. This is mainly used for organizational purposes.
|
|
76
|
+
|
|
77
|
+
run_id : typing.Optional[int]
|
|
78
|
+
|
|
79
|
+
dictionary_description : typing.Optional[str]
|
|
80
|
+
The description of the dictionary to be created. This is an optional field that is used to help you provide some info about your dictionaries for better organization.
|
|
81
|
+
|
|
82
|
+
request_options : typing.Optional[RequestOptions]
|
|
83
|
+
Request-specific configuration.
|
|
84
|
+
|
|
85
|
+
Returns
|
|
86
|
+
-------
|
|
87
|
+
typing.Any
|
|
88
|
+
Successful Response
|
|
89
|
+
|
|
90
|
+
Examples
|
|
91
|
+
--------
|
|
92
|
+
from camb import CambApi
|
|
93
|
+
|
|
94
|
+
client = CambApi(
|
|
95
|
+
api_key="YOUR_API_KEY",
|
|
96
|
+
)
|
|
97
|
+
client.dictionaries.create_dictionary_from_file(
|
|
98
|
+
dictionary_name="dictionary_name",
|
|
99
|
+
)
|
|
100
|
+
"""
|
|
101
|
+
_response = self._raw_client.create_dictionary_from_file(
|
|
102
|
+
dictionary_file=dictionary_file,
|
|
103
|
+
dictionary_name=dictionary_name,
|
|
104
|
+
run_id=run_id,
|
|
105
|
+
dictionary_description=dictionary_description,
|
|
106
|
+
request_options=request_options,
|
|
107
|
+
)
|
|
108
|
+
return _response.data
|
|
109
|
+
|
|
110
|
+
def get_dictionary_info(
|
|
111
|
+
self,
|
|
112
|
+
dictionary_id: int,
|
|
113
|
+
*,
|
|
114
|
+
run_id: typing.Optional[int] = None,
|
|
115
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
116
|
+
) -> DictionaryWithTerms:
|
|
117
|
+
"""
|
|
118
|
+
Parameters
|
|
119
|
+
----------
|
|
120
|
+
dictionary_id : int
|
|
121
|
+
|
|
122
|
+
run_id : typing.Optional[int]
|
|
123
|
+
|
|
124
|
+
request_options : typing.Optional[RequestOptions]
|
|
125
|
+
Request-specific configuration.
|
|
126
|
+
|
|
127
|
+
Returns
|
|
128
|
+
-------
|
|
129
|
+
DictionaryWithTerms
|
|
130
|
+
Successful Response
|
|
131
|
+
|
|
132
|
+
Examples
|
|
133
|
+
--------
|
|
134
|
+
from camb import CambApi
|
|
135
|
+
|
|
136
|
+
client = CambApi(
|
|
137
|
+
api_key="YOUR_API_KEY",
|
|
138
|
+
)
|
|
139
|
+
client.dictionaries.get_dictionary_info(
|
|
140
|
+
dictionary_id=1,
|
|
141
|
+
)
|
|
142
|
+
"""
|
|
143
|
+
_response = self._raw_client.get_dictionary_info(dictionary_id, run_id=run_id, request_options=request_options)
|
|
144
|
+
return _response.data
|
|
145
|
+
|
|
146
|
+
def delete_dictionary(
|
|
147
|
+
self,
|
|
148
|
+
dictionary_id: int,
|
|
149
|
+
*,
|
|
150
|
+
run_id: typing.Optional[int] = None,
|
|
151
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
152
|
+
) -> typing.Any:
|
|
153
|
+
"""
|
|
154
|
+
Parameters
|
|
155
|
+
----------
|
|
156
|
+
dictionary_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
|
+
typing.Any
|
|
166
|
+
Successful Response
|
|
167
|
+
|
|
168
|
+
Examples
|
|
169
|
+
--------
|
|
170
|
+
from camb import CambApi
|
|
171
|
+
|
|
172
|
+
client = CambApi(
|
|
173
|
+
api_key="YOUR_API_KEY",
|
|
174
|
+
)
|
|
175
|
+
client.dictionaries.delete_dictionary(
|
|
176
|
+
dictionary_id=1,
|
|
177
|
+
)
|
|
178
|
+
"""
|
|
179
|
+
_response = self._raw_client.delete_dictionary(dictionary_id, run_id=run_id, request_options=request_options)
|
|
180
|
+
return _response.data
|
|
181
|
+
|
|
182
|
+
def get_dictionary_details(
|
|
183
|
+
self,
|
|
184
|
+
dictionary_id: int,
|
|
185
|
+
*,
|
|
186
|
+
limit: typing.Optional[int] = None,
|
|
187
|
+
search_term: typing.Optional[str] = None,
|
|
188
|
+
run_id: typing.Optional[int] = None,
|
|
189
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
190
|
+
) -> DictionaryWithTerms:
|
|
191
|
+
"""
|
|
192
|
+
Parameters
|
|
193
|
+
----------
|
|
194
|
+
dictionary_id : int
|
|
195
|
+
|
|
196
|
+
limit : typing.Optional[int]
|
|
197
|
+
Limit how many terms are returned when fetching the dictionary details.
|
|
198
|
+
|
|
199
|
+
search_term : typing.Optional[str]
|
|
200
|
+
|
|
201
|
+
run_id : typing.Optional[int]
|
|
202
|
+
|
|
203
|
+
request_options : typing.Optional[RequestOptions]
|
|
204
|
+
Request-specific configuration.
|
|
205
|
+
|
|
206
|
+
Returns
|
|
207
|
+
-------
|
|
208
|
+
DictionaryWithTerms
|
|
209
|
+
Successful Response
|
|
210
|
+
|
|
211
|
+
Examples
|
|
212
|
+
--------
|
|
213
|
+
from camb import CambApi
|
|
214
|
+
|
|
215
|
+
client = CambApi(
|
|
216
|
+
api_key="YOUR_API_KEY",
|
|
217
|
+
)
|
|
218
|
+
client.dictionaries.get_dictionary_details(
|
|
219
|
+
dictionary_id=1,
|
|
220
|
+
)
|
|
221
|
+
"""
|
|
222
|
+
_response = self._raw_client.get_dictionary_details(
|
|
223
|
+
dictionary_id, limit=limit, search_term=search_term, run_id=run_id, request_options=request_options
|
|
224
|
+
)
|
|
225
|
+
return _response.data
|
|
226
|
+
|
|
227
|
+
def add_term_to_dictionary(
|
|
228
|
+
self,
|
|
229
|
+
dictionary_id: int,
|
|
230
|
+
*,
|
|
231
|
+
translations: typing.Sequence[TermTranslationInput],
|
|
232
|
+
run_id: typing.Optional[int] = None,
|
|
233
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
234
|
+
) -> typing.Any:
|
|
235
|
+
"""
|
|
236
|
+
Parameters
|
|
237
|
+
----------
|
|
238
|
+
dictionary_id : int
|
|
239
|
+
|
|
240
|
+
translations : typing.Sequence[TermTranslationInput]
|
|
241
|
+
|
|
242
|
+
run_id : typing.Optional[int]
|
|
243
|
+
|
|
244
|
+
request_options : typing.Optional[RequestOptions]
|
|
245
|
+
Request-specific configuration.
|
|
246
|
+
|
|
247
|
+
Returns
|
|
248
|
+
-------
|
|
249
|
+
typing.Any
|
|
250
|
+
Successful Response
|
|
251
|
+
|
|
252
|
+
Examples
|
|
253
|
+
--------
|
|
254
|
+
from camb import CambApi, TermTranslationInput
|
|
255
|
+
|
|
256
|
+
client = CambApi(
|
|
257
|
+
api_key="YOUR_API_KEY",
|
|
258
|
+
)
|
|
259
|
+
client.dictionaries.add_term_to_dictionary(
|
|
260
|
+
dictionary_id=1,
|
|
261
|
+
translations=[
|
|
262
|
+
TermTranslationInput(
|
|
263
|
+
translation="translation",
|
|
264
|
+
language=1,
|
|
265
|
+
)
|
|
266
|
+
],
|
|
267
|
+
)
|
|
268
|
+
"""
|
|
269
|
+
_response = self._raw_client.add_term_to_dictionary(
|
|
270
|
+
dictionary_id, translations=translations, run_id=run_id, request_options=request_options
|
|
271
|
+
)
|
|
272
|
+
return _response.data
|
|
273
|
+
|
|
274
|
+
def update_term_translation_in_dictionary_using_term_id(
|
|
275
|
+
self,
|
|
276
|
+
dictionary_id: int,
|
|
277
|
+
term_id: int,
|
|
278
|
+
*,
|
|
279
|
+
translations: typing.Sequence[TermTranslationInput],
|
|
280
|
+
run_id: typing.Optional[int] = None,
|
|
281
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
282
|
+
) -> typing.Any:
|
|
283
|
+
"""
|
|
284
|
+
Parameters
|
|
285
|
+
----------
|
|
286
|
+
dictionary_id : int
|
|
287
|
+
|
|
288
|
+
term_id : int
|
|
289
|
+
|
|
290
|
+
translations : typing.Sequence[TermTranslationInput]
|
|
291
|
+
|
|
292
|
+
run_id : typing.Optional[int]
|
|
293
|
+
|
|
294
|
+
request_options : typing.Optional[RequestOptions]
|
|
295
|
+
Request-specific configuration.
|
|
296
|
+
|
|
297
|
+
Returns
|
|
298
|
+
-------
|
|
299
|
+
typing.Any
|
|
300
|
+
Successful Response
|
|
301
|
+
|
|
302
|
+
Examples
|
|
303
|
+
--------
|
|
304
|
+
from camb import CambApi, TermTranslationInput
|
|
305
|
+
|
|
306
|
+
client = CambApi(
|
|
307
|
+
api_key="YOUR_API_KEY",
|
|
308
|
+
)
|
|
309
|
+
client.dictionaries.update_term_translation_in_dictionary_using_term_id(
|
|
310
|
+
dictionary_id=1,
|
|
311
|
+
term_id=1,
|
|
312
|
+
translations=[
|
|
313
|
+
TermTranslationInput(
|
|
314
|
+
translation="translation",
|
|
315
|
+
language=1,
|
|
316
|
+
)
|
|
317
|
+
],
|
|
318
|
+
)
|
|
319
|
+
"""
|
|
320
|
+
_response = self._raw_client.update_term_translation_in_dictionary_using_term_id(
|
|
321
|
+
dictionary_id, term_id, translations=translations, run_id=run_id, request_options=request_options
|
|
322
|
+
)
|
|
323
|
+
return _response.data
|
|
324
|
+
|
|
325
|
+
def delete_dictionary_term(
|
|
326
|
+
self,
|
|
327
|
+
dictionary_id: int,
|
|
328
|
+
term_id: int,
|
|
329
|
+
*,
|
|
330
|
+
run_id: typing.Optional[int] = None,
|
|
331
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
332
|
+
) -> typing.Any:
|
|
333
|
+
"""
|
|
334
|
+
Parameters
|
|
335
|
+
----------
|
|
336
|
+
dictionary_id : int
|
|
337
|
+
|
|
338
|
+
term_id : int
|
|
339
|
+
|
|
340
|
+
run_id : typing.Optional[int]
|
|
341
|
+
|
|
342
|
+
request_options : typing.Optional[RequestOptions]
|
|
343
|
+
Request-specific configuration.
|
|
344
|
+
|
|
345
|
+
Returns
|
|
346
|
+
-------
|
|
347
|
+
typing.Any
|
|
348
|
+
Successful Response
|
|
349
|
+
|
|
350
|
+
Examples
|
|
351
|
+
--------
|
|
352
|
+
from camb import CambApi
|
|
353
|
+
|
|
354
|
+
client = CambApi(
|
|
355
|
+
api_key="YOUR_API_KEY",
|
|
356
|
+
)
|
|
357
|
+
client.dictionaries.delete_dictionary_term(
|
|
358
|
+
dictionary_id=1,
|
|
359
|
+
term_id=1,
|
|
360
|
+
)
|
|
361
|
+
"""
|
|
362
|
+
_response = self._raw_client.delete_dictionary_term(
|
|
363
|
+
dictionary_id, term_id, run_id=run_id, request_options=request_options
|
|
364
|
+
)
|
|
365
|
+
return _response.data
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class AsyncDictionariesClient:
|
|
369
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
370
|
+
self._raw_client = AsyncRawDictionariesClient(client_wrapper=client_wrapper)
|
|
371
|
+
|
|
372
|
+
@property
|
|
373
|
+
def with_raw_response(self) -> AsyncRawDictionariesClient:
|
|
374
|
+
"""
|
|
375
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
376
|
+
|
|
377
|
+
Returns
|
|
378
|
+
-------
|
|
379
|
+
AsyncRawDictionariesClient
|
|
380
|
+
"""
|
|
381
|
+
return self._raw_client
|
|
382
|
+
|
|
383
|
+
async def get_dictionaries(
|
|
384
|
+
self, *, run_id: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
385
|
+
) -> typing.List[DictionaryWithTerms]:
|
|
386
|
+
"""
|
|
387
|
+
Parameters
|
|
388
|
+
----------
|
|
389
|
+
run_id : typing.Optional[int]
|
|
390
|
+
|
|
391
|
+
request_options : typing.Optional[RequestOptions]
|
|
392
|
+
Request-specific configuration.
|
|
393
|
+
|
|
394
|
+
Returns
|
|
395
|
+
-------
|
|
396
|
+
typing.List[DictionaryWithTerms]
|
|
397
|
+
Successful Response
|
|
398
|
+
|
|
399
|
+
Examples
|
|
400
|
+
--------
|
|
401
|
+
import asyncio
|
|
402
|
+
|
|
403
|
+
from camb import AsyncCambApi
|
|
404
|
+
|
|
405
|
+
client = AsyncCambApi(
|
|
406
|
+
api_key="YOUR_API_KEY",
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
async def main() -> None:
|
|
411
|
+
await client.dictionaries.get_dictionaries()
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
asyncio.run(main())
|
|
415
|
+
"""
|
|
416
|
+
_response = await self._raw_client.get_dictionaries(run_id=run_id, request_options=request_options)
|
|
417
|
+
return _response.data
|
|
418
|
+
|
|
419
|
+
async def create_dictionary_from_file(
|
|
420
|
+
self,
|
|
421
|
+
*,
|
|
422
|
+
dictionary_file: core.File,
|
|
423
|
+
dictionary_name: str,
|
|
424
|
+
run_id: typing.Optional[int] = None,
|
|
425
|
+
dictionary_description: typing.Optional[str] = OMIT,
|
|
426
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
427
|
+
) -> typing.Any:
|
|
428
|
+
"""
|
|
429
|
+
Parameters
|
|
430
|
+
----------
|
|
431
|
+
dictionary_file : core.File
|
|
432
|
+
See core.File for more documentation
|
|
433
|
+
|
|
434
|
+
dictionary_name : str
|
|
435
|
+
The name of the dictonary to be created. This is mainly used for organizational purposes.
|
|
436
|
+
|
|
437
|
+
run_id : typing.Optional[int]
|
|
438
|
+
|
|
439
|
+
dictionary_description : typing.Optional[str]
|
|
440
|
+
The description of the dictionary to be created. This is an optional field that is used to help you provide some info about your dictionaries for better organization.
|
|
441
|
+
|
|
442
|
+
request_options : typing.Optional[RequestOptions]
|
|
443
|
+
Request-specific configuration.
|
|
444
|
+
|
|
445
|
+
Returns
|
|
446
|
+
-------
|
|
447
|
+
typing.Any
|
|
448
|
+
Successful Response
|
|
449
|
+
|
|
450
|
+
Examples
|
|
451
|
+
--------
|
|
452
|
+
import asyncio
|
|
453
|
+
|
|
454
|
+
from camb import AsyncCambApi
|
|
455
|
+
|
|
456
|
+
client = AsyncCambApi(
|
|
457
|
+
api_key="YOUR_API_KEY",
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
async def main() -> None:
|
|
462
|
+
await client.dictionaries.create_dictionary_from_file(
|
|
463
|
+
dictionary_name="dictionary_name",
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
asyncio.run(main())
|
|
468
|
+
"""
|
|
469
|
+
_response = await self._raw_client.create_dictionary_from_file(
|
|
470
|
+
dictionary_file=dictionary_file,
|
|
471
|
+
dictionary_name=dictionary_name,
|
|
472
|
+
run_id=run_id,
|
|
473
|
+
dictionary_description=dictionary_description,
|
|
474
|
+
request_options=request_options,
|
|
475
|
+
)
|
|
476
|
+
return _response.data
|
|
477
|
+
|
|
478
|
+
async def get_dictionary_info(
|
|
479
|
+
self,
|
|
480
|
+
dictionary_id: int,
|
|
481
|
+
*,
|
|
482
|
+
run_id: typing.Optional[int] = None,
|
|
483
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
484
|
+
) -> DictionaryWithTerms:
|
|
485
|
+
"""
|
|
486
|
+
Parameters
|
|
487
|
+
----------
|
|
488
|
+
dictionary_id : int
|
|
489
|
+
|
|
490
|
+
run_id : typing.Optional[int]
|
|
491
|
+
|
|
492
|
+
request_options : typing.Optional[RequestOptions]
|
|
493
|
+
Request-specific configuration.
|
|
494
|
+
|
|
495
|
+
Returns
|
|
496
|
+
-------
|
|
497
|
+
DictionaryWithTerms
|
|
498
|
+
Successful Response
|
|
499
|
+
|
|
500
|
+
Examples
|
|
501
|
+
--------
|
|
502
|
+
import asyncio
|
|
503
|
+
|
|
504
|
+
from camb import AsyncCambApi
|
|
505
|
+
|
|
506
|
+
client = AsyncCambApi(
|
|
507
|
+
api_key="YOUR_API_KEY",
|
|
508
|
+
)
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
async def main() -> None:
|
|
512
|
+
await client.dictionaries.get_dictionary_info(
|
|
513
|
+
dictionary_id=1,
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
asyncio.run(main())
|
|
518
|
+
"""
|
|
519
|
+
_response = await self._raw_client.get_dictionary_info(
|
|
520
|
+
dictionary_id, run_id=run_id, request_options=request_options
|
|
521
|
+
)
|
|
522
|
+
return _response.data
|
|
523
|
+
|
|
524
|
+
async def delete_dictionary(
|
|
525
|
+
self,
|
|
526
|
+
dictionary_id: int,
|
|
527
|
+
*,
|
|
528
|
+
run_id: typing.Optional[int] = None,
|
|
529
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
530
|
+
) -> typing.Any:
|
|
531
|
+
"""
|
|
532
|
+
Parameters
|
|
533
|
+
----------
|
|
534
|
+
dictionary_id : int
|
|
535
|
+
|
|
536
|
+
run_id : typing.Optional[int]
|
|
537
|
+
|
|
538
|
+
request_options : typing.Optional[RequestOptions]
|
|
539
|
+
Request-specific configuration.
|
|
540
|
+
|
|
541
|
+
Returns
|
|
542
|
+
-------
|
|
543
|
+
typing.Any
|
|
544
|
+
Successful Response
|
|
545
|
+
|
|
546
|
+
Examples
|
|
547
|
+
--------
|
|
548
|
+
import asyncio
|
|
549
|
+
|
|
550
|
+
from camb import AsyncCambApi
|
|
551
|
+
|
|
552
|
+
client = AsyncCambApi(
|
|
553
|
+
api_key="YOUR_API_KEY",
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
async def main() -> None:
|
|
558
|
+
await client.dictionaries.delete_dictionary(
|
|
559
|
+
dictionary_id=1,
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
asyncio.run(main())
|
|
564
|
+
"""
|
|
565
|
+
_response = await self._raw_client.delete_dictionary(
|
|
566
|
+
dictionary_id, run_id=run_id, request_options=request_options
|
|
567
|
+
)
|
|
568
|
+
return _response.data
|
|
569
|
+
|
|
570
|
+
async def get_dictionary_details(
|
|
571
|
+
self,
|
|
572
|
+
dictionary_id: int,
|
|
573
|
+
*,
|
|
574
|
+
limit: typing.Optional[int] = None,
|
|
575
|
+
search_term: typing.Optional[str] = None,
|
|
576
|
+
run_id: typing.Optional[int] = None,
|
|
577
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
578
|
+
) -> DictionaryWithTerms:
|
|
579
|
+
"""
|
|
580
|
+
Parameters
|
|
581
|
+
----------
|
|
582
|
+
dictionary_id : int
|
|
583
|
+
|
|
584
|
+
limit : typing.Optional[int]
|
|
585
|
+
Limit how many terms are returned when fetching the dictionary details.
|
|
586
|
+
|
|
587
|
+
search_term : typing.Optional[str]
|
|
588
|
+
|
|
589
|
+
run_id : typing.Optional[int]
|
|
590
|
+
|
|
591
|
+
request_options : typing.Optional[RequestOptions]
|
|
592
|
+
Request-specific configuration.
|
|
593
|
+
|
|
594
|
+
Returns
|
|
595
|
+
-------
|
|
596
|
+
DictionaryWithTerms
|
|
597
|
+
Successful Response
|
|
598
|
+
|
|
599
|
+
Examples
|
|
600
|
+
--------
|
|
601
|
+
import asyncio
|
|
602
|
+
|
|
603
|
+
from camb import AsyncCambApi
|
|
604
|
+
|
|
605
|
+
client = AsyncCambApi(
|
|
606
|
+
api_key="YOUR_API_KEY",
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
async def main() -> None:
|
|
611
|
+
await client.dictionaries.get_dictionary_details(
|
|
612
|
+
dictionary_id=1,
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
asyncio.run(main())
|
|
617
|
+
"""
|
|
618
|
+
_response = await self._raw_client.get_dictionary_details(
|
|
619
|
+
dictionary_id, limit=limit, search_term=search_term, run_id=run_id, request_options=request_options
|
|
620
|
+
)
|
|
621
|
+
return _response.data
|
|
622
|
+
|
|
623
|
+
async def add_term_to_dictionary(
|
|
624
|
+
self,
|
|
625
|
+
dictionary_id: int,
|
|
626
|
+
*,
|
|
627
|
+
translations: typing.Sequence[TermTranslationInput],
|
|
628
|
+
run_id: typing.Optional[int] = None,
|
|
629
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
630
|
+
) -> typing.Any:
|
|
631
|
+
"""
|
|
632
|
+
Parameters
|
|
633
|
+
----------
|
|
634
|
+
dictionary_id : int
|
|
635
|
+
|
|
636
|
+
translations : typing.Sequence[TermTranslationInput]
|
|
637
|
+
|
|
638
|
+
run_id : typing.Optional[int]
|
|
639
|
+
|
|
640
|
+
request_options : typing.Optional[RequestOptions]
|
|
641
|
+
Request-specific configuration.
|
|
642
|
+
|
|
643
|
+
Returns
|
|
644
|
+
-------
|
|
645
|
+
typing.Any
|
|
646
|
+
Successful Response
|
|
647
|
+
|
|
648
|
+
Examples
|
|
649
|
+
--------
|
|
650
|
+
import asyncio
|
|
651
|
+
|
|
652
|
+
from camb import AsyncCambApi, TermTranslationInput
|
|
653
|
+
|
|
654
|
+
client = AsyncCambApi(
|
|
655
|
+
api_key="YOUR_API_KEY",
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
async def main() -> None:
|
|
660
|
+
await client.dictionaries.add_term_to_dictionary(
|
|
661
|
+
dictionary_id=1,
|
|
662
|
+
translations=[
|
|
663
|
+
TermTranslationInput(
|
|
664
|
+
translation="translation",
|
|
665
|
+
language=1,
|
|
666
|
+
)
|
|
667
|
+
],
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
asyncio.run(main())
|
|
672
|
+
"""
|
|
673
|
+
_response = await self._raw_client.add_term_to_dictionary(
|
|
674
|
+
dictionary_id, translations=translations, run_id=run_id, request_options=request_options
|
|
675
|
+
)
|
|
676
|
+
return _response.data
|
|
677
|
+
|
|
678
|
+
async def update_term_translation_in_dictionary_using_term_id(
|
|
679
|
+
self,
|
|
680
|
+
dictionary_id: int,
|
|
681
|
+
term_id: int,
|
|
682
|
+
*,
|
|
683
|
+
translations: typing.Sequence[TermTranslationInput],
|
|
684
|
+
run_id: typing.Optional[int] = None,
|
|
685
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
686
|
+
) -> typing.Any:
|
|
687
|
+
"""
|
|
688
|
+
Parameters
|
|
689
|
+
----------
|
|
690
|
+
dictionary_id : int
|
|
691
|
+
|
|
692
|
+
term_id : int
|
|
693
|
+
|
|
694
|
+
translations : typing.Sequence[TermTranslationInput]
|
|
695
|
+
|
|
696
|
+
run_id : typing.Optional[int]
|
|
697
|
+
|
|
698
|
+
request_options : typing.Optional[RequestOptions]
|
|
699
|
+
Request-specific configuration.
|
|
700
|
+
|
|
701
|
+
Returns
|
|
702
|
+
-------
|
|
703
|
+
typing.Any
|
|
704
|
+
Successful Response
|
|
705
|
+
|
|
706
|
+
Examples
|
|
707
|
+
--------
|
|
708
|
+
import asyncio
|
|
709
|
+
|
|
710
|
+
from camb import AsyncCambApi, TermTranslationInput
|
|
711
|
+
|
|
712
|
+
client = AsyncCambApi(
|
|
713
|
+
api_key="YOUR_API_KEY",
|
|
714
|
+
)
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
async def main() -> None:
|
|
718
|
+
await client.dictionaries.update_term_translation_in_dictionary_using_term_id(
|
|
719
|
+
dictionary_id=1,
|
|
720
|
+
term_id=1,
|
|
721
|
+
translations=[
|
|
722
|
+
TermTranslationInput(
|
|
723
|
+
translation="translation",
|
|
724
|
+
language=1,
|
|
725
|
+
)
|
|
726
|
+
],
|
|
727
|
+
)
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
asyncio.run(main())
|
|
731
|
+
"""
|
|
732
|
+
_response = await self._raw_client.update_term_translation_in_dictionary_using_term_id(
|
|
733
|
+
dictionary_id, term_id, translations=translations, run_id=run_id, request_options=request_options
|
|
734
|
+
)
|
|
735
|
+
return _response.data
|
|
736
|
+
|
|
737
|
+
async def delete_dictionary_term(
|
|
738
|
+
self,
|
|
739
|
+
dictionary_id: int,
|
|
740
|
+
term_id: int,
|
|
741
|
+
*,
|
|
742
|
+
run_id: typing.Optional[int] = None,
|
|
743
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
744
|
+
) -> typing.Any:
|
|
745
|
+
"""
|
|
746
|
+
Parameters
|
|
747
|
+
----------
|
|
748
|
+
dictionary_id : int
|
|
749
|
+
|
|
750
|
+
term_id : int
|
|
751
|
+
|
|
752
|
+
run_id : typing.Optional[int]
|
|
753
|
+
|
|
754
|
+
request_options : typing.Optional[RequestOptions]
|
|
755
|
+
Request-specific configuration.
|
|
756
|
+
|
|
757
|
+
Returns
|
|
758
|
+
-------
|
|
759
|
+
typing.Any
|
|
760
|
+
Successful Response
|
|
761
|
+
|
|
762
|
+
Examples
|
|
763
|
+
--------
|
|
764
|
+
import asyncio
|
|
765
|
+
|
|
766
|
+
from camb import AsyncCambApi
|
|
767
|
+
|
|
768
|
+
client = AsyncCambApi(
|
|
769
|
+
api_key="YOUR_API_KEY",
|
|
770
|
+
)
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
async def main() -> None:
|
|
774
|
+
await client.dictionaries.delete_dictionary_term(
|
|
775
|
+
dictionary_id=1,
|
|
776
|
+
term_id=1,
|
|
777
|
+
)
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
asyncio.run(main())
|
|
781
|
+
"""
|
|
782
|
+
_response = await self._raw_client.delete_dictionary_term(
|
|
783
|
+
dictionary_id, term_id, run_id=run_id, request_options=request_options
|
|
784
|
+
)
|
|
785
|
+
return _response.data
|