DocumentTranslationClient class
Client for the Azure AI Document Translation service, used to translate batches of documents stored in Azure Blob Storage.
Constructors
| Document |
Creates an instance of DocumentTranslationClient. |
Properties
| pipeline | The pipeline used by this client to make requests |
Methods
| cancel |
Cancel a currently processing or queued translation. A translation will not be cancelled if it is already completed or failed or cancelling. A bad request will be returned. All documents that have completed translation will not be cancelled and will be charged. All pending documents will be cancelled if possible. |
| get |
Returns the translation status for a specific document based on the request Id and document Id. |
| get |
The list of supported formats supported by the Document Translation service. The list includes the common file extension, as well as the content-type if using the upload API. |
| get |
Returns the status for a document translation request. The status includes the overall request status, as well as the status for documents that are being translated as part of that request. |
| list |
Returns the status for all documents in a batch document translation request. If the number of documents in the response exceeds our paging limit, server-side paging is used. Paginated responses indicate a partial result and include a continuation token in the response. The absence of a continuation token means that no additional pages are available. top, skip and maxPageSize options can be used to specify a number of results to return and an offset for the collection. top indicates the total number of records the user wants to be returned across all pages. skip indicates the number of records to skip from the list of document status held by the server based on the sorting method specified. By default, we sort by descending start time. maxPageSize is the maximum items returned in a page. If more items are requested via top (or top is not specified and there are more items to be returned), |
| list |
Returns a list of batch requests submitted and the status for each request. This list only contains batch requests submitted by the user (based on the resource). If the number of requests exceeds our paging limit, server-side paging is used. Paginated responses indicate a partial result and include a continuation token in the response. The absence of a continuation token means that no additional pages are available. top, skip and maxPageSize options can be used to specify a number of results to return and an offset for the collection. top indicates the total number of records the user wants to be returned across all pages. skip indicates the number of records to skip from the list of batches based on the sorting method specified. By default, we sort by descending start time. maxPageSize is the maximum items returned in a page. If more items are requested via top (or top is not specified and there are more items to be returned), |
| start |
Use this API to submit a bulk (batch) translation request to the Document Translation service. Each request can contain multiple documents and must contain a source and destination container for each document. The prefix and suffix filter (if supplied) are used to filter folders. The prefix is applied to the subpath after the container name. Glossaries / Translation memory can be included in the request and are applied by the service when the document is translated. If the glossary is invalid or unreachable during translation, an error is indicated in the document status. If a file with the same name already exists at the destination, it will be overwritten. The targetUrl for each target language must be unique. |
Constructor Details
DocumentTranslationClient(string, KeyCredential | TokenCredential, DocumentTranslationClientOptionalParams)
Creates an instance of DocumentTranslationClient.
new DocumentTranslationClient(endpointParam: string, credential: KeyCredential | TokenCredential, options?: DocumentTranslationClientOptionalParams)
Parameters
- endpointParam
-
string
The Document Translation endpoint, for example https://<resource-name>.cognitiveservices.azure.com.
- credential
A key credential or token credential used to authenticate requests to the service.
Options used to configure the client.
Property Details
pipeline
Method Details
cancelTranslation(string, CancelTranslationOptionalParams)
Cancel a currently processing or queued translation. A translation will not be cancelled if it is already completed or failed or cancelling. A bad request will be returned. All documents that have completed translation will not be cancelled and will be charged. All pending documents will be cancelled if possible.
function cancelTranslation(translationId: string, options?: CancelTranslationOptionalParams): Promise<TranslationStatus>
Parameters
- translationId
-
string
- options
- CancelTranslationOptionalParams
Returns
Promise<TranslationStatus>
getDocumentStatus(string, string, GetDocumentStatusOptionalParams)
Returns the translation status for a specific document based on the request Id and document Id.
function getDocumentStatus(translationId: string, documentId: string, options?: GetDocumentStatusOptionalParams): Promise<DocumentStatus>
Parameters
- translationId
-
string
- documentId
-
string
- options
- GetDocumentStatusOptionalParams
Returns
Promise<DocumentStatus>
getSupportedFormats(FileFormatType, GetSupportedFormatsOptionalParams)
The list of supported formats supported by the Document Translation service. The list includes the common file extension, as well as the content-type if using the upload API.
function getSupportedFormats(typeParam: FileFormatType, options?: GetSupportedFormatsOptionalParams): Promise<SupportedFileFormats>
Parameters
- typeParam
- FileFormatType
Returns
Promise<SupportedFileFormats>
getTranslationStatus(string, GetTranslationStatusOptionalParams)
Returns the status for a document translation request. The status includes the overall request status, as well as the status for documents that are being translated as part of that request.
function getTranslationStatus(translationId: string, options?: GetTranslationStatusOptionalParams): Promise<TranslationStatus>
Parameters
- translationId
-
string
Returns
Promise<TranslationStatus>
listDocumentStatuses(string, ListDocumentStatusesOptionalParams)
Returns the status for all documents in a batch document translation request.
If the number of documents in the response exceeds our paging limit, server-side paging is used. Paginated responses indicate a partial result and include a continuation token in the response. The absence of a continuation token means that no additional pages are available.
top, skip and maxPageSize options can be used to specify a number of results to return and an offset for the collection.
top indicates the total number of records the user wants to be returned across all pages. skip indicates the number of records to skip from the list of document status held by the server based on the sorting method specified. By default, we sort by descending start time. maxPageSize is the maximum items returned in a page. If more items are requested via top (or top is not specified and there are more items to be returned),
function listDocumentStatuses(translationId: string, options?: ListDocumentStatusesOptionalParams): PagedAsyncIterableIterator<DocumentStatus, DocumentStatus[], PageSettings>
Parameters
- translationId
-
string
Returns
listTranslationStatuses(ListTranslationStatusesOptionalParams)
Returns a list of batch requests submitted and the status for each request. This list only contains batch requests submitted by the user (based on the resource).
If the number of requests exceeds our paging limit, server-side paging is used. Paginated responses indicate a partial result and include a continuation token in the response. The absence of a continuation token means that no additional pages are available.
top, skip and maxPageSize options can be used to specify a number of results to return and an offset for the collection.
top indicates the total number of records the user wants to be returned across all pages. skip indicates the number of records to skip from the list of batches based on the sorting method specified. By default, we sort by descending start time. maxPageSize is the maximum items returned in a page. If more items are requested via top (or top is not specified and there are more items to be returned),
function listTranslationStatuses(options?: ListTranslationStatusesOptionalParams): PagedAsyncIterableIterator<TranslationStatus, TranslationStatus[], PageSettings>
Parameters
Returns
startTranslation(StartTranslationDetails, StartTranslationOptionalParams)
Use this API to submit a bulk (batch) translation request to the Document Translation service. Each request can contain multiple documents and must contain a source and destination container for each document.
The prefix and suffix filter (if supplied) are used to filter folders. The prefix is applied to the subpath after the container name.
Glossaries / Translation memory can be included in the request and are applied by the service when the document is translated.
If the glossary is invalid or unreachable during translation, an error is indicated in the document status. If a file with the same name already exists at the destination, it will be overwritten. The targetUrl for each target language must be unique.
function startTranslation(body: StartTranslationDetails, options?: StartTranslationOptionalParams): PollerLike<OperationState<TranslationStatus>, TranslationStatus>
Parameters
- options
- StartTranslationOptionalParams