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,1048 @@
|
|
|
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 .. import core
|
|
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.dictionary_with_terms import DictionaryWithTerms
|
|
16
|
+
from ..types.http_validation_error import HttpValidationError
|
|
17
|
+
from ..types.term_translation_input import TermTranslationInput
|
|
18
|
+
|
|
19
|
+
# this is used as the default value for optional parameters
|
|
20
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RawDictionariesClient:
|
|
24
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
25
|
+
self._client_wrapper = client_wrapper
|
|
26
|
+
|
|
27
|
+
def get_dictionaries(
|
|
28
|
+
self, *, run_id: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
29
|
+
) -> HttpResponse[typing.List[DictionaryWithTerms]]:
|
|
30
|
+
"""
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
run_id : typing.Optional[int]
|
|
34
|
+
|
|
35
|
+
request_options : typing.Optional[RequestOptions]
|
|
36
|
+
Request-specific configuration.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
HttpResponse[typing.List[DictionaryWithTerms]]
|
|
41
|
+
Successful Response
|
|
42
|
+
"""
|
|
43
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
44
|
+
"dictionaries",
|
|
45
|
+
method="GET",
|
|
46
|
+
params={
|
|
47
|
+
"run_id": run_id,
|
|
48
|
+
},
|
|
49
|
+
request_options=request_options,
|
|
50
|
+
)
|
|
51
|
+
try:
|
|
52
|
+
if 200 <= _response.status_code < 300:
|
|
53
|
+
_data = typing.cast(
|
|
54
|
+
typing.List[DictionaryWithTerms],
|
|
55
|
+
parse_obj_as(
|
|
56
|
+
type_=typing.List[DictionaryWithTerms], # type: ignore
|
|
57
|
+
object_=_response.json(),
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
return HttpResponse(response=_response, data=_data)
|
|
61
|
+
if _response.status_code == 422:
|
|
62
|
+
raise UnprocessableEntityError(
|
|
63
|
+
headers=dict(_response.headers),
|
|
64
|
+
body=typing.cast(
|
|
65
|
+
HttpValidationError,
|
|
66
|
+
parse_obj_as(
|
|
67
|
+
type_=HttpValidationError, # type: ignore
|
|
68
|
+
object_=_response.json(),
|
|
69
|
+
),
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
_response_json = _response.json()
|
|
73
|
+
except JSONDecodeError:
|
|
74
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
75
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
76
|
+
|
|
77
|
+
def create_dictionary_from_file(
|
|
78
|
+
self,
|
|
79
|
+
*,
|
|
80
|
+
dictionary_file: core.File,
|
|
81
|
+
dictionary_name: str,
|
|
82
|
+
run_id: typing.Optional[int] = None,
|
|
83
|
+
dictionary_description: typing.Optional[str] = OMIT,
|
|
84
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
85
|
+
) -> HttpResponse[typing.Any]:
|
|
86
|
+
"""
|
|
87
|
+
Parameters
|
|
88
|
+
----------
|
|
89
|
+
dictionary_file : core.File
|
|
90
|
+
See core.File for more documentation
|
|
91
|
+
|
|
92
|
+
dictionary_name : str
|
|
93
|
+
The name of the dictonary to be created. This is mainly used for organizational purposes.
|
|
94
|
+
|
|
95
|
+
run_id : typing.Optional[int]
|
|
96
|
+
|
|
97
|
+
dictionary_description : typing.Optional[str]
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
request_options : typing.Optional[RequestOptions]
|
|
101
|
+
Request-specific configuration.
|
|
102
|
+
|
|
103
|
+
Returns
|
|
104
|
+
-------
|
|
105
|
+
HttpResponse[typing.Any]
|
|
106
|
+
Successful Response
|
|
107
|
+
"""
|
|
108
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
109
|
+
"dictionaries/create-from-file",
|
|
110
|
+
method="POST",
|
|
111
|
+
params={
|
|
112
|
+
"run_id": run_id,
|
|
113
|
+
},
|
|
114
|
+
data={
|
|
115
|
+
"dictionary_name": dictionary_name,
|
|
116
|
+
"dictionary_description": dictionary_description,
|
|
117
|
+
},
|
|
118
|
+
files={
|
|
119
|
+
"dictionary_file": dictionary_file,
|
|
120
|
+
},
|
|
121
|
+
request_options=request_options,
|
|
122
|
+
omit=OMIT,
|
|
123
|
+
force_multipart=True,
|
|
124
|
+
)
|
|
125
|
+
try:
|
|
126
|
+
if _response is None or not _response.text.strip():
|
|
127
|
+
return HttpResponse(response=_response, data=None)
|
|
128
|
+
if 200 <= _response.status_code < 300:
|
|
129
|
+
_data = typing.cast(
|
|
130
|
+
typing.Any,
|
|
131
|
+
parse_obj_as(
|
|
132
|
+
type_=typing.Any, # type: ignore
|
|
133
|
+
object_=_response.json(),
|
|
134
|
+
),
|
|
135
|
+
)
|
|
136
|
+
return HttpResponse(response=_response, data=_data)
|
|
137
|
+
if _response.status_code == 422:
|
|
138
|
+
raise UnprocessableEntityError(
|
|
139
|
+
headers=dict(_response.headers),
|
|
140
|
+
body=typing.cast(
|
|
141
|
+
HttpValidationError,
|
|
142
|
+
parse_obj_as(
|
|
143
|
+
type_=HttpValidationError, # type: ignore
|
|
144
|
+
object_=_response.json(),
|
|
145
|
+
),
|
|
146
|
+
),
|
|
147
|
+
)
|
|
148
|
+
_response_json = _response.json()
|
|
149
|
+
except JSONDecodeError:
|
|
150
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
151
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
152
|
+
|
|
153
|
+
def get_dictionary_info(
|
|
154
|
+
self,
|
|
155
|
+
dictionary_id: int,
|
|
156
|
+
*,
|
|
157
|
+
run_id: typing.Optional[int] = None,
|
|
158
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
159
|
+
) -> HttpResponse[DictionaryWithTerms]:
|
|
160
|
+
"""
|
|
161
|
+
Parameters
|
|
162
|
+
----------
|
|
163
|
+
dictionary_id : int
|
|
164
|
+
|
|
165
|
+
run_id : typing.Optional[int]
|
|
166
|
+
|
|
167
|
+
request_options : typing.Optional[RequestOptions]
|
|
168
|
+
Request-specific configuration.
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
-------
|
|
172
|
+
HttpResponse[DictionaryWithTerms]
|
|
173
|
+
Successful Response
|
|
174
|
+
"""
|
|
175
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
176
|
+
f"dictionaries/{jsonable_encoder(dictionary_id)}",
|
|
177
|
+
method="GET",
|
|
178
|
+
params={
|
|
179
|
+
"run_id": run_id,
|
|
180
|
+
},
|
|
181
|
+
request_options=request_options,
|
|
182
|
+
)
|
|
183
|
+
try:
|
|
184
|
+
if 200 <= _response.status_code < 300:
|
|
185
|
+
_data = typing.cast(
|
|
186
|
+
DictionaryWithTerms,
|
|
187
|
+
parse_obj_as(
|
|
188
|
+
type_=DictionaryWithTerms, # type: ignore
|
|
189
|
+
object_=_response.json(),
|
|
190
|
+
),
|
|
191
|
+
)
|
|
192
|
+
return HttpResponse(response=_response, data=_data)
|
|
193
|
+
if _response.status_code == 422:
|
|
194
|
+
raise UnprocessableEntityError(
|
|
195
|
+
headers=dict(_response.headers),
|
|
196
|
+
body=typing.cast(
|
|
197
|
+
HttpValidationError,
|
|
198
|
+
parse_obj_as(
|
|
199
|
+
type_=HttpValidationError, # type: ignore
|
|
200
|
+
object_=_response.json(),
|
|
201
|
+
),
|
|
202
|
+
),
|
|
203
|
+
)
|
|
204
|
+
_response_json = _response.json()
|
|
205
|
+
except JSONDecodeError:
|
|
206
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
207
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
208
|
+
|
|
209
|
+
def delete_dictionary(
|
|
210
|
+
self,
|
|
211
|
+
dictionary_id: int,
|
|
212
|
+
*,
|
|
213
|
+
run_id: typing.Optional[int] = None,
|
|
214
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
215
|
+
) -> HttpResponse[typing.Any]:
|
|
216
|
+
"""
|
|
217
|
+
Parameters
|
|
218
|
+
----------
|
|
219
|
+
dictionary_id : int
|
|
220
|
+
|
|
221
|
+
run_id : typing.Optional[int]
|
|
222
|
+
|
|
223
|
+
request_options : typing.Optional[RequestOptions]
|
|
224
|
+
Request-specific configuration.
|
|
225
|
+
|
|
226
|
+
Returns
|
|
227
|
+
-------
|
|
228
|
+
HttpResponse[typing.Any]
|
|
229
|
+
Successful Response
|
|
230
|
+
"""
|
|
231
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
232
|
+
f"dictionaries/{jsonable_encoder(dictionary_id)}",
|
|
233
|
+
method="DELETE",
|
|
234
|
+
params={
|
|
235
|
+
"run_id": run_id,
|
|
236
|
+
},
|
|
237
|
+
request_options=request_options,
|
|
238
|
+
)
|
|
239
|
+
try:
|
|
240
|
+
if _response is None or not _response.text.strip():
|
|
241
|
+
return HttpResponse(response=_response, data=None)
|
|
242
|
+
if 200 <= _response.status_code < 300:
|
|
243
|
+
_data = typing.cast(
|
|
244
|
+
typing.Any,
|
|
245
|
+
parse_obj_as(
|
|
246
|
+
type_=typing.Any, # type: ignore
|
|
247
|
+
object_=_response.json(),
|
|
248
|
+
),
|
|
249
|
+
)
|
|
250
|
+
return HttpResponse(response=_response, data=_data)
|
|
251
|
+
if _response.status_code == 422:
|
|
252
|
+
raise UnprocessableEntityError(
|
|
253
|
+
headers=dict(_response.headers),
|
|
254
|
+
body=typing.cast(
|
|
255
|
+
HttpValidationError,
|
|
256
|
+
parse_obj_as(
|
|
257
|
+
type_=HttpValidationError, # type: ignore
|
|
258
|
+
object_=_response.json(),
|
|
259
|
+
),
|
|
260
|
+
),
|
|
261
|
+
)
|
|
262
|
+
_response_json = _response.json()
|
|
263
|
+
except JSONDecodeError:
|
|
264
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
265
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
266
|
+
|
|
267
|
+
def get_dictionary_details(
|
|
268
|
+
self,
|
|
269
|
+
dictionary_id: int,
|
|
270
|
+
*,
|
|
271
|
+
limit: typing.Optional[int] = None,
|
|
272
|
+
search_term: typing.Optional[str] = None,
|
|
273
|
+
run_id: typing.Optional[int] = None,
|
|
274
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
275
|
+
) -> HttpResponse[DictionaryWithTerms]:
|
|
276
|
+
"""
|
|
277
|
+
Parameters
|
|
278
|
+
----------
|
|
279
|
+
dictionary_id : int
|
|
280
|
+
|
|
281
|
+
limit : typing.Optional[int]
|
|
282
|
+
Limit how many terms are returned when fetching the dictionary details.
|
|
283
|
+
|
|
284
|
+
search_term : typing.Optional[str]
|
|
285
|
+
|
|
286
|
+
run_id : typing.Optional[int]
|
|
287
|
+
|
|
288
|
+
request_options : typing.Optional[RequestOptions]
|
|
289
|
+
Request-specific configuration.
|
|
290
|
+
|
|
291
|
+
Returns
|
|
292
|
+
-------
|
|
293
|
+
HttpResponse[DictionaryWithTerms]
|
|
294
|
+
Successful Response
|
|
295
|
+
"""
|
|
296
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
297
|
+
f"dictionaries/{jsonable_encoder(dictionary_id)}/full-details",
|
|
298
|
+
method="GET",
|
|
299
|
+
params={
|
|
300
|
+
"limit": limit,
|
|
301
|
+
"search_term": search_term,
|
|
302
|
+
"run_id": run_id,
|
|
303
|
+
},
|
|
304
|
+
request_options=request_options,
|
|
305
|
+
)
|
|
306
|
+
try:
|
|
307
|
+
if 200 <= _response.status_code < 300:
|
|
308
|
+
_data = typing.cast(
|
|
309
|
+
DictionaryWithTerms,
|
|
310
|
+
parse_obj_as(
|
|
311
|
+
type_=DictionaryWithTerms, # type: ignore
|
|
312
|
+
object_=_response.json(),
|
|
313
|
+
),
|
|
314
|
+
)
|
|
315
|
+
return HttpResponse(response=_response, data=_data)
|
|
316
|
+
if _response.status_code == 422:
|
|
317
|
+
raise UnprocessableEntityError(
|
|
318
|
+
headers=dict(_response.headers),
|
|
319
|
+
body=typing.cast(
|
|
320
|
+
HttpValidationError,
|
|
321
|
+
parse_obj_as(
|
|
322
|
+
type_=HttpValidationError, # type: ignore
|
|
323
|
+
object_=_response.json(),
|
|
324
|
+
),
|
|
325
|
+
),
|
|
326
|
+
)
|
|
327
|
+
_response_json = _response.json()
|
|
328
|
+
except JSONDecodeError:
|
|
329
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
330
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
331
|
+
|
|
332
|
+
def add_term_to_dictionary(
|
|
333
|
+
self,
|
|
334
|
+
dictionary_id: int,
|
|
335
|
+
*,
|
|
336
|
+
translations: typing.Sequence[TermTranslationInput],
|
|
337
|
+
run_id: typing.Optional[int] = None,
|
|
338
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
339
|
+
) -> HttpResponse[typing.Any]:
|
|
340
|
+
"""
|
|
341
|
+
Parameters
|
|
342
|
+
----------
|
|
343
|
+
dictionary_id : int
|
|
344
|
+
|
|
345
|
+
translations : typing.Sequence[TermTranslationInput]
|
|
346
|
+
|
|
347
|
+
run_id : typing.Optional[int]
|
|
348
|
+
|
|
349
|
+
request_options : typing.Optional[RequestOptions]
|
|
350
|
+
Request-specific configuration.
|
|
351
|
+
|
|
352
|
+
Returns
|
|
353
|
+
-------
|
|
354
|
+
HttpResponse[typing.Any]
|
|
355
|
+
Successful Response
|
|
356
|
+
"""
|
|
357
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
358
|
+
f"dictionaries/{jsonable_encoder(dictionary_id)}/add-term",
|
|
359
|
+
method="POST",
|
|
360
|
+
params={
|
|
361
|
+
"run_id": run_id,
|
|
362
|
+
},
|
|
363
|
+
json={
|
|
364
|
+
"translations": convert_and_respect_annotation_metadata(
|
|
365
|
+
object_=translations, annotation=typing.Sequence[TermTranslationInput], direction="write"
|
|
366
|
+
),
|
|
367
|
+
},
|
|
368
|
+
headers={
|
|
369
|
+
"content-type": "application/json",
|
|
370
|
+
},
|
|
371
|
+
request_options=request_options,
|
|
372
|
+
omit=OMIT,
|
|
373
|
+
)
|
|
374
|
+
try:
|
|
375
|
+
if _response is None or not _response.text.strip():
|
|
376
|
+
return HttpResponse(response=_response, data=None)
|
|
377
|
+
if 200 <= _response.status_code < 300:
|
|
378
|
+
_data = typing.cast(
|
|
379
|
+
typing.Any,
|
|
380
|
+
parse_obj_as(
|
|
381
|
+
type_=typing.Any, # type: ignore
|
|
382
|
+
object_=_response.json(),
|
|
383
|
+
),
|
|
384
|
+
)
|
|
385
|
+
return HttpResponse(response=_response, data=_data)
|
|
386
|
+
if _response.status_code == 422:
|
|
387
|
+
raise UnprocessableEntityError(
|
|
388
|
+
headers=dict(_response.headers),
|
|
389
|
+
body=typing.cast(
|
|
390
|
+
HttpValidationError,
|
|
391
|
+
parse_obj_as(
|
|
392
|
+
type_=HttpValidationError, # type: ignore
|
|
393
|
+
object_=_response.json(),
|
|
394
|
+
),
|
|
395
|
+
),
|
|
396
|
+
)
|
|
397
|
+
_response_json = _response.json()
|
|
398
|
+
except JSONDecodeError:
|
|
399
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
400
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
401
|
+
|
|
402
|
+
def update_term_translation_in_dictionary_using_term_id(
|
|
403
|
+
self,
|
|
404
|
+
dictionary_id: int,
|
|
405
|
+
term_id: int,
|
|
406
|
+
*,
|
|
407
|
+
translations: typing.Sequence[TermTranslationInput],
|
|
408
|
+
run_id: typing.Optional[int] = None,
|
|
409
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
410
|
+
) -> HttpResponse[typing.Any]:
|
|
411
|
+
"""
|
|
412
|
+
Parameters
|
|
413
|
+
----------
|
|
414
|
+
dictionary_id : int
|
|
415
|
+
|
|
416
|
+
term_id : int
|
|
417
|
+
|
|
418
|
+
translations : typing.Sequence[TermTranslationInput]
|
|
419
|
+
|
|
420
|
+
run_id : typing.Optional[int]
|
|
421
|
+
|
|
422
|
+
request_options : typing.Optional[RequestOptions]
|
|
423
|
+
Request-specific configuration.
|
|
424
|
+
|
|
425
|
+
Returns
|
|
426
|
+
-------
|
|
427
|
+
HttpResponse[typing.Any]
|
|
428
|
+
Successful Response
|
|
429
|
+
"""
|
|
430
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
431
|
+
f"dictionaries/term/{jsonable_encoder(dictionary_id)}/{jsonable_encoder(term_id)}",
|
|
432
|
+
method="PUT",
|
|
433
|
+
params={
|
|
434
|
+
"run_id": run_id,
|
|
435
|
+
},
|
|
436
|
+
json={
|
|
437
|
+
"translations": convert_and_respect_annotation_metadata(
|
|
438
|
+
object_=translations, annotation=typing.Sequence[TermTranslationInput], direction="write"
|
|
439
|
+
),
|
|
440
|
+
},
|
|
441
|
+
headers={
|
|
442
|
+
"content-type": "application/json",
|
|
443
|
+
},
|
|
444
|
+
request_options=request_options,
|
|
445
|
+
omit=OMIT,
|
|
446
|
+
)
|
|
447
|
+
try:
|
|
448
|
+
if _response is None or not _response.text.strip():
|
|
449
|
+
return HttpResponse(response=_response, data=None)
|
|
450
|
+
if 200 <= _response.status_code < 300:
|
|
451
|
+
_data = typing.cast(
|
|
452
|
+
typing.Any,
|
|
453
|
+
parse_obj_as(
|
|
454
|
+
type_=typing.Any, # type: ignore
|
|
455
|
+
object_=_response.json(),
|
|
456
|
+
),
|
|
457
|
+
)
|
|
458
|
+
return HttpResponse(response=_response, data=_data)
|
|
459
|
+
if _response.status_code == 422:
|
|
460
|
+
raise UnprocessableEntityError(
|
|
461
|
+
headers=dict(_response.headers),
|
|
462
|
+
body=typing.cast(
|
|
463
|
+
HttpValidationError,
|
|
464
|
+
parse_obj_as(
|
|
465
|
+
type_=HttpValidationError, # type: ignore
|
|
466
|
+
object_=_response.json(),
|
|
467
|
+
),
|
|
468
|
+
),
|
|
469
|
+
)
|
|
470
|
+
_response_json = _response.json()
|
|
471
|
+
except JSONDecodeError:
|
|
472
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
473
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
474
|
+
|
|
475
|
+
def delete_dictionary_term(
|
|
476
|
+
self,
|
|
477
|
+
dictionary_id: int,
|
|
478
|
+
term_id: int,
|
|
479
|
+
*,
|
|
480
|
+
run_id: typing.Optional[int] = None,
|
|
481
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
482
|
+
) -> HttpResponse[typing.Any]:
|
|
483
|
+
"""
|
|
484
|
+
Parameters
|
|
485
|
+
----------
|
|
486
|
+
dictionary_id : int
|
|
487
|
+
|
|
488
|
+
term_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
|
+
HttpResponse[typing.Any]
|
|
498
|
+
Successful Response
|
|
499
|
+
"""
|
|
500
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
501
|
+
f"dictionaries/term/{jsonable_encoder(dictionary_id)}/{jsonable_encoder(term_id)}",
|
|
502
|
+
method="DELETE",
|
|
503
|
+
params={
|
|
504
|
+
"run_id": run_id,
|
|
505
|
+
},
|
|
506
|
+
request_options=request_options,
|
|
507
|
+
)
|
|
508
|
+
try:
|
|
509
|
+
if _response is None or not _response.text.strip():
|
|
510
|
+
return HttpResponse(response=_response, data=None)
|
|
511
|
+
if 200 <= _response.status_code < 300:
|
|
512
|
+
_data = typing.cast(
|
|
513
|
+
typing.Any,
|
|
514
|
+
parse_obj_as(
|
|
515
|
+
type_=typing.Any, # type: ignore
|
|
516
|
+
object_=_response.json(),
|
|
517
|
+
),
|
|
518
|
+
)
|
|
519
|
+
return HttpResponse(response=_response, data=_data)
|
|
520
|
+
if _response.status_code == 422:
|
|
521
|
+
raise UnprocessableEntityError(
|
|
522
|
+
headers=dict(_response.headers),
|
|
523
|
+
body=typing.cast(
|
|
524
|
+
HttpValidationError,
|
|
525
|
+
parse_obj_as(
|
|
526
|
+
type_=HttpValidationError, # type: ignore
|
|
527
|
+
object_=_response.json(),
|
|
528
|
+
),
|
|
529
|
+
),
|
|
530
|
+
)
|
|
531
|
+
_response_json = _response.json()
|
|
532
|
+
except JSONDecodeError:
|
|
533
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
534
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
class AsyncRawDictionariesClient:
|
|
538
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
539
|
+
self._client_wrapper = client_wrapper
|
|
540
|
+
|
|
541
|
+
async def get_dictionaries(
|
|
542
|
+
self, *, run_id: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
543
|
+
) -> AsyncHttpResponse[typing.List[DictionaryWithTerms]]:
|
|
544
|
+
"""
|
|
545
|
+
Parameters
|
|
546
|
+
----------
|
|
547
|
+
run_id : typing.Optional[int]
|
|
548
|
+
|
|
549
|
+
request_options : typing.Optional[RequestOptions]
|
|
550
|
+
Request-specific configuration.
|
|
551
|
+
|
|
552
|
+
Returns
|
|
553
|
+
-------
|
|
554
|
+
AsyncHttpResponse[typing.List[DictionaryWithTerms]]
|
|
555
|
+
Successful Response
|
|
556
|
+
"""
|
|
557
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
558
|
+
"dictionaries",
|
|
559
|
+
method="GET",
|
|
560
|
+
params={
|
|
561
|
+
"run_id": run_id,
|
|
562
|
+
},
|
|
563
|
+
request_options=request_options,
|
|
564
|
+
)
|
|
565
|
+
try:
|
|
566
|
+
if 200 <= _response.status_code < 300:
|
|
567
|
+
_data = typing.cast(
|
|
568
|
+
typing.List[DictionaryWithTerms],
|
|
569
|
+
parse_obj_as(
|
|
570
|
+
type_=typing.List[DictionaryWithTerms], # type: ignore
|
|
571
|
+
object_=_response.json(),
|
|
572
|
+
),
|
|
573
|
+
)
|
|
574
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
575
|
+
if _response.status_code == 422:
|
|
576
|
+
raise UnprocessableEntityError(
|
|
577
|
+
headers=dict(_response.headers),
|
|
578
|
+
body=typing.cast(
|
|
579
|
+
HttpValidationError,
|
|
580
|
+
parse_obj_as(
|
|
581
|
+
type_=HttpValidationError, # type: ignore
|
|
582
|
+
object_=_response.json(),
|
|
583
|
+
),
|
|
584
|
+
),
|
|
585
|
+
)
|
|
586
|
+
_response_json = _response.json()
|
|
587
|
+
except JSONDecodeError:
|
|
588
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
589
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
590
|
+
|
|
591
|
+
async def create_dictionary_from_file(
|
|
592
|
+
self,
|
|
593
|
+
*,
|
|
594
|
+
dictionary_file: core.File,
|
|
595
|
+
dictionary_name: str,
|
|
596
|
+
run_id: typing.Optional[int] = None,
|
|
597
|
+
dictionary_description: typing.Optional[str] = OMIT,
|
|
598
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
599
|
+
) -> AsyncHttpResponse[typing.Any]:
|
|
600
|
+
"""
|
|
601
|
+
Parameters
|
|
602
|
+
----------
|
|
603
|
+
dictionary_file : core.File
|
|
604
|
+
See core.File for more documentation
|
|
605
|
+
|
|
606
|
+
dictionary_name : str
|
|
607
|
+
The name of the dictonary to be created. This is mainly used for organizational purposes.
|
|
608
|
+
|
|
609
|
+
run_id : typing.Optional[int]
|
|
610
|
+
|
|
611
|
+
dictionary_description : typing.Optional[str]
|
|
612
|
+
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.
|
|
613
|
+
|
|
614
|
+
request_options : typing.Optional[RequestOptions]
|
|
615
|
+
Request-specific configuration.
|
|
616
|
+
|
|
617
|
+
Returns
|
|
618
|
+
-------
|
|
619
|
+
AsyncHttpResponse[typing.Any]
|
|
620
|
+
Successful Response
|
|
621
|
+
"""
|
|
622
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
623
|
+
"dictionaries/create-from-file",
|
|
624
|
+
method="POST",
|
|
625
|
+
params={
|
|
626
|
+
"run_id": run_id,
|
|
627
|
+
},
|
|
628
|
+
data={
|
|
629
|
+
"dictionary_name": dictionary_name,
|
|
630
|
+
"dictionary_description": dictionary_description,
|
|
631
|
+
},
|
|
632
|
+
files={
|
|
633
|
+
"dictionary_file": dictionary_file,
|
|
634
|
+
},
|
|
635
|
+
request_options=request_options,
|
|
636
|
+
omit=OMIT,
|
|
637
|
+
force_multipart=True,
|
|
638
|
+
)
|
|
639
|
+
try:
|
|
640
|
+
if _response is None or not _response.text.strip():
|
|
641
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
642
|
+
if 200 <= _response.status_code < 300:
|
|
643
|
+
_data = typing.cast(
|
|
644
|
+
typing.Any,
|
|
645
|
+
parse_obj_as(
|
|
646
|
+
type_=typing.Any, # type: ignore
|
|
647
|
+
object_=_response.json(),
|
|
648
|
+
),
|
|
649
|
+
)
|
|
650
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
651
|
+
if _response.status_code == 422:
|
|
652
|
+
raise UnprocessableEntityError(
|
|
653
|
+
headers=dict(_response.headers),
|
|
654
|
+
body=typing.cast(
|
|
655
|
+
HttpValidationError,
|
|
656
|
+
parse_obj_as(
|
|
657
|
+
type_=HttpValidationError, # type: ignore
|
|
658
|
+
object_=_response.json(),
|
|
659
|
+
),
|
|
660
|
+
),
|
|
661
|
+
)
|
|
662
|
+
_response_json = _response.json()
|
|
663
|
+
except JSONDecodeError:
|
|
664
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
665
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
666
|
+
|
|
667
|
+
async def get_dictionary_info(
|
|
668
|
+
self,
|
|
669
|
+
dictionary_id: int,
|
|
670
|
+
*,
|
|
671
|
+
run_id: typing.Optional[int] = None,
|
|
672
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
673
|
+
) -> AsyncHttpResponse[DictionaryWithTerms]:
|
|
674
|
+
"""
|
|
675
|
+
Parameters
|
|
676
|
+
----------
|
|
677
|
+
dictionary_id : int
|
|
678
|
+
|
|
679
|
+
run_id : typing.Optional[int]
|
|
680
|
+
|
|
681
|
+
request_options : typing.Optional[RequestOptions]
|
|
682
|
+
Request-specific configuration.
|
|
683
|
+
|
|
684
|
+
Returns
|
|
685
|
+
-------
|
|
686
|
+
AsyncHttpResponse[DictionaryWithTerms]
|
|
687
|
+
Successful Response
|
|
688
|
+
"""
|
|
689
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
690
|
+
f"dictionaries/{jsonable_encoder(dictionary_id)}",
|
|
691
|
+
method="GET",
|
|
692
|
+
params={
|
|
693
|
+
"run_id": run_id,
|
|
694
|
+
},
|
|
695
|
+
request_options=request_options,
|
|
696
|
+
)
|
|
697
|
+
try:
|
|
698
|
+
if 200 <= _response.status_code < 300:
|
|
699
|
+
_data = typing.cast(
|
|
700
|
+
DictionaryWithTerms,
|
|
701
|
+
parse_obj_as(
|
|
702
|
+
type_=DictionaryWithTerms, # type: ignore
|
|
703
|
+
object_=_response.json(),
|
|
704
|
+
),
|
|
705
|
+
)
|
|
706
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
707
|
+
if _response.status_code == 422:
|
|
708
|
+
raise UnprocessableEntityError(
|
|
709
|
+
headers=dict(_response.headers),
|
|
710
|
+
body=typing.cast(
|
|
711
|
+
HttpValidationError,
|
|
712
|
+
parse_obj_as(
|
|
713
|
+
type_=HttpValidationError, # type: ignore
|
|
714
|
+
object_=_response.json(),
|
|
715
|
+
),
|
|
716
|
+
),
|
|
717
|
+
)
|
|
718
|
+
_response_json = _response.json()
|
|
719
|
+
except JSONDecodeError:
|
|
720
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
721
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
722
|
+
|
|
723
|
+
async def delete_dictionary(
|
|
724
|
+
self,
|
|
725
|
+
dictionary_id: int,
|
|
726
|
+
*,
|
|
727
|
+
run_id: typing.Optional[int] = None,
|
|
728
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
729
|
+
) -> AsyncHttpResponse[typing.Any]:
|
|
730
|
+
"""
|
|
731
|
+
Parameters
|
|
732
|
+
----------
|
|
733
|
+
dictionary_id : int
|
|
734
|
+
|
|
735
|
+
run_id : typing.Optional[int]
|
|
736
|
+
|
|
737
|
+
request_options : typing.Optional[RequestOptions]
|
|
738
|
+
Request-specific configuration.
|
|
739
|
+
|
|
740
|
+
Returns
|
|
741
|
+
-------
|
|
742
|
+
AsyncHttpResponse[typing.Any]
|
|
743
|
+
Successful Response
|
|
744
|
+
"""
|
|
745
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
746
|
+
f"dictionaries/{jsonable_encoder(dictionary_id)}",
|
|
747
|
+
method="DELETE",
|
|
748
|
+
params={
|
|
749
|
+
"run_id": run_id,
|
|
750
|
+
},
|
|
751
|
+
request_options=request_options,
|
|
752
|
+
)
|
|
753
|
+
try:
|
|
754
|
+
if _response is None or not _response.text.strip():
|
|
755
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
756
|
+
if 200 <= _response.status_code < 300:
|
|
757
|
+
_data = typing.cast(
|
|
758
|
+
typing.Any,
|
|
759
|
+
parse_obj_as(
|
|
760
|
+
type_=typing.Any, # type: ignore
|
|
761
|
+
object_=_response.json(),
|
|
762
|
+
),
|
|
763
|
+
)
|
|
764
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
765
|
+
if _response.status_code == 422:
|
|
766
|
+
raise UnprocessableEntityError(
|
|
767
|
+
headers=dict(_response.headers),
|
|
768
|
+
body=typing.cast(
|
|
769
|
+
HttpValidationError,
|
|
770
|
+
parse_obj_as(
|
|
771
|
+
type_=HttpValidationError, # type: ignore
|
|
772
|
+
object_=_response.json(),
|
|
773
|
+
),
|
|
774
|
+
),
|
|
775
|
+
)
|
|
776
|
+
_response_json = _response.json()
|
|
777
|
+
except JSONDecodeError:
|
|
778
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
779
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
780
|
+
|
|
781
|
+
async def get_dictionary_details(
|
|
782
|
+
self,
|
|
783
|
+
dictionary_id: int,
|
|
784
|
+
*,
|
|
785
|
+
limit: typing.Optional[int] = None,
|
|
786
|
+
search_term: typing.Optional[str] = None,
|
|
787
|
+
run_id: typing.Optional[int] = None,
|
|
788
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
789
|
+
) -> AsyncHttpResponse[DictionaryWithTerms]:
|
|
790
|
+
"""
|
|
791
|
+
Parameters
|
|
792
|
+
----------
|
|
793
|
+
dictionary_id : int
|
|
794
|
+
|
|
795
|
+
limit : typing.Optional[int]
|
|
796
|
+
Limit how many terms are returned when fetching the dictionary details.
|
|
797
|
+
|
|
798
|
+
search_term : typing.Optional[str]
|
|
799
|
+
|
|
800
|
+
run_id : typing.Optional[int]
|
|
801
|
+
|
|
802
|
+
request_options : typing.Optional[RequestOptions]
|
|
803
|
+
Request-specific configuration.
|
|
804
|
+
|
|
805
|
+
Returns
|
|
806
|
+
-------
|
|
807
|
+
AsyncHttpResponse[DictionaryWithTerms]
|
|
808
|
+
Successful Response
|
|
809
|
+
"""
|
|
810
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
811
|
+
f"dictionaries/{jsonable_encoder(dictionary_id)}/full-details",
|
|
812
|
+
method="GET",
|
|
813
|
+
params={
|
|
814
|
+
"limit": limit,
|
|
815
|
+
"search_term": search_term,
|
|
816
|
+
"run_id": run_id,
|
|
817
|
+
},
|
|
818
|
+
request_options=request_options,
|
|
819
|
+
)
|
|
820
|
+
try:
|
|
821
|
+
if 200 <= _response.status_code < 300:
|
|
822
|
+
_data = typing.cast(
|
|
823
|
+
DictionaryWithTerms,
|
|
824
|
+
parse_obj_as(
|
|
825
|
+
type_=DictionaryWithTerms, # type: ignore
|
|
826
|
+
object_=_response.json(),
|
|
827
|
+
),
|
|
828
|
+
)
|
|
829
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
830
|
+
if _response.status_code == 422:
|
|
831
|
+
raise UnprocessableEntityError(
|
|
832
|
+
headers=dict(_response.headers),
|
|
833
|
+
body=typing.cast(
|
|
834
|
+
HttpValidationError,
|
|
835
|
+
parse_obj_as(
|
|
836
|
+
type_=HttpValidationError, # type: ignore
|
|
837
|
+
object_=_response.json(),
|
|
838
|
+
),
|
|
839
|
+
),
|
|
840
|
+
)
|
|
841
|
+
_response_json = _response.json()
|
|
842
|
+
except JSONDecodeError:
|
|
843
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
844
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
845
|
+
|
|
846
|
+
async def add_term_to_dictionary(
|
|
847
|
+
self,
|
|
848
|
+
dictionary_id: int,
|
|
849
|
+
*,
|
|
850
|
+
translations: typing.Sequence[TermTranslationInput],
|
|
851
|
+
run_id: typing.Optional[int] = None,
|
|
852
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
853
|
+
) -> AsyncHttpResponse[typing.Any]:
|
|
854
|
+
"""
|
|
855
|
+
Parameters
|
|
856
|
+
----------
|
|
857
|
+
dictionary_id : int
|
|
858
|
+
|
|
859
|
+
translations : typing.Sequence[TermTranslationInput]
|
|
860
|
+
|
|
861
|
+
run_id : typing.Optional[int]
|
|
862
|
+
|
|
863
|
+
request_options : typing.Optional[RequestOptions]
|
|
864
|
+
Request-specific configuration.
|
|
865
|
+
|
|
866
|
+
Returns
|
|
867
|
+
-------
|
|
868
|
+
AsyncHttpResponse[typing.Any]
|
|
869
|
+
Successful Response
|
|
870
|
+
"""
|
|
871
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
872
|
+
f"dictionaries/{jsonable_encoder(dictionary_id)}/add-term",
|
|
873
|
+
method="POST",
|
|
874
|
+
params={
|
|
875
|
+
"run_id": run_id,
|
|
876
|
+
},
|
|
877
|
+
json={
|
|
878
|
+
"translations": convert_and_respect_annotation_metadata(
|
|
879
|
+
object_=translations, annotation=typing.Sequence[TermTranslationInput], direction="write"
|
|
880
|
+
),
|
|
881
|
+
},
|
|
882
|
+
headers={
|
|
883
|
+
"content-type": "application/json",
|
|
884
|
+
},
|
|
885
|
+
request_options=request_options,
|
|
886
|
+
omit=OMIT,
|
|
887
|
+
)
|
|
888
|
+
try:
|
|
889
|
+
if _response is None or not _response.text.strip():
|
|
890
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
891
|
+
if 200 <= _response.status_code < 300:
|
|
892
|
+
_data = typing.cast(
|
|
893
|
+
typing.Any,
|
|
894
|
+
parse_obj_as(
|
|
895
|
+
type_=typing.Any, # type: ignore
|
|
896
|
+
object_=_response.json(),
|
|
897
|
+
),
|
|
898
|
+
)
|
|
899
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
900
|
+
if _response.status_code == 422:
|
|
901
|
+
raise UnprocessableEntityError(
|
|
902
|
+
headers=dict(_response.headers),
|
|
903
|
+
body=typing.cast(
|
|
904
|
+
HttpValidationError,
|
|
905
|
+
parse_obj_as(
|
|
906
|
+
type_=HttpValidationError, # type: ignore
|
|
907
|
+
object_=_response.json(),
|
|
908
|
+
),
|
|
909
|
+
),
|
|
910
|
+
)
|
|
911
|
+
_response_json = _response.json()
|
|
912
|
+
except JSONDecodeError:
|
|
913
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
914
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
915
|
+
|
|
916
|
+
async def update_term_translation_in_dictionary_using_term_id(
|
|
917
|
+
self,
|
|
918
|
+
dictionary_id: int,
|
|
919
|
+
term_id: int,
|
|
920
|
+
*,
|
|
921
|
+
translations: typing.Sequence[TermTranslationInput],
|
|
922
|
+
run_id: typing.Optional[int] = None,
|
|
923
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
924
|
+
) -> AsyncHttpResponse[typing.Any]:
|
|
925
|
+
"""
|
|
926
|
+
Parameters
|
|
927
|
+
----------
|
|
928
|
+
dictionary_id : int
|
|
929
|
+
|
|
930
|
+
term_id : int
|
|
931
|
+
|
|
932
|
+
translations : typing.Sequence[TermTranslationInput]
|
|
933
|
+
|
|
934
|
+
run_id : typing.Optional[int]
|
|
935
|
+
|
|
936
|
+
request_options : typing.Optional[RequestOptions]
|
|
937
|
+
Request-specific configuration.
|
|
938
|
+
|
|
939
|
+
Returns
|
|
940
|
+
-------
|
|
941
|
+
AsyncHttpResponse[typing.Any]
|
|
942
|
+
Successful Response
|
|
943
|
+
"""
|
|
944
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
945
|
+
f"dictionaries/term/{jsonable_encoder(dictionary_id)}/{jsonable_encoder(term_id)}",
|
|
946
|
+
method="PUT",
|
|
947
|
+
params={
|
|
948
|
+
"run_id": run_id,
|
|
949
|
+
},
|
|
950
|
+
json={
|
|
951
|
+
"translations": convert_and_respect_annotation_metadata(
|
|
952
|
+
object_=translations, annotation=typing.Sequence[TermTranslationInput], direction="write"
|
|
953
|
+
),
|
|
954
|
+
},
|
|
955
|
+
headers={
|
|
956
|
+
"content-type": "application/json",
|
|
957
|
+
},
|
|
958
|
+
request_options=request_options,
|
|
959
|
+
omit=OMIT,
|
|
960
|
+
)
|
|
961
|
+
try:
|
|
962
|
+
if _response is None or not _response.text.strip():
|
|
963
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
964
|
+
if 200 <= _response.status_code < 300:
|
|
965
|
+
_data = typing.cast(
|
|
966
|
+
typing.Any,
|
|
967
|
+
parse_obj_as(
|
|
968
|
+
type_=typing.Any, # type: ignore
|
|
969
|
+
object_=_response.json(),
|
|
970
|
+
),
|
|
971
|
+
)
|
|
972
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
973
|
+
if _response.status_code == 422:
|
|
974
|
+
raise UnprocessableEntityError(
|
|
975
|
+
headers=dict(_response.headers),
|
|
976
|
+
body=typing.cast(
|
|
977
|
+
HttpValidationError,
|
|
978
|
+
parse_obj_as(
|
|
979
|
+
type_=HttpValidationError, # type: ignore
|
|
980
|
+
object_=_response.json(),
|
|
981
|
+
),
|
|
982
|
+
),
|
|
983
|
+
)
|
|
984
|
+
_response_json = _response.json()
|
|
985
|
+
except JSONDecodeError:
|
|
986
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
987
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
988
|
+
|
|
989
|
+
async def delete_dictionary_term(
|
|
990
|
+
self,
|
|
991
|
+
dictionary_id: int,
|
|
992
|
+
term_id: int,
|
|
993
|
+
*,
|
|
994
|
+
run_id: typing.Optional[int] = None,
|
|
995
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
996
|
+
) -> AsyncHttpResponse[typing.Any]:
|
|
997
|
+
"""
|
|
998
|
+
Parameters
|
|
999
|
+
----------
|
|
1000
|
+
dictionary_id : int
|
|
1001
|
+
|
|
1002
|
+
term_id : int
|
|
1003
|
+
|
|
1004
|
+
run_id : typing.Optional[int]
|
|
1005
|
+
|
|
1006
|
+
request_options : typing.Optional[RequestOptions]
|
|
1007
|
+
Request-specific configuration.
|
|
1008
|
+
|
|
1009
|
+
Returns
|
|
1010
|
+
-------
|
|
1011
|
+
AsyncHttpResponse[typing.Any]
|
|
1012
|
+
Successful Response
|
|
1013
|
+
"""
|
|
1014
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1015
|
+
f"dictionaries/term/{jsonable_encoder(dictionary_id)}/{jsonable_encoder(term_id)}",
|
|
1016
|
+
method="DELETE",
|
|
1017
|
+
params={
|
|
1018
|
+
"run_id": run_id,
|
|
1019
|
+
},
|
|
1020
|
+
request_options=request_options,
|
|
1021
|
+
)
|
|
1022
|
+
try:
|
|
1023
|
+
if _response is None or not _response.text.strip():
|
|
1024
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1025
|
+
if 200 <= _response.status_code < 300:
|
|
1026
|
+
_data = typing.cast(
|
|
1027
|
+
typing.Any,
|
|
1028
|
+
parse_obj_as(
|
|
1029
|
+
type_=typing.Any, # type: ignore
|
|
1030
|
+
object_=_response.json(),
|
|
1031
|
+
),
|
|
1032
|
+
)
|
|
1033
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1034
|
+
if _response.status_code == 422:
|
|
1035
|
+
raise UnprocessableEntityError(
|
|
1036
|
+
headers=dict(_response.headers),
|
|
1037
|
+
body=typing.cast(
|
|
1038
|
+
HttpValidationError,
|
|
1039
|
+
parse_obj_as(
|
|
1040
|
+
type_=HttpValidationError, # type: ignore
|
|
1041
|
+
object_=_response.json(),
|
|
1042
|
+
),
|
|
1043
|
+
),
|
|
1044
|
+
)
|
|
1045
|
+
_response_json = _response.json()
|
|
1046
|
+
except JSONDecodeError:
|
|
1047
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1048
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|