@googleapis/translate 3.5.0 → 5.0.1
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 +44 -0
- package/build/index.d.ts +1 -1
- package/build/index.js.map +1 -1
- package/build/v2.d.ts +291 -11
- package/build/v2.js.map +1 -1
- package/build/v3.d.ts +3024 -101
- package/build/v3.js.map +1 -1
- package/build/v3beta1.d.ts +1214 -41
- package/build/v3beta1.js.map +1 -1
- package/index.ts +0 -1
- package/package.json +2 -2
- package/v2.ts +301 -21
- package/v3.ts +3176 -175
- package/v3beta1.ts +1274 -71
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.0.1](https://github.com/googleapis/google-api-nodejs-client/compare/translate-v5.0.0...translate-v5.0.1) (2025-07-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **translate:** update the API ([452fa61](https://github.com/googleapis/google-api-nodejs-client/commit/452fa61967b5777b40c25317e8b41bd20127c290))
|
|
9
|
+
* **translate:** update the API ([ca1c63e](https://github.com/googleapis/google-api-nodejs-client/commit/ca1c63ed8367c7a41ddc990a0aa23aa3e439aaaf))
|
|
10
|
+
|
|
11
|
+
## [5.0.0](https://github.com/googleapis/google-api-nodejs-client/compare/translate-v4.0.1...translate-v5.0.0) (2025-06-30)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* upgrade to node 18
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **translate:** update the API ([b3ec4cc](https://github.com/googleapis/google-api-nodejs-client/commit/b3ec4cc74bc3e622f1ffcb53a12ac6ce1db70768))
|
|
21
|
+
* upgrade to node 18 ([682fbb8](https://github.com/googleapis/google-api-nodejs-client/commit/682fbb869189ae92b3e9a194d37d0548af0c1f92))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **deps:** upgrade googleapis-common to 8.0.2-rc ([f4b0990](https://github.com/googleapis/google-api-nodejs-client/commit/f4b099071040cfbcfe4a2e7d487d45ee93b369e0))
|
|
27
|
+
* **translate:** update the API ([ca1c63e](https://github.com/googleapis/google-api-nodejs-client/commit/ca1c63ed8367c7a41ddc990a0aa23aa3e439aaaf))
|
|
28
|
+
|
|
29
|
+
## [4.0.1](https://github.com/googleapis/google-api-nodejs-client/compare/translate-v4.0.0...translate-v4.0.1) (2025-06-04)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **deps:** upgrade googleapis-common to 8.0.2-rc ([f4b0990](https://github.com/googleapis/google-api-nodejs-client/commit/f4b099071040cfbcfe4a2e7d487d45ee93b369e0))
|
|
35
|
+
|
|
36
|
+
## [4.0.0](https://github.com/googleapis/google-api-nodejs-client/compare/translate-v3.5.0...translate-v4.0.0) (2025-05-29)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### ⚠ BREAKING CHANGES
|
|
40
|
+
|
|
41
|
+
* upgrade to node 18
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
|
|
45
|
+
* upgrade to node 18 ([682fbb8](https://github.com/googleapis/google-api-nodejs-client/commit/682fbb869189ae92b3e9a194d37d0548af0c1f92))
|
|
46
|
+
|
|
3
47
|
## [3.5.0](https://github.com/googleapis/google-api-nodejs-client/compare/translate-v3.4.0...translate-v3.5.0) (2025-05-05)
|
|
4
48
|
|
|
5
49
|
|
package/build/index.d.ts
CHANGED
|
@@ -19,4 +19,4 @@ export { auth };
|
|
|
19
19
|
export { translate_v2 };
|
|
20
20
|
export { translate_v3 };
|
|
21
21
|
export { translate_v3beta1 };
|
|
22
|
-
export { AuthPlus, GlobalOptions, APIRequestContext, GoogleConfigurable, StreamMethodOptions,
|
|
22
|
+
export { AuthPlus, GlobalOptions, APIRequestContext, GoogleConfigurable, StreamMethodOptions, MethodOptions, BodyResponseCallback, } from 'googleapis-common';
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,kCAAkC;AAElC,yDAAuE;AACvE,6BAAkC;AA0C1B,6FA1CA,iBAAY,OA0CA;AAzCpB,6BAAkC;AA0C1B,6FA1CA,iBAAY,OA0CA;AAzCpB,uCAA4C;AA0CpC,kGA1CA,2BAAiB,OA0CA;AAxCZ,QAAA,QAAQ,GAAG;IACtB,EAAE,EAAE,iBAAY,CAAC,SAAS;IAC1B,EAAE,EAAE,iBAAY,CAAC,SAAS;IAC1B,OAAO,EAAE,2BAAiB,CAAC,SAAS;CACrC,CAAC;AAcF,SAAgB,SAAS,CAOvB,gBAM6B;IAE7B,OAAO,IAAA,0BAAM,EAAI,WAAW,EAAE,gBAAgB,EAAE,gBAAQ,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAhBD,8BAgBC;AAED,MAAM,IAAI,GAAG,IAAI,4BAAQ,EAAE,CAAC;AACpB,oBAAI;AAIZ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,kCAAkC;AAElC,yDAAuE;AACvE,6BAAkC;AA0C1B,6FA1CA,iBAAY,OA0CA;AAzCpB,6BAAkC;AA0C1B,6FA1CA,iBAAY,OA0CA;AAzCpB,uCAA4C;AA0CpC,kGA1CA,2BAAiB,OA0CA;AAxCZ,QAAA,QAAQ,GAAG;IACtB,EAAE,EAAE,iBAAY,CAAC,SAAS;IAC1B,EAAE,EAAE,iBAAY,CAAC,SAAS;IAC1B,OAAO,EAAE,2BAAiB,CAAC,SAAS;CACrC,CAAC;AAcF,SAAgB,SAAS,CAOvB,gBAM6B;IAE7B,OAAO,IAAA,0BAAM,EAAI,WAAW,EAAE,gBAAgB,EAAE,gBAAQ,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAhBD,8BAgBC;AAED,MAAM,IAAI,GAAG,IAAI,4BAAQ,EAAE,CAAC;AACpB,oBAAI;AAIZ,uDAQ2B;AAPzB,6GAAA,QAAQ,OAAA"}
|
package/build/v2.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { OAuth2Client, JWT, Compute, UserRefreshClient, BaseExternalAccountClient,
|
|
2
|
+
import { OAuth2Client, JWT, Compute, UserRefreshClient, BaseExternalAccountClient, GaxiosResponseWithHTTP2, GoogleConfigurable, MethodOptions, StreamMethodOptions, GlobalOptions, GoogleAuth, BodyResponseCallback, APIRequestContext } from 'googleapis-common';
|
|
3
3
|
import { Readable } from 'stream';
|
|
4
4
|
export declare namespace translate_v2 {
|
|
5
5
|
export interface Options extends GlobalOptions {
|
|
@@ -196,28 +196,132 @@ export declare namespace translate_v2 {
|
|
|
196
196
|
constructor(context: APIRequestContext);
|
|
197
197
|
/**
|
|
198
198
|
* Detects the language of text within a request.
|
|
199
|
+
* @example
|
|
200
|
+
* ```js
|
|
201
|
+
* // Before running the sample:
|
|
202
|
+
* // - Enable the API at:
|
|
203
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
204
|
+
* // - Login into gcloud by running:
|
|
205
|
+
* // ```sh
|
|
206
|
+
* // $ gcloud auth application-default login
|
|
207
|
+
* // ```
|
|
208
|
+
* // - Install the npm module by running:
|
|
209
|
+
* // ```sh
|
|
210
|
+
* // $ npm install googleapis
|
|
211
|
+
* // ```
|
|
212
|
+
*
|
|
213
|
+
* const {google} = require('googleapis');
|
|
214
|
+
* const translate = google.translate('v2');
|
|
215
|
+
*
|
|
216
|
+
* async function main() {
|
|
217
|
+
* const auth = new google.auth.GoogleAuth({
|
|
218
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
219
|
+
* scopes: [
|
|
220
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
221
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
222
|
+
* ],
|
|
223
|
+
* });
|
|
224
|
+
*
|
|
225
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
226
|
+
* const authClient = await auth.getClient();
|
|
227
|
+
* google.options({auth: authClient});
|
|
228
|
+
*
|
|
229
|
+
* // Do the magic
|
|
230
|
+
* const res = await language.detections.detect({
|
|
231
|
+
* // Request body metadata
|
|
232
|
+
* requestBody: {
|
|
233
|
+
* // request body parameters
|
|
234
|
+
* // {
|
|
235
|
+
* // "q": []
|
|
236
|
+
* // }
|
|
237
|
+
* },
|
|
238
|
+
* });
|
|
239
|
+
* console.log(res.data);
|
|
240
|
+
*
|
|
241
|
+
* // Example response
|
|
242
|
+
* // {
|
|
243
|
+
* // "detections": []
|
|
244
|
+
* // }
|
|
245
|
+
* }
|
|
246
|
+
*
|
|
247
|
+
* main().catch(e => {
|
|
248
|
+
* console.error(e);
|
|
249
|
+
* throw e;
|
|
250
|
+
* });
|
|
251
|
+
*
|
|
252
|
+
* ```
|
|
199
253
|
*
|
|
200
254
|
* @param params - Parameters for request
|
|
201
255
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
202
256
|
* @param callback - Optional callback that handles the response.
|
|
203
257
|
* @returns A promise if used with async/await, or void if used with a callback.
|
|
204
258
|
*/
|
|
205
|
-
detect(params: Params$Resource$Detections$Detect, options: StreamMethodOptions):
|
|
206
|
-
detect(params?: Params$Resource$Detections$Detect, options?: MethodOptions):
|
|
259
|
+
detect(params: Params$Resource$Detections$Detect, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
260
|
+
detect(params?: Params$Resource$Detections$Detect, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$DetectionsListResponse>>;
|
|
207
261
|
detect(params: Params$Resource$Detections$Detect, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
|
|
208
262
|
detect(params: Params$Resource$Detections$Detect, options: MethodOptions | BodyResponseCallback<Schema$DetectionsListResponse>, callback: BodyResponseCallback<Schema$DetectionsListResponse>): void;
|
|
209
263
|
detect(params: Params$Resource$Detections$Detect, callback: BodyResponseCallback<Schema$DetectionsListResponse>): void;
|
|
210
264
|
detect(callback: BodyResponseCallback<Schema$DetectionsListResponse>): void;
|
|
211
265
|
/**
|
|
212
266
|
* Detects the language of text within a request.
|
|
267
|
+
* @example
|
|
268
|
+
* ```js
|
|
269
|
+
* // Before running the sample:
|
|
270
|
+
* // - Enable the API at:
|
|
271
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
272
|
+
* // - Login into gcloud by running:
|
|
273
|
+
* // ```sh
|
|
274
|
+
* // $ gcloud auth application-default login
|
|
275
|
+
* // ```
|
|
276
|
+
* // - Install the npm module by running:
|
|
277
|
+
* // ```sh
|
|
278
|
+
* // $ npm install googleapis
|
|
279
|
+
* // ```
|
|
280
|
+
*
|
|
281
|
+
* const {google} = require('googleapis');
|
|
282
|
+
* const translate = google.translate('v2');
|
|
283
|
+
*
|
|
284
|
+
* async function main() {
|
|
285
|
+
* const auth = new google.auth.GoogleAuth({
|
|
286
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
287
|
+
* scopes: [
|
|
288
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
289
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
290
|
+
* ],
|
|
291
|
+
* });
|
|
292
|
+
*
|
|
293
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
294
|
+
* const authClient = await auth.getClient();
|
|
295
|
+
* google.options({auth: authClient});
|
|
296
|
+
*
|
|
297
|
+
* // Do the magic
|
|
298
|
+
* const res = await language.detections.list({
|
|
299
|
+
* // The input text upon which to perform language detection. Repeat this
|
|
300
|
+
* // parameter to perform language detection on multiple text inputs.
|
|
301
|
+
* q: 'placeholder-value',
|
|
302
|
+
* });
|
|
303
|
+
* console.log(res.data);
|
|
304
|
+
*
|
|
305
|
+
* // Example response
|
|
306
|
+
* // {
|
|
307
|
+
* // "detections": []
|
|
308
|
+
* // }
|
|
309
|
+
* }
|
|
310
|
+
*
|
|
311
|
+
* main().catch(e => {
|
|
312
|
+
* console.error(e);
|
|
313
|
+
* throw e;
|
|
314
|
+
* });
|
|
315
|
+
*
|
|
316
|
+
* ```
|
|
213
317
|
*
|
|
214
318
|
* @param params - Parameters for request
|
|
215
319
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
216
320
|
* @param callback - Optional callback that handles the response.
|
|
217
321
|
* @returns A promise if used with async/await, or void if used with a callback.
|
|
218
322
|
*/
|
|
219
|
-
list(params: Params$Resource$Detections$List, options: StreamMethodOptions):
|
|
220
|
-
list(params?: Params$Resource$Detections$List, options?: MethodOptions):
|
|
323
|
+
list(params: Params$Resource$Detections$List, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
324
|
+
list(params?: Params$Resource$Detections$List, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$DetectionsListResponse>>;
|
|
221
325
|
list(params: Params$Resource$Detections$List, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
|
|
222
326
|
list(params: Params$Resource$Detections$List, options: MethodOptions | BodyResponseCallback<Schema$DetectionsListResponse>, callback: BodyResponseCallback<Schema$DetectionsListResponse>): void;
|
|
223
327
|
list(params: Params$Resource$Detections$List, callback: BodyResponseCallback<Schema$DetectionsListResponse>): void;
|
|
@@ -241,14 +345,66 @@ export declare namespace translate_v2 {
|
|
|
241
345
|
constructor(context: APIRequestContext);
|
|
242
346
|
/**
|
|
243
347
|
* Returns a list of supported languages for translation.
|
|
348
|
+
* @example
|
|
349
|
+
* ```js
|
|
350
|
+
* // Before running the sample:
|
|
351
|
+
* // - Enable the API at:
|
|
352
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
353
|
+
* // - Login into gcloud by running:
|
|
354
|
+
* // ```sh
|
|
355
|
+
* // $ gcloud auth application-default login
|
|
356
|
+
* // ```
|
|
357
|
+
* // - Install the npm module by running:
|
|
358
|
+
* // ```sh
|
|
359
|
+
* // $ npm install googleapis
|
|
360
|
+
* // ```
|
|
361
|
+
*
|
|
362
|
+
* const {google} = require('googleapis');
|
|
363
|
+
* const translate = google.translate('v2');
|
|
364
|
+
*
|
|
365
|
+
* async function main() {
|
|
366
|
+
* const auth = new google.auth.GoogleAuth({
|
|
367
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
368
|
+
* scopes: [
|
|
369
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
370
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
371
|
+
* ],
|
|
372
|
+
* });
|
|
373
|
+
*
|
|
374
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
375
|
+
* const authClient = await auth.getClient();
|
|
376
|
+
* google.options({auth: authClient});
|
|
377
|
+
*
|
|
378
|
+
* // Do the magic
|
|
379
|
+
* const res = await language.languages.list({
|
|
380
|
+
* // The model type for which supported languages should be returned.
|
|
381
|
+
* model: 'placeholder-value',
|
|
382
|
+
* // The language to use to return localized, human readable names of supported
|
|
383
|
+
* // languages.
|
|
384
|
+
* target: 'placeholder-value',
|
|
385
|
+
* });
|
|
386
|
+
* console.log(res.data);
|
|
387
|
+
*
|
|
388
|
+
* // Example response
|
|
389
|
+
* // {
|
|
390
|
+
* // "languages": []
|
|
391
|
+
* // }
|
|
392
|
+
* }
|
|
393
|
+
*
|
|
394
|
+
* main().catch(e => {
|
|
395
|
+
* console.error(e);
|
|
396
|
+
* throw e;
|
|
397
|
+
* });
|
|
398
|
+
*
|
|
399
|
+
* ```
|
|
244
400
|
*
|
|
245
401
|
* @param params - Parameters for request
|
|
246
402
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
247
403
|
* @param callback - Optional callback that handles the response.
|
|
248
404
|
* @returns A promise if used with async/await, or void if used with a callback.
|
|
249
405
|
*/
|
|
250
|
-
list(params: Params$Resource$Languages$List, options: StreamMethodOptions):
|
|
251
|
-
list(params?: Params$Resource$Languages$List, options?: MethodOptions):
|
|
406
|
+
list(params: Params$Resource$Languages$List, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
407
|
+
list(params?: Params$Resource$Languages$List, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$LanguagesListResponse>>;
|
|
252
408
|
list(params: Params$Resource$Languages$List, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
|
|
253
409
|
list(params: Params$Resource$Languages$List, options: MethodOptions | BodyResponseCallback<Schema$LanguagesListResponse>, callback: BodyResponseCallback<Schema$LanguagesListResponse>): void;
|
|
254
410
|
list(params: Params$Resource$Languages$List, callback: BodyResponseCallback<Schema$LanguagesListResponse>): void;
|
|
@@ -270,28 +426,152 @@ export declare namespace translate_v2 {
|
|
|
270
426
|
constructor(context: APIRequestContext);
|
|
271
427
|
/**
|
|
272
428
|
* Translates input text, returning translated text.
|
|
429
|
+
* @example
|
|
430
|
+
* ```js
|
|
431
|
+
* // Before running the sample:
|
|
432
|
+
* // - Enable the API at:
|
|
433
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
434
|
+
* // - Login into gcloud by running:
|
|
435
|
+
* // ```sh
|
|
436
|
+
* // $ gcloud auth application-default login
|
|
437
|
+
* // ```
|
|
438
|
+
* // - Install the npm module by running:
|
|
439
|
+
* // ```sh
|
|
440
|
+
* // $ npm install googleapis
|
|
441
|
+
* // ```
|
|
442
|
+
*
|
|
443
|
+
* const {google} = require('googleapis');
|
|
444
|
+
* const translate = google.translate('v2');
|
|
445
|
+
*
|
|
446
|
+
* async function main() {
|
|
447
|
+
* const auth = new google.auth.GoogleAuth({
|
|
448
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
449
|
+
* scopes: [
|
|
450
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
451
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
452
|
+
* ],
|
|
453
|
+
* });
|
|
454
|
+
*
|
|
455
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
456
|
+
* const authClient = await auth.getClient();
|
|
457
|
+
* google.options({auth: authClient});
|
|
458
|
+
*
|
|
459
|
+
* // Do the magic
|
|
460
|
+
* const res = await language.translations.list({
|
|
461
|
+
* // The customization id for translate
|
|
462
|
+
* cid: 'placeholder-value',
|
|
463
|
+
* // The format of the source text, in either HTML (default) or plain-text. A
|
|
464
|
+
* // value of "html" indicates HTML and a value of "text" indicates plain-text.
|
|
465
|
+
* format: 'placeholder-value',
|
|
466
|
+
* // The `model` type requested for this translation. Valid values are
|
|
467
|
+
* // listed in public documentation.
|
|
468
|
+
* model: 'placeholder-value',
|
|
469
|
+
* // The input text to translate. Repeat this parameter to perform translation
|
|
470
|
+
* // operations on multiple text inputs.
|
|
471
|
+
* q: 'placeholder-value',
|
|
472
|
+
* // The language of the source text, set to one of the language codes listed in
|
|
473
|
+
* // Language Support. If the source language is not specified, the API will
|
|
474
|
+
* // attempt to identify the source language automatically and return it within
|
|
475
|
+
* // the response.
|
|
476
|
+
* source: 'placeholder-value',
|
|
477
|
+
* // The language to use for translation of the input text, set to one of the
|
|
478
|
+
* // language codes listed in Language Support.
|
|
479
|
+
* target: 'placeholder-value',
|
|
480
|
+
* });
|
|
481
|
+
* console.log(res.data);
|
|
482
|
+
*
|
|
483
|
+
* // Example response
|
|
484
|
+
* // {
|
|
485
|
+
* // "translations": []
|
|
486
|
+
* // }
|
|
487
|
+
* }
|
|
488
|
+
*
|
|
489
|
+
* main().catch(e => {
|
|
490
|
+
* console.error(e);
|
|
491
|
+
* throw e;
|
|
492
|
+
* });
|
|
493
|
+
*
|
|
494
|
+
* ```
|
|
273
495
|
*
|
|
274
496
|
* @param params - Parameters for request
|
|
275
497
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
276
498
|
* @param callback - Optional callback that handles the response.
|
|
277
499
|
* @returns A promise if used with async/await, or void if used with a callback.
|
|
278
500
|
*/
|
|
279
|
-
list(params: Params$Resource$Translations$List, options: StreamMethodOptions):
|
|
280
|
-
list(params?: Params$Resource$Translations$List, options?: MethodOptions):
|
|
501
|
+
list(params: Params$Resource$Translations$List, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
502
|
+
list(params?: Params$Resource$Translations$List, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$TranslationsListResponse>>;
|
|
281
503
|
list(params: Params$Resource$Translations$List, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
|
|
282
504
|
list(params: Params$Resource$Translations$List, options: MethodOptions | BodyResponseCallback<Schema$TranslationsListResponse>, callback: BodyResponseCallback<Schema$TranslationsListResponse>): void;
|
|
283
505
|
list(params: Params$Resource$Translations$List, callback: BodyResponseCallback<Schema$TranslationsListResponse>): void;
|
|
284
506
|
list(callback: BodyResponseCallback<Schema$TranslationsListResponse>): void;
|
|
285
507
|
/**
|
|
286
508
|
* Translates input text, returning translated text.
|
|
509
|
+
* @example
|
|
510
|
+
* ```js
|
|
511
|
+
* // Before running the sample:
|
|
512
|
+
* // - Enable the API at:
|
|
513
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
514
|
+
* // - Login into gcloud by running:
|
|
515
|
+
* // ```sh
|
|
516
|
+
* // $ gcloud auth application-default login
|
|
517
|
+
* // ```
|
|
518
|
+
* // - Install the npm module by running:
|
|
519
|
+
* // ```sh
|
|
520
|
+
* // $ npm install googleapis
|
|
521
|
+
* // ```
|
|
522
|
+
*
|
|
523
|
+
* const {google} = require('googleapis');
|
|
524
|
+
* const translate = google.translate('v2');
|
|
525
|
+
*
|
|
526
|
+
* async function main() {
|
|
527
|
+
* const auth = new google.auth.GoogleAuth({
|
|
528
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
529
|
+
* scopes: [
|
|
530
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
531
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
532
|
+
* ],
|
|
533
|
+
* });
|
|
534
|
+
*
|
|
535
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
536
|
+
* const authClient = await auth.getClient();
|
|
537
|
+
* google.options({auth: authClient});
|
|
538
|
+
*
|
|
539
|
+
* // Do the magic
|
|
540
|
+
* const res = await language.translations.translate({
|
|
541
|
+
* // Request body metadata
|
|
542
|
+
* requestBody: {
|
|
543
|
+
* // request body parameters
|
|
544
|
+
* // {
|
|
545
|
+
* // "format": "my_format",
|
|
546
|
+
* // "model": "my_model",
|
|
547
|
+
* // "q": [],
|
|
548
|
+
* // "source": "my_source",
|
|
549
|
+
* // "target": "my_target"
|
|
550
|
+
* // }
|
|
551
|
+
* },
|
|
552
|
+
* });
|
|
553
|
+
* console.log(res.data);
|
|
554
|
+
*
|
|
555
|
+
* // Example response
|
|
556
|
+
* // {
|
|
557
|
+
* // "translations": []
|
|
558
|
+
* // }
|
|
559
|
+
* }
|
|
560
|
+
*
|
|
561
|
+
* main().catch(e => {
|
|
562
|
+
* console.error(e);
|
|
563
|
+
* throw e;
|
|
564
|
+
* });
|
|
565
|
+
*
|
|
566
|
+
* ```
|
|
287
567
|
*
|
|
288
568
|
* @param params - Parameters for request
|
|
289
569
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
290
570
|
* @param callback - Optional callback that handles the response.
|
|
291
571
|
* @returns A promise if used with async/await, or void if used with a callback.
|
|
292
572
|
*/
|
|
293
|
-
translate(params: Params$Resource$Translations$Translate, options: StreamMethodOptions):
|
|
294
|
-
translate(params?: Params$Resource$Translations$Translate, options?: MethodOptions):
|
|
573
|
+
translate(params: Params$Resource$Translations$Translate, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
574
|
+
translate(params?: Params$Resource$Translations$Translate, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$TranslationsListResponse>>;
|
|
295
575
|
translate(params: Params$Resource$Translations$Translate, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
|
|
296
576
|
translate(params: Params$Resource$Translations$Translate, options: MethodOptions | BodyResponseCallback<Schema$TranslationsListResponse>, callback: BodyResponseCallback<Schema$TranslationsListResponse>): void;
|
|
297
577
|
translate(params: Params$Resource$Translations$Translate, callback: BodyResponseCallback<Schema$TranslationsListResponse>): void;
|
package/build/v2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2.js","sourceRoot":"","sources":["../v2.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,uDAAuD;AACvD,sDAAsD;AACtD,0DAA0D;AAC1D,oDAAoD;AACpD,4CAA4C;AAE5C,yDAe2B;AAG3B,IAAiB,YAAY,
|
|
1
|
+
{"version":3,"file":"v2.js","sourceRoot":"","sources":["../v2.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,s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