Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated the TypeSpec and re-generated the SDK with TranslationStatus …
…id as string
  • Loading branch information
hamshavathimunibyraiah committed Oct 26, 2024
commit 4824e4f1d4a81978efe40e652d2f75cbd8e2b0b4
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class DocumentStatus(_model_base.Model):
:vartype error: ~azure.ai.translation.document.models.DocumentTranslationError
:ivar translation_progress: Progress of the translation if available. Required.
:vartype translation_progress: float
:ivar document_id: Document Id. Required.
:vartype document_id: str
:ivar id: Document Id. Required.
:vartype id: str
:ivar characters_charged: Character charged by the API.
:vartype characters_charged: int
"""
Expand All @@ -150,7 +150,7 @@ class DocumentStatus(_model_base.Model):
inner error with more descriptive details."""
translation_progress: float = rest_field(name="progress")
"""Progress of the translation if available. Required."""
document_id: str = rest_field(name="id")
id: str = rest_field()
"""Document Id. Required."""
characters_charged: Optional[int] = rest_field(name="characterCharged")
"""Character charged by the API."""
Expand All @@ -165,7 +165,7 @@ def __init__(
status: Union[str, "_models.Status"],
translated_to: str,
translation_progress: float,
document_id: str,
id: str, # pylint: disable=redefined-builtin
translated_document_url: Optional[str] = None,
error: Optional["_models.DocumentTranslationError"] = None,
characters_charged: Optional[int] = None,
Expand Down Expand Up @@ -583,8 +583,8 @@ class TranslationStatus(_model_base.Model):
"""Translation job status response.


:ivar translation_id: Id of the translation operation. Required.
:vartype translation_id: str
:ivar id: Id of the translation operation. Required.
:vartype id: str
:ivar created_on: Operation created date time. Required.
:vartype created_on: ~datetime.datetime
:ivar last_updated_on: Date time in which the operation's status has been updated. Required.
Expand All @@ -600,7 +600,7 @@ class TranslationStatus(_model_base.Model):
:vartype summary: ~azure.ai.translation.document.models.TranslationStatusSummary
"""

translation_id: str = rest_field(name="id")
id: str = rest_field()
"""Id of the translation operation. Required."""
created_on: datetime.datetime = rest_field(name="createdDateTimeUtc", format="rfc3339")
"""Operation created date time. Required."""
Expand All @@ -620,7 +620,7 @@ class TranslationStatus(_model_base.Model):
def __init__(
self,
*,
translation_id: str,
id: str, # pylint: disable=redefined-builtin
created_on: datetime.datetime,
last_updated_on: datetime.datetime,
status: Union[str, "_models.Status"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ async def sample_single_document_translation_async():
document_translate_content = DocumentTranslateContent(document=document_content)

async with client:
response_stream = await client.translate(
body=document_translate_content, target_language=target_languages
)
response_stream = await client.translate(body=document_translate_content, target_language=target_languages)
translated_response = response_stream.decode("utf-8-sig") # type: ignore[attr-defined]
print(f"Translated response: {translated_response}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ def test_translate_text_document(self, **kwargs):
document_translate_content = DocumentTranslateContent(document=self._get_document_content())

# Invoke document translation
response_stream = client.translate(
body=document_translate_content, target_language=target_languages
)
response_stream = client.translate(body=document_translate_content, target_language=target_languages)

# validate response
translated_response = response_stream.decode("utf-8-sig")
Expand All @@ -97,9 +95,7 @@ def test_translate_single_csv_glossary(self, **kwargs):
)

# Invoke document translation
response_stream = client.translate(
body=document_translate_content, target_language=target_languages
)
response_stream = client.translate(body=document_translate_content, target_language=target_languages)

# validate response
translated_response = response_stream.decode("utf-8-sig")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ async def test_translate_text_document(self, **kwargs):
)

# Invoke document translation
response_stream = await client.translate(
body=document_translate_content, target_language=target_languages
)
response_stream = await client.translate(body=document_translate_content, target_language=target_languages)

# validate response
translated_response = response_stream.decode("utf-8-sig")
Expand All @@ -70,9 +68,7 @@ async def test_translate_single_csv_glossary(self, **kwargs):
)

# Invoke document translation
response_stream = await client.translate(
body=document_translate_content, target_language=target_languages
)
response_stream = await client.translate(body=document_translate_content, target_language=target_languages)

# validate response
translated_response = response_stream.decode("utf-8-sig")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
commit: 83d8d0055567c94271572b995d1d7ef1180892a4
commit: 17a3ee0a2a03dbfbf1359a1370f994862e02925d
repo: Azure/azure-rest-api-specs
directory: specification/translation/Azure.AI.DocumentTranslation