@aws-sdk/client-translate 3.118.1 → 3.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist-cjs/Translate.js +15 -0
- package/dist-cjs/commands/ListLanguagesCommand.js +36 -0
- package/dist-cjs/commands/index.js +1 -0
- package/dist-cjs/models/models_0.js +48 -2
- package/dist-cjs/pagination/ListLanguagesPaginator.js +36 -0
- package/dist-cjs/pagination/index.js +1 -0
- package/dist-cjs/protocols/Aws_json1_1.js +105 -1
- package/dist-es/Translate.js +15 -0
- package/dist-es/commands/ListLanguagesCommand.js +39 -0
- package/dist-es/commands/index.js +1 -0
- package/dist-es/models/models_0.js +39 -0
- package/dist-es/pagination/ListLanguagesPaginator.js +75 -0
- package/dist-es/pagination/index.js +1 -0
- package/dist-es/protocols/Aws_json1_1.js +119 -1
- package/dist-types/Translate.d.ts +15 -8
- package/dist-types/TranslateClient.d.ts +3 -2
- package/dist-types/commands/ImportTerminologyCommand.d.ts +8 -8
- package/dist-types/commands/ListLanguagesCommand.d.ts +35 -0
- package/dist-types/commands/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +144 -32
- package/dist-types/pagination/ListLanguagesPaginator.d.ts +4 -0
- package/dist-types/pagination/index.d.ts +1 -0
- package/dist-types/protocols/Aws_json1_1.d.ts +3 -0
- package/dist-types/ts3.4/Translate.d.ts +5 -0
- package/dist-types/ts3.4/TranslateClient.d.ts +3 -2
- package/dist-types/ts3.4/commands/ListLanguagesCommand.d.ts +17 -0
- package/dist-types/ts3.4/commands/index.d.ts +1 -0
- package/dist-types/ts3.4/models/models_0.d.ts +58 -0
- package/dist-types/ts3.4/pagination/ListLanguagesPaginator.d.ts +4 -0
- package/dist-types/ts3.4/pagination/index.d.ts +1 -0
- package/dist-types/ts3.4/protocols/Aws_json1_1.d.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.120.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.119.0...v3.120.0) (2022-06-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **client-translate:** Added ListLanguages API which can be used to list the languages supported by Translate. ([4ec076d](https://github.com/aws/aws-sdk-js-v3/commit/4ec076d3339948f276cb96ea9bfef6200a18793b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [3.118.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.118.0...v3.118.1) (2022-06-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @aws-sdk/client-translate
|
package/dist-cjs/Translate.js
CHANGED
|
@@ -8,6 +8,7 @@ const DescribeTextTranslationJobCommand_1 = require("./commands/DescribeTextTran
|
|
|
8
8
|
const GetParallelDataCommand_1 = require("./commands/GetParallelDataCommand");
|
|
9
9
|
const GetTerminologyCommand_1 = require("./commands/GetTerminologyCommand");
|
|
10
10
|
const ImportTerminologyCommand_1 = require("./commands/ImportTerminologyCommand");
|
|
11
|
+
const ListLanguagesCommand_1 = require("./commands/ListLanguagesCommand");
|
|
11
12
|
const ListParallelDataCommand_1 = require("./commands/ListParallelDataCommand");
|
|
12
13
|
const ListTerminologiesCommand_1 = require("./commands/ListTerminologiesCommand");
|
|
13
14
|
const ListTextTranslationJobsCommand_1 = require("./commands/ListTextTranslationJobsCommand");
|
|
@@ -115,6 +116,20 @@ class Translate extends TranslateClient_1.TranslateClient {
|
|
|
115
116
|
return this.send(command, optionsOrCb);
|
|
116
117
|
}
|
|
117
118
|
}
|
|
119
|
+
listLanguages(args, optionsOrCb, cb) {
|
|
120
|
+
const command = new ListLanguagesCommand_1.ListLanguagesCommand(args);
|
|
121
|
+
if (typeof optionsOrCb === "function") {
|
|
122
|
+
this.send(command, optionsOrCb);
|
|
123
|
+
}
|
|
124
|
+
else if (typeof cb === "function") {
|
|
125
|
+
if (typeof optionsOrCb !== "object")
|
|
126
|
+
throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
|
|
127
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return this.send(command, optionsOrCb);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
118
133
|
listParallelData(args, optionsOrCb, cb) {
|
|
119
134
|
const command = new ListParallelDataCommand_1.ListParallelDataCommand(args);
|
|
120
135
|
if (typeof optionsOrCb === "function") {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListLanguagesCommand = void 0;
|
|
4
|
+
const middleware_serde_1 = require("@aws-sdk/middleware-serde");
|
|
5
|
+
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
|
+
const models_0_1 = require("../models/models_0");
|
|
7
|
+
const Aws_json1_1_1 = require("../protocols/Aws_json1_1");
|
|
8
|
+
class ListLanguagesCommand extends smithy_client_1.Command {
|
|
9
|
+
constructor(input) {
|
|
10
|
+
super();
|
|
11
|
+
this.input = input;
|
|
12
|
+
}
|
|
13
|
+
resolveMiddleware(clientStack, configuration, options) {
|
|
14
|
+
this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
15
|
+
const stack = clientStack.concat(this.middlewareStack);
|
|
16
|
+
const { logger } = configuration;
|
|
17
|
+
const clientName = "TranslateClient";
|
|
18
|
+
const commandName = "ListLanguagesCommand";
|
|
19
|
+
const handlerExecutionContext = {
|
|
20
|
+
logger,
|
|
21
|
+
clientName,
|
|
22
|
+
commandName,
|
|
23
|
+
inputFilterSensitiveLog: models_0_1.ListLanguagesRequest.filterSensitiveLog,
|
|
24
|
+
outputFilterSensitiveLog: models_0_1.ListLanguagesResponse.filterSensitiveLog,
|
|
25
|
+
};
|
|
26
|
+
const { requestHandler } = configuration;
|
|
27
|
+
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
|
|
28
|
+
}
|
|
29
|
+
serialize(input, context) {
|
|
30
|
+
return (0, Aws_json1_1_1.serializeAws_json1_1ListLanguagesCommand)(input, context);
|
|
31
|
+
}
|
|
32
|
+
deserialize(output, context) {
|
|
33
|
+
return (0, Aws_json1_1_1.deserializeAws_json1_1ListLanguagesCommand)(output, context);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ListLanguagesCommand = ListLanguagesCommand;
|
|
@@ -8,6 +8,7 @@ tslib_1.__exportStar(require("./DescribeTextTranslationJobCommand"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./GetParallelDataCommand"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./GetTerminologyCommand"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./ImportTerminologyCommand"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./ListLanguagesCommand"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./ListParallelDataCommand"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./ListTerminologiesCommand"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./ListTextTranslationJobsCommand"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.UpdateParallelDataResponse = exports.UpdateParallelDataRequest = exports.TranslateTextResponse = exports.TranslateTextRequest = exports.TextSizeLimitExceededException = exports.ServiceUnavailableException = exports.DetectedLanguageLowConfidenceException = exports.StopTextTranslationJobResponse = exports.StopTextTranslationJobRequest = exports.UnsupportedLanguagePairException = exports.StartTextTranslationJobResponse = exports.StartTextTranslationJobRequest = exports.ListTextTranslationJobsResponse = exports.ListTextTranslationJobsRequest = void 0;
|
|
3
|
+
exports.ListParallelDataRequest = exports.UnsupportedDisplayLanguageCodeException = exports.ListLanguagesResponse = exports.Language = exports.ListLanguagesRequest = exports.DisplayLanguageCode = exports.ImportTerminologyResponse = exports.ImportTerminologyRequest = exports.TerminologyData = exports.MergeStrategy = exports.GetTerminologyResponse = exports.TerminologyProperties = exports.Directionality = exports.TerminologyDataLocation = exports.GetTerminologyRequest = exports.TerminologyDataFormat = exports.GetParallelDataResponse = exports.ParallelDataProperties = exports.ParallelDataDataLocation = exports.GetParallelDataRequest = exports.DescribeTextTranslationJobResponse = exports.TextTranslationJobProperties = exports.TranslationSettings = exports.Profanity = exports.Formality = exports.OutputDataConfig = exports.JobStatus = exports.JobDetails = exports.InputDataConfig = exports.DescribeTextTranslationJobRequest = exports.DeleteTerminologyRequest = exports.ResourceNotFoundException = exports.DeleteParallelDataResponse = exports.DeleteParallelDataRequest = exports.ConcurrentModificationException = exports.TooManyRequestsException = exports.LimitExceededException = exports.InvalidRequestException = exports.InvalidParameterValueException = exports.InternalServerException = exports.CreateParallelDataResponse = exports.ParallelDataStatus = exports.CreateParallelDataRequest = exports.ParallelDataConfig = exports.ParallelDataFormat = exports.EncryptionKey = exports.EncryptionKeyType = exports.ConflictException = exports.AppliedTerminology = exports.Term = void 0;
|
|
4
|
+
exports.UpdateParallelDataResponse = exports.UpdateParallelDataRequest = exports.TranslateTextResponse = exports.TranslateTextRequest = exports.TextSizeLimitExceededException = exports.ServiceUnavailableException = exports.DetectedLanguageLowConfidenceException = exports.StopTextTranslationJobResponse = exports.StopTextTranslationJobRequest = exports.UnsupportedLanguagePairException = exports.StartTextTranslationJobResponse = exports.StartTextTranslationJobRequest = exports.ListTextTranslationJobsResponse = exports.ListTextTranslationJobsRequest = exports.TextTranslationJobFilter = exports.InvalidFilterException = exports.ListTerminologiesResponse = exports.ListTerminologiesRequest = exports.ListParallelDataResponse = void 0;
|
|
5
5
|
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
6
|
const TranslateServiceException_1 = require("./TranslateServiceException");
|
|
7
7
|
var Term;
|
|
@@ -332,6 +332,52 @@ var ImportTerminologyResponse;
|
|
|
332
332
|
...obj,
|
|
333
333
|
});
|
|
334
334
|
})(ImportTerminologyResponse = exports.ImportTerminologyResponse || (exports.ImportTerminologyResponse = {}));
|
|
335
|
+
var DisplayLanguageCode;
|
|
336
|
+
(function (DisplayLanguageCode) {
|
|
337
|
+
DisplayLanguageCode["DE"] = "de";
|
|
338
|
+
DisplayLanguageCode["EN"] = "en";
|
|
339
|
+
DisplayLanguageCode["ES"] = "es";
|
|
340
|
+
DisplayLanguageCode["FR"] = "fr";
|
|
341
|
+
DisplayLanguageCode["IT"] = "it";
|
|
342
|
+
DisplayLanguageCode["JA"] = "ja";
|
|
343
|
+
DisplayLanguageCode["KO"] = "ko";
|
|
344
|
+
DisplayLanguageCode["PT"] = "pt";
|
|
345
|
+
DisplayLanguageCode["ZH"] = "zh";
|
|
346
|
+
DisplayLanguageCode["ZH_TW"] = "zh-TW";
|
|
347
|
+
})(DisplayLanguageCode = exports.DisplayLanguageCode || (exports.DisplayLanguageCode = {}));
|
|
348
|
+
var ListLanguagesRequest;
|
|
349
|
+
(function (ListLanguagesRequest) {
|
|
350
|
+
ListLanguagesRequest.filterSensitiveLog = (obj) => ({
|
|
351
|
+
...obj,
|
|
352
|
+
});
|
|
353
|
+
})(ListLanguagesRequest = exports.ListLanguagesRequest || (exports.ListLanguagesRequest = {}));
|
|
354
|
+
var Language;
|
|
355
|
+
(function (Language) {
|
|
356
|
+
Language.filterSensitiveLog = (obj) => ({
|
|
357
|
+
...obj,
|
|
358
|
+
});
|
|
359
|
+
})(Language = exports.Language || (exports.Language = {}));
|
|
360
|
+
var ListLanguagesResponse;
|
|
361
|
+
(function (ListLanguagesResponse) {
|
|
362
|
+
ListLanguagesResponse.filterSensitiveLog = (obj) => ({
|
|
363
|
+
...obj,
|
|
364
|
+
});
|
|
365
|
+
})(ListLanguagesResponse = exports.ListLanguagesResponse || (exports.ListLanguagesResponse = {}));
|
|
366
|
+
class UnsupportedDisplayLanguageCodeException extends TranslateServiceException_1.TranslateServiceException {
|
|
367
|
+
constructor(opts) {
|
|
368
|
+
super({
|
|
369
|
+
name: "UnsupportedDisplayLanguageCodeException",
|
|
370
|
+
$fault: "client",
|
|
371
|
+
...opts,
|
|
372
|
+
});
|
|
373
|
+
this.name = "UnsupportedDisplayLanguageCodeException";
|
|
374
|
+
this.$fault = "client";
|
|
375
|
+
Object.setPrototypeOf(this, UnsupportedDisplayLanguageCodeException.prototype);
|
|
376
|
+
this.Message = opts.Message;
|
|
377
|
+
this.DisplayLanguageCode = opts.DisplayLanguageCode;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
exports.UnsupportedDisplayLanguageCodeException = UnsupportedDisplayLanguageCodeException;
|
|
335
381
|
var ListParallelDataRequest;
|
|
336
382
|
(function (ListParallelDataRequest) {
|
|
337
383
|
ListParallelDataRequest.filterSensitiveLog = (obj) => ({
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paginateListLanguages = void 0;
|
|
4
|
+
const ListLanguagesCommand_1 = require("../commands/ListLanguagesCommand");
|
|
5
|
+
const Translate_1 = require("../Translate");
|
|
6
|
+
const TranslateClient_1 = require("../TranslateClient");
|
|
7
|
+
const makePagedClientRequest = async (client, input, ...args) => {
|
|
8
|
+
return await client.send(new ListLanguagesCommand_1.ListLanguagesCommand(input), ...args);
|
|
9
|
+
};
|
|
10
|
+
const makePagedRequest = async (client, input, ...args) => {
|
|
11
|
+
return await client.listLanguages(input, ...args);
|
|
12
|
+
};
|
|
13
|
+
async function* paginateListLanguages(config, input, ...additionalArguments) {
|
|
14
|
+
let token = config.startingToken || undefined;
|
|
15
|
+
let hasNext = true;
|
|
16
|
+
let page;
|
|
17
|
+
while (hasNext) {
|
|
18
|
+
input.NextToken = token;
|
|
19
|
+
input["MaxResults"] = config.pageSize;
|
|
20
|
+
if (config.client instanceof Translate_1.Translate) {
|
|
21
|
+
page = await makePagedRequest(config.client, input, ...additionalArguments);
|
|
22
|
+
}
|
|
23
|
+
else if (config.client instanceof TranslateClient_1.TranslateClient) {
|
|
24
|
+
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
throw new Error("Invalid client, expected Translate | TranslateClient");
|
|
28
|
+
}
|
|
29
|
+
yield page;
|
|
30
|
+
const prevToken = token;
|
|
31
|
+
token = page.NextToken;
|
|
32
|
+
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
exports.paginateListLanguages = paginateListLanguages;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./Interfaces"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./ListLanguagesPaginator"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./ListParallelDataPaginator"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./ListTerminologiesPaginator"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./ListTextTranslationJobsPaginator"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deserializeAws_json1_1UpdateParallelDataCommand = exports.deserializeAws_json1_1TranslateTextCommand = exports.deserializeAws_json1_1StopTextTranslationJobCommand = exports.deserializeAws_json1_1StartTextTranslationJobCommand = exports.deserializeAws_json1_1ListTextTranslationJobsCommand = exports.deserializeAws_json1_1ListTerminologiesCommand = exports.deserializeAws_json1_1ListParallelDataCommand = exports.deserializeAws_json1_1ImportTerminologyCommand = exports.deserializeAws_json1_1GetTerminologyCommand = exports.deserializeAws_json1_1GetParallelDataCommand = exports.deserializeAws_json1_1DescribeTextTranslationJobCommand = exports.deserializeAws_json1_1DeleteTerminologyCommand = exports.deserializeAws_json1_1DeleteParallelDataCommand = exports.deserializeAws_json1_1CreateParallelDataCommand = exports.serializeAws_json1_1UpdateParallelDataCommand = exports.serializeAws_json1_1TranslateTextCommand = exports.serializeAws_json1_1StopTextTranslationJobCommand = exports.serializeAws_json1_1StartTextTranslationJobCommand = exports.serializeAws_json1_1ListTextTranslationJobsCommand = exports.serializeAws_json1_1ListTerminologiesCommand = exports.serializeAws_json1_1ListParallelDataCommand = exports.serializeAws_json1_1ImportTerminologyCommand = exports.serializeAws_json1_1GetTerminologyCommand = exports.serializeAws_json1_1GetParallelDataCommand = exports.serializeAws_json1_1DescribeTextTranslationJobCommand = exports.serializeAws_json1_1DeleteTerminologyCommand = exports.serializeAws_json1_1DeleteParallelDataCommand = exports.serializeAws_json1_1CreateParallelDataCommand = void 0;
|
|
3
|
+
exports.deserializeAws_json1_1UpdateParallelDataCommand = exports.deserializeAws_json1_1TranslateTextCommand = exports.deserializeAws_json1_1StopTextTranslationJobCommand = exports.deserializeAws_json1_1StartTextTranslationJobCommand = exports.deserializeAws_json1_1ListTextTranslationJobsCommand = exports.deserializeAws_json1_1ListTerminologiesCommand = exports.deserializeAws_json1_1ListParallelDataCommand = exports.deserializeAws_json1_1ListLanguagesCommand = exports.deserializeAws_json1_1ImportTerminologyCommand = exports.deserializeAws_json1_1GetTerminologyCommand = exports.deserializeAws_json1_1GetParallelDataCommand = exports.deserializeAws_json1_1DescribeTextTranslationJobCommand = exports.deserializeAws_json1_1DeleteTerminologyCommand = exports.deserializeAws_json1_1DeleteParallelDataCommand = exports.deserializeAws_json1_1CreateParallelDataCommand = exports.serializeAws_json1_1UpdateParallelDataCommand = exports.serializeAws_json1_1TranslateTextCommand = exports.serializeAws_json1_1StopTextTranslationJobCommand = exports.serializeAws_json1_1StartTextTranslationJobCommand = exports.serializeAws_json1_1ListTextTranslationJobsCommand = exports.serializeAws_json1_1ListTerminologiesCommand = exports.serializeAws_json1_1ListParallelDataCommand = exports.serializeAws_json1_1ListLanguagesCommand = exports.serializeAws_json1_1ImportTerminologyCommand = exports.serializeAws_json1_1GetTerminologyCommand = exports.serializeAws_json1_1GetParallelDataCommand = exports.serializeAws_json1_1DescribeTextTranslationJobCommand = exports.serializeAws_json1_1DeleteTerminologyCommand = exports.serializeAws_json1_1DeleteParallelDataCommand = exports.serializeAws_json1_1CreateParallelDataCommand = void 0;
|
|
4
4
|
const protocol_http_1 = require("@aws-sdk/protocol-http");
|
|
5
5
|
const smithy_client_1 = require("@aws-sdk/smithy-client");
|
|
6
6
|
const uuid_1 = require("uuid");
|
|
@@ -76,6 +76,16 @@ const serializeAws_json1_1ImportTerminologyCommand = async (input, context) => {
|
|
|
76
76
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
77
77
|
};
|
|
78
78
|
exports.serializeAws_json1_1ImportTerminologyCommand = serializeAws_json1_1ImportTerminologyCommand;
|
|
79
|
+
const serializeAws_json1_1ListLanguagesCommand = async (input, context) => {
|
|
80
|
+
const headers = {
|
|
81
|
+
"content-type": "application/x-amz-json-1.1",
|
|
82
|
+
"x-amz-target": "AWSShineFrontendService_20170701.ListLanguages",
|
|
83
|
+
};
|
|
84
|
+
let body;
|
|
85
|
+
body = JSON.stringify(serializeAws_json1_1ListLanguagesRequest(input, context));
|
|
86
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
87
|
+
};
|
|
88
|
+
exports.serializeAws_json1_1ListLanguagesCommand = serializeAws_json1_1ListLanguagesCommand;
|
|
79
89
|
const serializeAws_json1_1ListParallelDataCommand = async (input, context) => {
|
|
80
90
|
const headers = {
|
|
81
91
|
"content-type": "application/x-amz-json-1.1",
|
|
@@ -461,6 +471,51 @@ const deserializeAws_json1_1ImportTerminologyCommandError = async (output, conte
|
|
|
461
471
|
throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
|
|
462
472
|
}
|
|
463
473
|
};
|
|
474
|
+
const deserializeAws_json1_1ListLanguagesCommand = async (output, context) => {
|
|
475
|
+
if (output.statusCode >= 300) {
|
|
476
|
+
return deserializeAws_json1_1ListLanguagesCommandError(output, context);
|
|
477
|
+
}
|
|
478
|
+
const data = await parseBody(output.body, context);
|
|
479
|
+
let contents = {};
|
|
480
|
+
contents = deserializeAws_json1_1ListLanguagesResponse(data, context);
|
|
481
|
+
const response = {
|
|
482
|
+
$metadata: deserializeMetadata(output),
|
|
483
|
+
...contents,
|
|
484
|
+
};
|
|
485
|
+
return Promise.resolve(response);
|
|
486
|
+
};
|
|
487
|
+
exports.deserializeAws_json1_1ListLanguagesCommand = deserializeAws_json1_1ListLanguagesCommand;
|
|
488
|
+
const deserializeAws_json1_1ListLanguagesCommandError = async (output, context) => {
|
|
489
|
+
const parsedOutput = {
|
|
490
|
+
...output,
|
|
491
|
+
body: await parseBody(output.body, context),
|
|
492
|
+
};
|
|
493
|
+
let response;
|
|
494
|
+
let errorCode = "UnknownError";
|
|
495
|
+
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
496
|
+
switch (errorCode) {
|
|
497
|
+
case "InternalServerException":
|
|
498
|
+
case "com.amazonaws.translate#InternalServerException":
|
|
499
|
+
throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
|
|
500
|
+
case "InvalidParameterValueException":
|
|
501
|
+
case "com.amazonaws.translate#InvalidParameterValueException":
|
|
502
|
+
throw await deserializeAws_json1_1InvalidParameterValueExceptionResponse(parsedOutput, context);
|
|
503
|
+
case "TooManyRequestsException":
|
|
504
|
+
case "com.amazonaws.translate#TooManyRequestsException":
|
|
505
|
+
throw await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context);
|
|
506
|
+
case "UnsupportedDisplayLanguageCodeException":
|
|
507
|
+
case "com.amazonaws.translate#UnsupportedDisplayLanguageCodeException":
|
|
508
|
+
throw await deserializeAws_json1_1UnsupportedDisplayLanguageCodeExceptionResponse(parsedOutput, context);
|
|
509
|
+
default:
|
|
510
|
+
const parsedBody = parsedOutput.body;
|
|
511
|
+
response = new TranslateServiceException_1.TranslateServiceException({
|
|
512
|
+
name: parsedBody.code || parsedBody.Code || errorCode,
|
|
513
|
+
$fault: "client",
|
|
514
|
+
$metadata: deserializeMetadata(output),
|
|
515
|
+
});
|
|
516
|
+
throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
464
519
|
const deserializeAws_json1_1ListParallelDataCommand = async (output, context) => {
|
|
465
520
|
if (output.statusCode >= 300) {
|
|
466
521
|
return deserializeAws_json1_1ListParallelDataCommandError(output, context);
|
|
@@ -905,6 +960,15 @@ const deserializeAws_json1_1TooManyRequestsExceptionResponse = async (parsedOutp
|
|
|
905
960
|
});
|
|
906
961
|
return (0, smithy_client_1.decorateServiceException)(exception, body);
|
|
907
962
|
};
|
|
963
|
+
const deserializeAws_json1_1UnsupportedDisplayLanguageCodeExceptionResponse = async (parsedOutput, context) => {
|
|
964
|
+
const body = parsedOutput.body;
|
|
965
|
+
const deserialized = deserializeAws_json1_1UnsupportedDisplayLanguageCodeException(body, context);
|
|
966
|
+
const exception = new models_0_1.UnsupportedDisplayLanguageCodeException({
|
|
967
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
968
|
+
...deserialized,
|
|
969
|
+
});
|
|
970
|
+
return (0, smithy_client_1.decorateServiceException)(exception, body);
|
|
971
|
+
};
|
|
908
972
|
const deserializeAws_json1_1UnsupportedLanguagePairExceptionResponse = async (parsedOutput, context) => {
|
|
909
973
|
const body = parsedOutput.body;
|
|
910
974
|
const deserialized = deserializeAws_json1_1UnsupportedLanguagePairException(body, context);
|
|
@@ -984,6 +1048,14 @@ const serializeAws_json1_1InputDataConfig = (input, context) => {
|
|
|
984
1048
|
...(input.S3Uri !== undefined && input.S3Uri !== null && { S3Uri: input.S3Uri }),
|
|
985
1049
|
};
|
|
986
1050
|
};
|
|
1051
|
+
const serializeAws_json1_1ListLanguagesRequest = (input, context) => {
|
|
1052
|
+
return {
|
|
1053
|
+
...(input.DisplayLanguageCode !== undefined &&
|
|
1054
|
+
input.DisplayLanguageCode !== null && { DisplayLanguageCode: input.DisplayLanguageCode }),
|
|
1055
|
+
...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
|
|
1056
|
+
...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
|
|
1057
|
+
};
|
|
1058
|
+
};
|
|
987
1059
|
const serializeAws_json1_1ListParallelDataRequest = (input, context) => {
|
|
988
1060
|
return {
|
|
989
1061
|
...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
|
|
@@ -1265,6 +1337,12 @@ const deserializeAws_json1_1JobDetails = (output, context) => {
|
|
|
1265
1337
|
TranslatedDocumentsCount: (0, smithy_client_1.expectInt32)(output.TranslatedDocumentsCount),
|
|
1266
1338
|
};
|
|
1267
1339
|
};
|
|
1340
|
+
const deserializeAws_json1_1Language = (output, context) => {
|
|
1341
|
+
return {
|
|
1342
|
+
LanguageCode: (0, smithy_client_1.expectString)(output.LanguageCode),
|
|
1343
|
+
LanguageName: (0, smithy_client_1.expectString)(output.LanguageName),
|
|
1344
|
+
};
|
|
1345
|
+
};
|
|
1268
1346
|
const deserializeAws_json1_1LanguageCodeStringList = (output, context) => {
|
|
1269
1347
|
const retVal = (output || [])
|
|
1270
1348
|
.filter((e) => e != null)
|
|
@@ -1276,11 +1354,31 @@ const deserializeAws_json1_1LanguageCodeStringList = (output, context) => {
|
|
|
1276
1354
|
});
|
|
1277
1355
|
return retVal;
|
|
1278
1356
|
};
|
|
1357
|
+
const deserializeAws_json1_1LanguagesList = (output, context) => {
|
|
1358
|
+
const retVal = (output || [])
|
|
1359
|
+
.filter((e) => e != null)
|
|
1360
|
+
.map((entry) => {
|
|
1361
|
+
if (entry === null) {
|
|
1362
|
+
return null;
|
|
1363
|
+
}
|
|
1364
|
+
return deserializeAws_json1_1Language(entry, context);
|
|
1365
|
+
});
|
|
1366
|
+
return retVal;
|
|
1367
|
+
};
|
|
1279
1368
|
const deserializeAws_json1_1LimitExceededException = (output, context) => {
|
|
1280
1369
|
return {
|
|
1281
1370
|
Message: (0, smithy_client_1.expectString)(output.Message),
|
|
1282
1371
|
};
|
|
1283
1372
|
};
|
|
1373
|
+
const deserializeAws_json1_1ListLanguagesResponse = (output, context) => {
|
|
1374
|
+
return {
|
|
1375
|
+
DisplayLanguageCode: (0, smithy_client_1.expectString)(output.DisplayLanguageCode),
|
|
1376
|
+
Languages: output.Languages !== undefined && output.Languages !== null
|
|
1377
|
+
? deserializeAws_json1_1LanguagesList(output.Languages, context)
|
|
1378
|
+
: undefined,
|
|
1379
|
+
NextToken: (0, smithy_client_1.expectString)(output.NextToken),
|
|
1380
|
+
};
|
|
1381
|
+
};
|
|
1284
1382
|
const deserializeAws_json1_1ListParallelDataResponse = (output, context) => {
|
|
1285
1383
|
return {
|
|
1286
1384
|
NextToken: (0, smithy_client_1.expectString)(output.NextToken),
|
|
@@ -1550,6 +1648,12 @@ const deserializeAws_json1_1TranslationSettings = (output, context) => {
|
|
|
1550
1648
|
Profanity: (0, smithy_client_1.expectString)(output.Profanity),
|
|
1551
1649
|
};
|
|
1552
1650
|
};
|
|
1651
|
+
const deserializeAws_json1_1UnsupportedDisplayLanguageCodeException = (output, context) => {
|
|
1652
|
+
return {
|
|
1653
|
+
DisplayLanguageCode: (0, smithy_client_1.expectString)(output.DisplayLanguageCode),
|
|
1654
|
+
Message: (0, smithy_client_1.expectString)(output.Message),
|
|
1655
|
+
};
|
|
1656
|
+
};
|
|
1553
1657
|
const deserializeAws_json1_1UnsupportedLanguagePairException = (output, context) => {
|
|
1554
1658
|
return {
|
|
1555
1659
|
Message: (0, smithy_client_1.expectString)(output.Message),
|
package/dist-es/Translate.js
CHANGED
|
@@ -6,6 +6,7 @@ import { DescribeTextTranslationJobCommand, } from "./commands/DescribeTextTrans
|
|
|
6
6
|
import { GetParallelDataCommand, } from "./commands/GetParallelDataCommand";
|
|
7
7
|
import { GetTerminologyCommand, } from "./commands/GetTerminologyCommand";
|
|
8
8
|
import { ImportTerminologyCommand, } from "./commands/ImportTerminologyCommand";
|
|
9
|
+
import { ListLanguagesCommand, } from "./commands/ListLanguagesCommand";
|
|
9
10
|
import { ListParallelDataCommand, } from "./commands/ListParallelDataCommand";
|
|
10
11
|
import { ListTerminologiesCommand, } from "./commands/ListTerminologiesCommand";
|
|
11
12
|
import { ListTextTranslationJobsCommand, } from "./commands/ListTextTranslationJobsCommand";
|
|
@@ -117,6 +118,20 @@ var Translate = (function (_super) {
|
|
|
117
118
|
return this.send(command, optionsOrCb);
|
|
118
119
|
}
|
|
119
120
|
};
|
|
121
|
+
Translate.prototype.listLanguages = function (args, optionsOrCb, cb) {
|
|
122
|
+
var command = new ListLanguagesCommand(args);
|
|
123
|
+
if (typeof optionsOrCb === "function") {
|
|
124
|
+
this.send(command, optionsOrCb);
|
|
125
|
+
}
|
|
126
|
+
else if (typeof cb === "function") {
|
|
127
|
+
if (typeof optionsOrCb !== "object")
|
|
128
|
+
throw new Error("Expect http options but get ".concat(typeof optionsOrCb));
|
|
129
|
+
this.send(command, optionsOrCb || {}, cb);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return this.send(command, optionsOrCb);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
120
135
|
Translate.prototype.listParallelData = function (args, optionsOrCb, cb) {
|
|
121
136
|
var command = new ListParallelDataCommand(args);
|
|
122
137
|
if (typeof optionsOrCb === "function") {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __extends } from "tslib";
|
|
2
|
+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
|
|
3
|
+
import { Command as $Command } from "@aws-sdk/smithy-client";
|
|
4
|
+
import { ListLanguagesRequest, ListLanguagesResponse } from "../models/models_0";
|
|
5
|
+
import { deserializeAws_json1_1ListLanguagesCommand, serializeAws_json1_1ListLanguagesCommand, } from "../protocols/Aws_json1_1";
|
|
6
|
+
var ListLanguagesCommand = (function (_super) {
|
|
7
|
+
__extends(ListLanguagesCommand, _super);
|
|
8
|
+
function ListLanguagesCommand(input) {
|
|
9
|
+
var _this = _super.call(this) || this;
|
|
10
|
+
_this.input = input;
|
|
11
|
+
return _this;
|
|
12
|
+
}
|
|
13
|
+
ListLanguagesCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
|
|
14
|
+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
15
|
+
var stack = clientStack.concat(this.middlewareStack);
|
|
16
|
+
var logger = configuration.logger;
|
|
17
|
+
var clientName = "TranslateClient";
|
|
18
|
+
var commandName = "ListLanguagesCommand";
|
|
19
|
+
var handlerExecutionContext = {
|
|
20
|
+
logger: logger,
|
|
21
|
+
clientName: clientName,
|
|
22
|
+
commandName: commandName,
|
|
23
|
+
inputFilterSensitiveLog: ListLanguagesRequest.filterSensitiveLog,
|
|
24
|
+
outputFilterSensitiveLog: ListLanguagesResponse.filterSensitiveLog,
|
|
25
|
+
};
|
|
26
|
+
var requestHandler = configuration.requestHandler;
|
|
27
|
+
return stack.resolve(function (request) {
|
|
28
|
+
return requestHandler.handle(request.request, options || {});
|
|
29
|
+
}, handlerExecutionContext);
|
|
30
|
+
};
|
|
31
|
+
ListLanguagesCommand.prototype.serialize = function (input, context) {
|
|
32
|
+
return serializeAws_json1_1ListLanguagesCommand(input, context);
|
|
33
|
+
};
|
|
34
|
+
ListLanguagesCommand.prototype.deserialize = function (output, context) {
|
|
35
|
+
return deserializeAws_json1_1ListLanguagesCommand(output, context);
|
|
36
|
+
};
|
|
37
|
+
return ListLanguagesCommand;
|
|
38
|
+
}($Command));
|
|
39
|
+
export { ListLanguagesCommand };
|
|
@@ -5,6 +5,7 @@ export * from "./DescribeTextTranslationJobCommand";
|
|
|
5
5
|
export * from "./GetParallelDataCommand";
|
|
6
6
|
export * from "./GetTerminologyCommand";
|
|
7
7
|
export * from "./ImportTerminologyCommand";
|
|
8
|
+
export * from "./ListLanguagesCommand";
|
|
8
9
|
export * from "./ListParallelDataCommand";
|
|
9
10
|
export * from "./ListTerminologiesCommand";
|
|
10
11
|
export * from "./ListTextTranslationJobsCommand";
|
|
@@ -265,6 +265,45 @@ export var ImportTerminologyResponse;
|
|
|
265
265
|
(function (ImportTerminologyResponse) {
|
|
266
266
|
ImportTerminologyResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
|
|
267
267
|
})(ImportTerminologyResponse || (ImportTerminologyResponse = {}));
|
|
268
|
+
export var DisplayLanguageCode;
|
|
269
|
+
(function (DisplayLanguageCode) {
|
|
270
|
+
DisplayLanguageCode["DE"] = "de";
|
|
271
|
+
DisplayLanguageCode["EN"] = "en";
|
|
272
|
+
DisplayLanguageCode["ES"] = "es";
|
|
273
|
+
DisplayLanguageCode["FR"] = "fr";
|
|
274
|
+
DisplayLanguageCode["IT"] = "it";
|
|
275
|
+
DisplayLanguageCode["JA"] = "ja";
|
|
276
|
+
DisplayLanguageCode["KO"] = "ko";
|
|
277
|
+
DisplayLanguageCode["PT"] = "pt";
|
|
278
|
+
DisplayLanguageCode["ZH"] = "zh";
|
|
279
|
+
DisplayLanguageCode["ZH_TW"] = "zh-TW";
|
|
280
|
+
})(DisplayLanguageCode || (DisplayLanguageCode = {}));
|
|
281
|
+
export var ListLanguagesRequest;
|
|
282
|
+
(function (ListLanguagesRequest) {
|
|
283
|
+
ListLanguagesRequest.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
|
|
284
|
+
})(ListLanguagesRequest || (ListLanguagesRequest = {}));
|
|
285
|
+
export var Language;
|
|
286
|
+
(function (Language) {
|
|
287
|
+
Language.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
|
|
288
|
+
})(Language || (Language = {}));
|
|
289
|
+
export var ListLanguagesResponse;
|
|
290
|
+
(function (ListLanguagesResponse) {
|
|
291
|
+
ListLanguagesResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
|
|
292
|
+
})(ListLanguagesResponse || (ListLanguagesResponse = {}));
|
|
293
|
+
var UnsupportedDisplayLanguageCodeException = (function (_super) {
|
|
294
|
+
__extends(UnsupportedDisplayLanguageCodeException, _super);
|
|
295
|
+
function UnsupportedDisplayLanguageCodeException(opts) {
|
|
296
|
+
var _this = _super.call(this, __assign({ name: "UnsupportedDisplayLanguageCodeException", $fault: "client" }, opts)) || this;
|
|
297
|
+
_this.name = "UnsupportedDisplayLanguageCodeException";
|
|
298
|
+
_this.$fault = "client";
|
|
299
|
+
Object.setPrototypeOf(_this, UnsupportedDisplayLanguageCodeException.prototype);
|
|
300
|
+
_this.Message = opts.Message;
|
|
301
|
+
_this.DisplayLanguageCode = opts.DisplayLanguageCode;
|
|
302
|
+
return _this;
|
|
303
|
+
}
|
|
304
|
+
return UnsupportedDisplayLanguageCodeException;
|
|
305
|
+
}(__BaseException));
|
|
306
|
+
export { UnsupportedDisplayLanguageCodeException };
|
|
268
307
|
export var ListParallelDataRequest;
|
|
269
308
|
(function (ListParallelDataRequest) {
|
|
270
309
|
ListParallelDataRequest.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
|
|
2
|
+
import { ListLanguagesCommand, } from "../commands/ListLanguagesCommand";
|
|
3
|
+
import { Translate } from "../Translate";
|
|
4
|
+
import { TranslateClient } from "../TranslateClient";
|
|
5
|
+
var makePagedClientRequest = function (client, input) {
|
|
6
|
+
var args = [];
|
|
7
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
8
|
+
args[_i - 2] = arguments[_i];
|
|
9
|
+
}
|
|
10
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
11
|
+
return __generator(this, function (_a) {
|
|
12
|
+
switch (_a.label) {
|
|
13
|
+
case 0: return [4, client.send.apply(client, __spreadArray([new ListLanguagesCommand(input)], __read(args), false))];
|
|
14
|
+
case 1: return [2, _a.sent()];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
var makePagedRequest = function (client, input) {
|
|
20
|
+
var args = [];
|
|
21
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
22
|
+
args[_i - 2] = arguments[_i];
|
|
23
|
+
}
|
|
24
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
25
|
+
return __generator(this, function (_a) {
|
|
26
|
+
switch (_a.label) {
|
|
27
|
+
case 0: return [4, client.listLanguages.apply(client, __spreadArray([input], __read(args), false))];
|
|
28
|
+
case 1: return [2, _a.sent()];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export function paginateListLanguages(config, input) {
|
|
34
|
+
var additionalArguments = [];
|
|
35
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
36
|
+
additionalArguments[_i - 2] = arguments[_i];
|
|
37
|
+
}
|
|
38
|
+
return __asyncGenerator(this, arguments, function paginateListLanguages_1() {
|
|
39
|
+
var token, hasNext, page, prevToken;
|
|
40
|
+
return __generator(this, function (_a) {
|
|
41
|
+
switch (_a.label) {
|
|
42
|
+
case 0:
|
|
43
|
+
token = config.startingToken || undefined;
|
|
44
|
+
hasNext = true;
|
|
45
|
+
_a.label = 1;
|
|
46
|
+
case 1:
|
|
47
|
+
if (!hasNext) return [3, 9];
|
|
48
|
+
input.NextToken = token;
|
|
49
|
+
input["MaxResults"] = config.pageSize;
|
|
50
|
+
if (!(config.client instanceof Translate)) return [3, 3];
|
|
51
|
+
return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
|
|
52
|
+
case 2:
|
|
53
|
+
page = _a.sent();
|
|
54
|
+
return [3, 6];
|
|
55
|
+
case 3:
|
|
56
|
+
if (!(config.client instanceof TranslateClient)) return [3, 5];
|
|
57
|
+
return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
|
|
58
|
+
case 4:
|
|
59
|
+
page = _a.sent();
|
|
60
|
+
return [3, 6];
|
|
61
|
+
case 5: throw new Error("Invalid client, expected Translate | TranslateClient");
|
|
62
|
+
case 6: return [4, __await(page)];
|
|
63
|
+
case 7: return [4, _a.sent()];
|
|
64
|
+
case 8:
|
|
65
|
+
_a.sent();
|
|
66
|
+
prevToken = token;
|
|
67
|
+
token = page.NextToken;
|
|
68
|
+
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
|
|
69
|
+
return [3, 1];
|
|
70
|
+
case 9: return [4, __await(undefined)];
|
|
71
|
+
case 10: return [2, _a.sent()];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|