UNPKG

26.2 kBTypeScriptView Raw
1import {Request} from '../lib/request';
2import {Response} from '../lib/response';
3import {AWSError} from '../lib/error';
4import {Service} from '../lib/service';
5import {ServiceConfigurationOptions} from '../lib/service';
6import {ConfigBase as Config} from '../lib/config';
7interface Blob {}
8declare class Translate extends Service {
9 /**
10 * Constructs a service object. This object has one method for each API operation.
11 */
12 constructor(options?: Translate.Types.ClientConfiguration)
13 config: Config & Translate.Types.ClientConfiguration;
14 /**
15 * A synchronous action that deletes a custom terminology.
16 */
17 deleteTerminology(params: Translate.Types.DeleteTerminologyRequest, callback?: (err: AWSError, data: {}) => void): Request<{}, AWSError>;
18 /**
19 * A synchronous action that deletes a custom terminology.
20 */
21 deleteTerminology(callback?: (err: AWSError, data: {}) => void): Request<{}, AWSError>;
22 /**
23 * Gets the properties associated with an asycnhronous batch translation job including name, ID, status, source and target languages, input/output S3 buckets, and so on.
24 */
25 describeTextTranslationJob(params: Translate.Types.DescribeTextTranslationJobRequest, callback?: (err: AWSError, data: Translate.Types.DescribeTextTranslationJobResponse) => void): Request<Translate.Types.DescribeTextTranslationJobResponse, AWSError>;
26 /**
27 * Gets the properties associated with an asycnhronous batch translation job including name, ID, status, source and target languages, input/output S3 buckets, and so on.
28 */
29 describeTextTranslationJob(callback?: (err: AWSError, data: Translate.Types.DescribeTextTranslationJobResponse) => void): Request<Translate.Types.DescribeTextTranslationJobResponse, AWSError>;
30 /**
31 * Retrieves a custom terminology.
32 */
33 getTerminology(params: Translate.Types.GetTerminologyRequest, callback?: (err: AWSError, data: Translate.Types.GetTerminologyResponse) => void): Request<Translate.Types.GetTerminologyResponse, AWSError>;
34 /**
35 * Retrieves a custom terminology.
36 */
37 getTerminology(callback?: (err: AWSError, data: Translate.Types.GetTerminologyResponse) => void): Request<Translate.Types.GetTerminologyResponse, AWSError>;
38 /**
39 * Creates or updates a custom terminology, depending on whether or not one already exists for the given terminology name. Importing a terminology with the same name as an existing one will merge the terminologies based on the chosen merge strategy. Currently, the only supported merge strategy is OVERWRITE, and so the imported terminology will overwrite an existing terminology of the same name. If you import a terminology that overwrites an existing one, the new terminology take up to 10 minutes to fully propagate and be available for use in a translation due to cache policies with the DataPlane service that performs the translations.
40 */
41 importTerminology(params: Translate.Types.ImportTerminologyRequest, callback?: (err: AWSError, data: Translate.Types.ImportTerminologyResponse) => void): Request<Translate.Types.ImportTerminologyResponse, AWSError>;
42 /**
43 * Creates or updates a custom terminology, depending on whether or not one already exists for the given terminology name. Importing a terminology with the same name as an existing one will merge the terminologies based on the chosen merge strategy. Currently, the only supported merge strategy is OVERWRITE, and so the imported terminology will overwrite an existing terminology of the same name. If you import a terminology that overwrites an existing one, the new terminology take up to 10 minutes to fully propagate and be available for use in a translation due to cache policies with the DataPlane service that performs the translations.
44 */
45 importTerminology(callback?: (err: AWSError, data: Translate.Types.ImportTerminologyResponse) => void): Request<Translate.Types.ImportTerminologyResponse, AWSError>;
46 /**
47 * Provides a list of custom terminologies associated with your account.
48 */
49 listTerminologies(params: Translate.Types.ListTerminologiesRequest, callback?: (err: AWSError, data: Translate.Types.ListTerminologiesResponse) => void): Request<Translate.Types.ListTerminologiesResponse, AWSError>;
50 /**
51 * Provides a list of custom terminologies associated with your account.
52 */
53 listTerminologies(callback?: (err: AWSError, data: Translate.Types.ListTerminologiesResponse) => void): Request<Translate.Types.ListTerminologiesResponse, AWSError>;
54 /**
55 * Gets a list of the batch translation jobs that you have submitted.
56 */
57 listTextTranslationJobs(params: Translate.Types.ListTextTranslationJobsRequest, callback?: (err: AWSError, data: Translate.Types.ListTextTranslationJobsResponse) => void): Request<Translate.Types.ListTextTranslationJobsResponse, AWSError>;
58 /**
59 * Gets a list of the batch translation jobs that you have submitted.
60 */
61 listTextTranslationJobs(callback?: (err: AWSError, data: Translate.Types.ListTextTranslationJobsResponse) => void): Request<Translate.Types.ListTextTranslationJobsResponse, AWSError>;
62 /**
63 * Starts an asynchronous batch translation job. Batch translation jobs can be used to translate large volumes of text across multiple documents at once. For more information, see async. Batch translation jobs can be described with the DescribeTextTranslationJob operation, listed with the ListTextTranslationJobs operation, and stopped with the StopTextTranslationJob operation. Amazon Translate does not support batch translation of multiple source languages at once.
64 */
65 startTextTranslationJob(params: Translate.Types.StartTextTranslationJobRequest, callback?: (err: AWSError, data: Translate.Types.StartTextTranslationJobResponse) => void): Request<Translate.Types.StartTextTranslationJobResponse, AWSError>;
66 /**
67 * Starts an asynchronous batch translation job. Batch translation jobs can be used to translate large volumes of text across multiple documents at once. For more information, see async. Batch translation jobs can be described with the DescribeTextTranslationJob operation, listed with the ListTextTranslationJobs operation, and stopped with the StopTextTranslationJob operation. Amazon Translate does not support batch translation of multiple source languages at once.
68 */
69 startTextTranslationJob(callback?: (err: AWSError, data: Translate.Types.StartTextTranslationJobResponse) => void): Request<Translate.Types.StartTextTranslationJobResponse, AWSError>;
70 /**
71 * Stops an asynchronous batch translation job that is in progress. If the job's state is IN_PROGRESS, the job will be marked for termination and put into the STOP_REQUESTED state. If the job completes before it can be stopped, it is put into the COMPLETED state. Otherwise, the job is put into the STOPPED state. Asynchronous batch translation jobs are started with the StartTextTranslationJob operation. You can use the DescribeTextTranslationJob or ListTextTranslationJobs operations to get a batch translation job's JobId.
72 */
73 stopTextTranslationJob(params: Translate.Types.StopTextTranslationJobRequest, callback?: (err: AWSError, data: Translate.Types.StopTextTranslationJobResponse) => void): Request<Translate.Types.StopTextTranslationJobResponse, AWSError>;
74 /**
75 * Stops an asynchronous batch translation job that is in progress. If the job's state is IN_PROGRESS, the job will be marked for termination and put into the STOP_REQUESTED state. If the job completes before it can be stopped, it is put into the COMPLETED state. Otherwise, the job is put into the STOPPED state. Asynchronous batch translation jobs are started with the StartTextTranslationJob operation. You can use the DescribeTextTranslationJob or ListTextTranslationJobs operations to get a batch translation job's JobId.
76 */
77 stopTextTranslationJob(callback?: (err: AWSError, data: Translate.Types.StopTextTranslationJobResponse) => void): Request<Translate.Types.StopTextTranslationJobResponse, AWSError>;
78 /**
79 * Translates input text from the source language to the target language. For a list of available languages and language codes, see what-is-languages.
80 */
81 translateText(params: Translate.Types.TranslateTextRequest, callback?: (err: AWSError, data: Translate.Types.TranslateTextResponse) => void): Request<Translate.Types.TranslateTextResponse, AWSError>;
82 /**
83 * Translates input text from the source language to the target language. For a list of available languages and language codes, see what-is-languages.
84 */
85 translateText(callback?: (err: AWSError, data: Translate.Types.TranslateTextResponse) => void): Request<Translate.Types.TranslateTextResponse, AWSError>;
86}
87declare namespace Translate {
88 export interface AppliedTerminology {
89 /**
90 * The name of the custom terminology applied to the input text by Amazon Translate for the translated text response.
91 */
92 Name?: ResourceName;
93 /**
94 * The specific terms of the custom terminology applied to the input text by Amazon Translate for the translated text response. A maximum of 250 terms will be returned, and the specific terms applied will be the first 250 terms in the source text.
95 */
96 Terms?: TermList;
97 }
98 export type AppliedTerminologyList = AppliedTerminology[];
99 export type BoundedLengthString = string;
100 export type ClientTokenString = string;
101 export type ContentType = string;
102 export interface DeleteTerminologyRequest {
103 /**
104 * The name of the custom terminology being deleted.
105 */
106 Name: ResourceName;
107 }
108 export interface DescribeTextTranslationJobRequest {
109 /**
110 * The identifier that Amazon Translate generated for the job. The StartTextTranslationJob operation returns this identifier in its response.
111 */
112 JobId: JobId;
113 }
114 export interface DescribeTextTranslationJobResponse {
115 /**
116 * An object that contains the properties associated with an asynchronous batch translation job.
117 */
118 TextTranslationJobProperties?: TextTranslationJobProperties;
119 }
120 export type Description = string;
121 export interface EncryptionKey {
122 /**
123 * The type of encryption key used by Amazon Translate to encrypt custom terminologies.
124 */
125 Type: EncryptionKeyType;
126 /**
127 * The Amazon Resource Name (ARN) of the encryption key being used to encrypt the custom terminology.
128 */
129 Id: EncryptionKeyID;
130 }
131 export type EncryptionKeyID = string;
132 export type EncryptionKeyType = "KMS"|string;
133 export interface GetTerminologyRequest {
134 /**
135 * The name of the custom terminology being retrieved.
136 */
137 Name: ResourceName;
138 /**
139 * The data format of the custom terminology being retrieved, either CSV or TMX.
140 */
141 TerminologyDataFormat: TerminologyDataFormat;
142 }
143 export interface GetTerminologyResponse {
144 /**
145 * The properties of the custom terminology being retrieved.
146 */
147 TerminologyProperties?: TerminologyProperties;
148 /**
149 * The data location of the custom terminology being retrieved. The custom terminology file is returned in a presigned url that has a 30 minute expiration.
150 */
151 TerminologyDataLocation?: TerminologyDataLocation;
152 }
153 export type IamRoleArn = string;
154 export interface ImportTerminologyRequest {
155 /**
156 * The name of the custom terminology being imported.
157 */
158 Name: ResourceName;
159 /**
160 * The merge strategy of the custom terminology being imported. Currently, only the OVERWRITE merge strategy is supported. In this case, the imported terminology will overwrite an existing terminology of the same name.
161 */
162 MergeStrategy: MergeStrategy;
163 /**
164 * The description of the custom terminology being imported.
165 */
166 Description?: Description;
167 /**
168 * The terminology data for the custom terminology being imported.
169 */
170 TerminologyData: TerminologyData;
171 /**
172 * The encryption key for the custom terminology being imported.
173 */
174 EncryptionKey?: EncryptionKey;
175 }
176 export interface ImportTerminologyResponse {
177 /**
178 * The properties of the custom terminology being imported.
179 */
180 TerminologyProperties?: TerminologyProperties;
181 }
182 export interface InputDataConfig {
183 /**
184 * The URI of the AWS S3 folder that contains the input file. The folder must be in the same Region as the API endpoint you are calling.
185 */
186 S3Uri: S3Uri;
187 /**
188 * The multipurpose internet mail extension (MIME) type of the input files. Valid values are text/plain for plaintext files and text/html for HTML files.
189 */
190 ContentType: ContentType;
191 }
192 export type Integer = number;
193 export interface JobDetails {
194 /**
195 * The number of documents successfully processed during a translation job.
196 */
197 TranslatedDocumentsCount?: Integer;
198 /**
199 * The number of documents that could not be processed during a translation job.
200 */
201 DocumentsWithErrorsCount?: Integer;
202 /**
203 * The number of documents used as input in a translation job.
204 */
205 InputDocumentsCount?: Integer;
206 }
207 export type JobId = string;
208 export type JobName = string;
209 export type JobStatus = "SUBMITTED"|"IN_PROGRESS"|"COMPLETED"|"COMPLETED_WITH_ERROR"|"FAILED"|"STOP_REQUESTED"|"STOPPED"|string;
210 export type LanguageCodeString = string;
211 export type LanguageCodeStringList = LanguageCodeString[];
212 export interface ListTerminologiesRequest {
213 /**
214 * If the result of the request to ListTerminologies was truncated, include the NextToken to fetch the next group of custom terminologies.
215 */
216 NextToken?: NextToken;
217 /**
218 * The maximum number of custom terminologies returned per list request.
219 */
220 MaxResults?: MaxResultsInteger;
221 }
222 export interface ListTerminologiesResponse {
223 /**
224 * The properties list of the custom terminologies returned on the list request.
225 */
226 TerminologyPropertiesList?: TerminologyPropertiesList;
227 /**
228 * If the response to the ListTerminologies was truncated, the NextToken fetches the next group of custom terminologies.
229 */
230 NextToken?: NextToken;
231 }
232 export interface ListTextTranslationJobsRequest {
233 /**
234 * The parameters that specify which batch translation jobs to retrieve. Filters include job name, job status, and submission time. You can only set one filter at a time.
235 */
236 Filter?: TextTranslationJobFilter;
237 /**
238 * The token to request the next page of results.
239 */
240 NextToken?: NextToken;
241 /**
242 * The maximum number of results to return in each page. The default value is 100.
243 */
244 MaxResults?: MaxResultsInteger;
245 }
246 export interface ListTextTranslationJobsResponse {
247 /**
248 * A list containing the properties of each job that is returned.
249 */
250 TextTranslationJobPropertiesList?: TextTranslationJobPropertiesList;
251 /**
252 * The token to use to retreive the next page of results. This value is null when there are no more results to return.
253 */
254 NextToken?: NextToken;
255 }
256 export type MaxResultsInteger = number;
257 export type MergeStrategy = "OVERWRITE"|string;
258 export type NextToken = string;
259 export interface OutputDataConfig {
260 /**
261 * The URI of the S3 folder that contains a translation job's output file. The folder must be in the same Region as the API endpoint that you are calling.
262 */
263 S3Uri: S3Uri;
264 }
265 export type ResourceName = string;
266 export type ResourceNameList = ResourceName[];
267 export type S3Uri = string;
268 export interface StartTextTranslationJobRequest {
269 /**
270 * The name of the batch translation job to be performed.
271 */
272 JobName?: JobName;
273 /**
274 * Specifies the format and S3 location of the input documents for the translation job.
275 */
276 InputDataConfig: InputDataConfig;
277 /**
278 * Specifies the S3 folder to which your job output will be saved.
279 */
280 OutputDataConfig: OutputDataConfig;
281 /**
282 * The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM) role that grants Amazon Translate read access to your input data. For more nformation, see identity-and-access-management.
283 */
284 DataAccessRoleArn: IamRoleArn;
285 /**
286 * The language code of the input language. For a list of language codes, see what-is-languages. Amazon Translate does not automatically detect a source language during batch translation jobs.
287 */
288 SourceLanguageCode: LanguageCodeString;
289 /**
290 * The language code of the output language.
291 */
292 TargetLanguageCodes: TargetLanguageCodeStringList;
293 /**
294 * The name of the terminology to use in the batch translation job. For a list of available terminologies, use the ListTerminologies operation.
295 */
296 TerminologyNames?: ResourceNameList;
297 /**
298 * The client token of the EC2 instance calling the request. This token is auto-generated when using the Amazon Translate SDK. Otherwise, use the DescribeInstances EC2 operation to retreive an instance's client token. For more information, see Client Tokens in the EC2 User Guide.
299 */
300 ClientToken: ClientTokenString;
301 }
302 export interface StartTextTranslationJobResponse {
303 /**
304 * The identifier generated for the job. To get the status of a job, use this ID with the DescribeTextTranslationJob operation.
305 */
306 JobId?: JobId;
307 /**
308 * The status of the job. Possible values include: SUBMITTED - The job has been received and is queued for processing. IN_PROGRESS - Amazon Translate is processing the job. COMPLETED - The job was successfully completed and the output is available. COMPLETED_WITH_ERRORS - The job was completed with errors. The errors can be analyzed in the job's output. FAILED - The job did not complete. To get details, use the DescribeTextTranslationJob operation. STOP_REQUESTED - The user who started the job has requested that it be stopped. STOPPED - The job has been stopped.
309 */
310 JobStatus?: JobStatus;
311 }
312 export interface StopTextTranslationJobRequest {
313 /**
314 * The job ID of the job to be stopped.
315 */
316 JobId: JobId;
317 }
318 export interface StopTextTranslationJobResponse {
319 /**
320 * The job ID of the stopped batch translation job.
321 */
322 JobId?: JobId;
323 /**
324 * The status of the designated job. Upon successful completion, the job's status will be STOPPED.
325 */
326 JobStatus?: JobStatus;
327 }
328 export type String = string;
329 export type TargetLanguageCodeStringList = LanguageCodeString[];
330 export interface Term {
331 /**
332 * The source text of the term being translated by the custom terminology.
333 */
334 SourceText?: String;
335 /**
336 * The target text of the term being translated by the custom terminology.
337 */
338 TargetText?: String;
339 }
340 export type TermList = Term[];
341 export type TerminologyArn = string;
342 export interface TerminologyData {
343 /**
344 * The file containing the custom terminology data. Your version of the AWS SDK performs a Base64-encoding on this field before sending a request to the AWS service. Users of the SDK should not perform Base64-encoding themselves.
345 */
346 File: TerminologyFile;
347 /**
348 * The data format of the custom terminology. Either CSV or TMX.
349 */
350 Format: TerminologyDataFormat;
351 }
352 export type TerminologyDataFormat = "CSV"|"TMX"|string;
353 export interface TerminologyDataLocation {
354 /**
355 * The repository type for the custom terminology data.
356 */
357 RepositoryType: String;
358 /**
359 * The location of the custom terminology data.
360 */
361 Location: String;
362 }
363 export type TerminologyFile = Buffer|Uint8Array|Blob|string;
364 export interface TerminologyProperties {
365 /**
366 * The name of the custom terminology.
367 */
368 Name?: ResourceName;
369 /**
370 * The description of the custom terminology properties.
371 */
372 Description?: Description;
373 /**
374 * The Amazon Resource Name (ARN) of the custom terminology.
375 */
376 Arn?: TerminologyArn;
377 /**
378 * The language code for the source text of the translation request for which the custom terminology is being used.
379 */
380 SourceLanguageCode?: LanguageCodeString;
381 /**
382 * The language codes for the target languages available with the custom terminology file. All possible target languages are returned in array.
383 */
384 TargetLanguageCodes?: LanguageCodeStringList;
385 /**
386 * The encryption key for the custom terminology.
387 */
388 EncryptionKey?: EncryptionKey;
389 /**
390 * The size of the file used when importing a custom terminology.
391 */
392 SizeBytes?: Integer;
393 /**
394 * The number of terms included in the custom terminology.
395 */
396 TermCount?: Integer;
397 /**
398 * The time at which the custom terminology was created, based on the timestamp.
399 */
400 CreatedAt?: Timestamp;
401 /**
402 * The time at which the custom terminology was last update, based on the timestamp.
403 */
404 LastUpdatedAt?: Timestamp;
405 }
406 export type TerminologyPropertiesList = TerminologyProperties[];
407 export interface TextTranslationJobFilter {
408 /**
409 * Filters the list of jobs by name.
410 */
411 JobName?: JobName;
412 /**
413 * Filters the list of jobs based by job status.
414 */
415 JobStatus?: JobStatus;
416 /**
417 * Filters the list of jobs based on the time that the job was submitted for processing and returns only the jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.
418 */
419 SubmittedBeforeTime?: Timestamp;
420 /**
421 * Filters the list of jobs based on the time that the job was submitted for processing and returns only the jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.
422 */
423 SubmittedAfterTime?: Timestamp;
424 }
425 export interface TextTranslationJobProperties {
426 /**
427 * The ID of the translation job.
428 */
429 JobId?: JobId;
430 /**
431 * The user-defined name of the translation job.
432 */
433 JobName?: JobName;
434 /**
435 * The status of the translation job.
436 */
437 JobStatus?: JobStatus;
438 /**
439 * The number of documents successfully and unsuccessfully processed during the translation job.
440 */
441 JobDetails?: JobDetails;
442 /**
443 * The language code of the language of the source text. The language must be a language supported by Amazon Translate.
444 */
445 SourceLanguageCode?: LanguageCodeString;
446 /**
447 * The language code of the language of the target text. The language must be a language supported by Amazon Translate.
448 */
449 TargetLanguageCodes?: TargetLanguageCodeStringList;
450 /**
451 * A list containing the names of the terminologies applied to a translation job. Only one terminology can be applied per StartTextTranslationJob request at this time.
452 */
453 TerminologyNames?: ResourceNameList;
454 /**
455 * An explanation of any errors that may have occured during the translation job.
456 */
457 Message?: UnboundedLengthString;
458 /**
459 * The time at which the translation job was submitted.
460 */
461 SubmittedTime?: Timestamp;
462 /**
463 * The time at which the translation job ended.
464 */
465 EndTime?: Timestamp;
466 /**
467 * The input configuration properties that were specified when the job was requested.
468 */
469 InputDataConfig?: InputDataConfig;
470 /**
471 * The output configuration properties that were specified when the job was requested.
472 */
473 OutputDataConfig?: OutputDataConfig;
474 /**
475 * The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM) role that granted Amazon Translate read access to the job's input data.
476 */
477 DataAccessRoleArn?: IamRoleArn;
478 }
479 export type TextTranslationJobPropertiesList = TextTranslationJobProperties[];
480 export type Timestamp = Date;
481 export interface TranslateTextRequest {
482 /**
483 * The text to translate. The text string can be a maximum of 5,000 bytes long. Depending on your character set, this may be fewer than 5,000 characters.
484 */
485 Text: BoundedLengthString;
486 /**
487 * The name of the terminology list file to be used in the TranslateText request. You can use 1 terminology list at most in a TranslateText request. Terminology lists can contain a maximum of 256 terms.
488 */
489 TerminologyNames?: ResourceNameList;
490 /**
491 * The language code for the language of the source text. The language must be a language supported by Amazon Translate. For a list of language codes, see what-is-languages. To have Amazon Translate determine the source language of your text, you can specify auto in the SourceLanguageCode field. If you specify auto, Amazon Translate will call Amazon Comprehend to determine the source language.
492 */
493 SourceLanguageCode: LanguageCodeString;
494 /**
495 * The language code requested for the language of the target text. The language must be a language supported by Amazon Translate.
496 */
497 TargetLanguageCode: LanguageCodeString;
498 }
499 export interface TranslateTextResponse {
500 /**
501 * The translated text.
502 */
503 TranslatedText: String;
504 /**
505 * The language code for the language of the source text.
506 */
507 SourceLanguageCode: LanguageCodeString;
508 /**
509 * The language code for the language of the target text.
510 */
511 TargetLanguageCode: LanguageCodeString;
512 /**
513 * The names of the custom terminologies applied to the input text by Amazon Translate for the translated text response.
514 */
515 AppliedTerminologies?: AppliedTerminologyList;
516 }
517 export type UnboundedLengthString = string;
518 /**
519 * A string in YYYY-MM-DD format that represents the latest possible API version that can be used in this service. Specify 'latest' to use the latest possible version.
520 */
521 export type apiVersion = "2017-07-01"|"latest"|string;
522 export interface ClientApiVersions {
523 /**
524 * A string in YYYY-MM-DD format that represents the latest possible API version that can be used in this service. Specify 'latest' to use the latest possible version.
525 */
526 apiVersion?: apiVersion;
527 }
528 export type ClientConfiguration = ServiceConfigurationOptions & ClientApiVersions;
529 /**
530 * Contains interfaces for use with the Translate client.
531 */
532 export import Types = Translate;
533}
534export = Translate;