Skip to content

Commit

Permalink
[translation] regenerate on v1.0 (Azure#18861)
Browse files Browse the repository at this point in the history
* regen code on v1.0 swagger

* update code for swagger renames

* rerecord tests with v1.0

* update changelog
  • Loading branch information
kristapratico authored May 24, 2021
1 parent 79f4c97 commit 1abed9d
Show file tree
Hide file tree
Showing 78 changed files with 17,625 additions and 75,675 deletions.
9 changes: 9 additions & 0 deletions sdk/translation/azure-ai-translation-document/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## 1.0.0b2 (Unreleased)

This version of the SDK defaults to the latest supported service version, which currently is v1.0

**New features**

- Added paging and filtering options to `list_all_document_statuses` and `list_submitted_jobs`.

**Dependency updates**

- Package requires [azure-core](https://pypi.org/project/azure-core/) version 1.14.0 or greater.

## 1.0.0b1 (2021-04-06)

Expand Down
2 changes: 1 addition & 1 deletion sdk/translation/azure-ai-translation-document/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Install the Azure Document Translation client library for Python with [pip][pip]
pip install azure-ai-translation-document --pre
```

> Note: This version of the client library defaults to the v1.0-preview.1 version of the service
> Note: This version of the client library defaults to the v1.0 version of the service
#### Create a Document Translation resource
Document Translation supports [single-service access][single_service] only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DocumentTranslationApiVersion(str, Enum):
"""Document Translation API versions supported by this package"""

#: This is the default version
V1_0_PREVIEW = "1.0-preview.1"
V1_0 = "1.0"


def validate_api_version(api_version):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from azure.core.credentials import AzureKeyCredential
from azure.core.pipeline.policies import AzureKeyCredentialPolicy
from ._generated import BatchDocumentTranslationClient as _BatchDocumentTranslationClient
from ._generated.models import BatchStatusDetail as _BatchStatusDetail
from ._generated.models import TranslationStatus as _TranslationStatus
from ._models import (
JobStatusResult,
DocumentStatusResult,
Expand Down Expand Up @@ -116,7 +116,7 @@ def create_translation_job(self, inputs, **kwargs):
"""

# submit translation job
response_headers = self._client.document_translation._submit_batch_request_initial( # pylint: disable=protected-access
response_headers = self._client.document_translation._start_translation_initial( # pylint: disable=protected-access
inputs=DocumentTranslationInput._to_generated_list(inputs), # pylint: disable=protected-access
cls=lambda pipeline_response, _, response_headers: response_headers,
**kwargs
Expand Down Expand Up @@ -147,7 +147,7 @@ def get_job_status(self, job_id, **kwargs):
:raises ~azure.core.exceptions.HttpResponseError or ~azure.core.exceptions.ResourceNotFoundError:
"""

job_status = self._client.document_translation.get_operation_status(job_id, **kwargs)
job_status = self._client.document_translation.get_translation_status(job_id, **kwargs)
return JobStatusResult._from_generated(job_status) # pylint: disable=protected-access

@distributed_trace
Expand All @@ -165,7 +165,7 @@ def cancel_job(self, job_id, **kwargs):
:raises ~azure.core.exceptions.HttpResponseError or ~azure.core.exceptions.ResourceNotFoundError:
"""

self._client.document_translation.cancel_operation(job_id, **kwargs)
self._client.document_translation.cancel_translation(job_id, **kwargs)

@distributed_trace
def wait_until_done(self, job_id, **kwargs):
Expand All @@ -191,13 +191,13 @@ def wait_until_done(self, job_id, **kwargs):
:caption: Create a translation job and wait until it is done.
"""

pipeline_response = self._client.document_translation.get_operation_status(
pipeline_response = self._client.document_translation.get_translation_status(
job_id,
cls=lambda pipeline_response, _, response_headers: pipeline_response
)

def callback(raw_response):
detail = self._client._deserialize(_BatchStatusDetail, raw_response) # pylint: disable=protected-access
detail = self._client._deserialize(_TranslationStatus, raw_response) # pylint: disable=protected-access
return JobStatusResult._from_generated(detail) # pylint: disable=protected-access

poller = LROPoller(
Expand Down Expand Up @@ -257,7 +257,7 @@ def _convert_from_generated_model(generated_model): # pylint: disable=protected
_convert_from_generated_model(job_status) for job_status in job_statuses
])

return self._client.document_translation.get_operations(
return self._client.document_translation.get_translations_status(
cls=model_conversion_function,
maxpagesize=results_per_page,
created_date_time_utc_start=created_after,
Expand Down Expand Up @@ -313,7 +313,7 @@ def _convert_from_generated_model(generated_model):
_convert_from_generated_model(doc_status) for doc_status in doc_statuses
])

return self._client.document_translation.get_operation_documents_status(
return self._client.document_translation.get_documents_status(
id=job_id,
cls=model_conversion_function,
maxpagesize=results_per_page,
Expand Down Expand Up @@ -351,7 +351,7 @@ def get_glossary_formats(self, **kwargs):
:raises ~azure.core.exceptions.HttpResponseError:
"""

glossary_formats = self._client.document_translation.get_glossary_formats(**kwargs)
glossary_formats = self._client.document_translation.get_supported_glossary_formats(**kwargs)
return FileFormat._from_generated_list(glossary_formats.value) # pylint: disable=protected-access

@distributed_trace
Expand All @@ -364,5 +364,5 @@ def get_document_formats(self, **kwargs):
:raises ~azure.core.exceptions.HttpResponseError:
"""

document_formats = self._client.document_translation.get_document_formats(**kwargs)
document_formats = self._client.document_translation.get_supported_document_formats(**kwargs)
return FileFormat._from_generated_list(document_formats.value) # pylint: disable=protected-access
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(
**kwargs # type: Any
):
# type: (...) -> None
base_url = '{endpoint}/translator/text/batch/v1.0-preview.1'
base_url = '{endpoint}/translator/text/batch/v1.0'
self._config = BatchDocumentTranslationClientConfiguration(credential, endpoint, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
endpoint: str,
**kwargs: Any
) -> None:
base_url = '{endpoint}/translator/text/batch/v1.0-preview.1'
base_url = '{endpoint}/translator/text/batch/v1.0'
self._config = BatchDocumentTranslationClientConfiguration(credential, endpoint, **kwargs)
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)

Expand Down
Loading

0 comments on commit 1abed9d

Please sign in to comment.