1414 TranslationStatus ,
1515 DocumentStatus ,
1616 DocumentTranslationInput ,
17- FileFormat ,
17+ DocumentTranslationFileFormat ,
18+ convert_status
1819)
1920from ._user_agent import USER_AGENT
2021from ._polling import TranslationPolling , DocumentTranslationLROPollingMethod
@@ -174,7 +175,7 @@ def deserialization_callback(
174175 raw_response , _ , headers
175176 ): # pylint: disable=unused-argument
176177 translation_status = json .loads (raw_response .http_response .text ())
177- return self .list_all_document_statuses (translation_status ["id" ])
178+ return self .list_document_statuses (translation_status ["id" ])
178179
179180 polling_interval = kwargs .pop (
180181 "polling_interval" ,
@@ -228,9 +229,9 @@ def cancel_translation(self, translation_id, **kwargs):
228229 # type: (str, **Any) -> None
229230 """Cancel a currently processing or queued translation operation.
230231
231- A translation will not be cancelled if it is already completed, failed, or cancelling .
232- All documents that have completed translation will not be cancelled and will be charged.
233- If possible, all pending documents will be cancelled .
232+ A translation will not be canceled if it is already completed, failed, or canceling .
233+ All documents that have completed translation will not be canceled and will be charged.
234+ If possible, all pending documents will be canceled .
234235
235236 :param str translation_id: The translation operation ID.
236237 :return: None
@@ -241,7 +242,7 @@ def cancel_translation(self, translation_id, **kwargs):
241242 self ._client .document_translation .cancel_translation (translation_id , ** kwargs )
242243
243244 @distributed_trace
244- def list_all_translation_statuses (self , ** kwargs ):
245+ def list_translation_statuses (self , ** kwargs ):
245246 # type: (**Any) -> ItemPaged[TranslationStatus]
246247 """List all the submitted translation operations under the Document Translation resource.
247248
@@ -251,7 +252,7 @@ def list_all_translation_statuses(self, **kwargs):
251252 :keyword int results_per_page: is the number of operations returned per page.
252253 :keyword list[str] translation_ids: translation operations ids to filter by.
253254 :keyword list[str] statuses: translation operation statuses to filter by. Options include
254- 'NotStarted', 'Running', 'Succeeded', 'Failed', 'Cancelled ', 'Cancelling ',
255+ 'NotStarted', 'Running', 'Succeeded', 'Failed', 'Canceled ', 'Canceling ',
255256 and 'ValidationFailed'.
256257 :keyword created_after: get operations created after certain datetime.
257258 :paramtype created_after: Union[str, datetime.datetime]
@@ -267,14 +268,17 @@ def list_all_translation_statuses(self, **kwargs):
267268
268269 .. admonition:: Example:
269270
270- .. literalinclude:: ../samples/sample_list_all_translations .py
271- :start-after: [START list_all_translations ]
272- :end-before: [END list_all_translations ]
271+ .. literalinclude:: ../samples/sample_list_translations .py
272+ :start-after: [START list_translations ]
273+ :end-before: [END list_translations ]
273274 :language: python
274275 :dedent: 4
275276 :caption: List all submitted translations under the resource.
276277 """
277278
279+ statuses = kwargs .pop ("statuses" , None )
280+ if statuses :
281+ statuses = [convert_status (status , ll = True ) for status in statuses ]
278282 order_by = convert_order_by (kwargs .pop ("order_by" , None ))
279283 created_after = kwargs .pop ("created_after" , None )
280284 created_before = kwargs .pop ("created_before" , None )
@@ -304,11 +308,12 @@ def _convert_from_generated_model(
304308 created_date_time_utc_end = created_before ,
305309 ids = translation_ids ,
306310 order_by = order_by ,
311+ statuses = statuses ,
307312 ** kwargs
308313 )
309314
310315 @distributed_trace
311- def list_all_document_statuses (self , translation_id , ** kwargs ):
316+ def list_document_statuses (self , translation_id , ** kwargs ):
312317 # type: (str, **Any) -> ItemPaged[DocumentStatus]
313318 """List all the document statuses for a given translation operation.
314319
@@ -319,7 +324,7 @@ def list_all_document_statuses(self, translation_id, **kwargs):
319324 :keyword int results_per_page: is the number of documents returned per page.
320325 :keyword list[str] document_ids: document IDs to filter by.
321326 :keyword list[str] statuses: document statuses to filter by. Options include
322- 'NotStarted', 'Running', 'Succeeded', 'Failed', 'Cancelled ', 'Cancelling ',
327+ 'NotStarted', 'Running', 'Succeeded', 'Failed', 'Canceled ', 'Canceling ',
323328 and 'ValidationFailed'.
324329 :keyword created_after: get document created after certain datetime.
325330 :paramtype created_after: Union[str, datetime.datetime]
@@ -336,13 +341,16 @@ def list_all_document_statuses(self, translation_id, **kwargs):
336341 .. admonition:: Example:
337342
338343 .. literalinclude:: ../samples/sample_check_document_statuses.py
339- :start-after: [START list_all_document_statuses ]
340- :end-before: [END list_all_document_statuses ]
344+ :start-after: [START list_document_statuses ]
345+ :end-before: [END list_document_statuses ]
341346 :language: python
342347 :dedent: 4
343348 :caption: List all the document statuses as they are being translated.
344349 """
345350
351+ statuses = kwargs .pop ("statuses" , None )
352+ if statuses :
353+ statuses = [convert_status (status , ll = True ) for status in statuses ]
346354 order_by = convert_order_by (kwargs .pop ("order_by" , None ))
347355 created_after = kwargs .pop ("created_after" , None )
348356 created_before = kwargs .pop ("created_before" , None )
@@ -375,6 +383,7 @@ def _convert_from_generated_model(generated_model):
375383 created_date_time_utc_end = created_before ,
376384 ids = document_ids ,
377385 order_by = order_by ,
386+ statuses = statuses ,
378387 ** kwargs
379388 )
380389
@@ -399,34 +408,34 @@ def get_document_status(self, translation_id, document_id, **kwargs):
399408
400409 @distributed_trace
401410 def get_supported_glossary_formats (self , ** kwargs ):
402- # type: (**Any) -> List[FileFormat ]
411+ # type: (**Any) -> List[DocumentTranslationFileFormat ]
403412 """Get the list of the glossary formats supported by the Document Translation service.
404413
405414 :return: A list of supported glossary formats.
406- :rtype: List[FileFormat ]
415+ :rtype: List[DocumentTranslationFileFormat ]
407416 :raises ~azure.core.exceptions.HttpResponseError:
408417 """
409418
410419 glossary_formats = (
411420 self ._client .document_translation .get_supported_glossary_formats (** kwargs )
412421 )
413- return FileFormat ._from_generated_list ( # pylint: disable=protected-access
422+ return DocumentTranslationFileFormat ._from_generated_list ( # pylint: disable=protected-access
414423 glossary_formats .value
415424 )
416425
417426 @distributed_trace
418427 def get_supported_document_formats (self , ** kwargs ):
419- # type: (**Any) -> List[FileFormat ]
428+ # type: (**Any) -> List[DocumentTranslationFileFormat ]
420429 """Get the list of the document formats supported by the Document Translation service.
421430
422431 :return: A list of supported document formats for translation.
423- :rtype: List[FileFormat ]
432+ :rtype: List[DocumentTranslationFileFormat ]
424433 :raises ~azure.core.exceptions.HttpResponseError:
425434 """
426435
427436 document_formats = (
428437 self ._client .document_translation .get_supported_document_formats (** kwargs )
429438 )
430- return FileFormat ._from_generated_list ( # pylint: disable=protected-access
439+ return DocumentTranslationFileFormat ._from_generated_list ( # pylint: disable=protected-access
431440 document_formats .value
432441 )
0 commit comments