@@ -254,6 +254,60 @@ export namespace translate_v2 {
254
254
255
255
/**
256
256
* Detects the language of text within a request.
257
+ * @example
258
+ * ```js
259
+ * // Before running the sample:
260
+ * // - Enable the API at:
261
+ * // https://console.developers.google.com/apis/api/translate.googleapis.com
262
+ * // - Login into gcloud by running:
263
+ * // ```sh
264
+ * // $ gcloud auth application-default login
265
+ * // ```
266
+ * // - Install the npm module by running:
267
+ * // ```sh
268
+ * // $ npm install googleapis
269
+ * // ```
270
+ *
271
+ * const {google} = require('googleapis');
272
+ * const translate = google.translate('v2');
273
+ *
274
+ * async function main() {
275
+ * const auth = new google.auth.GoogleAuth({
276
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
277
+ * scopes: [
278
+ * 'https://www.googleapis.com/auth/cloud-translation',
279
+ * 'https://www.googleapis.com/auth/cloud-platform',
280
+ * ],
281
+ * });
282
+ *
283
+ * // Acquire an auth client, and bind it to all future calls
284
+ * const authClient = await auth.getClient();
285
+ * google.options({auth: authClient});
286
+ *
287
+ * // Do the magic
288
+ * const res = await language.detections.detect({
289
+ * // Request body metadata
290
+ * requestBody: {
291
+ * // request body parameters
292
+ * // {
293
+ * // "q": []
294
+ * // }
295
+ * },
296
+ * });
297
+ * console.log(res.data);
298
+ *
299
+ * // Example response
300
+ * // {
301
+ * // "detections": []
302
+ * // }
303
+ * }
304
+ *
305
+ * main().catch(e => {
306
+ * console.error(e);
307
+ * throw e;
308
+ * });
309
+ *
310
+ * ```
257
311
*
258
312
* @param params - Parameters for request
259
313
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -347,6 +401,56 @@ export namespace translate_v2 {
347
401
348
402
/**
349
403
* Detects the language of text within a request.
404
+ * @example
405
+ * ```js
406
+ * // Before running the sample:
407
+ * // - Enable the API at:
408
+ * // https://console.developers.google.com/apis/api/translate.googleapis.com
409
+ * // - Login into gcloud by running:
410
+ * // ```sh
411
+ * // $ gcloud auth application-default login
412
+ * // ```
413
+ * // - Install the npm module by running:
414
+ * // ```sh
415
+ * // $ npm install googleapis
416
+ * // ```
417
+ *
418
+ * const {google} = require('googleapis');
419
+ * const translate = google.translate('v2');
420
+ *
421
+ * async function main() {
422
+ * const auth = new google.auth.GoogleAuth({
423
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
424
+ * scopes: [
425
+ * 'https://www.googleapis.com/auth/cloud-translation',
426
+ * 'https://www.googleapis.com/auth/cloud-platform',
427
+ * ],
428
+ * });
429
+ *
430
+ * // Acquire an auth client, and bind it to all future calls
431
+ * const authClient = await auth.getClient();
432
+ * google.options({auth: authClient});
433
+ *
434
+ * // Do the magic
435
+ * const res = await language.detections.list({
436
+ * // The input text upon which to perform language detection. Repeat this
437
+ * // parameter to perform language detection on multiple text inputs.
438
+ * q: 'placeholder-value',
439
+ * });
440
+ * console.log(res.data);
441
+ *
442
+ * // Example response
443
+ * // {
444
+ * // "detections": []
445
+ * // }
446
+ * }
447
+ *
448
+ * main().catch(e => {
449
+ * console.error(e);
450
+ * throw e;
451
+ * });
452
+ *
453
+ * ```
350
454
*
351
455
* @param params - Parameters for request
352
456
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -461,6 +565,58 @@ export namespace translate_v2 {
461
565
462
566
/**
463
567
* Returns a list of supported languages for translation.
568
+ * @example
569
+ * ```js
570
+ * // Before running the sample:
571
+ * // - Enable the API at:
572
+ * // https://console.developers.google.com/apis/api/translate.googleapis.com
573
+ * // - Login into gcloud by running:
574
+ * // ```sh
575
+ * // $ gcloud auth application-default login
576
+ * // ```
577
+ * // - Install the npm module by running:
578
+ * // ```sh
579
+ * // $ npm install googleapis
580
+ * // ```
581
+ *
582
+ * const {google} = require('googleapis');
583
+ * const translate = google.translate('v2');
584
+ *
585
+ * async function main() {
586
+ * const auth = new google.auth.GoogleAuth({
587
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
588
+ * scopes: [
589
+ * 'https://www.googleapis.com/auth/cloud-translation',
590
+ * 'https://www.googleapis.com/auth/cloud-platform',
591
+ * ],
592
+ * });
593
+ *
594
+ * // Acquire an auth client, and bind it to all future calls
595
+ * const authClient = await auth.getClient();
596
+ * google.options({auth: authClient});
597
+ *
598
+ * // Do the magic
599
+ * const res = await language.languages.list({
600
+ * // The model type for which supported languages should be returned.
601
+ * model: 'placeholder-value',
602
+ * // The language to use to return localized, human readable names of supported
603
+ * // languages.
604
+ * target: 'placeholder-value',
605
+ * });
606
+ * console.log(res.data);
607
+ *
608
+ * // Example response
609
+ * // {
610
+ * // "languages": []
611
+ * // }
612
+ * }
613
+ *
614
+ * main().catch(e => {
615
+ * console.error(e);
616
+ * throw e;
617
+ * });
618
+ *
619
+ * ```
464
620
*
465
621
* @param params - Parameters for request
466
622
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -572,6 +728,72 @@ export namespace translate_v2 {
572
728
573
729
/**
574
730
* Translates input text, returning translated text.
731
+ * @example
732
+ * ```js
733
+ * // Before running the sample:
734
+ * // - Enable the API at:
735
+ * // https://console.developers.google.com/apis/api/translate.googleapis.com
736
+ * // - Login into gcloud by running:
737
+ * // ```sh
738
+ * // $ gcloud auth application-default login
739
+ * // ```
740
+ * // - Install the npm module by running:
741
+ * // ```sh
742
+ * // $ npm install googleapis
743
+ * // ```
744
+ *
745
+ * const {google} = require('googleapis');
746
+ * const translate = google.translate('v2');
747
+ *
748
+ * async function main() {
749
+ * const auth = new google.auth.GoogleAuth({
750
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
751
+ * scopes: [
752
+ * 'https://www.googleapis.com/auth/cloud-translation',
753
+ * 'https://www.googleapis.com/auth/cloud-platform',
754
+ * ],
755
+ * });
756
+ *
757
+ * // Acquire an auth client, and bind it to all future calls
758
+ * const authClient = await auth.getClient();
759
+ * google.options({auth: authClient});
760
+ *
761
+ * // Do the magic
762
+ * const res = await language.translations.list({
763
+ * // The customization id for translate
764
+ * cid: 'placeholder-value',
765
+ * // The format of the source text, in either HTML (default) or plain-text. A
766
+ * // value of "html" indicates HTML and a value of "text" indicates plain-text.
767
+ * format: 'placeholder-value',
768
+ * // The `model` type requested for this translation. Valid values are
769
+ * // listed in public documentation.
770
+ * model: 'placeholder-value',
771
+ * // The input text to translate. Repeat this parameter to perform translation
772
+ * // operations on multiple text inputs.
773
+ * q: 'placeholder-value',
774
+ * // The language of the source text, set to one of the language codes listed in
775
+ * // Language Support. If the source language is not specified, the API will
776
+ * // attempt to identify the source language automatically and return it within
777
+ * // the response.
778
+ * source: 'placeholder-value',
779
+ * // The language to use for translation of the input text, set to one of the
780
+ * // language codes listed in Language Support.
781
+ * target: 'placeholder-value',
782
+ * });
783
+ * console.log(res.data);
784
+ *
785
+ * // Example response
786
+ * // {
787
+ * // "translations": []
788
+ * // }
789
+ * }
790
+ *
791
+ * main().catch(e => {
792
+ * console.error(e);
793
+ * throw e;
794
+ * });
795
+ *
796
+ * ```
575
797
*
576
798
* @param params - Parameters for request
577
799
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -665,6 +887,64 @@ export namespace translate_v2 {
665
887
666
888
/**
667
889
* Translates input text, returning translated text.
890
+ * @example
891
+ * ```js
892
+ * // Before running the sample:
893
+ * // - Enable the API at:
894
+ * // https://console.developers.google.com/apis/api/translate.googleapis.com
895
+ * // - Login into gcloud by running:
896
+ * // ```sh
897
+ * // $ gcloud auth application-default login
898
+ * // ```
899
+ * // - Install the npm module by running:
900
+ * // ```sh
901
+ * // $ npm install googleapis
902
+ * // ```
903
+ *
904
+ * const {google} = require('googleapis');
905
+ * const translate = google.translate('v2');
906
+ *
907
+ * async function main() {
908
+ * const auth = new google.auth.GoogleAuth({
909
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
910
+ * scopes: [
911
+ * 'https://www.googleapis.com/auth/cloud-translation',
912
+ * 'https://www.googleapis.com/auth/cloud-platform',
913
+ * ],
914
+ * });
915
+ *
916
+ * // Acquire an auth client, and bind it to all future calls
917
+ * const authClient = await auth.getClient();
918
+ * google.options({auth: authClient});
919
+ *
920
+ * // Do the magic
921
+ * const res = await language.translations.translate({
922
+ * // Request body metadata
923
+ * requestBody: {
924
+ * // request body parameters
925
+ * // {
926
+ * // "format": "my_format",
927
+ * // "model": "my_model",
928
+ * // "q": [],
929
+ * // "source": "my_source",
930
+ * // "target": "my_target"
931
+ * // }
932
+ * },
933
+ * });
934
+ * console.log(res.data);
935
+ *
936
+ * // Example response
937
+ * // {
938
+ * // "translations": []
939
+ * // }
940
+ * }
941
+ *
942
+ * main().catch(e => {
943
+ * console.error(e);
944
+ * throw e;
945
+ * });
946
+ *
947
+ * ```
668
948
*
669
949
* @param params - Parameters for request
670
950
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
0 commit comments