UNPKG

14.5 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 * Retrieves a custom terminology.
24 */
25 getTerminology(params: Translate.Types.GetTerminologyRequest, callback?: (err: AWSError, data: Translate.Types.GetTerminologyResponse) => void): Request<Translate.Types.GetTerminologyResponse, AWSError>;
26 /**
27 * Retrieves a custom terminology.
28 */
29 getTerminology(callback?: (err: AWSError, data: Translate.Types.GetTerminologyResponse) => void): Request<Translate.Types.GetTerminologyResponse, AWSError>;
30 /**
31 * 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.
32 */
33 importTerminology(params: Translate.Types.ImportTerminologyRequest, callback?: (err: AWSError, data: Translate.Types.ImportTerminologyResponse) => void): Request<Translate.Types.ImportTerminologyResponse, AWSError>;
34 /**
35 * 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.
36 */
37 importTerminology(callback?: (err: AWSError, data: Translate.Types.ImportTerminologyResponse) => void): Request<Translate.Types.ImportTerminologyResponse, AWSError>;
38 /**
39 * Provides a list of custom terminologies associated with your account.
40 */
41 listTerminologies(params: Translate.Types.ListTerminologiesRequest, callback?: (err: AWSError, data: Translate.Types.ListTerminologiesResponse) => void): Request<Translate.Types.ListTerminologiesResponse, AWSError>;
42 /**
43 * Provides a list of custom terminologies associated with your account.
44 */
45 listTerminologies(callback?: (err: AWSError, data: Translate.Types.ListTerminologiesResponse) => void): Request<Translate.Types.ListTerminologiesResponse, AWSError>;
46 /**
47 * Translates input text from the source language to the target language. It is not necessary to use English (en) as either the source or the target language but not all language combinations are supported by Amazon Translate. For more information, see Supported Language Pairs. Arabic (ar) Chinese (Simplified) (zh) Chinese (Traditional) (zh-TW) Czech (cs) Danish (da) Dutch (nl) English (en) Finnish (fi) French (fr) German (de) Hebrew (he) Indonesian (id) Italian (it) Japanese (ja) Korean (ko) Polish (pl) Portuguese (pt) Russian (ru) Spanish (es) Swedish (sv) Turkish (tr) 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.
48 */
49 translateText(params: Translate.Types.TranslateTextRequest, callback?: (err: AWSError, data: Translate.Types.TranslateTextResponse) => void): Request<Translate.Types.TranslateTextResponse, AWSError>;
50 /**
51 * Translates input text from the source language to the target language. It is not necessary to use English (en) as either the source or the target language but not all language combinations are supported by Amazon Translate. For more information, see Supported Language Pairs. Arabic (ar) Chinese (Simplified) (zh) Chinese (Traditional) (zh-TW) Czech (cs) Danish (da) Dutch (nl) English (en) Finnish (fi) French (fr) German (de) Hebrew (he) Indonesian (id) Italian (it) Japanese (ja) Korean (ko) Polish (pl) Portuguese (pt) Russian (ru) Spanish (es) Swedish (sv) Turkish (tr) 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.
52 */
53 translateText(callback?: (err: AWSError, data: Translate.Types.TranslateTextResponse) => void): Request<Translate.Types.TranslateTextResponse, AWSError>;
54}
55declare namespace Translate {
56 export interface AppliedTerminology {
57 /**
58 * The name of the custom terminology applied to the input text by Amazon Translate for the translated text response.
59 */
60 Name?: ResourceName;
61 /**
62 * 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.
63 */
64 Terms?: TermList;
65 }
66 export type AppliedTerminologyList = AppliedTerminology[];
67 export type BoundedLengthString = string;
68 export interface DeleteTerminologyRequest {
69 /**
70 * The name of the custom terminology being deleted.
71 */
72 Name: ResourceName;
73 }
74 export type Description = string;
75 export interface EncryptionKey {
76 /**
77 * The type of encryption key used by Amazon Translate to encrypt custom terminologies.
78 */
79 Type: EncryptionKeyType;
80 /**
81 * The Amazon Resource Name (ARN) of the encryption key being used to encrypt the custom terminology.
82 */
83 Id: EncryptionKeyID;
84 }
85 export type EncryptionKeyID = string;
86 export type EncryptionKeyType = "KMS"|string;
87 export interface GetTerminologyRequest {
88 /**
89 * The name of the custom terminology being retrieved.
90 */
91 Name: ResourceName;
92 /**
93 * The data format of the custom terminology being retrieved, either CSV or TMX.
94 */
95 TerminologyDataFormat: TerminologyDataFormat;
96 }
97 export interface GetTerminologyResponse {
98 /**
99 * The properties of the custom terminology being retrieved.
100 */
101 TerminologyProperties?: TerminologyProperties;
102 /**
103 * 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.
104 */
105 TerminologyDataLocation?: TerminologyDataLocation;
106 }
107 export interface ImportTerminologyRequest {
108 /**
109 * The name of the custom terminology being imported.
110 */
111 Name: ResourceName;
112 /**
113 * 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.
114 */
115 MergeStrategy: MergeStrategy;
116 /**
117 * The description of the custom terminology being imported.
118 */
119 Description?: Description;
120 /**
121 * The terminology data for the custom terminology being imported.
122 */
123 TerminologyData: TerminologyData;
124 /**
125 * The encryption key for the custom terminology being imported.
126 */
127 EncryptionKey?: EncryptionKey;
128 }
129 export interface ImportTerminologyResponse {
130 /**
131 * The properties of the custom terminology being imported.
132 */
133 TerminologyProperties?: TerminologyProperties;
134 }
135 export type Integer = number;
136 export type LanguageCodeString = string;
137 export type LanguageCodeStringList = LanguageCodeString[];
138 export interface ListTerminologiesRequest {
139 /**
140 * If the result of the request to ListTerminologies was truncated, include the NextToken to fetch the next group of custom terminologies.
141 */
142 NextToken?: NextToken;
143 /**
144 * The maximum number of custom terminologies returned per list request.
145 */
146 MaxResults?: MaxResultsInteger;
147 }
148 export interface ListTerminologiesResponse {
149 /**
150 * The properties list of the custom terminologies returned on the list request.
151 */
152 TerminologyPropertiesList?: TerminologyPropertiesList;
153 /**
154 * If the response to the ListTerminologies was truncated, the NextToken fetches the next group of custom terminologies.
155 */
156 NextToken?: NextToken;
157 }
158 export type MaxResultsInteger = number;
159 export type MergeStrategy = "OVERWRITE"|string;
160 export type NextToken = string;
161 export type ResourceName = string;
162 export type ResourceNameList = ResourceName[];
163 export type String = string;
164 export interface Term {
165 /**
166 * The source text of the term being translated by the custom terminology.
167 */
168 SourceText?: String;
169 /**
170 * The target text of the term being translated by the custom terminology.
171 */
172 TargetText?: String;
173 }
174 export type TermList = Term[];
175 export type TerminologyArn = string;
176 export interface TerminologyData {
177 /**
178 * The file containing the custom terminology data.
179 */
180 File: TerminologyFile;
181 /**
182 * The data format of the custom terminology. Either CSV or TMX.
183 */
184 Format: TerminologyDataFormat;
185 }
186 export type TerminologyDataFormat = "CSV"|"TMX"|string;
187 export interface TerminologyDataLocation {
188 /**
189 * The repository type for the custom terminology data.
190 */
191 RepositoryType: String;
192 /**
193 * The location of the custom terminology data.
194 */
195 Location: String;
196 }
197 export type TerminologyFile = Buffer|Uint8Array|Blob|string;
198 export interface TerminologyProperties {
199 /**
200 * The name of the custom terminology.
201 */
202 Name?: ResourceName;
203 /**
204 * The description of the custom terminology properties.
205 */
206 Description?: Description;
207 /**
208 * The Amazon Resource Name (ARN) of the custom terminology.
209 */
210 Arn?: TerminologyArn;
211 /**
212 * The language code for the source text of the translation request for which the custom terminology is being used.
213 */
214 SourceLanguageCode?: LanguageCodeString;
215 /**
216 * The language codes for the target languages available with the custom terminology file. All possible target languages are returned in array.
217 */
218 TargetLanguageCodes?: LanguageCodeStringList;
219 /**
220 * The encryption key for the custom terminology.
221 */
222 EncryptionKey?: EncryptionKey;
223 /**
224 * The size of the file used when importing a custom terminology.
225 */
226 SizeBytes?: Integer;
227 /**
228 * The number of terms included in the custom terminology.
229 */
230 TermCount?: Integer;
231 /**
232 * The time at which the custom terminology was created, based on the timestamp.
233 */
234 CreatedAt?: Timestamp;
235 /**
236 * The time at which the custom terminology was last update, based on the timestamp.
237 */
238 LastUpdatedAt?: Timestamp;
239 }
240 export type TerminologyPropertiesList = TerminologyProperties[];
241 export type Timestamp = Date;
242 export interface TranslateTextRequest {
243 /**
244 * 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.
245 */
246 Text: BoundedLengthString;
247 /**
248 * The TerminologyNames list that is taken as input to the TranslateText request. This has a minimum length of 0 and a maximum length of 1.
249 */
250 TerminologyNames?: ResourceNameList;
251 /**
252 * The language code for the language of the source text. The language must be a language supported by Amazon Translate. 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.
253 */
254 SourceLanguageCode: LanguageCodeString;
255 /**
256 * The language code requested for the language of the target text. The language must be a language supported by Amazon Translate.
257 */
258 TargetLanguageCode: LanguageCodeString;
259 }
260 export interface TranslateTextResponse {
261 /**
262 * The the translated text. The maximum length of this text is 5kb.
263 */
264 TranslatedText: String;
265 /**
266 * The language code for the language of the source text.
267 */
268 SourceLanguageCode: LanguageCodeString;
269 /**
270 * The language code for the language of the target text.
271 */
272 TargetLanguageCode: LanguageCodeString;
273 /**
274 * The names of the custom terminologies applied to the input text by Amazon Translate for the translated text response.
275 */
276 AppliedTerminologies?: AppliedTerminologyList;
277 }
278 /**
279 * 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.
280 */
281 export type apiVersion = "2017-07-01"|"latest"|string;
282 export interface ClientApiVersions {
283 /**
284 * 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.
285 */
286 apiVersion?: apiVersion;
287 }
288 export type ClientConfiguration = ServiceConfigurationOptions & ClientApiVersions;
289 /**
290 * Contains interfaces for use with the Translate client.
291 */
292 export import Types = Translate;
293}
294export = Translate;