Skip to content

Commit

Permalink
Add TranslatorBatch API v1.1 (#16705)
Browse files Browse the repository at this point in the history
* add API v1.1

* Match v1.0 swagger

* Remove unneeded changes

* Address PR failures

* Update readme

* Update @failedDocumentStatusLink name

* Fix swagger examples

* Fixing swagger examples

* Fix swagger

* Address board review comments

* move options to target level
* remove the @ from failedDocumentStatusLink
* switch the pdf output options to enum

* Remove failedDocmentsStatusLink field from response

* Update TranslatorText Readme file

* Add collectionFormat

Co-authored-by: Fady Essam <faanis@micrososft.com>
  • Loading branch information
FadyEssam2 and Fady Essam authored Jan 12, 2022
1 parent 02fce64 commit 1f1d5b0
Show file tree
Hide file tree
Showing 11 changed files with 2,444 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Configuration for generating Translator Text SDK.

The current release is `release_3_0`.

The current document batch preview release is `release_1_0_preview.1'`.
The current document batch release is `release_1_1'`.

``` yaml

Expand All @@ -17,13 +17,7 @@ openapi-type: data-plane
``` yaml

tag: release_1_0_preview.1
add-credentials: true
openapi-type: data-plane
```
``` yaml

tag: release_1_0
tag: release_1_1
add-credentials: true
openapi-type: data-plane
```
Expand All @@ -41,6 +35,12 @@ This setting is for batch document translator and only applied when `--tag=relea
input-file: stable/v1.0/TranslatorBatch.json
```

### 1.1 Batch API
This setting is for batch document translator and only applied when `--tag=release_1_1` is specified on the command line.
``` yaml $(tag) == 'release_1_1'
input-file: stable/v1.1/TranslatorBatch.json
```

### Release 3.0
These settings apply only when `--tag=release_3_0` is specified on the command line.

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"parameters": {
"api-version": "v1.1",
"subscriptionId": "EA19050C-51FC-4B55-84E5-9EA7283601DA",
"resourceGroupName": "TestResourceGroup",
"endpoint": "{endpoint}",
"Ocp-Apim-Subscription-Key": "{API key}",
"body": {
"inputs": [
{
"source": {
"sourceUrl": "https://myblob.blob.core.windows.net/sourceContainer",
"filter": {
"prefix": "pre",
"suffix": ".txt"
},
"language": "en",
"storageSource": "AzureBlob"
},
"targets": [
{
"targetUrl": "https://myblob.blob.core.windows.net/destinationContainer1",
"category": "general",
"language": "fr",
"glossaries": [
{
"glossaryUrl": "https://myblob.blob.core.windows.net/myglossary/en_fr_glossary.xlf",
"format": "XLIFF",
"storageSource": "AzureBlob"
}
],
"options": {
"pdfOutputAdditionalFormat": "None"
},
"storageSource": "AzureBlob"
},
{
"targetUrl": "https://myblob.blob.core.windows.net/destinationContainer2",
"category": "general",
"language": "es",
"options": {
"pdfOutputAdditionalFormat": "None"
},
"storageSource": "AzureBlob"
}
],
"storageType": "Folder"
}
]
}
},
"responses": {
"202": {
"headers": {
"Operation-Location": "https://westus.cognitiveservices.azure.com/translator/text/batch/v1.1/operation/0FA2822F-4C2A-4317-9C20-658C801E0E55"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"parameters": {
"api-version": "v1.1",
"subscriptionId": "EA19050C-51FC-4B55-84E5-9EA7283601DA",
"resourceGroupName": "TestResourceGroup",
"endpoint": "{endpoint}",
"Ocp-Apim-Subscription-Key": "{API key}",
"id": "727BF148-F327-47A0-9481-ABAE6362F11E"
},
"responses": {
"401": {
"headers": {},
"body": {
"error": {
"code": "Unauthorized",
"message": "User is not authorized",
"target": "Operation",
"innerError": {
"code": "Unauthorized",
"message": "Operation is not authorized"
}
}
}
},
"429": {
"headers": {},
"body": {
"error": {
"code": "RequestRateTooHigh",
"message": "User's request rate is too high",
"target": "Operation",
"innerError": {
"code": "RateTooHigh",
"message": "Request rate is too high"
}
}
}
},
"500": {
"headers": {},
"body": {
"error": {
"code": "InternalServerError",
"message": "Internal Server Error",
"target": "Operation",
"innerError": {
"code": "InternalServerError",
"message": "Unexpected internal server error has occurred"
}
}
}
},
"503": {
"headers": {},
"body": {
"error": {
"code": "ServiceUnavailable",
"message": "Service is temporary unavailable",
"target": "Operation",
"innerError": {
"code": "ServiceTemporaryUnavailable",
"message": "Service is currently unavailable. Please try again later"
}
}
}
},
"404": {
"headers": {},
"body": {
"error": {
"code": "ResourceNotFound",
"message": "id not found",
"target": "Operation",
"innerError": {
"code": "ResourceNotFound",
"message": "Resource requested is not found"
}
}
}
},
"200": {
"headers": {},
"body": {
"id": "727bf148-f327-47a0-9481-abae6362f11e",
"createdDateTimeUtc": "2020-03-26T00:00:00Z",
"lastActionDateTimeUtc": "2020-03-26T01:00:00Z",
"status": "Succeeded",
"summary": {
"total": 10,
"failed": 1,
"success": 9,
"inProgress": 0,
"notYetStarted": 0,
"cancelled": 0,
"totalCharacterCharged": 0
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"parameters": {
"api-version": "v1.1",
"subscriptionId": "EA19050C-51FC-4B55-84E5-9EA7283601DA",
"resourceGroupName": "TestResourceGroup",
"endpoint": "{endpoint}",
"Ocp-Apim-Subscription-Key": "{API key}",
"id": "727BF148-F327-47A0-9481-ABAE6362F11E",
"documentId": "273622BD-835C-4946-9798-FD8F19F6BBF2"
},
"responses": {
"401": {
"headers": {},
"body": {
"error": {
"code": "Unauthorized",
"message": "User is not authorized",
"target": "Document",
"innerError": {
"code": "Unauthorized",
"message": "Operation is not authorized"
}
}
}
},
"429": {
"headers": {},
"body": {
"error": {
"code": "RequestRateTooHigh",
"message": "User's request rate is too high",
"target": "Document",
"innerError": {
"code": "RateTooHigh",
"message": "Request rate is too high"
}
}
}
},
"500": {
"headers": {},
"body": {
"error": {
"code": "InternalServerError",
"message": "Internal Server Error",
"target": "Document",
"innerError": {
"code": "InternalServerError",
"message": "Unexpected internal server error has occurred"
}
}
}
},
"503": {
"headers": {},
"body": {
"error": {
"code": "ServiceUnavailable",
"message": "Service is temporary unavailable",
"target": "Document",
"innerError": {
"code": "ServiceTemporaryUnavailable",
"message": "Service is currently unavailable. Please try again later"
}
}
}
},
"404": {
"headers": {},
"body": {
"error": {
"code": "ResourceNotFound",
"message": "id not found",
"target": "Document",
"innerError": {
"code": "ResourceNotFound",
"message": "Resource requested is not found"
}
}
}
},
"200": {
"headers": {
"retry-after": "30",
"ETag": "686897696a7c876b7e"
},
"body": {
"path": "https://myblob.blob.core.windows.net/destinationContainer/fr/mydoc.txt",
"sourcePath": "https://myblob.blob.core.windows.net/sourceContainer/fr/mydoc.txt",
"createdDateTimeUtc": "2020-03-26T00:00:00Z",
"lastActionDateTimeUtc": "2020-03-26T01:00:00Z",
"status": "Running",
"to": "fr",
"progress": 0.1,
"id": "273622bd-835c-4946-9798-fd8f19f6bbf2",
"characterCharged": 0
}
}
}
}
Loading

0 comments on commit 1f1d5b0

Please sign in to comment.