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