@googleapis/translate 4.0.1 → 6.0.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 +55 -0
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/v2.d.ts +280 -1
- package/build/v2.js +8 -1
- package/build/v2.js.map +1 -1
- package/build/v3.d.ts +2923 -1
- package/build/v3.js +26 -1
- package/build/v3.js.map +1 -1
- package/build/v3beta1.d.ts +1173 -1
- package/build/v3beta1.js +10 -1
- package/build/v3beta1.js.map +1 -1
- package/package.json +4 -4
- package/v2.ts +280 -0
- package/v3.ts +2923 -0
- package/v3beta1.ts +1173 -0
package/build/v3beta1.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { OAuth2Client, JWT, Compute, UserRefreshClient, BaseExternalAccountClient, GaxiosResponseWithHTTP2, GoogleConfigurable, MethodOptions, StreamMethodOptions, GlobalOptions, GoogleAuth, BodyResponseCallback, APIRequestContext } from 'googleapis-common';
|
|
3
2
|
import { Readable } from 'stream';
|
|
4
3
|
export declare namespace translate_v3beta1 {
|
|
@@ -701,6 +700,66 @@ export declare namespace translate_v3beta1 {
|
|
|
701
700
|
constructor(context: APIRequestContext);
|
|
702
701
|
/**
|
|
703
702
|
* Detects the language of text within a request.
|
|
703
|
+
* @example
|
|
704
|
+
* ```js
|
|
705
|
+
* // Before running the sample:
|
|
706
|
+
* // - Enable the API at:
|
|
707
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
708
|
+
* // - Login into gcloud by running:
|
|
709
|
+
* // ```sh
|
|
710
|
+
* // $ gcloud auth application-default login
|
|
711
|
+
* // ```
|
|
712
|
+
* // - Install the npm module by running:
|
|
713
|
+
* // ```sh
|
|
714
|
+
* // $ npm install googleapis
|
|
715
|
+
* // ```
|
|
716
|
+
*
|
|
717
|
+
* const {google} = require('googleapis');
|
|
718
|
+
* const translate = google.translate('v3beta1');
|
|
719
|
+
*
|
|
720
|
+
* async function main() {
|
|
721
|
+
* const auth = new google.auth.GoogleAuth({
|
|
722
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
723
|
+
* scopes: [
|
|
724
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
725
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
726
|
+
* ],
|
|
727
|
+
* });
|
|
728
|
+
*
|
|
729
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
730
|
+
* const authClient = await auth.getClient();
|
|
731
|
+
* google.options({auth: authClient});
|
|
732
|
+
*
|
|
733
|
+
* // Do the magic
|
|
734
|
+
* const res = await translate.projects.detectLanguage({
|
|
735
|
+
* // Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id\}/locations/{location-id\}` or `projects/{project-number-or-id\}`. For global calls, use `projects/{project-number-or-id\}/locations/global` or `projects/{project-number-or-id\}`. Only models within the same region (has same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
736
|
+
* parent: 'projects/my-project',
|
|
737
|
+
*
|
|
738
|
+
* // Request body metadata
|
|
739
|
+
* requestBody: {
|
|
740
|
+
* // request body parameters
|
|
741
|
+
* // {
|
|
742
|
+
* // "content": "my_content",
|
|
743
|
+
* // "labels": {},
|
|
744
|
+
* // "mimeType": "my_mimeType",
|
|
745
|
+
* // "model": "my_model"
|
|
746
|
+
* // }
|
|
747
|
+
* },
|
|
748
|
+
* });
|
|
749
|
+
* console.log(res.data);
|
|
750
|
+
*
|
|
751
|
+
* // Example response
|
|
752
|
+
* // {
|
|
753
|
+
* // "languages": []
|
|
754
|
+
* // }
|
|
755
|
+
* }
|
|
756
|
+
*
|
|
757
|
+
* main().catch(e => {
|
|
758
|
+
* console.error(e);
|
|
759
|
+
* throw e;
|
|
760
|
+
* });
|
|
761
|
+
*
|
|
762
|
+
* ```
|
|
704
763
|
*
|
|
705
764
|
* @param params - Parameters for request
|
|
706
765
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -715,6 +774,59 @@ export declare namespace translate_v3beta1 {
|
|
|
715
774
|
detectLanguage(callback: BodyResponseCallback<Schema$DetectLanguageResponse>): void;
|
|
716
775
|
/**
|
|
717
776
|
* Returns a list of supported languages for translation.
|
|
777
|
+
* @example
|
|
778
|
+
* ```js
|
|
779
|
+
* // Before running the sample:
|
|
780
|
+
* // - Enable the API at:
|
|
781
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
782
|
+
* // - Login into gcloud by running:
|
|
783
|
+
* // ```sh
|
|
784
|
+
* // $ gcloud auth application-default login
|
|
785
|
+
* // ```
|
|
786
|
+
* // - Install the npm module by running:
|
|
787
|
+
* // ```sh
|
|
788
|
+
* // $ npm install googleapis
|
|
789
|
+
* // ```
|
|
790
|
+
*
|
|
791
|
+
* const {google} = require('googleapis');
|
|
792
|
+
* const translate = google.translate('v3beta1');
|
|
793
|
+
*
|
|
794
|
+
* async function main() {
|
|
795
|
+
* const auth = new google.auth.GoogleAuth({
|
|
796
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
797
|
+
* scopes: [
|
|
798
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
799
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
800
|
+
* ],
|
|
801
|
+
* });
|
|
802
|
+
*
|
|
803
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
804
|
+
* const authClient = await auth.getClient();
|
|
805
|
+
* google.options({auth: authClient});
|
|
806
|
+
*
|
|
807
|
+
* // Do the magic
|
|
808
|
+
* const res = await translate.projects.getSupportedLanguages({
|
|
809
|
+
* // Optional. The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response.
|
|
810
|
+
* displayLanguageCode: 'placeholder-value',
|
|
811
|
+
* // Optional. Get supported languages of this model. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id\}/locations/{location-id\}/models/{model-id\}` - General (built-in) models: `projects/{project-number-or-id\}/locations/{location-id\}/models/general/nmt`, Returns languages supported by the specified model. If missing, we get supported languages of Google general NMT model.
|
|
812
|
+
* model: 'placeholder-value',
|
|
813
|
+
* // Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id\}` or `projects/{project-number-or-id\}/locations/{location-id\}`. For global calls, use `projects/{project-number-or-id\}/locations/global` or `projects/{project-number-or-id\}`. Non-global location is required for AutoML models. Only models within the same region (have same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
814
|
+
* parent: 'projects/my-project',
|
|
815
|
+
* });
|
|
816
|
+
* console.log(res.data);
|
|
817
|
+
*
|
|
818
|
+
* // Example response
|
|
819
|
+
* // {
|
|
820
|
+
* // "languages": []
|
|
821
|
+
* // }
|
|
822
|
+
* }
|
|
823
|
+
*
|
|
824
|
+
* main().catch(e => {
|
|
825
|
+
* console.error(e);
|
|
826
|
+
* throw e;
|
|
827
|
+
* });
|
|
828
|
+
*
|
|
829
|
+
* ```
|
|
718
830
|
*
|
|
719
831
|
* @param params - Parameters for request
|
|
720
832
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -729,6 +841,70 @@ export declare namespace translate_v3beta1 {
|
|
|
729
841
|
getSupportedLanguages(callback: BodyResponseCallback<Schema$SupportedLanguages>): void;
|
|
730
842
|
/**
|
|
731
843
|
* Translates input text and returns translated text.
|
|
844
|
+
* @example
|
|
845
|
+
* ```js
|
|
846
|
+
* // Before running the sample:
|
|
847
|
+
* // - Enable the API at:
|
|
848
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
849
|
+
* // - Login into gcloud by running:
|
|
850
|
+
* // ```sh
|
|
851
|
+
* // $ gcloud auth application-default login
|
|
852
|
+
* // ```
|
|
853
|
+
* // - Install the npm module by running:
|
|
854
|
+
* // ```sh
|
|
855
|
+
* // $ npm install googleapis
|
|
856
|
+
* // ```
|
|
857
|
+
*
|
|
858
|
+
* const {google} = require('googleapis');
|
|
859
|
+
* const translate = google.translate('v3beta1');
|
|
860
|
+
*
|
|
861
|
+
* async function main() {
|
|
862
|
+
* const auth = new google.auth.GoogleAuth({
|
|
863
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
864
|
+
* scopes: [
|
|
865
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
866
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
867
|
+
* ],
|
|
868
|
+
* });
|
|
869
|
+
*
|
|
870
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
871
|
+
* const authClient = await auth.getClient();
|
|
872
|
+
* google.options({auth: authClient});
|
|
873
|
+
*
|
|
874
|
+
* // Do the magic
|
|
875
|
+
* const res = await translate.projects.translateText({
|
|
876
|
+
* // Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id\}` or `projects/{project-number-or-id\}/locations/{location-id\}`. For global calls, use `projects/{project-number-or-id\}/locations/global` or `projects/{project-number-or-id\}`. Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
877
|
+
* parent: 'projects/my-project',
|
|
878
|
+
*
|
|
879
|
+
* // Request body metadata
|
|
880
|
+
* requestBody: {
|
|
881
|
+
* // request body parameters
|
|
882
|
+
* // {
|
|
883
|
+
* // "contents": [],
|
|
884
|
+
* // "glossaryConfig": {},
|
|
885
|
+
* // "labels": {},
|
|
886
|
+
* // "mimeType": "my_mimeType",
|
|
887
|
+
* // "model": "my_model",
|
|
888
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
889
|
+
* // "targetLanguageCode": "my_targetLanguageCode"
|
|
890
|
+
* // }
|
|
891
|
+
* },
|
|
892
|
+
* });
|
|
893
|
+
* console.log(res.data);
|
|
894
|
+
*
|
|
895
|
+
* // Example response
|
|
896
|
+
* // {
|
|
897
|
+
* // "glossaryTranslations": [],
|
|
898
|
+
* // "translations": []
|
|
899
|
+
* // }
|
|
900
|
+
* }
|
|
901
|
+
*
|
|
902
|
+
* main().catch(e => {
|
|
903
|
+
* console.error(e);
|
|
904
|
+
* throw e;
|
|
905
|
+
* });
|
|
906
|
+
*
|
|
907
|
+
* ```
|
|
732
908
|
*
|
|
733
909
|
* @param params - Parameters for request
|
|
734
910
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -783,6 +959,76 @@ export declare namespace translate_v3beta1 {
|
|
|
783
959
|
constructor(context: APIRequestContext);
|
|
784
960
|
/**
|
|
785
961
|
* Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
|
|
962
|
+
* @example
|
|
963
|
+
* ```js
|
|
964
|
+
* // Before running the sample:
|
|
965
|
+
* // - Enable the API at:
|
|
966
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
967
|
+
* // - Login into gcloud by running:
|
|
968
|
+
* // ```sh
|
|
969
|
+
* // $ gcloud auth application-default login
|
|
970
|
+
* // ```
|
|
971
|
+
* // - Install the npm module by running:
|
|
972
|
+
* // ```sh
|
|
973
|
+
* // $ npm install googleapis
|
|
974
|
+
* // ```
|
|
975
|
+
*
|
|
976
|
+
* const {google} = require('googleapis');
|
|
977
|
+
* const translate = google.translate('v3beta1');
|
|
978
|
+
*
|
|
979
|
+
* async function main() {
|
|
980
|
+
* const auth = new google.auth.GoogleAuth({
|
|
981
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
982
|
+
* scopes: [
|
|
983
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
984
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
985
|
+
* ],
|
|
986
|
+
* });
|
|
987
|
+
*
|
|
988
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
989
|
+
* const authClient = await auth.getClient();
|
|
990
|
+
* google.options({auth: authClient});
|
|
991
|
+
*
|
|
992
|
+
* // Do the magic
|
|
993
|
+
* const res = await translate.projects.locations.batchTranslateDocument({
|
|
994
|
+
* // Required. Location to make a regional call. Format: `projects/{project-number-or-id\}/locations/{location-id\}`. The `global` location is not supported for batch translation. Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
995
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
996
|
+
*
|
|
997
|
+
* // Request body metadata
|
|
998
|
+
* requestBody: {
|
|
999
|
+
* // request body parameters
|
|
1000
|
+
* // {
|
|
1001
|
+
* // "customizedAttribution": "my_customizedAttribution",
|
|
1002
|
+
* // "enableRotationCorrection": false,
|
|
1003
|
+
* // "enableShadowRemovalNativePdf": false,
|
|
1004
|
+
* // "formatConversions": {},
|
|
1005
|
+
* // "glossaries": {},
|
|
1006
|
+
* // "inputConfigs": [],
|
|
1007
|
+
* // "models": {},
|
|
1008
|
+
* // "outputConfig": {},
|
|
1009
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1010
|
+
* // "targetLanguageCodes": []
|
|
1011
|
+
* // }
|
|
1012
|
+
* },
|
|
1013
|
+
* });
|
|
1014
|
+
* console.log(res.data);
|
|
1015
|
+
*
|
|
1016
|
+
* // Example response
|
|
1017
|
+
* // {
|
|
1018
|
+
* // "done": false,
|
|
1019
|
+
* // "error": {},
|
|
1020
|
+
* // "metadata": {},
|
|
1021
|
+
* // "name": "my_name",
|
|
1022
|
+
* // "response": {}
|
|
1023
|
+
* // }
|
|
1024
|
+
* }
|
|
1025
|
+
*
|
|
1026
|
+
* main().catch(e => {
|
|
1027
|
+
* console.error(e);
|
|
1028
|
+
* throw e;
|
|
1029
|
+
* });
|
|
1030
|
+
*
|
|
1031
|
+
* ```
|
|
786
1032
|
*
|
|
787
1033
|
* @param params - Parameters for request
|
|
788
1034
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -797,6 +1043,73 @@ export declare namespace translate_v3beta1 {
|
|
|
797
1043
|
batchTranslateDocument(callback: BodyResponseCallback<Schema$Operation>): void;
|
|
798
1044
|
/**
|
|
799
1045
|
* Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
|
|
1046
|
+
* @example
|
|
1047
|
+
* ```js
|
|
1048
|
+
* // Before running the sample:
|
|
1049
|
+
* // - Enable the API at:
|
|
1050
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1051
|
+
* // - Login into gcloud by running:
|
|
1052
|
+
* // ```sh
|
|
1053
|
+
* // $ gcloud auth application-default login
|
|
1054
|
+
* // ```
|
|
1055
|
+
* // - Install the npm module by running:
|
|
1056
|
+
* // ```sh
|
|
1057
|
+
* // $ npm install googleapis
|
|
1058
|
+
* // ```
|
|
1059
|
+
*
|
|
1060
|
+
* const {google} = require('googleapis');
|
|
1061
|
+
* const translate = google.translate('v3beta1');
|
|
1062
|
+
*
|
|
1063
|
+
* async function main() {
|
|
1064
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1065
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1066
|
+
* scopes: [
|
|
1067
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1068
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1069
|
+
* ],
|
|
1070
|
+
* });
|
|
1071
|
+
*
|
|
1072
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1073
|
+
* const authClient = await auth.getClient();
|
|
1074
|
+
* google.options({auth: authClient});
|
|
1075
|
+
*
|
|
1076
|
+
* // Do the magic
|
|
1077
|
+
* const res = await translate.projects.locations.batchTranslateText({
|
|
1078
|
+
* // Required. Location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id\}/locations/{location-id\}`. The `global` location is not supported for batch translation. Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
1079
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1080
|
+
*
|
|
1081
|
+
* // Request body metadata
|
|
1082
|
+
* requestBody: {
|
|
1083
|
+
* // request body parameters
|
|
1084
|
+
* // {
|
|
1085
|
+
* // "glossaries": {},
|
|
1086
|
+
* // "inputConfigs": [],
|
|
1087
|
+
* // "labels": {},
|
|
1088
|
+
* // "models": {},
|
|
1089
|
+
* // "outputConfig": {},
|
|
1090
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1091
|
+
* // "targetLanguageCodes": []
|
|
1092
|
+
* // }
|
|
1093
|
+
* },
|
|
1094
|
+
* });
|
|
1095
|
+
* console.log(res.data);
|
|
1096
|
+
*
|
|
1097
|
+
* // Example response
|
|
1098
|
+
* // {
|
|
1099
|
+
* // "done": false,
|
|
1100
|
+
* // "error": {},
|
|
1101
|
+
* // "metadata": {},
|
|
1102
|
+
* // "name": "my_name",
|
|
1103
|
+
* // "response": {}
|
|
1104
|
+
* // }
|
|
1105
|
+
* }
|
|
1106
|
+
*
|
|
1107
|
+
* main().catch(e => {
|
|
1108
|
+
* console.error(e);
|
|
1109
|
+
* throw e;
|
|
1110
|
+
* });
|
|
1111
|
+
*
|
|
1112
|
+
* ```
|
|
800
1113
|
*
|
|
801
1114
|
* @param params - Parameters for request
|
|
802
1115
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -811,6 +1124,66 @@ export declare namespace translate_v3beta1 {
|
|
|
811
1124
|
batchTranslateText(callback: BodyResponseCallback<Schema$Operation>): void;
|
|
812
1125
|
/**
|
|
813
1126
|
* Detects the language of text within a request.
|
|
1127
|
+
* @example
|
|
1128
|
+
* ```js
|
|
1129
|
+
* // Before running the sample:
|
|
1130
|
+
* // - Enable the API at:
|
|
1131
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1132
|
+
* // - Login into gcloud by running:
|
|
1133
|
+
* // ```sh
|
|
1134
|
+
* // $ gcloud auth application-default login
|
|
1135
|
+
* // ```
|
|
1136
|
+
* // - Install the npm module by running:
|
|
1137
|
+
* // ```sh
|
|
1138
|
+
* // $ npm install googleapis
|
|
1139
|
+
* // ```
|
|
1140
|
+
*
|
|
1141
|
+
* const {google} = require('googleapis');
|
|
1142
|
+
* const translate = google.translate('v3beta1');
|
|
1143
|
+
*
|
|
1144
|
+
* async function main() {
|
|
1145
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1146
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1147
|
+
* scopes: [
|
|
1148
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1149
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1150
|
+
* ],
|
|
1151
|
+
* });
|
|
1152
|
+
*
|
|
1153
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1154
|
+
* const authClient = await auth.getClient();
|
|
1155
|
+
* google.options({auth: authClient});
|
|
1156
|
+
*
|
|
1157
|
+
* // Do the magic
|
|
1158
|
+
* const res = await translate.projects.locations.detectLanguage({
|
|
1159
|
+
* // Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id\}/locations/{location-id\}` or `projects/{project-number-or-id\}`. For global calls, use `projects/{project-number-or-id\}/locations/global` or `projects/{project-number-or-id\}`. Only models within the same region (has same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
1160
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1161
|
+
*
|
|
1162
|
+
* // Request body metadata
|
|
1163
|
+
* requestBody: {
|
|
1164
|
+
* // request body parameters
|
|
1165
|
+
* // {
|
|
1166
|
+
* // "content": "my_content",
|
|
1167
|
+
* // "labels": {},
|
|
1168
|
+
* // "mimeType": "my_mimeType",
|
|
1169
|
+
* // "model": "my_model"
|
|
1170
|
+
* // }
|
|
1171
|
+
* },
|
|
1172
|
+
* });
|
|
1173
|
+
* console.log(res.data);
|
|
1174
|
+
*
|
|
1175
|
+
* // Example response
|
|
1176
|
+
* // {
|
|
1177
|
+
* // "languages": []
|
|
1178
|
+
* // }
|
|
1179
|
+
* }
|
|
1180
|
+
*
|
|
1181
|
+
* main().catch(e => {
|
|
1182
|
+
* console.error(e);
|
|
1183
|
+
* throw e;
|
|
1184
|
+
* });
|
|
1185
|
+
*
|
|
1186
|
+
* ```
|
|
814
1187
|
*
|
|
815
1188
|
* @param params - Parameters for request
|
|
816
1189
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -825,6 +1198,59 @@ export declare namespace translate_v3beta1 {
|
|
|
825
1198
|
detectLanguage(callback: BodyResponseCallback<Schema$DetectLanguageResponse>): void;
|
|
826
1199
|
/**
|
|
827
1200
|
* Gets information about a location.
|
|
1201
|
+
* @example
|
|
1202
|
+
* ```js
|
|
1203
|
+
* // Before running the sample:
|
|
1204
|
+
* // - Enable the API at:
|
|
1205
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1206
|
+
* // - Login into gcloud by running:
|
|
1207
|
+
* // ```sh
|
|
1208
|
+
* // $ gcloud auth application-default login
|
|
1209
|
+
* // ```
|
|
1210
|
+
* // - Install the npm module by running:
|
|
1211
|
+
* // ```sh
|
|
1212
|
+
* // $ npm install googleapis
|
|
1213
|
+
* // ```
|
|
1214
|
+
*
|
|
1215
|
+
* const {google} = require('googleapis');
|
|
1216
|
+
* const translate = google.translate('v3beta1');
|
|
1217
|
+
*
|
|
1218
|
+
* async function main() {
|
|
1219
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1220
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1221
|
+
* scopes: [
|
|
1222
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1223
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1224
|
+
* ],
|
|
1225
|
+
* });
|
|
1226
|
+
*
|
|
1227
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1228
|
+
* const authClient = await auth.getClient();
|
|
1229
|
+
* google.options({auth: authClient});
|
|
1230
|
+
*
|
|
1231
|
+
* // Do the magic
|
|
1232
|
+
* const res = await translate.projects.locations.get({
|
|
1233
|
+
* // Resource name for the location.
|
|
1234
|
+
* name: 'projects/my-project/locations/my-location',
|
|
1235
|
+
* });
|
|
1236
|
+
* console.log(res.data);
|
|
1237
|
+
*
|
|
1238
|
+
* // Example response
|
|
1239
|
+
* // {
|
|
1240
|
+
* // "displayName": "my_displayName",
|
|
1241
|
+
* // "labels": {},
|
|
1242
|
+
* // "locationId": "my_locationId",
|
|
1243
|
+
* // "metadata": {},
|
|
1244
|
+
* // "name": "my_name"
|
|
1245
|
+
* // }
|
|
1246
|
+
* }
|
|
1247
|
+
*
|
|
1248
|
+
* main().catch(e => {
|
|
1249
|
+
* console.error(e);
|
|
1250
|
+
* throw e;
|
|
1251
|
+
* });
|
|
1252
|
+
*
|
|
1253
|
+
* ```
|
|
828
1254
|
*
|
|
829
1255
|
* @param params - Parameters for request
|
|
830
1256
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -839,6 +1265,59 @@ export declare namespace translate_v3beta1 {
|
|
|
839
1265
|
get(callback: BodyResponseCallback<Schema$Location>): void;
|
|
840
1266
|
/**
|
|
841
1267
|
* Returns a list of supported languages for translation.
|
|
1268
|
+
* @example
|
|
1269
|
+
* ```js
|
|
1270
|
+
* // Before running the sample:
|
|
1271
|
+
* // - Enable the API at:
|
|
1272
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1273
|
+
* // - Login into gcloud by running:
|
|
1274
|
+
* // ```sh
|
|
1275
|
+
* // $ gcloud auth application-default login
|
|
1276
|
+
* // ```
|
|
1277
|
+
* // - Install the npm module by running:
|
|
1278
|
+
* // ```sh
|
|
1279
|
+
* // $ npm install googleapis
|
|
1280
|
+
* // ```
|
|
1281
|
+
*
|
|
1282
|
+
* const {google} = require('googleapis');
|
|
1283
|
+
* const translate = google.translate('v3beta1');
|
|
1284
|
+
*
|
|
1285
|
+
* async function main() {
|
|
1286
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1287
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1288
|
+
* scopes: [
|
|
1289
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1290
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1291
|
+
* ],
|
|
1292
|
+
* });
|
|
1293
|
+
*
|
|
1294
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1295
|
+
* const authClient = await auth.getClient();
|
|
1296
|
+
* google.options({auth: authClient});
|
|
1297
|
+
*
|
|
1298
|
+
* // Do the magic
|
|
1299
|
+
* const res = await translate.projects.locations.getSupportedLanguages({
|
|
1300
|
+
* // Optional. The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response.
|
|
1301
|
+
* displayLanguageCode: 'placeholder-value',
|
|
1302
|
+
* // Optional. Get supported languages of this model. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id\}/locations/{location-id\}/models/{model-id\}` - General (built-in) models: `projects/{project-number-or-id\}/locations/{location-id\}/models/general/nmt`, Returns languages supported by the specified model. If missing, we get supported languages of Google general NMT model.
|
|
1303
|
+
* model: 'placeholder-value',
|
|
1304
|
+
* // Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id\}` or `projects/{project-number-or-id\}/locations/{location-id\}`. For global calls, use `projects/{project-number-or-id\}/locations/global` or `projects/{project-number-or-id\}`. Non-global location is required for AutoML models. Only models within the same region (have same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
1305
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1306
|
+
* });
|
|
1307
|
+
* console.log(res.data);
|
|
1308
|
+
*
|
|
1309
|
+
* // Example response
|
|
1310
|
+
* // {
|
|
1311
|
+
* // "languages": []
|
|
1312
|
+
* // }
|
|
1313
|
+
* }
|
|
1314
|
+
*
|
|
1315
|
+
* main().catch(e => {
|
|
1316
|
+
* console.error(e);
|
|
1317
|
+
* throw e;
|
|
1318
|
+
* });
|
|
1319
|
+
*
|
|
1320
|
+
* ```
|
|
842
1321
|
*
|
|
843
1322
|
* @param params - Parameters for request
|
|
844
1323
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -853,6 +1332,64 @@ export declare namespace translate_v3beta1 {
|
|
|
853
1332
|
getSupportedLanguages(callback: BodyResponseCallback<Schema$SupportedLanguages>): void;
|
|
854
1333
|
/**
|
|
855
1334
|
* Lists information about the supported locations for this service.
|
|
1335
|
+
* @example
|
|
1336
|
+
* ```js
|
|
1337
|
+
* // Before running the sample:
|
|
1338
|
+
* // - Enable the API at:
|
|
1339
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1340
|
+
* // - Login into gcloud by running:
|
|
1341
|
+
* // ```sh
|
|
1342
|
+
* // $ gcloud auth application-default login
|
|
1343
|
+
* // ```
|
|
1344
|
+
* // - Install the npm module by running:
|
|
1345
|
+
* // ```sh
|
|
1346
|
+
* // $ npm install googleapis
|
|
1347
|
+
* // ```
|
|
1348
|
+
*
|
|
1349
|
+
* const {google} = require('googleapis');
|
|
1350
|
+
* const translate = google.translate('v3beta1');
|
|
1351
|
+
*
|
|
1352
|
+
* async function main() {
|
|
1353
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1354
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1355
|
+
* scopes: [
|
|
1356
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1357
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1358
|
+
* ],
|
|
1359
|
+
* });
|
|
1360
|
+
*
|
|
1361
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1362
|
+
* const authClient = await auth.getClient();
|
|
1363
|
+
* google.options({auth: authClient});
|
|
1364
|
+
*
|
|
1365
|
+
* // Do the magic
|
|
1366
|
+
* const res = await translate.projects.locations.list({
|
|
1367
|
+
* // Optional. A list of extra location types that should be used as conditions for controlling the visibility of the locations.
|
|
1368
|
+
* extraLocationTypes: 'placeholder-value',
|
|
1369
|
+
* // A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
|
|
1370
|
+
* filter: 'placeholder-value',
|
|
1371
|
+
* // The resource that owns the locations collection, if applicable.
|
|
1372
|
+
* name: 'projects/my-project',
|
|
1373
|
+
* // The maximum number of results to return. If not set, the service selects a default.
|
|
1374
|
+
* pageSize: 'placeholder-value',
|
|
1375
|
+
* // A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
|
|
1376
|
+
* pageToken: 'placeholder-value',
|
|
1377
|
+
* });
|
|
1378
|
+
* console.log(res.data);
|
|
1379
|
+
*
|
|
1380
|
+
* // Example response
|
|
1381
|
+
* // {
|
|
1382
|
+
* // "locations": [],
|
|
1383
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
1384
|
+
* // }
|
|
1385
|
+
* }
|
|
1386
|
+
*
|
|
1387
|
+
* main().catch(e => {
|
|
1388
|
+
* console.error(e);
|
|
1389
|
+
* throw e;
|
|
1390
|
+
* });
|
|
1391
|
+
*
|
|
1392
|
+
* ```
|
|
856
1393
|
*
|
|
857
1394
|
* @param params - Parameters for request
|
|
858
1395
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -867,6 +1404,76 @@ export declare namespace translate_v3beta1 {
|
|
|
867
1404
|
list(callback: BodyResponseCallback<Schema$ListLocationsResponse>): void;
|
|
868
1405
|
/**
|
|
869
1406
|
* Translates documents in synchronous mode.
|
|
1407
|
+
* @example
|
|
1408
|
+
* ```js
|
|
1409
|
+
* // Before running the sample:
|
|
1410
|
+
* // - Enable the API at:
|
|
1411
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1412
|
+
* // - Login into gcloud by running:
|
|
1413
|
+
* // ```sh
|
|
1414
|
+
* // $ gcloud auth application-default login
|
|
1415
|
+
* // ```
|
|
1416
|
+
* // - Install the npm module by running:
|
|
1417
|
+
* // ```sh
|
|
1418
|
+
* // $ npm install googleapis
|
|
1419
|
+
* // ```
|
|
1420
|
+
*
|
|
1421
|
+
* const {google} = require('googleapis');
|
|
1422
|
+
* const translate = google.translate('v3beta1');
|
|
1423
|
+
*
|
|
1424
|
+
* async function main() {
|
|
1425
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1426
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1427
|
+
* scopes: [
|
|
1428
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1429
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1430
|
+
* ],
|
|
1431
|
+
* });
|
|
1432
|
+
*
|
|
1433
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1434
|
+
* const authClient = await auth.getClient();
|
|
1435
|
+
* google.options({auth: authClient});
|
|
1436
|
+
*
|
|
1437
|
+
* // Do the magic
|
|
1438
|
+
* const res = await translate.projects.locations.translateDocument({
|
|
1439
|
+
* // Required. Location to make a regional call. Format: `projects/{project-number-or-id\}/locations/{location-id\}`. For global calls, use `projects/{project-number-or-id\}/locations/global`. Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have the same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
1440
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1441
|
+
*
|
|
1442
|
+
* // Request body metadata
|
|
1443
|
+
* requestBody: {
|
|
1444
|
+
* // request body parameters
|
|
1445
|
+
* // {
|
|
1446
|
+
* // "customizedAttribution": "my_customizedAttribution",
|
|
1447
|
+
* // "documentInputConfig": {},
|
|
1448
|
+
* // "documentOutputConfig": {},
|
|
1449
|
+
* // "enableRotationCorrection": false,
|
|
1450
|
+
* // "enableShadowRemovalNativePdf": false,
|
|
1451
|
+
* // "glossaryConfig": {},
|
|
1452
|
+
* // "isTranslateNativePdfOnly": false,
|
|
1453
|
+
* // "labels": {},
|
|
1454
|
+
* // "model": "my_model",
|
|
1455
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1456
|
+
* // "targetLanguageCode": "my_targetLanguageCode"
|
|
1457
|
+
* // }
|
|
1458
|
+
* },
|
|
1459
|
+
* });
|
|
1460
|
+
* console.log(res.data);
|
|
1461
|
+
*
|
|
1462
|
+
* // Example response
|
|
1463
|
+
* // {
|
|
1464
|
+
* // "documentTranslation": {},
|
|
1465
|
+
* // "glossaryConfig": {},
|
|
1466
|
+
* // "glossaryDocumentTranslation": {},
|
|
1467
|
+
* // "model": "my_model"
|
|
1468
|
+
* // }
|
|
1469
|
+
* }
|
|
1470
|
+
*
|
|
1471
|
+
* main().catch(e => {
|
|
1472
|
+
* console.error(e);
|
|
1473
|
+
* throw e;
|
|
1474
|
+
* });
|
|
1475
|
+
*
|
|
1476
|
+
* ```
|
|
870
1477
|
*
|
|
871
1478
|
* @param params - Parameters for request
|
|
872
1479
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -881,6 +1488,70 @@ export declare namespace translate_v3beta1 {
|
|
|
881
1488
|
translateDocument(callback: BodyResponseCallback<Schema$TranslateDocumentResponse>): void;
|
|
882
1489
|
/**
|
|
883
1490
|
* Translates input text and returns translated text.
|
|
1491
|
+
* @example
|
|
1492
|
+
* ```js
|
|
1493
|
+
* // Before running the sample:
|
|
1494
|
+
* // - Enable the API at:
|
|
1495
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1496
|
+
* // - Login into gcloud by running:
|
|
1497
|
+
* // ```sh
|
|
1498
|
+
* // $ gcloud auth application-default login
|
|
1499
|
+
* // ```
|
|
1500
|
+
* // - Install the npm module by running:
|
|
1501
|
+
* // ```sh
|
|
1502
|
+
* // $ npm install googleapis
|
|
1503
|
+
* // ```
|
|
1504
|
+
*
|
|
1505
|
+
* const {google} = require('googleapis');
|
|
1506
|
+
* const translate = google.translate('v3beta1');
|
|
1507
|
+
*
|
|
1508
|
+
* async function main() {
|
|
1509
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1510
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1511
|
+
* scopes: [
|
|
1512
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1513
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1514
|
+
* ],
|
|
1515
|
+
* });
|
|
1516
|
+
*
|
|
1517
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1518
|
+
* const authClient = await auth.getClient();
|
|
1519
|
+
* google.options({auth: authClient});
|
|
1520
|
+
*
|
|
1521
|
+
* // Do the magic
|
|
1522
|
+
* const res = await translate.projects.locations.translateText({
|
|
1523
|
+
* // Required. Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id\}` or `projects/{project-number-or-id\}/locations/{location-id\}`. For global calls, use `projects/{project-number-or-id\}/locations/global` or `projects/{project-number-or-id\}`. Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
1524
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1525
|
+
*
|
|
1526
|
+
* // Request body metadata
|
|
1527
|
+
* requestBody: {
|
|
1528
|
+
* // request body parameters
|
|
1529
|
+
* // {
|
|
1530
|
+
* // "contents": [],
|
|
1531
|
+
* // "glossaryConfig": {},
|
|
1532
|
+
* // "labels": {},
|
|
1533
|
+
* // "mimeType": "my_mimeType",
|
|
1534
|
+
* // "model": "my_model",
|
|
1535
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1536
|
+
* // "targetLanguageCode": "my_targetLanguageCode"
|
|
1537
|
+
* // }
|
|
1538
|
+
* },
|
|
1539
|
+
* });
|
|
1540
|
+
* console.log(res.data);
|
|
1541
|
+
*
|
|
1542
|
+
* // Example response
|
|
1543
|
+
* // {
|
|
1544
|
+
* // "glossaryTranslations": [],
|
|
1545
|
+
* // "translations": []
|
|
1546
|
+
* // }
|
|
1547
|
+
* }
|
|
1548
|
+
*
|
|
1549
|
+
* main().catch(e => {
|
|
1550
|
+
* console.error(e);
|
|
1551
|
+
* throw e;
|
|
1552
|
+
* });
|
|
1553
|
+
*
|
|
1554
|
+
* ```
|
|
884
1555
|
*
|
|
885
1556
|
* @param params - Parameters for request
|
|
886
1557
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -991,6 +1662,73 @@ export declare namespace translate_v3beta1 {
|
|
|
991
1662
|
constructor(context: APIRequestContext);
|
|
992
1663
|
/**
|
|
993
1664
|
* Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
|
|
1665
|
+
* @example
|
|
1666
|
+
* ```js
|
|
1667
|
+
* // Before running the sample:
|
|
1668
|
+
* // - Enable the API at:
|
|
1669
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1670
|
+
* // - Login into gcloud by running:
|
|
1671
|
+
* // ```sh
|
|
1672
|
+
* // $ gcloud auth application-default login
|
|
1673
|
+
* // ```
|
|
1674
|
+
* // - Install the npm module by running:
|
|
1675
|
+
* // ```sh
|
|
1676
|
+
* // $ npm install googleapis
|
|
1677
|
+
* // ```
|
|
1678
|
+
*
|
|
1679
|
+
* const {google} = require('googleapis');
|
|
1680
|
+
* const translate = google.translate('v3beta1');
|
|
1681
|
+
*
|
|
1682
|
+
* async function main() {
|
|
1683
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1684
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1685
|
+
* scopes: [
|
|
1686
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1687
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1688
|
+
* ],
|
|
1689
|
+
* });
|
|
1690
|
+
*
|
|
1691
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1692
|
+
* const authClient = await auth.getClient();
|
|
1693
|
+
* google.options({auth: authClient});
|
|
1694
|
+
*
|
|
1695
|
+
* // Do the magic
|
|
1696
|
+
* const res = await translate.projects.locations.glossaries.create({
|
|
1697
|
+
* // Required. The project name.
|
|
1698
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1699
|
+
*
|
|
1700
|
+
* // Request body metadata
|
|
1701
|
+
* requestBody: {
|
|
1702
|
+
* // request body parameters
|
|
1703
|
+
* // {
|
|
1704
|
+
* // "endTime": "my_endTime",
|
|
1705
|
+
* // "entryCount": 0,
|
|
1706
|
+
* // "inputConfig": {},
|
|
1707
|
+
* // "languageCodesSet": {},
|
|
1708
|
+
* // "languagePair": {},
|
|
1709
|
+
* // "name": "my_name",
|
|
1710
|
+
* // "submitTime": "my_submitTime"
|
|
1711
|
+
* // }
|
|
1712
|
+
* },
|
|
1713
|
+
* });
|
|
1714
|
+
* console.log(res.data);
|
|
1715
|
+
*
|
|
1716
|
+
* // Example response
|
|
1717
|
+
* // {
|
|
1718
|
+
* // "done": false,
|
|
1719
|
+
* // "error": {},
|
|
1720
|
+
* // "metadata": {},
|
|
1721
|
+
* // "name": "my_name",
|
|
1722
|
+
* // "response": {}
|
|
1723
|
+
* // }
|
|
1724
|
+
* }
|
|
1725
|
+
*
|
|
1726
|
+
* main().catch(e => {
|
|
1727
|
+
* console.error(e);
|
|
1728
|
+
* throw e;
|
|
1729
|
+
* });
|
|
1730
|
+
*
|
|
1731
|
+
* ```
|
|
994
1732
|
*
|
|
995
1733
|
* @param params - Parameters for request
|
|
996
1734
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1005,6 +1743,59 @@ export declare namespace translate_v3beta1 {
|
|
|
1005
1743
|
create(callback: BodyResponseCallback<Schema$Operation>): void;
|
|
1006
1744
|
/**
|
|
1007
1745
|
* Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
|
|
1746
|
+
* @example
|
|
1747
|
+
* ```js
|
|
1748
|
+
* // Before running the sample:
|
|
1749
|
+
* // - Enable the API at:
|
|
1750
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1751
|
+
* // - Login into gcloud by running:
|
|
1752
|
+
* // ```sh
|
|
1753
|
+
* // $ gcloud auth application-default login
|
|
1754
|
+
* // ```
|
|
1755
|
+
* // - Install the npm module by running:
|
|
1756
|
+
* // ```sh
|
|
1757
|
+
* // $ npm install googleapis
|
|
1758
|
+
* // ```
|
|
1759
|
+
*
|
|
1760
|
+
* const {google} = require('googleapis');
|
|
1761
|
+
* const translate = google.translate('v3beta1');
|
|
1762
|
+
*
|
|
1763
|
+
* async function main() {
|
|
1764
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1765
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1766
|
+
* scopes: [
|
|
1767
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1768
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1769
|
+
* ],
|
|
1770
|
+
* });
|
|
1771
|
+
*
|
|
1772
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1773
|
+
* const authClient = await auth.getClient();
|
|
1774
|
+
* google.options({auth: authClient});
|
|
1775
|
+
*
|
|
1776
|
+
* // Do the magic
|
|
1777
|
+
* const res = await translate.projects.locations.glossaries.delete({
|
|
1778
|
+
* // Required. The name of the glossary to delete.
|
|
1779
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
1780
|
+
* });
|
|
1781
|
+
* console.log(res.data);
|
|
1782
|
+
*
|
|
1783
|
+
* // Example response
|
|
1784
|
+
* // {
|
|
1785
|
+
* // "done": false,
|
|
1786
|
+
* // "error": {},
|
|
1787
|
+
* // "metadata": {},
|
|
1788
|
+
* // "name": "my_name",
|
|
1789
|
+
* // "response": {}
|
|
1790
|
+
* // }
|
|
1791
|
+
* }
|
|
1792
|
+
*
|
|
1793
|
+
* main().catch(e => {
|
|
1794
|
+
* console.error(e);
|
|
1795
|
+
* throw e;
|
|
1796
|
+
* });
|
|
1797
|
+
*
|
|
1798
|
+
* ```
|
|
1008
1799
|
*
|
|
1009
1800
|
* @param params - Parameters for request
|
|
1010
1801
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1019,6 +1810,61 @@ export declare namespace translate_v3beta1 {
|
|
|
1019
1810
|
delete(callback: BodyResponseCallback<Schema$Operation>): void;
|
|
1020
1811
|
/**
|
|
1021
1812
|
* Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
|
|
1813
|
+
* @example
|
|
1814
|
+
* ```js
|
|
1815
|
+
* // Before running the sample:
|
|
1816
|
+
* // - Enable the API at:
|
|
1817
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1818
|
+
* // - Login into gcloud by running:
|
|
1819
|
+
* // ```sh
|
|
1820
|
+
* // $ gcloud auth application-default login
|
|
1821
|
+
* // ```
|
|
1822
|
+
* // - Install the npm module by running:
|
|
1823
|
+
* // ```sh
|
|
1824
|
+
* // $ npm install googleapis
|
|
1825
|
+
* // ```
|
|
1826
|
+
*
|
|
1827
|
+
* const {google} = require('googleapis');
|
|
1828
|
+
* const translate = google.translate('v3beta1');
|
|
1829
|
+
*
|
|
1830
|
+
* async function main() {
|
|
1831
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1832
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1833
|
+
* scopes: [
|
|
1834
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1835
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1836
|
+
* ],
|
|
1837
|
+
* });
|
|
1838
|
+
*
|
|
1839
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1840
|
+
* const authClient = await auth.getClient();
|
|
1841
|
+
* google.options({auth: authClient});
|
|
1842
|
+
*
|
|
1843
|
+
* // Do the magic
|
|
1844
|
+
* const res = await translate.projects.locations.glossaries.get({
|
|
1845
|
+
* // Required. The name of the glossary to retrieve.
|
|
1846
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
1847
|
+
* });
|
|
1848
|
+
* console.log(res.data);
|
|
1849
|
+
*
|
|
1850
|
+
* // Example response
|
|
1851
|
+
* // {
|
|
1852
|
+
* // "endTime": "my_endTime",
|
|
1853
|
+
* // "entryCount": 0,
|
|
1854
|
+
* // "inputConfig": {},
|
|
1855
|
+
* // "languageCodesSet": {},
|
|
1856
|
+
* // "languagePair": {},
|
|
1857
|
+
* // "name": "my_name",
|
|
1858
|
+
* // "submitTime": "my_submitTime"
|
|
1859
|
+
* // }
|
|
1860
|
+
* }
|
|
1861
|
+
*
|
|
1862
|
+
* main().catch(e => {
|
|
1863
|
+
* console.error(e);
|
|
1864
|
+
* throw e;
|
|
1865
|
+
* });
|
|
1866
|
+
*
|
|
1867
|
+
* ```
|
|
1022
1868
|
*
|
|
1023
1869
|
* @param params - Parameters for request
|
|
1024
1870
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1033,6 +1879,62 @@ export declare namespace translate_v3beta1 {
|
|
|
1033
1879
|
get(callback: BodyResponseCallback<Schema$Glossary>): void;
|
|
1034
1880
|
/**
|
|
1035
1881
|
* Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
|
|
1882
|
+
* @example
|
|
1883
|
+
* ```js
|
|
1884
|
+
* // Before running the sample:
|
|
1885
|
+
* // - Enable the API at:
|
|
1886
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1887
|
+
* // - Login into gcloud by running:
|
|
1888
|
+
* // ```sh
|
|
1889
|
+
* // $ gcloud auth application-default login
|
|
1890
|
+
* // ```
|
|
1891
|
+
* // - Install the npm module by running:
|
|
1892
|
+
* // ```sh
|
|
1893
|
+
* // $ npm install googleapis
|
|
1894
|
+
* // ```
|
|
1895
|
+
*
|
|
1896
|
+
* const {google} = require('googleapis');
|
|
1897
|
+
* const translate = google.translate('v3beta1');
|
|
1898
|
+
*
|
|
1899
|
+
* async function main() {
|
|
1900
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1901
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1902
|
+
* scopes: [
|
|
1903
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1904
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1905
|
+
* ],
|
|
1906
|
+
* });
|
|
1907
|
+
*
|
|
1908
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1909
|
+
* const authClient = await auth.getClient();
|
|
1910
|
+
* google.options({auth: authClient});
|
|
1911
|
+
*
|
|
1912
|
+
* // Do the magic
|
|
1913
|
+
* const res = await translate.projects.locations.glossaries.list({
|
|
1914
|
+
* // Optional. Filter specifying constraints of a list operation. Specify the constraint by the format of "key=value", where key must be "src" or "tgt", and the value must be a valid language code. For multiple restrictions, concatenate them by "AND" (uppercase only), such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used here, which means using 'en-US' and 'en' can lead to different results, which depends on the language code you used when you create the glossary. For the unidirectional glossaries, the "src" and "tgt" add restrictions on the source and target language code separately. For the equivalent term set glossaries, the "src" and/or "tgt" add restrictions on the term set. For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional glossaries which exactly match the source language code as "en-US" and the target language code "zh-CN", but all equivalent term set glossaries which contain "en-US" and "zh-CN" in their language set will be picked. If missing, no filtering is performed.
|
|
1915
|
+
* filter: 'placeholder-value',
|
|
1916
|
+
* // Optional. Requested page size. The server may return fewer glossaries than requested. If unspecified, the server picks an appropriate default.
|
|
1917
|
+
* pageSize: 'placeholder-value',
|
|
1918
|
+
* // Optional. A token identifying a page of results the server should return. Typically, this is the value of [ListGlossariesResponse.next_page_token] returned from the previous call to `ListGlossaries` method. The first page is returned if `page_token`is empty or missing.
|
|
1919
|
+
* pageToken: 'placeholder-value',
|
|
1920
|
+
* // Required. The name of the project from which to list all of the glossaries.
|
|
1921
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1922
|
+
* });
|
|
1923
|
+
* console.log(res.data);
|
|
1924
|
+
*
|
|
1925
|
+
* // Example response
|
|
1926
|
+
* // {
|
|
1927
|
+
* // "glossaries": [],
|
|
1928
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
1929
|
+
* // }
|
|
1930
|
+
* }
|
|
1931
|
+
*
|
|
1932
|
+
* main().catch(e => {
|
|
1933
|
+
* console.error(e);
|
|
1934
|
+
* throw e;
|
|
1935
|
+
* });
|
|
1936
|
+
*
|
|
1937
|
+
* ```
|
|
1036
1938
|
*
|
|
1037
1939
|
* @param params - Parameters for request
|
|
1038
1940
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1091,6 +1993,59 @@ export declare namespace translate_v3beta1 {
|
|
|
1091
1993
|
constructor(context: APIRequestContext);
|
|
1092
1994
|
/**
|
|
1093
1995
|
* Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of `1`, corresponding to `Code.CANCELLED`.
|
|
1996
|
+
* @example
|
|
1997
|
+
* ```js
|
|
1998
|
+
* // Before running the sample:
|
|
1999
|
+
* // - Enable the API at:
|
|
2000
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2001
|
+
* // - Login into gcloud by running:
|
|
2002
|
+
* // ```sh
|
|
2003
|
+
* // $ gcloud auth application-default login
|
|
2004
|
+
* // ```
|
|
2005
|
+
* // - Install the npm module by running:
|
|
2006
|
+
* // ```sh
|
|
2007
|
+
* // $ npm install googleapis
|
|
2008
|
+
* // ```
|
|
2009
|
+
*
|
|
2010
|
+
* const {google} = require('googleapis');
|
|
2011
|
+
* const translate = google.translate('v3beta1');
|
|
2012
|
+
*
|
|
2013
|
+
* async function main() {
|
|
2014
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2015
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2016
|
+
* scopes: [
|
|
2017
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2018
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2019
|
+
* ],
|
|
2020
|
+
* });
|
|
2021
|
+
*
|
|
2022
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2023
|
+
* const authClient = await auth.getClient();
|
|
2024
|
+
* google.options({auth: authClient});
|
|
2025
|
+
*
|
|
2026
|
+
* // Do the magic
|
|
2027
|
+
* const res = await translate.projects.locations.operations.cancel({
|
|
2028
|
+
* // The name of the operation resource to be cancelled.
|
|
2029
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
2030
|
+
*
|
|
2031
|
+
* // Request body metadata
|
|
2032
|
+
* requestBody: {
|
|
2033
|
+
* // request body parameters
|
|
2034
|
+
* // {}
|
|
2035
|
+
* },
|
|
2036
|
+
* });
|
|
2037
|
+
* console.log(res.data);
|
|
2038
|
+
*
|
|
2039
|
+
* // Example response
|
|
2040
|
+
* // {}
|
|
2041
|
+
* }
|
|
2042
|
+
*
|
|
2043
|
+
* main().catch(e => {
|
|
2044
|
+
* console.error(e);
|
|
2045
|
+
* throw e;
|
|
2046
|
+
* });
|
|
2047
|
+
*
|
|
2048
|
+
* ```
|
|
1094
2049
|
*
|
|
1095
2050
|
* @param params - Parameters for request
|
|
1096
2051
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1105,6 +2060,53 @@ export declare namespace translate_v3beta1 {
|
|
|
1105
2060
|
cancel(callback: BodyResponseCallback<Schema$Empty>): void;
|
|
1106
2061
|
/**
|
|
1107
2062
|
* Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
|
|
2063
|
+
* @example
|
|
2064
|
+
* ```js
|
|
2065
|
+
* // Before running the sample:
|
|
2066
|
+
* // - Enable the API at:
|
|
2067
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2068
|
+
* // - Login into gcloud by running:
|
|
2069
|
+
* // ```sh
|
|
2070
|
+
* // $ gcloud auth application-default login
|
|
2071
|
+
* // ```
|
|
2072
|
+
* // - Install the npm module by running:
|
|
2073
|
+
* // ```sh
|
|
2074
|
+
* // $ npm install googleapis
|
|
2075
|
+
* // ```
|
|
2076
|
+
*
|
|
2077
|
+
* const {google} = require('googleapis');
|
|
2078
|
+
* const translate = google.translate('v3beta1');
|
|
2079
|
+
*
|
|
2080
|
+
* async function main() {
|
|
2081
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2082
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2083
|
+
* scopes: [
|
|
2084
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2085
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2086
|
+
* ],
|
|
2087
|
+
* });
|
|
2088
|
+
*
|
|
2089
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2090
|
+
* const authClient = await auth.getClient();
|
|
2091
|
+
* google.options({auth: authClient});
|
|
2092
|
+
*
|
|
2093
|
+
* // Do the magic
|
|
2094
|
+
* const res = await translate.projects.locations.operations.delete({
|
|
2095
|
+
* // The name of the operation resource to be deleted.
|
|
2096
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
2097
|
+
* });
|
|
2098
|
+
* console.log(res.data);
|
|
2099
|
+
*
|
|
2100
|
+
* // Example response
|
|
2101
|
+
* // {}
|
|
2102
|
+
* }
|
|
2103
|
+
*
|
|
2104
|
+
* main().catch(e => {
|
|
2105
|
+
* console.error(e);
|
|
2106
|
+
* throw e;
|
|
2107
|
+
* });
|
|
2108
|
+
*
|
|
2109
|
+
* ```
|
|
1108
2110
|
*
|
|
1109
2111
|
* @param params - Parameters for request
|
|
1110
2112
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1119,6 +2121,59 @@ export declare namespace translate_v3beta1 {
|
|
|
1119
2121
|
delete(callback: BodyResponseCallback<Schema$Empty>): void;
|
|
1120
2122
|
/**
|
|
1121
2123
|
* Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
|
|
2124
|
+
* @example
|
|
2125
|
+
* ```js
|
|
2126
|
+
* // Before running the sample:
|
|
2127
|
+
* // - Enable the API at:
|
|
2128
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2129
|
+
* // - Login into gcloud by running:
|
|
2130
|
+
* // ```sh
|
|
2131
|
+
* // $ gcloud auth application-default login
|
|
2132
|
+
* // ```
|
|
2133
|
+
* // - Install the npm module by running:
|
|
2134
|
+
* // ```sh
|
|
2135
|
+
* // $ npm install googleapis
|
|
2136
|
+
* // ```
|
|
2137
|
+
*
|
|
2138
|
+
* const {google} = require('googleapis');
|
|
2139
|
+
* const translate = google.translate('v3beta1');
|
|
2140
|
+
*
|
|
2141
|
+
* async function main() {
|
|
2142
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2143
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2144
|
+
* scopes: [
|
|
2145
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2146
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2147
|
+
* ],
|
|
2148
|
+
* });
|
|
2149
|
+
*
|
|
2150
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2151
|
+
* const authClient = await auth.getClient();
|
|
2152
|
+
* google.options({auth: authClient});
|
|
2153
|
+
*
|
|
2154
|
+
* // Do the magic
|
|
2155
|
+
* const res = await translate.projects.locations.operations.get({
|
|
2156
|
+
* // The name of the operation resource.
|
|
2157
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
2158
|
+
* });
|
|
2159
|
+
* console.log(res.data);
|
|
2160
|
+
*
|
|
2161
|
+
* // Example response
|
|
2162
|
+
* // {
|
|
2163
|
+
* // "done": false,
|
|
2164
|
+
* // "error": {},
|
|
2165
|
+
* // "metadata": {},
|
|
2166
|
+
* // "name": "my_name",
|
|
2167
|
+
* // "response": {}
|
|
2168
|
+
* // }
|
|
2169
|
+
* }
|
|
2170
|
+
*
|
|
2171
|
+
* main().catch(e => {
|
|
2172
|
+
* console.error(e);
|
|
2173
|
+
* throw e;
|
|
2174
|
+
* });
|
|
2175
|
+
*
|
|
2176
|
+
* ```
|
|
1122
2177
|
*
|
|
1123
2178
|
* @param params - Parameters for request
|
|
1124
2179
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1133,6 +2188,62 @@ export declare namespace translate_v3beta1 {
|
|
|
1133
2188
|
get(callback: BodyResponseCallback<Schema$Operation>): void;
|
|
1134
2189
|
/**
|
|
1135
2190
|
* Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
|
|
2191
|
+
* @example
|
|
2192
|
+
* ```js
|
|
2193
|
+
* // Before running the sample:
|
|
2194
|
+
* // - Enable the API at:
|
|
2195
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2196
|
+
* // - Login into gcloud by running:
|
|
2197
|
+
* // ```sh
|
|
2198
|
+
* // $ gcloud auth application-default login
|
|
2199
|
+
* // ```
|
|
2200
|
+
* // - Install the npm module by running:
|
|
2201
|
+
* // ```sh
|
|
2202
|
+
* // $ npm install googleapis
|
|
2203
|
+
* // ```
|
|
2204
|
+
*
|
|
2205
|
+
* const {google} = require('googleapis');
|
|
2206
|
+
* const translate = google.translate('v3beta1');
|
|
2207
|
+
*
|
|
2208
|
+
* async function main() {
|
|
2209
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2210
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2211
|
+
* scopes: [
|
|
2212
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2213
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2214
|
+
* ],
|
|
2215
|
+
* });
|
|
2216
|
+
*
|
|
2217
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2218
|
+
* const authClient = await auth.getClient();
|
|
2219
|
+
* google.options({auth: authClient});
|
|
2220
|
+
*
|
|
2221
|
+
* // Do the magic
|
|
2222
|
+
* const res = await translate.projects.locations.operations.list({
|
|
2223
|
+
* // The standard list filter.
|
|
2224
|
+
* filter: 'placeholder-value',
|
|
2225
|
+
* // The name of the operation's parent resource.
|
|
2226
|
+
* name: 'projects/my-project/locations/my-location',
|
|
2227
|
+
* // The standard list page size.
|
|
2228
|
+
* pageSize: 'placeholder-value',
|
|
2229
|
+
* // The standard list page token.
|
|
2230
|
+
* pageToken: 'placeholder-value',
|
|
2231
|
+
* });
|
|
2232
|
+
* console.log(res.data);
|
|
2233
|
+
*
|
|
2234
|
+
* // Example response
|
|
2235
|
+
* // {
|
|
2236
|
+
* // "nextPageToken": "my_nextPageToken",
|
|
2237
|
+
* // "operations": []
|
|
2238
|
+
* // }
|
|
2239
|
+
* }
|
|
2240
|
+
*
|
|
2241
|
+
* main().catch(e => {
|
|
2242
|
+
* console.error(e);
|
|
2243
|
+
* throw e;
|
|
2244
|
+
* });
|
|
2245
|
+
*
|
|
2246
|
+
* ```
|
|
1136
2247
|
*
|
|
1137
2248
|
* @param params - Parameters for request
|
|
1138
2249
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1147,6 +2258,67 @@ export declare namespace translate_v3beta1 {
|
|
|
1147
2258
|
list(callback: BodyResponseCallback<Schema$ListOperationsResponse>): void;
|
|
1148
2259
|
/**
|
|
1149
2260
|
* Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
|
|
2261
|
+
* @example
|
|
2262
|
+
* ```js
|
|
2263
|
+
* // Before running the sample:
|
|
2264
|
+
* // - Enable the API at:
|
|
2265
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2266
|
+
* // - Login into gcloud by running:
|
|
2267
|
+
* // ```sh
|
|
2268
|
+
* // $ gcloud auth application-default login
|
|
2269
|
+
* // ```
|
|
2270
|
+
* // - Install the npm module by running:
|
|
2271
|
+
* // ```sh
|
|
2272
|
+
* // $ npm install googleapis
|
|
2273
|
+
* // ```
|
|
2274
|
+
*
|
|
2275
|
+
* const {google} = require('googleapis');
|
|
2276
|
+
* const translate = google.translate('v3beta1');
|
|
2277
|
+
*
|
|
2278
|
+
* async function main() {
|
|
2279
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2280
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2281
|
+
* scopes: [
|
|
2282
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2283
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2284
|
+
* ],
|
|
2285
|
+
* });
|
|
2286
|
+
*
|
|
2287
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2288
|
+
* const authClient = await auth.getClient();
|
|
2289
|
+
* google.options({auth: authClient});
|
|
2290
|
+
*
|
|
2291
|
+
* // Do the magic
|
|
2292
|
+
* const res = await translate.projects.locations.operations.wait({
|
|
2293
|
+
* // The name of the operation resource to wait on.
|
|
2294
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
2295
|
+
*
|
|
2296
|
+
* // Request body metadata
|
|
2297
|
+
* requestBody: {
|
|
2298
|
+
* // request body parameters
|
|
2299
|
+
* // {
|
|
2300
|
+
* // "timeout": "my_timeout"
|
|
2301
|
+
* // }
|
|
2302
|
+
* },
|
|
2303
|
+
* });
|
|
2304
|
+
* console.log(res.data);
|
|
2305
|
+
*
|
|
2306
|
+
* // Example response
|
|
2307
|
+
* // {
|
|
2308
|
+
* // "done": false,
|
|
2309
|
+
* // "error": {},
|
|
2310
|
+
* // "metadata": {},
|
|
2311
|
+
* // "name": "my_name",
|
|
2312
|
+
* // "response": {}
|
|
2313
|
+
* // }
|
|
2314
|
+
* }
|
|
2315
|
+
*
|
|
2316
|
+
* main().catch(e => {
|
|
2317
|
+
* console.error(e);
|
|
2318
|
+
* throw e;
|
|
2319
|
+
* });
|
|
2320
|
+
*
|
|
2321
|
+
* ```
|
|
1150
2322
|
*
|
|
1151
2323
|
* @param params - Parameters for request
|
|
1152
2324
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|