diff --git a/sdk/translation/azure-ai-translation-document/CHANGELOG.md b/sdk/translation/azure-ai-translation-document/CHANGELOG.md index cd7f3e49341c..8f9a925025e8 100644 --- a/sdk/translation/azure-ai-translation-document/CHANGELOG.md +++ b/sdk/translation/azure-ai-translation-document/CHANGELOG.md @@ -7,6 +7,7 @@ ### Breaking Changes ### Bugs Fixed +- The operation `id` under `details` of the poller object now populates correctly. ### Other Changes diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py index e614d09e7c3b..ad194c453228 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py @@ -63,9 +63,11 @@ def details(self): :rtype: ~azure.ai.translation.document.TranslationStatus """ - return TranslationStatus._from_generated( # pylint: disable=protected-access - self._polling_method._current_body # pylint: disable=protected-access - ) + if self._polling_method._current_body: # pylint: disable=protected-access + return TranslationStatus._from_generated( # pylint: disable=protected-access + self._polling_method._current_body # pylint: disable=protected-access + ) + return TranslationStatus(id=self._polling_method._get_id_from_headers()) # pylint: disable=protected-access @classmethod def from_continuation_token(cls, polling_method, continuation_token, **kwargs): diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py index 379751ec66bc..79efe2f85c82 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_async_polling.py @@ -43,9 +43,11 @@ def details(self) -> TranslationStatus: :rtype: ~azure.ai.translation.document.TranslationStatus """ - return TranslationStatus._from_generated( # pylint: disable=protected-access - self._polling_method._current_body # pylint: disable=protected-access - ) + if self._polling_method._current_body: # pylint: disable=protected-access + return TranslationStatus._from_generated( # pylint: disable=protected-access + self._polling_method._current_body # pylint: disable=protected-access + ) + return TranslationStatus(id=self._polling_method._get_id_from_headers()) # pylint: disable=protected-access @classmethod def from_continuation_token( diff --git a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py index 591f0885e076..c8463bda0272 100644 --- a/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py +++ b/sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py @@ -271,7 +271,7 @@ def list_all_translation_statuses(self, **kwargs): format: ["param1 asc/desc", "param2 asc/desc", ...] (ex: 'created_on asc', 'created_on desc'). :return: A pageable of TranslationStatus. - :rtype: ~azure.core.paging.ItemPaged[TranslationStatus] + :rtype: ~azure.core.async_paging.AsyncItemPaged[TranslationStatus] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -336,7 +336,7 @@ def list_all_document_statuses(self, translation_id, **kwargs): format: ["param1 asc/desc", "param2 asc/desc", ...] (ex: 'created_on asc', 'created_on desc'). :return: A pageable of DocumentStatus. - :rtype: ~azure.core.paging.ItemPaged[DocumentStatus] + :rtype: ~azure.core.async_paging.AsyncItemPaged[DocumentStatus] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: diff --git a/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py b/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py index b1c7a3b9c681..a7fe4612cac8 100644 --- a/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py +++ b/sdk/translation/azure-ai-translation-document/tests/asynctestcase.py @@ -26,6 +26,7 @@ async def _begin_and_validate_translation_async(self, async_client, translation_ # submit operation poller = await async_client.begin_translation(translation_inputs) self.assertIsNotNone(poller.id) + self.assertIsNotNone(poller.details.id) # wait for result doc_statuses = await poller.result() # validate diff --git a/sdk/translation/azure-ai-translation-document/tests/testcase.py b/sdk/translation/azure-ai-translation-document/tests/testcase.py index 733618adbe57..1c16c23a2db2 100644 --- a/sdk/translation/azure-ai-translation-document/tests/testcase.py +++ b/sdk/translation/azure-ai-translation-document/tests/testcase.py @@ -236,6 +236,7 @@ def _begin_and_validate_translation(self, client, translation_inputs, total_docs # submit job poller = client.begin_translation(translation_inputs) self.assertIsNotNone(poller.id) + self.assertIsNotNone(poller.details.id) # wait for result result = poller.result() # validate