@@ -122,7 +122,7 @@ async def __begin_translation_initial(
122
122
@overload
123
123
async def _begin_translation (
124
124
self , body : _models .StartTranslationDetails , * , content_type : str = "application/json" , ** kwargs : Any
125
- ) -> AsyncLROPoller [None ]:
125
+ ) -> AsyncLROPoller [_models . TranslationStatus ]:
126
126
"""Submit a document translation request to the Document Translation service.
127
127
128
128
Use this API to submit a bulk (batch) translation request to the Document
@@ -150,15 +150,17 @@ async def _begin_translation(
150
150
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
151
151
Default value is "application/json".
152
152
:paramtype content_type: str
153
- :return: An instance of AsyncLROPoller that returns None
154
- :rtype: ~azure.core.polling.AsyncLROPoller[None]
153
+ :return: An instance of AsyncLROPoller that returns TranslationStatus. The TranslationStatus is
154
+ compatible with MutableMapping
155
+ :rtype:
156
+ ~azure.core.polling.AsyncLROPoller[~azure.ai.translation.document.models.TranslationStatus]
155
157
:raises ~azure.core.exceptions.HttpResponseError:
156
158
"""
157
159
158
160
@overload
159
161
async def _begin_translation (
160
162
self , body : JSON , * , content_type : str = "application/json" , ** kwargs : Any
161
- ) -> AsyncLROPoller [None ]:
163
+ ) -> AsyncLROPoller [_models . TranslationStatus ]:
162
164
"""Submit a document translation request to the Document Translation service.
163
165
164
166
Use this API to submit a bulk (batch) translation request to the Document
@@ -186,15 +188,17 @@ async def _begin_translation(
186
188
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
187
189
Default value is "application/json".
188
190
:paramtype content_type: str
189
- :return: An instance of AsyncLROPoller that returns None
190
- :rtype: ~azure.core.polling.AsyncLROPoller[None]
191
+ :return: An instance of AsyncLROPoller that returns TranslationStatus. The TranslationStatus is
192
+ compatible with MutableMapping
193
+ :rtype:
194
+ ~azure.core.polling.AsyncLROPoller[~azure.ai.translation.document.models.TranslationStatus]
191
195
:raises ~azure.core.exceptions.HttpResponseError:
192
196
"""
193
197
194
198
@overload
195
199
async def _begin_translation (
196
200
self , body : IO [bytes ], * , content_type : str = "application/json" , ** kwargs : Any
197
- ) -> AsyncLROPoller [None ]:
201
+ ) -> AsyncLROPoller [_models . TranslationStatus ]:
198
202
"""Submit a document translation request to the Document Translation service.
199
203
200
204
Use this API to submit a bulk (batch) translation request to the Document
@@ -222,15 +226,17 @@ async def _begin_translation(
222
226
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
223
227
Default value is "application/json".
224
228
:paramtype content_type: str
225
- :return: An instance of AsyncLROPoller that returns None
226
- :rtype: ~azure.core.polling.AsyncLROPoller[None]
229
+ :return: An instance of AsyncLROPoller that returns TranslationStatus. The TranslationStatus is
230
+ compatible with MutableMapping
231
+ :rtype:
232
+ ~azure.core.polling.AsyncLROPoller[~azure.ai.translation.document.models.TranslationStatus]
227
233
:raises ~azure.core.exceptions.HttpResponseError:
228
234
"""
229
235
230
236
@distributed_trace_async
231
237
async def _begin_translation (
232
238
self , body : Union [_models .StartTranslationDetails , JSON , IO [bytes ]], ** kwargs : Any
233
- ) -> AsyncLROPoller [None ]:
239
+ ) -> AsyncLROPoller [_models . TranslationStatus ]:
234
240
"""Submit a document translation request to the Document Translation service.
235
241
236
242
Use this API to submit a bulk (batch) translation request to the Document
@@ -256,15 +262,17 @@ async def _begin_translation(
256
262
:param body: Translation job submission batch request. Is one of the following types:
257
263
StartTranslationDetails, JSON, IO[bytes] Required.
258
264
:type body: ~azure.ai.translation.document.models.StartTranslationDetails or JSON or IO[bytes]
259
- :return: An instance of AsyncLROPoller that returns None
260
- :rtype: ~azure.core.polling.AsyncLROPoller[None]
265
+ :return: An instance of AsyncLROPoller that returns TranslationStatus. The TranslationStatus is
266
+ compatible with MutableMapping
267
+ :rtype:
268
+ ~azure.core.polling.AsyncLROPoller[~azure.ai.translation.document.models.TranslationStatus]
261
269
:raises ~azure.core.exceptions.HttpResponseError:
262
270
"""
263
271
_headers = case_insensitive_dict (kwargs .pop ("headers" , {}) or {})
264
272
_params = kwargs .pop ("params" , {}) or {}
265
273
266
274
content_type : Optional [str ] = kwargs .pop ("content_type" , _headers .pop ("Content-Type" , None ))
267
- cls : ClsType [None ] = kwargs .pop ("cls" , None )
275
+ cls : ClsType [_models . TranslationStatus ] = kwargs .pop ("cls" , None )
268
276
polling : Union [bool , AsyncPollingMethod ] = kwargs .pop ("polling" , True )
269
277
lro_delay = kwargs .pop ("polling_interval" , self ._config .polling_interval )
270
278
cont_token : Optional [str ] = kwargs .pop ("continuation_token" , None )
@@ -275,9 +283,17 @@ async def _begin_translation(
275
283
await raw_result .http_response .read () # type: ignore
276
284
kwargs .pop ("error_map" , None )
277
285
278
- def get_long_running_output (pipeline_response ): # pylint: disable=inconsistent-return-statements
286
+ def get_long_running_output (pipeline_response ):
287
+ response_headers = {}
288
+ response = pipeline_response .http_response
289
+ response_headers ["Operation-Location" ] = self ._deserialize (
290
+ "str" , response .headers .get ("Operation-Location" )
291
+ )
292
+
293
+ deserialized = _deserialize (_models .TranslationStatus , response .json ())
279
294
if cls :
280
- return cls (pipeline_response , None , {}) # type: ignore
295
+ return cls (pipeline_response , deserialized , response_headers ) # type: ignore
296
+ return deserialized
281
297
282
298
path_format_arguments = {
283
299
"endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" , skip_quote = True ),
@@ -293,13 +309,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
293
309
else :
294
310
polling_method = polling
295
311
if cont_token :
296
- return AsyncLROPoller [None ].from_continuation_token (
312
+ return AsyncLROPoller [_models . TranslationStatus ].from_continuation_token (
297
313
polling_method = polling_method ,
298
314
continuation_token = cont_token ,
299
315
client = self ._client ,
300
316
deserialization_callback = get_long_running_output ,
301
317
)
302
- return AsyncLROPoller [None ](self ._client , raw_result , get_long_running_output , polling_method ) # type: ignore
318
+ return AsyncLROPoller [_models .TranslationStatus ](
319
+ self ._client , raw_result , get_long_running_output , polling_method # type: ignore
320
+ )
303
321
304
322
@distributed_trace
305
323
def list_translation_statuses (
0 commit comments