@googleapis/translate 3.5.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/build/index.d.ts +1 -1
- package/build/index.js.map +1 -1
- package/build/v2.d.ts +291 -11
- package/build/v2.js.map +1 -1
- package/build/v3.d.ts +3024 -101
- package/build/v3.js.map +1 -1
- package/build/v3beta1.d.ts +1214 -41
- package/build/v3beta1.js.map +1 -1
- package/index.ts +0 -1
- package/package.json +2 -2
- package/v2.ts +301 -21
- package/v3.ts +3176 -175
- package/v3beta1.ts +1274 -71
package/v3beta1.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
Compute,
|
|
24
24
|
UserRefreshClient,
|
|
25
25
|
BaseExternalAccountClient,
|
|
26
|
-
|
|
26
|
+
GaxiosResponseWithHTTP2,
|
|
27
27
|
GoogleConfigurable,
|
|
28
28
|
createAPIRequest,
|
|
29
29
|
MethodOptions,
|
|
@@ -729,6 +729,66 @@ export namespace translate_v3beta1 {
|
|
|
729
729
|
|
|
730
730
|
/**
|
|
731
731
|
* Detects the language of text within a request.
|
|
732
|
+
* @example
|
|
733
|
+
* ```js
|
|
734
|
+
* // Before running the sample:
|
|
735
|
+
* // - Enable the API at:
|
|
736
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
737
|
+
* // - Login into gcloud by running:
|
|
738
|
+
* // ```sh
|
|
739
|
+
* // $ gcloud auth application-default login
|
|
740
|
+
* // ```
|
|
741
|
+
* // - Install the npm module by running:
|
|
742
|
+
* // ```sh
|
|
743
|
+
* // $ npm install googleapis
|
|
744
|
+
* // ```
|
|
745
|
+
*
|
|
746
|
+
* const {google} = require('googleapis');
|
|
747
|
+
* const translate = google.translate('v3beta1');
|
|
748
|
+
*
|
|
749
|
+
* async function main() {
|
|
750
|
+
* const auth = new google.auth.GoogleAuth({
|
|
751
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
752
|
+
* scopes: [
|
|
753
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
754
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
755
|
+
* ],
|
|
756
|
+
* });
|
|
757
|
+
*
|
|
758
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
759
|
+
* const authClient = await auth.getClient();
|
|
760
|
+
* google.options({auth: authClient});
|
|
761
|
+
*
|
|
762
|
+
* // Do the magic
|
|
763
|
+
* const res = await translate.projects.detectLanguage({
|
|
764
|
+
* // 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.
|
|
765
|
+
* parent: 'projects/my-project',
|
|
766
|
+
*
|
|
767
|
+
* // Request body metadata
|
|
768
|
+
* requestBody: {
|
|
769
|
+
* // request body parameters
|
|
770
|
+
* // {
|
|
771
|
+
* // "content": "my_content",
|
|
772
|
+
* // "labels": {},
|
|
773
|
+
* // "mimeType": "my_mimeType",
|
|
774
|
+
* // "model": "my_model"
|
|
775
|
+
* // }
|
|
776
|
+
* },
|
|
777
|
+
* });
|
|
778
|
+
* console.log(res.data);
|
|
779
|
+
*
|
|
780
|
+
* // Example response
|
|
781
|
+
* // {
|
|
782
|
+
* // "languages": []
|
|
783
|
+
* // }
|
|
784
|
+
* }
|
|
785
|
+
*
|
|
786
|
+
* main().catch(e => {
|
|
787
|
+
* console.error(e);
|
|
788
|
+
* throw e;
|
|
789
|
+
* });
|
|
790
|
+
*
|
|
791
|
+
* ```
|
|
732
792
|
*
|
|
733
793
|
* @param params - Parameters for request
|
|
734
794
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -738,11 +798,11 @@ export namespace translate_v3beta1 {
|
|
|
738
798
|
detectLanguage(
|
|
739
799
|
params: Params$Resource$Projects$Detectlanguage,
|
|
740
800
|
options: StreamMethodOptions
|
|
741
|
-
):
|
|
801
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
742
802
|
detectLanguage(
|
|
743
803
|
params?: Params$Resource$Projects$Detectlanguage,
|
|
744
804
|
options?: MethodOptions
|
|
745
|
-
):
|
|
805
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$DetectLanguageResponse>>;
|
|
746
806
|
detectLanguage(
|
|
747
807
|
params: Params$Resource$Projects$Detectlanguage,
|
|
748
808
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -777,8 +837,8 @@ export namespace translate_v3beta1 {
|
|
|
777
837
|
| BodyResponseCallback<Readable>
|
|
778
838
|
):
|
|
779
839
|
| void
|
|
780
|
-
|
|
|
781
|
-
|
|
|
840
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$DetectLanguageResponse>>
|
|
841
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
782
842
|
let params = (paramsOrCallback ||
|
|
783
843
|
{}) as Params$Resource$Projects$Detectlanguage;
|
|
784
844
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -824,6 +884,59 @@ export namespace translate_v3beta1 {
|
|
|
824
884
|
|
|
825
885
|
/**
|
|
826
886
|
* Returns a list of supported languages for translation.
|
|
887
|
+
* @example
|
|
888
|
+
* ```js
|
|
889
|
+
* // Before running the sample:
|
|
890
|
+
* // - Enable the API at:
|
|
891
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
892
|
+
* // - Login into gcloud by running:
|
|
893
|
+
* // ```sh
|
|
894
|
+
* // $ gcloud auth application-default login
|
|
895
|
+
* // ```
|
|
896
|
+
* // - Install the npm module by running:
|
|
897
|
+
* // ```sh
|
|
898
|
+
* // $ npm install googleapis
|
|
899
|
+
* // ```
|
|
900
|
+
*
|
|
901
|
+
* const {google} = require('googleapis');
|
|
902
|
+
* const translate = google.translate('v3beta1');
|
|
903
|
+
*
|
|
904
|
+
* async function main() {
|
|
905
|
+
* const auth = new google.auth.GoogleAuth({
|
|
906
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
907
|
+
* scopes: [
|
|
908
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
909
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
910
|
+
* ],
|
|
911
|
+
* });
|
|
912
|
+
*
|
|
913
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
914
|
+
* const authClient = await auth.getClient();
|
|
915
|
+
* google.options({auth: authClient});
|
|
916
|
+
*
|
|
917
|
+
* // Do the magic
|
|
918
|
+
* const res = await translate.projects.getSupportedLanguages({
|
|
919
|
+
* // 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.
|
|
920
|
+
* displayLanguageCode: 'placeholder-value',
|
|
921
|
+
* // 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.
|
|
922
|
+
* model: 'placeholder-value',
|
|
923
|
+
* // 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.
|
|
924
|
+
* parent: 'projects/my-project',
|
|
925
|
+
* });
|
|
926
|
+
* console.log(res.data);
|
|
927
|
+
*
|
|
928
|
+
* // Example response
|
|
929
|
+
* // {
|
|
930
|
+
* // "languages": []
|
|
931
|
+
* // }
|
|
932
|
+
* }
|
|
933
|
+
*
|
|
934
|
+
* main().catch(e => {
|
|
935
|
+
* console.error(e);
|
|
936
|
+
* throw e;
|
|
937
|
+
* });
|
|
938
|
+
*
|
|
939
|
+
* ```
|
|
827
940
|
*
|
|
828
941
|
* @param params - Parameters for request
|
|
829
942
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -833,11 +946,11 @@ export namespace translate_v3beta1 {
|
|
|
833
946
|
getSupportedLanguages(
|
|
834
947
|
params: Params$Resource$Projects$Getsupportedlanguages,
|
|
835
948
|
options: StreamMethodOptions
|
|
836
|
-
):
|
|
949
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
837
950
|
getSupportedLanguages(
|
|
838
951
|
params?: Params$Resource$Projects$Getsupportedlanguages,
|
|
839
952
|
options?: MethodOptions
|
|
840
|
-
):
|
|
953
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$SupportedLanguages>>;
|
|
841
954
|
getSupportedLanguages(
|
|
842
955
|
params: Params$Resource$Projects$Getsupportedlanguages,
|
|
843
956
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -870,8 +983,8 @@ export namespace translate_v3beta1 {
|
|
|
870
983
|
| BodyResponseCallback<Readable>
|
|
871
984
|
):
|
|
872
985
|
| void
|
|
873
|
-
|
|
|
874
|
-
|
|
|
986
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$SupportedLanguages>>
|
|
987
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
875
988
|
let params = (paramsOrCallback ||
|
|
876
989
|
{}) as Params$Resource$Projects$Getsupportedlanguages;
|
|
877
990
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -917,6 +1030,70 @@ export namespace translate_v3beta1 {
|
|
|
917
1030
|
|
|
918
1031
|
/**
|
|
919
1032
|
* Translates input text and returns translated text.
|
|
1033
|
+
* @example
|
|
1034
|
+
* ```js
|
|
1035
|
+
* // Before running the sample:
|
|
1036
|
+
* // - Enable the API at:
|
|
1037
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1038
|
+
* // - Login into gcloud by running:
|
|
1039
|
+
* // ```sh
|
|
1040
|
+
* // $ gcloud auth application-default login
|
|
1041
|
+
* // ```
|
|
1042
|
+
* // - Install the npm module by running:
|
|
1043
|
+
* // ```sh
|
|
1044
|
+
* // $ npm install googleapis
|
|
1045
|
+
* // ```
|
|
1046
|
+
*
|
|
1047
|
+
* const {google} = require('googleapis');
|
|
1048
|
+
* const translate = google.translate('v3beta1');
|
|
1049
|
+
*
|
|
1050
|
+
* async function main() {
|
|
1051
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1052
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1053
|
+
* scopes: [
|
|
1054
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1055
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1056
|
+
* ],
|
|
1057
|
+
* });
|
|
1058
|
+
*
|
|
1059
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1060
|
+
* const authClient = await auth.getClient();
|
|
1061
|
+
* google.options({auth: authClient});
|
|
1062
|
+
*
|
|
1063
|
+
* // Do the magic
|
|
1064
|
+
* const res = await translate.projects.translateText({
|
|
1065
|
+
* // 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.
|
|
1066
|
+
* parent: 'projects/my-project',
|
|
1067
|
+
*
|
|
1068
|
+
* // Request body metadata
|
|
1069
|
+
* requestBody: {
|
|
1070
|
+
* // request body parameters
|
|
1071
|
+
* // {
|
|
1072
|
+
* // "contents": [],
|
|
1073
|
+
* // "glossaryConfig": {},
|
|
1074
|
+
* // "labels": {},
|
|
1075
|
+
* // "mimeType": "my_mimeType",
|
|
1076
|
+
* // "model": "my_model",
|
|
1077
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1078
|
+
* // "targetLanguageCode": "my_targetLanguageCode"
|
|
1079
|
+
* // }
|
|
1080
|
+
* },
|
|
1081
|
+
* });
|
|
1082
|
+
* console.log(res.data);
|
|
1083
|
+
*
|
|
1084
|
+
* // Example response
|
|
1085
|
+
* // {
|
|
1086
|
+
* // "glossaryTranslations": [],
|
|
1087
|
+
* // "translations": []
|
|
1088
|
+
* // }
|
|
1089
|
+
* }
|
|
1090
|
+
*
|
|
1091
|
+
* main().catch(e => {
|
|
1092
|
+
* console.error(e);
|
|
1093
|
+
* throw e;
|
|
1094
|
+
* });
|
|
1095
|
+
*
|
|
1096
|
+
* ```
|
|
920
1097
|
*
|
|
921
1098
|
* @param params - Parameters for request
|
|
922
1099
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -926,11 +1103,11 @@ export namespace translate_v3beta1 {
|
|
|
926
1103
|
translateText(
|
|
927
1104
|
params: Params$Resource$Projects$Translatetext,
|
|
928
1105
|
options: StreamMethodOptions
|
|
929
|
-
):
|
|
1106
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
930
1107
|
translateText(
|
|
931
1108
|
params?: Params$Resource$Projects$Translatetext,
|
|
932
1109
|
options?: MethodOptions
|
|
933
|
-
):
|
|
1110
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$TranslateTextResponse>>;
|
|
934
1111
|
translateText(
|
|
935
1112
|
params: Params$Resource$Projects$Translatetext,
|
|
936
1113
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -965,8 +1142,8 @@ export namespace translate_v3beta1 {
|
|
|
965
1142
|
| BodyResponseCallback<Readable>
|
|
966
1143
|
):
|
|
967
1144
|
| void
|
|
968
|
-
|
|
|
969
|
-
|
|
|
1145
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$TranslateTextResponse>>
|
|
1146
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
970
1147
|
let params = (paramsOrCallback ||
|
|
971
1148
|
{}) as Params$Resource$Projects$Translatetext;
|
|
972
1149
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1067,6 +1244,76 @@ export namespace translate_v3beta1 {
|
|
|
1067
1244
|
|
|
1068
1245
|
/**
|
|
1069
1246
|
* 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.
|
|
1247
|
+
* @example
|
|
1248
|
+
* ```js
|
|
1249
|
+
* // Before running the sample:
|
|
1250
|
+
* // - Enable the API at:
|
|
1251
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1252
|
+
* // - Login into gcloud by running:
|
|
1253
|
+
* // ```sh
|
|
1254
|
+
* // $ gcloud auth application-default login
|
|
1255
|
+
* // ```
|
|
1256
|
+
* // - Install the npm module by running:
|
|
1257
|
+
* // ```sh
|
|
1258
|
+
* // $ npm install googleapis
|
|
1259
|
+
* // ```
|
|
1260
|
+
*
|
|
1261
|
+
* const {google} = require('googleapis');
|
|
1262
|
+
* const translate = google.translate('v3beta1');
|
|
1263
|
+
*
|
|
1264
|
+
* async function main() {
|
|
1265
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1266
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1267
|
+
* scopes: [
|
|
1268
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1269
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1270
|
+
* ],
|
|
1271
|
+
* });
|
|
1272
|
+
*
|
|
1273
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1274
|
+
* const authClient = await auth.getClient();
|
|
1275
|
+
* google.options({auth: authClient});
|
|
1276
|
+
*
|
|
1277
|
+
* // Do the magic
|
|
1278
|
+
* const res = await translate.projects.locations.batchTranslateDocument({
|
|
1279
|
+
* // 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.
|
|
1280
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1281
|
+
*
|
|
1282
|
+
* // Request body metadata
|
|
1283
|
+
* requestBody: {
|
|
1284
|
+
* // request body parameters
|
|
1285
|
+
* // {
|
|
1286
|
+
* // "customizedAttribution": "my_customizedAttribution",
|
|
1287
|
+
* // "enableRotationCorrection": false,
|
|
1288
|
+
* // "enableShadowRemovalNativePdf": false,
|
|
1289
|
+
* // "formatConversions": {},
|
|
1290
|
+
* // "glossaries": {},
|
|
1291
|
+
* // "inputConfigs": [],
|
|
1292
|
+
* // "models": {},
|
|
1293
|
+
* // "outputConfig": {},
|
|
1294
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1295
|
+
* // "targetLanguageCodes": []
|
|
1296
|
+
* // }
|
|
1297
|
+
* },
|
|
1298
|
+
* });
|
|
1299
|
+
* console.log(res.data);
|
|
1300
|
+
*
|
|
1301
|
+
* // Example response
|
|
1302
|
+
* // {
|
|
1303
|
+
* // "done": false,
|
|
1304
|
+
* // "error": {},
|
|
1305
|
+
* // "metadata": {},
|
|
1306
|
+
* // "name": "my_name",
|
|
1307
|
+
* // "response": {}
|
|
1308
|
+
* // }
|
|
1309
|
+
* }
|
|
1310
|
+
*
|
|
1311
|
+
* main().catch(e => {
|
|
1312
|
+
* console.error(e);
|
|
1313
|
+
* throw e;
|
|
1314
|
+
* });
|
|
1315
|
+
*
|
|
1316
|
+
* ```
|
|
1070
1317
|
*
|
|
1071
1318
|
* @param params - Parameters for request
|
|
1072
1319
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1076,11 +1323,11 @@ export namespace translate_v3beta1 {
|
|
|
1076
1323
|
batchTranslateDocument(
|
|
1077
1324
|
params: Params$Resource$Projects$Locations$Batchtranslatedocument,
|
|
1078
1325
|
options: StreamMethodOptions
|
|
1079
|
-
):
|
|
1326
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1080
1327
|
batchTranslateDocument(
|
|
1081
1328
|
params?: Params$Resource$Projects$Locations$Batchtranslatedocument,
|
|
1082
1329
|
options?: MethodOptions
|
|
1083
|
-
):
|
|
1330
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Operation>>;
|
|
1084
1331
|
batchTranslateDocument(
|
|
1085
1332
|
params: Params$Resource$Projects$Locations$Batchtranslatedocument,
|
|
1086
1333
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1111,7 +1358,10 @@ export namespace translate_v3beta1 {
|
|
|
1111
1358
|
callback?:
|
|
1112
1359
|
| BodyResponseCallback<Schema$Operation>
|
|
1113
1360
|
| BodyResponseCallback<Readable>
|
|
1114
|
-
):
|
|
1361
|
+
):
|
|
1362
|
+
| void
|
|
1363
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Operation>>
|
|
1364
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1115
1365
|
let params = (paramsOrCallback ||
|
|
1116
1366
|
{}) as Params$Resource$Projects$Locations$Batchtranslatedocument;
|
|
1117
1367
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1157,6 +1407,73 @@ export namespace translate_v3beta1 {
|
|
|
1157
1407
|
|
|
1158
1408
|
/**
|
|
1159
1409
|
* 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.
|
|
1410
|
+
* @example
|
|
1411
|
+
* ```js
|
|
1412
|
+
* // Before running the sample:
|
|
1413
|
+
* // - Enable the API at:
|
|
1414
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1415
|
+
* // - Login into gcloud by running:
|
|
1416
|
+
* // ```sh
|
|
1417
|
+
* // $ gcloud auth application-default login
|
|
1418
|
+
* // ```
|
|
1419
|
+
* // - Install the npm module by running:
|
|
1420
|
+
* // ```sh
|
|
1421
|
+
* // $ npm install googleapis
|
|
1422
|
+
* // ```
|
|
1423
|
+
*
|
|
1424
|
+
* const {google} = require('googleapis');
|
|
1425
|
+
* const translate = google.translate('v3beta1');
|
|
1426
|
+
*
|
|
1427
|
+
* async function main() {
|
|
1428
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1429
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1430
|
+
* scopes: [
|
|
1431
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1432
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1433
|
+
* ],
|
|
1434
|
+
* });
|
|
1435
|
+
*
|
|
1436
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1437
|
+
* const authClient = await auth.getClient();
|
|
1438
|
+
* google.options({auth: authClient});
|
|
1439
|
+
*
|
|
1440
|
+
* // Do the magic
|
|
1441
|
+
* const res = await translate.projects.locations.batchTranslateText({
|
|
1442
|
+
* // 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.
|
|
1443
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1444
|
+
*
|
|
1445
|
+
* // Request body metadata
|
|
1446
|
+
* requestBody: {
|
|
1447
|
+
* // request body parameters
|
|
1448
|
+
* // {
|
|
1449
|
+
* // "glossaries": {},
|
|
1450
|
+
* // "inputConfigs": [],
|
|
1451
|
+
* // "labels": {},
|
|
1452
|
+
* // "models": {},
|
|
1453
|
+
* // "outputConfig": {},
|
|
1454
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1455
|
+
* // "targetLanguageCodes": []
|
|
1456
|
+
* // }
|
|
1457
|
+
* },
|
|
1458
|
+
* });
|
|
1459
|
+
* console.log(res.data);
|
|
1460
|
+
*
|
|
1461
|
+
* // Example response
|
|
1462
|
+
* // {
|
|
1463
|
+
* // "done": false,
|
|
1464
|
+
* // "error": {},
|
|
1465
|
+
* // "metadata": {},
|
|
1466
|
+
* // "name": "my_name",
|
|
1467
|
+
* // "response": {}
|
|
1468
|
+
* // }
|
|
1469
|
+
* }
|
|
1470
|
+
*
|
|
1471
|
+
* main().catch(e => {
|
|
1472
|
+
* console.error(e);
|
|
1473
|
+
* throw e;
|
|
1474
|
+
* });
|
|
1475
|
+
*
|
|
1476
|
+
* ```
|
|
1160
1477
|
*
|
|
1161
1478
|
* @param params - Parameters for request
|
|
1162
1479
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1166,11 +1483,11 @@ export namespace translate_v3beta1 {
|
|
|
1166
1483
|
batchTranslateText(
|
|
1167
1484
|
params: Params$Resource$Projects$Locations$Batchtranslatetext,
|
|
1168
1485
|
options: StreamMethodOptions
|
|
1169
|
-
):
|
|
1486
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1170
1487
|
batchTranslateText(
|
|
1171
1488
|
params?: Params$Resource$Projects$Locations$Batchtranslatetext,
|
|
1172
1489
|
options?: MethodOptions
|
|
1173
|
-
):
|
|
1490
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Operation>>;
|
|
1174
1491
|
batchTranslateText(
|
|
1175
1492
|
params: Params$Resource$Projects$Locations$Batchtranslatetext,
|
|
1176
1493
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1199,7 +1516,10 @@ export namespace translate_v3beta1 {
|
|
|
1199
1516
|
callback?:
|
|
1200
1517
|
| BodyResponseCallback<Schema$Operation>
|
|
1201
1518
|
| BodyResponseCallback<Readable>
|
|
1202
|
-
):
|
|
1519
|
+
):
|
|
1520
|
+
| void
|
|
1521
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Operation>>
|
|
1522
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1203
1523
|
let params = (paramsOrCallback ||
|
|
1204
1524
|
{}) as Params$Resource$Projects$Locations$Batchtranslatetext;
|
|
1205
1525
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1245,6 +1565,66 @@ export namespace translate_v3beta1 {
|
|
|
1245
1565
|
|
|
1246
1566
|
/**
|
|
1247
1567
|
* Detects the language of text within a request.
|
|
1568
|
+
* @example
|
|
1569
|
+
* ```js
|
|
1570
|
+
* // Before running the sample:
|
|
1571
|
+
* // - Enable the API at:
|
|
1572
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1573
|
+
* // - Login into gcloud by running:
|
|
1574
|
+
* // ```sh
|
|
1575
|
+
* // $ gcloud auth application-default login
|
|
1576
|
+
* // ```
|
|
1577
|
+
* // - Install the npm module by running:
|
|
1578
|
+
* // ```sh
|
|
1579
|
+
* // $ npm install googleapis
|
|
1580
|
+
* // ```
|
|
1581
|
+
*
|
|
1582
|
+
* const {google} = require('googleapis');
|
|
1583
|
+
* const translate = google.translate('v3beta1');
|
|
1584
|
+
*
|
|
1585
|
+
* async function main() {
|
|
1586
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1587
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1588
|
+
* scopes: [
|
|
1589
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1590
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1591
|
+
* ],
|
|
1592
|
+
* });
|
|
1593
|
+
*
|
|
1594
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1595
|
+
* const authClient = await auth.getClient();
|
|
1596
|
+
* google.options({auth: authClient});
|
|
1597
|
+
*
|
|
1598
|
+
* // Do the magic
|
|
1599
|
+
* const res = await translate.projects.locations.detectLanguage({
|
|
1600
|
+
* // 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.
|
|
1601
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1602
|
+
*
|
|
1603
|
+
* // Request body metadata
|
|
1604
|
+
* requestBody: {
|
|
1605
|
+
* // request body parameters
|
|
1606
|
+
* // {
|
|
1607
|
+
* // "content": "my_content",
|
|
1608
|
+
* // "labels": {},
|
|
1609
|
+
* // "mimeType": "my_mimeType",
|
|
1610
|
+
* // "model": "my_model"
|
|
1611
|
+
* // }
|
|
1612
|
+
* },
|
|
1613
|
+
* });
|
|
1614
|
+
* console.log(res.data);
|
|
1615
|
+
*
|
|
1616
|
+
* // Example response
|
|
1617
|
+
* // {
|
|
1618
|
+
* // "languages": []
|
|
1619
|
+
* // }
|
|
1620
|
+
* }
|
|
1621
|
+
*
|
|
1622
|
+
* main().catch(e => {
|
|
1623
|
+
* console.error(e);
|
|
1624
|
+
* throw e;
|
|
1625
|
+
* });
|
|
1626
|
+
*
|
|
1627
|
+
* ```
|
|
1248
1628
|
*
|
|
1249
1629
|
* @param params - Parameters for request
|
|
1250
1630
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1254,11 +1634,11 @@ export namespace translate_v3beta1 {
|
|
|
1254
1634
|
detectLanguage(
|
|
1255
1635
|
params: Params$Resource$Projects$Locations$Detectlanguage,
|
|
1256
1636
|
options: StreamMethodOptions
|
|
1257
|
-
):
|
|
1637
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1258
1638
|
detectLanguage(
|
|
1259
1639
|
params?: Params$Resource$Projects$Locations$Detectlanguage,
|
|
1260
1640
|
options?: MethodOptions
|
|
1261
|
-
):
|
|
1641
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$DetectLanguageResponse>>;
|
|
1262
1642
|
detectLanguage(
|
|
1263
1643
|
params: Params$Resource$Projects$Locations$Detectlanguage,
|
|
1264
1644
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1293,8 +1673,8 @@ export namespace translate_v3beta1 {
|
|
|
1293
1673
|
| BodyResponseCallback<Readable>
|
|
1294
1674
|
):
|
|
1295
1675
|
| void
|
|
1296
|
-
|
|
|
1297
|
-
|
|
|
1676
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$DetectLanguageResponse>>
|
|
1677
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1298
1678
|
let params = (paramsOrCallback ||
|
|
1299
1679
|
{}) as Params$Resource$Projects$Locations$Detectlanguage;
|
|
1300
1680
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1340,6 +1720,59 @@ export namespace translate_v3beta1 {
|
|
|
1340
1720
|
|
|
1341
1721
|
/**
|
|
1342
1722
|
* Gets information about a location.
|
|
1723
|
+
* @example
|
|
1724
|
+
* ```js
|
|
1725
|
+
* // Before running the sample:
|
|
1726
|
+
* // - Enable the API at:
|
|
1727
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1728
|
+
* // - Login into gcloud by running:
|
|
1729
|
+
* // ```sh
|
|
1730
|
+
* // $ gcloud auth application-default login
|
|
1731
|
+
* // ```
|
|
1732
|
+
* // - Install the npm module by running:
|
|
1733
|
+
* // ```sh
|
|
1734
|
+
* // $ npm install googleapis
|
|
1735
|
+
* // ```
|
|
1736
|
+
*
|
|
1737
|
+
* const {google} = require('googleapis');
|
|
1738
|
+
* const translate = google.translate('v3beta1');
|
|
1739
|
+
*
|
|
1740
|
+
* async function main() {
|
|
1741
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1742
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1743
|
+
* scopes: [
|
|
1744
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1745
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1746
|
+
* ],
|
|
1747
|
+
* });
|
|
1748
|
+
*
|
|
1749
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1750
|
+
* const authClient = await auth.getClient();
|
|
1751
|
+
* google.options({auth: authClient});
|
|
1752
|
+
*
|
|
1753
|
+
* // Do the magic
|
|
1754
|
+
* const res = await translate.projects.locations.get({
|
|
1755
|
+
* // Resource name for the location.
|
|
1756
|
+
* name: 'projects/my-project/locations/my-location',
|
|
1757
|
+
* });
|
|
1758
|
+
* console.log(res.data);
|
|
1759
|
+
*
|
|
1760
|
+
* // Example response
|
|
1761
|
+
* // {
|
|
1762
|
+
* // "displayName": "my_displayName",
|
|
1763
|
+
* // "labels": {},
|
|
1764
|
+
* // "locationId": "my_locationId",
|
|
1765
|
+
* // "metadata": {},
|
|
1766
|
+
* // "name": "my_name"
|
|
1767
|
+
* // }
|
|
1768
|
+
* }
|
|
1769
|
+
*
|
|
1770
|
+
* main().catch(e => {
|
|
1771
|
+
* console.error(e);
|
|
1772
|
+
* throw e;
|
|
1773
|
+
* });
|
|
1774
|
+
*
|
|
1775
|
+
* ```
|
|
1343
1776
|
*
|
|
1344
1777
|
* @param params - Parameters for request
|
|
1345
1778
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1349,11 +1782,11 @@ export namespace translate_v3beta1 {
|
|
|
1349
1782
|
get(
|
|
1350
1783
|
params: Params$Resource$Projects$Locations$Get,
|
|
1351
1784
|
options: StreamMethodOptions
|
|
1352
|
-
):
|
|
1785
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1353
1786
|
get(
|
|
1354
1787
|
params?: Params$Resource$Projects$Locations$Get,
|
|
1355
1788
|
options?: MethodOptions
|
|
1356
|
-
):
|
|
1789
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Location>>;
|
|
1357
1790
|
get(
|
|
1358
1791
|
params: Params$Resource$Projects$Locations$Get,
|
|
1359
1792
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1382,7 +1815,10 @@ export namespace translate_v3beta1 {
|
|
|
1382
1815
|
callback?:
|
|
1383
1816
|
| BodyResponseCallback<Schema$Location>
|
|
1384
1817
|
| BodyResponseCallback<Readable>
|
|
1385
|
-
):
|
|
1818
|
+
):
|
|
1819
|
+
| void
|
|
1820
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Location>>
|
|
1821
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1386
1822
|
let params = (paramsOrCallback ||
|
|
1387
1823
|
{}) as Params$Resource$Projects$Locations$Get;
|
|
1388
1824
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1425,6 +1861,59 @@ export namespace translate_v3beta1 {
|
|
|
1425
1861
|
|
|
1426
1862
|
/**
|
|
1427
1863
|
* Returns a list of supported languages for translation.
|
|
1864
|
+
* @example
|
|
1865
|
+
* ```js
|
|
1866
|
+
* // Before running the sample:
|
|
1867
|
+
* // - Enable the API at:
|
|
1868
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1869
|
+
* // - Login into gcloud by running:
|
|
1870
|
+
* // ```sh
|
|
1871
|
+
* // $ gcloud auth application-default login
|
|
1872
|
+
* // ```
|
|
1873
|
+
* // - Install the npm module by running:
|
|
1874
|
+
* // ```sh
|
|
1875
|
+
* // $ npm install googleapis
|
|
1876
|
+
* // ```
|
|
1877
|
+
*
|
|
1878
|
+
* const {google} = require('googleapis');
|
|
1879
|
+
* const translate = google.translate('v3beta1');
|
|
1880
|
+
*
|
|
1881
|
+
* async function main() {
|
|
1882
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1883
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1884
|
+
* scopes: [
|
|
1885
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1886
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1887
|
+
* ],
|
|
1888
|
+
* });
|
|
1889
|
+
*
|
|
1890
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1891
|
+
* const authClient = await auth.getClient();
|
|
1892
|
+
* google.options({auth: authClient});
|
|
1893
|
+
*
|
|
1894
|
+
* // Do the magic
|
|
1895
|
+
* const res = await translate.projects.locations.getSupportedLanguages({
|
|
1896
|
+
* // 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.
|
|
1897
|
+
* displayLanguageCode: 'placeholder-value',
|
|
1898
|
+
* // 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.
|
|
1899
|
+
* model: 'placeholder-value',
|
|
1900
|
+
* // 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.
|
|
1901
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
1902
|
+
* });
|
|
1903
|
+
* console.log(res.data);
|
|
1904
|
+
*
|
|
1905
|
+
* // Example response
|
|
1906
|
+
* // {
|
|
1907
|
+
* // "languages": []
|
|
1908
|
+
* // }
|
|
1909
|
+
* }
|
|
1910
|
+
*
|
|
1911
|
+
* main().catch(e => {
|
|
1912
|
+
* console.error(e);
|
|
1913
|
+
* throw e;
|
|
1914
|
+
* });
|
|
1915
|
+
*
|
|
1916
|
+
* ```
|
|
1428
1917
|
*
|
|
1429
1918
|
* @param params - Parameters for request
|
|
1430
1919
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1434,11 +1923,11 @@ export namespace translate_v3beta1 {
|
|
|
1434
1923
|
getSupportedLanguages(
|
|
1435
1924
|
params: Params$Resource$Projects$Locations$Getsupportedlanguages,
|
|
1436
1925
|
options: StreamMethodOptions
|
|
1437
|
-
):
|
|
1926
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1438
1927
|
getSupportedLanguages(
|
|
1439
1928
|
params?: Params$Resource$Projects$Locations$Getsupportedlanguages,
|
|
1440
1929
|
options?: MethodOptions
|
|
1441
|
-
):
|
|
1930
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$SupportedLanguages>>;
|
|
1442
1931
|
getSupportedLanguages(
|
|
1443
1932
|
params: Params$Resource$Projects$Locations$Getsupportedlanguages,
|
|
1444
1933
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1471,8 +1960,8 @@ export namespace translate_v3beta1 {
|
|
|
1471
1960
|
| BodyResponseCallback<Readable>
|
|
1472
1961
|
):
|
|
1473
1962
|
| void
|
|
1474
|
-
|
|
|
1475
|
-
|
|
|
1963
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$SupportedLanguages>>
|
|
1964
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1476
1965
|
let params = (paramsOrCallback ||
|
|
1477
1966
|
{}) as Params$Resource$Projects$Locations$Getsupportedlanguages;
|
|
1478
1967
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1518,6 +2007,64 @@ export namespace translate_v3beta1 {
|
|
|
1518
2007
|
|
|
1519
2008
|
/**
|
|
1520
2009
|
* Lists information about the supported locations for this service.
|
|
2010
|
+
* @example
|
|
2011
|
+
* ```js
|
|
2012
|
+
* // Before running the sample:
|
|
2013
|
+
* // - Enable the API at:
|
|
2014
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2015
|
+
* // - Login into gcloud by running:
|
|
2016
|
+
* // ```sh
|
|
2017
|
+
* // $ gcloud auth application-default login
|
|
2018
|
+
* // ```
|
|
2019
|
+
* // - Install the npm module by running:
|
|
2020
|
+
* // ```sh
|
|
2021
|
+
* // $ npm install googleapis
|
|
2022
|
+
* // ```
|
|
2023
|
+
*
|
|
2024
|
+
* const {google} = require('googleapis');
|
|
2025
|
+
* const translate = google.translate('v3beta1');
|
|
2026
|
+
*
|
|
2027
|
+
* async function main() {
|
|
2028
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2029
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2030
|
+
* scopes: [
|
|
2031
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2032
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2033
|
+
* ],
|
|
2034
|
+
* });
|
|
2035
|
+
*
|
|
2036
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2037
|
+
* const authClient = await auth.getClient();
|
|
2038
|
+
* google.options({auth: authClient});
|
|
2039
|
+
*
|
|
2040
|
+
* // Do the magic
|
|
2041
|
+
* const res = await translate.projects.locations.list({
|
|
2042
|
+
* // Optional. A list of extra location types that should be used as conditions for controlling the visibility of the locations.
|
|
2043
|
+
* extraLocationTypes: 'placeholder-value',
|
|
2044
|
+
* // 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).
|
|
2045
|
+
* filter: 'placeholder-value',
|
|
2046
|
+
* // The resource that owns the locations collection, if applicable.
|
|
2047
|
+
* name: 'projects/my-project',
|
|
2048
|
+
* // The maximum number of results to return. If not set, the service selects a default.
|
|
2049
|
+
* pageSize: 'placeholder-value',
|
|
2050
|
+
* // A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
|
|
2051
|
+
* pageToken: 'placeholder-value',
|
|
2052
|
+
* });
|
|
2053
|
+
* console.log(res.data);
|
|
2054
|
+
*
|
|
2055
|
+
* // Example response
|
|
2056
|
+
* // {
|
|
2057
|
+
* // "locations": [],
|
|
2058
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
2059
|
+
* // }
|
|
2060
|
+
* }
|
|
2061
|
+
*
|
|
2062
|
+
* main().catch(e => {
|
|
2063
|
+
* console.error(e);
|
|
2064
|
+
* throw e;
|
|
2065
|
+
* });
|
|
2066
|
+
*
|
|
2067
|
+
* ```
|
|
1521
2068
|
*
|
|
1522
2069
|
* @param params - Parameters for request
|
|
1523
2070
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1527,11 +2074,11 @@ export namespace translate_v3beta1 {
|
|
|
1527
2074
|
list(
|
|
1528
2075
|
params: Params$Resource$Projects$Locations$List,
|
|
1529
2076
|
options: StreamMethodOptions
|
|
1530
|
-
):
|
|
2077
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1531
2078
|
list(
|
|
1532
2079
|
params?: Params$Resource$Projects$Locations$List,
|
|
1533
2080
|
options?: MethodOptions
|
|
1534
|
-
):
|
|
2081
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$ListLocationsResponse>>;
|
|
1535
2082
|
list(
|
|
1536
2083
|
params: Params$Resource$Projects$Locations$List,
|
|
1537
2084
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1564,8 +2111,8 @@ export namespace translate_v3beta1 {
|
|
|
1564
2111
|
| BodyResponseCallback<Readable>
|
|
1565
2112
|
):
|
|
1566
2113
|
| void
|
|
1567
|
-
|
|
|
1568
|
-
|
|
|
2114
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$ListLocationsResponse>>
|
|
2115
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1569
2116
|
let params = (paramsOrCallback ||
|
|
1570
2117
|
{}) as Params$Resource$Projects$Locations$List;
|
|
1571
2118
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1611,6 +2158,76 @@ export namespace translate_v3beta1 {
|
|
|
1611
2158
|
|
|
1612
2159
|
/**
|
|
1613
2160
|
* Translates documents in synchronous mode.
|
|
2161
|
+
* @example
|
|
2162
|
+
* ```js
|
|
2163
|
+
* // Before running the sample:
|
|
2164
|
+
* // - Enable the API at:
|
|
2165
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2166
|
+
* // - Login into gcloud by running:
|
|
2167
|
+
* // ```sh
|
|
2168
|
+
* // $ gcloud auth application-default login
|
|
2169
|
+
* // ```
|
|
2170
|
+
* // - Install the npm module by running:
|
|
2171
|
+
* // ```sh
|
|
2172
|
+
* // $ npm install googleapis
|
|
2173
|
+
* // ```
|
|
2174
|
+
*
|
|
2175
|
+
* const {google} = require('googleapis');
|
|
2176
|
+
* const translate = google.translate('v3beta1');
|
|
2177
|
+
*
|
|
2178
|
+
* async function main() {
|
|
2179
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2180
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2181
|
+
* scopes: [
|
|
2182
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2183
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2184
|
+
* ],
|
|
2185
|
+
* });
|
|
2186
|
+
*
|
|
2187
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2188
|
+
* const authClient = await auth.getClient();
|
|
2189
|
+
* google.options({auth: authClient});
|
|
2190
|
+
*
|
|
2191
|
+
* // Do the magic
|
|
2192
|
+
* const res = await translate.projects.locations.translateDocument({
|
|
2193
|
+
* // 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.
|
|
2194
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2195
|
+
*
|
|
2196
|
+
* // Request body metadata
|
|
2197
|
+
* requestBody: {
|
|
2198
|
+
* // request body parameters
|
|
2199
|
+
* // {
|
|
2200
|
+
* // "customizedAttribution": "my_customizedAttribution",
|
|
2201
|
+
* // "documentInputConfig": {},
|
|
2202
|
+
* // "documentOutputConfig": {},
|
|
2203
|
+
* // "enableRotationCorrection": false,
|
|
2204
|
+
* // "enableShadowRemovalNativePdf": false,
|
|
2205
|
+
* // "glossaryConfig": {},
|
|
2206
|
+
* // "isTranslateNativePdfOnly": false,
|
|
2207
|
+
* // "labels": {},
|
|
2208
|
+
* // "model": "my_model",
|
|
2209
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
2210
|
+
* // "targetLanguageCode": "my_targetLanguageCode"
|
|
2211
|
+
* // }
|
|
2212
|
+
* },
|
|
2213
|
+
* });
|
|
2214
|
+
* console.log(res.data);
|
|
2215
|
+
*
|
|
2216
|
+
* // Example response
|
|
2217
|
+
* // {
|
|
2218
|
+
* // "documentTranslation": {},
|
|
2219
|
+
* // "glossaryConfig": {},
|
|
2220
|
+
* // "glossaryDocumentTranslation": {},
|
|
2221
|
+
* // "model": "my_model"
|
|
2222
|
+
* // }
|
|
2223
|
+
* }
|
|
2224
|
+
*
|
|
2225
|
+
* main().catch(e => {
|
|
2226
|
+
* console.error(e);
|
|
2227
|
+
* throw e;
|
|
2228
|
+
* });
|
|
2229
|
+
*
|
|
2230
|
+
* ```
|
|
1614
2231
|
*
|
|
1615
2232
|
* @param params - Parameters for request
|
|
1616
2233
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1620,11 +2237,11 @@ export namespace translate_v3beta1 {
|
|
|
1620
2237
|
translateDocument(
|
|
1621
2238
|
params: Params$Resource$Projects$Locations$Translatedocument,
|
|
1622
2239
|
options: StreamMethodOptions
|
|
1623
|
-
):
|
|
2240
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1624
2241
|
translateDocument(
|
|
1625
2242
|
params?: Params$Resource$Projects$Locations$Translatedocument,
|
|
1626
2243
|
options?: MethodOptions
|
|
1627
|
-
):
|
|
2244
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$TranslateDocumentResponse>>;
|
|
1628
2245
|
translateDocument(
|
|
1629
2246
|
params: Params$Resource$Projects$Locations$Translatedocument,
|
|
1630
2247
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1659,8 +2276,8 @@ export namespace translate_v3beta1 {
|
|
|
1659
2276
|
| BodyResponseCallback<Readable>
|
|
1660
2277
|
):
|
|
1661
2278
|
| void
|
|
1662
|
-
|
|
|
1663
|
-
|
|
|
2279
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$TranslateDocumentResponse>>
|
|
2280
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1664
2281
|
let params = (paramsOrCallback ||
|
|
1665
2282
|
{}) as Params$Resource$Projects$Locations$Translatedocument;
|
|
1666
2283
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1706,6 +2323,70 @@ export namespace translate_v3beta1 {
|
|
|
1706
2323
|
|
|
1707
2324
|
/**
|
|
1708
2325
|
* Translates input text and returns translated text.
|
|
2326
|
+
* @example
|
|
2327
|
+
* ```js
|
|
2328
|
+
* // Before running the sample:
|
|
2329
|
+
* // - Enable the API at:
|
|
2330
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2331
|
+
* // - Login into gcloud by running:
|
|
2332
|
+
* // ```sh
|
|
2333
|
+
* // $ gcloud auth application-default login
|
|
2334
|
+
* // ```
|
|
2335
|
+
* // - Install the npm module by running:
|
|
2336
|
+
* // ```sh
|
|
2337
|
+
* // $ npm install googleapis
|
|
2338
|
+
* // ```
|
|
2339
|
+
*
|
|
2340
|
+
* const {google} = require('googleapis');
|
|
2341
|
+
* const translate = google.translate('v3beta1');
|
|
2342
|
+
*
|
|
2343
|
+
* async function main() {
|
|
2344
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2345
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2346
|
+
* scopes: [
|
|
2347
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2348
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2349
|
+
* ],
|
|
2350
|
+
* });
|
|
2351
|
+
*
|
|
2352
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2353
|
+
* const authClient = await auth.getClient();
|
|
2354
|
+
* google.options({auth: authClient});
|
|
2355
|
+
*
|
|
2356
|
+
* // Do the magic
|
|
2357
|
+
* const res = await translate.projects.locations.translateText({
|
|
2358
|
+
* // 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.
|
|
2359
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2360
|
+
*
|
|
2361
|
+
* // Request body metadata
|
|
2362
|
+
* requestBody: {
|
|
2363
|
+
* // request body parameters
|
|
2364
|
+
* // {
|
|
2365
|
+
* // "contents": [],
|
|
2366
|
+
* // "glossaryConfig": {},
|
|
2367
|
+
* // "labels": {},
|
|
2368
|
+
* // "mimeType": "my_mimeType",
|
|
2369
|
+
* // "model": "my_model",
|
|
2370
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
2371
|
+
* // "targetLanguageCode": "my_targetLanguageCode"
|
|
2372
|
+
* // }
|
|
2373
|
+
* },
|
|
2374
|
+
* });
|
|
2375
|
+
* console.log(res.data);
|
|
2376
|
+
*
|
|
2377
|
+
* // Example response
|
|
2378
|
+
* // {
|
|
2379
|
+
* // "glossaryTranslations": [],
|
|
2380
|
+
* // "translations": []
|
|
2381
|
+
* // }
|
|
2382
|
+
* }
|
|
2383
|
+
*
|
|
2384
|
+
* main().catch(e => {
|
|
2385
|
+
* console.error(e);
|
|
2386
|
+
* throw e;
|
|
2387
|
+
* });
|
|
2388
|
+
*
|
|
2389
|
+
* ```
|
|
1709
2390
|
*
|
|
1710
2391
|
* @param params - Parameters for request
|
|
1711
2392
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1715,11 +2396,11 @@ export namespace translate_v3beta1 {
|
|
|
1715
2396
|
translateText(
|
|
1716
2397
|
params: Params$Resource$Projects$Locations$Translatetext,
|
|
1717
2398
|
options: StreamMethodOptions
|
|
1718
|
-
):
|
|
2399
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1719
2400
|
translateText(
|
|
1720
2401
|
params?: Params$Resource$Projects$Locations$Translatetext,
|
|
1721
2402
|
options?: MethodOptions
|
|
1722
|
-
):
|
|
2403
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$TranslateTextResponse>>;
|
|
1723
2404
|
translateText(
|
|
1724
2405
|
params: Params$Resource$Projects$Locations$Translatetext,
|
|
1725
2406
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1754,8 +2435,8 @@ export namespace translate_v3beta1 {
|
|
|
1754
2435
|
| BodyResponseCallback<Readable>
|
|
1755
2436
|
):
|
|
1756
2437
|
| void
|
|
1757
|
-
|
|
|
1758
|
-
|
|
|
2438
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$TranslateTextResponse>>
|
|
2439
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1759
2440
|
let params = (paramsOrCallback ||
|
|
1760
2441
|
{}) as Params$Resource$Projects$Locations$Translatetext;
|
|
1761
2442
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -1914,6 +2595,73 @@ export namespace translate_v3beta1 {
|
|
|
1914
2595
|
|
|
1915
2596
|
/**
|
|
1916
2597
|
* Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
|
|
2598
|
+
* @example
|
|
2599
|
+
* ```js
|
|
2600
|
+
* // Before running the sample:
|
|
2601
|
+
* // - Enable the API at:
|
|
2602
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2603
|
+
* // - Login into gcloud by running:
|
|
2604
|
+
* // ```sh
|
|
2605
|
+
* // $ gcloud auth application-default login
|
|
2606
|
+
* // ```
|
|
2607
|
+
* // - Install the npm module by running:
|
|
2608
|
+
* // ```sh
|
|
2609
|
+
* // $ npm install googleapis
|
|
2610
|
+
* // ```
|
|
2611
|
+
*
|
|
2612
|
+
* const {google} = require('googleapis');
|
|
2613
|
+
* const translate = google.translate('v3beta1');
|
|
2614
|
+
*
|
|
2615
|
+
* async function main() {
|
|
2616
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2617
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2618
|
+
* scopes: [
|
|
2619
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2620
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2621
|
+
* ],
|
|
2622
|
+
* });
|
|
2623
|
+
*
|
|
2624
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2625
|
+
* const authClient = await auth.getClient();
|
|
2626
|
+
* google.options({auth: authClient});
|
|
2627
|
+
*
|
|
2628
|
+
* // Do the magic
|
|
2629
|
+
* const res = await translate.projects.locations.glossaries.create({
|
|
2630
|
+
* // Required. The project name.
|
|
2631
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2632
|
+
*
|
|
2633
|
+
* // Request body metadata
|
|
2634
|
+
* requestBody: {
|
|
2635
|
+
* // request body parameters
|
|
2636
|
+
* // {
|
|
2637
|
+
* // "endTime": "my_endTime",
|
|
2638
|
+
* // "entryCount": 0,
|
|
2639
|
+
* // "inputConfig": {},
|
|
2640
|
+
* // "languageCodesSet": {},
|
|
2641
|
+
* // "languagePair": {},
|
|
2642
|
+
* // "name": "my_name",
|
|
2643
|
+
* // "submitTime": "my_submitTime"
|
|
2644
|
+
* // }
|
|
2645
|
+
* },
|
|
2646
|
+
* });
|
|
2647
|
+
* console.log(res.data);
|
|
2648
|
+
*
|
|
2649
|
+
* // Example response
|
|
2650
|
+
* // {
|
|
2651
|
+
* // "done": false,
|
|
2652
|
+
* // "error": {},
|
|
2653
|
+
* // "metadata": {},
|
|
2654
|
+
* // "name": "my_name",
|
|
2655
|
+
* // "response": {}
|
|
2656
|
+
* // }
|
|
2657
|
+
* }
|
|
2658
|
+
*
|
|
2659
|
+
* main().catch(e => {
|
|
2660
|
+
* console.error(e);
|
|
2661
|
+
* throw e;
|
|
2662
|
+
* });
|
|
2663
|
+
*
|
|
2664
|
+
* ```
|
|
1917
2665
|
*
|
|
1918
2666
|
* @param params - Parameters for request
|
|
1919
2667
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1923,11 +2671,11 @@ export namespace translate_v3beta1 {
|
|
|
1923
2671
|
create(
|
|
1924
2672
|
params: Params$Resource$Projects$Locations$Glossaries$Create,
|
|
1925
2673
|
options: StreamMethodOptions
|
|
1926
|
-
):
|
|
2674
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
1927
2675
|
create(
|
|
1928
2676
|
params?: Params$Resource$Projects$Locations$Glossaries$Create,
|
|
1929
2677
|
options?: MethodOptions
|
|
1930
|
-
):
|
|
2678
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Operation>>;
|
|
1931
2679
|
create(
|
|
1932
2680
|
params: Params$Resource$Projects$Locations$Glossaries$Create,
|
|
1933
2681
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -1956,7 +2704,10 @@ export namespace translate_v3beta1 {
|
|
|
1956
2704
|
callback?:
|
|
1957
2705
|
| BodyResponseCallback<Schema$Operation>
|
|
1958
2706
|
| BodyResponseCallback<Readable>
|
|
1959
|
-
):
|
|
2707
|
+
):
|
|
2708
|
+
| void
|
|
2709
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Operation>>
|
|
2710
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
1960
2711
|
let params = (paramsOrCallback ||
|
|
1961
2712
|
{}) as Params$Resource$Projects$Locations$Glossaries$Create;
|
|
1962
2713
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -2002,6 +2753,59 @@ export namespace translate_v3beta1 {
|
|
|
2002
2753
|
|
|
2003
2754
|
/**
|
|
2004
2755
|
* Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
|
|
2756
|
+
* @example
|
|
2757
|
+
* ```js
|
|
2758
|
+
* // Before running the sample:
|
|
2759
|
+
* // - Enable the API at:
|
|
2760
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2761
|
+
* // - Login into gcloud by running:
|
|
2762
|
+
* // ```sh
|
|
2763
|
+
* // $ gcloud auth application-default login
|
|
2764
|
+
* // ```
|
|
2765
|
+
* // - Install the npm module by running:
|
|
2766
|
+
* // ```sh
|
|
2767
|
+
* // $ npm install googleapis
|
|
2768
|
+
* // ```
|
|
2769
|
+
*
|
|
2770
|
+
* const {google} = require('googleapis');
|
|
2771
|
+
* const translate = google.translate('v3beta1');
|
|
2772
|
+
*
|
|
2773
|
+
* async function main() {
|
|
2774
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2775
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2776
|
+
* scopes: [
|
|
2777
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2778
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2779
|
+
* ],
|
|
2780
|
+
* });
|
|
2781
|
+
*
|
|
2782
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2783
|
+
* const authClient = await auth.getClient();
|
|
2784
|
+
* google.options({auth: authClient});
|
|
2785
|
+
*
|
|
2786
|
+
* // Do the magic
|
|
2787
|
+
* const res = await translate.projects.locations.glossaries.delete({
|
|
2788
|
+
* // Required. The name of the glossary to delete.
|
|
2789
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
2790
|
+
* });
|
|
2791
|
+
* console.log(res.data);
|
|
2792
|
+
*
|
|
2793
|
+
* // Example response
|
|
2794
|
+
* // {
|
|
2795
|
+
* // "done": false,
|
|
2796
|
+
* // "error": {},
|
|
2797
|
+
* // "metadata": {},
|
|
2798
|
+
* // "name": "my_name",
|
|
2799
|
+
* // "response": {}
|
|
2800
|
+
* // }
|
|
2801
|
+
* }
|
|
2802
|
+
*
|
|
2803
|
+
* main().catch(e => {
|
|
2804
|
+
* console.error(e);
|
|
2805
|
+
* throw e;
|
|
2806
|
+
* });
|
|
2807
|
+
*
|
|
2808
|
+
* ```
|
|
2005
2809
|
*
|
|
2006
2810
|
* @param params - Parameters for request
|
|
2007
2811
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2011,11 +2815,11 @@ export namespace translate_v3beta1 {
|
|
|
2011
2815
|
delete(
|
|
2012
2816
|
params: Params$Resource$Projects$Locations$Glossaries$Delete,
|
|
2013
2817
|
options: StreamMethodOptions
|
|
2014
|
-
):
|
|
2818
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2015
2819
|
delete(
|
|
2016
2820
|
params?: Params$Resource$Projects$Locations$Glossaries$Delete,
|
|
2017
2821
|
options?: MethodOptions
|
|
2018
|
-
):
|
|
2822
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Operation>>;
|
|
2019
2823
|
delete(
|
|
2020
2824
|
params: Params$Resource$Projects$Locations$Glossaries$Delete,
|
|
2021
2825
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -2044,7 +2848,10 @@ export namespace translate_v3beta1 {
|
|
|
2044
2848
|
callback?:
|
|
2045
2849
|
| BodyResponseCallback<Schema$Operation>
|
|
2046
2850
|
| BodyResponseCallback<Readable>
|
|
2047
|
-
):
|
|
2851
|
+
):
|
|
2852
|
+
| void
|
|
2853
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Operation>>
|
|
2854
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2048
2855
|
let params = (paramsOrCallback ||
|
|
2049
2856
|
{}) as Params$Resource$Projects$Locations$Glossaries$Delete;
|
|
2050
2857
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -2087,6 +2894,61 @@ export namespace translate_v3beta1 {
|
|
|
2087
2894
|
|
|
2088
2895
|
/**
|
|
2089
2896
|
* Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
|
|
2897
|
+
* @example
|
|
2898
|
+
* ```js
|
|
2899
|
+
* // Before running the sample:
|
|
2900
|
+
* // - Enable the API at:
|
|
2901
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2902
|
+
* // - Login into gcloud by running:
|
|
2903
|
+
* // ```sh
|
|
2904
|
+
* // $ gcloud auth application-default login
|
|
2905
|
+
* // ```
|
|
2906
|
+
* // - Install the npm module by running:
|
|
2907
|
+
* // ```sh
|
|
2908
|
+
* // $ npm install googleapis
|
|
2909
|
+
* // ```
|
|
2910
|
+
*
|
|
2911
|
+
* const {google} = require('googleapis');
|
|
2912
|
+
* const translate = google.translate('v3beta1');
|
|
2913
|
+
*
|
|
2914
|
+
* async function main() {
|
|
2915
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2916
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2917
|
+
* scopes: [
|
|
2918
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2919
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2920
|
+
* ],
|
|
2921
|
+
* });
|
|
2922
|
+
*
|
|
2923
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2924
|
+
* const authClient = await auth.getClient();
|
|
2925
|
+
* google.options({auth: authClient});
|
|
2926
|
+
*
|
|
2927
|
+
* // Do the magic
|
|
2928
|
+
* const res = await translate.projects.locations.glossaries.get({
|
|
2929
|
+
* // Required. The name of the glossary to retrieve.
|
|
2930
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
2931
|
+
* });
|
|
2932
|
+
* console.log(res.data);
|
|
2933
|
+
*
|
|
2934
|
+
* // Example response
|
|
2935
|
+
* // {
|
|
2936
|
+
* // "endTime": "my_endTime",
|
|
2937
|
+
* // "entryCount": 0,
|
|
2938
|
+
* // "inputConfig": {},
|
|
2939
|
+
* // "languageCodesSet": {},
|
|
2940
|
+
* // "languagePair": {},
|
|
2941
|
+
* // "name": "my_name",
|
|
2942
|
+
* // "submitTime": "my_submitTime"
|
|
2943
|
+
* // }
|
|
2944
|
+
* }
|
|
2945
|
+
*
|
|
2946
|
+
* main().catch(e => {
|
|
2947
|
+
* console.error(e);
|
|
2948
|
+
* throw e;
|
|
2949
|
+
* });
|
|
2950
|
+
*
|
|
2951
|
+
* ```
|
|
2090
2952
|
*
|
|
2091
2953
|
* @param params - Parameters for request
|
|
2092
2954
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2096,11 +2958,11 @@ export namespace translate_v3beta1 {
|
|
|
2096
2958
|
get(
|
|
2097
2959
|
params: Params$Resource$Projects$Locations$Glossaries$Get,
|
|
2098
2960
|
options: StreamMethodOptions
|
|
2099
|
-
):
|
|
2961
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2100
2962
|
get(
|
|
2101
2963
|
params?: Params$Resource$Projects$Locations$Glossaries$Get,
|
|
2102
2964
|
options?: MethodOptions
|
|
2103
|
-
):
|
|
2965
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Glossary>>;
|
|
2104
2966
|
get(
|
|
2105
2967
|
params: Params$Resource$Projects$Locations$Glossaries$Get,
|
|
2106
2968
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -2129,7 +2991,10 @@ export namespace translate_v3beta1 {
|
|
|
2129
2991
|
callback?:
|
|
2130
2992
|
| BodyResponseCallback<Schema$Glossary>
|
|
2131
2993
|
| BodyResponseCallback<Readable>
|
|
2132
|
-
):
|
|
2994
|
+
):
|
|
2995
|
+
| void
|
|
2996
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Glossary>>
|
|
2997
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2133
2998
|
let params = (paramsOrCallback ||
|
|
2134
2999
|
{}) as Params$Resource$Projects$Locations$Glossaries$Get;
|
|
2135
3000
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -2172,6 +3037,62 @@ export namespace translate_v3beta1 {
|
|
|
2172
3037
|
|
|
2173
3038
|
/**
|
|
2174
3039
|
* Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
|
|
3040
|
+
* @example
|
|
3041
|
+
* ```js
|
|
3042
|
+
* // Before running the sample:
|
|
3043
|
+
* // - Enable the API at:
|
|
3044
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3045
|
+
* // - Login into gcloud by running:
|
|
3046
|
+
* // ```sh
|
|
3047
|
+
* // $ gcloud auth application-default login
|
|
3048
|
+
* // ```
|
|
3049
|
+
* // - Install the npm module by running:
|
|
3050
|
+
* // ```sh
|
|
3051
|
+
* // $ npm install googleapis
|
|
3052
|
+
* // ```
|
|
3053
|
+
*
|
|
3054
|
+
* const {google} = require('googleapis');
|
|
3055
|
+
* const translate = google.translate('v3beta1');
|
|
3056
|
+
*
|
|
3057
|
+
* async function main() {
|
|
3058
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3059
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3060
|
+
* scopes: [
|
|
3061
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3062
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3063
|
+
* ],
|
|
3064
|
+
* });
|
|
3065
|
+
*
|
|
3066
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3067
|
+
* const authClient = await auth.getClient();
|
|
3068
|
+
* google.options({auth: authClient});
|
|
3069
|
+
*
|
|
3070
|
+
* // Do the magic
|
|
3071
|
+
* const res = await translate.projects.locations.glossaries.list({
|
|
3072
|
+
* // 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.
|
|
3073
|
+
* filter: 'placeholder-value',
|
|
3074
|
+
* // Optional. Requested page size. The server may return fewer glossaries than requested. If unspecified, the server picks an appropriate default.
|
|
3075
|
+
* pageSize: 'placeholder-value',
|
|
3076
|
+
* // 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.
|
|
3077
|
+
* pageToken: 'placeholder-value',
|
|
3078
|
+
* // Required. The name of the project from which to list all of the glossaries.
|
|
3079
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
3080
|
+
* });
|
|
3081
|
+
* console.log(res.data);
|
|
3082
|
+
*
|
|
3083
|
+
* // Example response
|
|
3084
|
+
* // {
|
|
3085
|
+
* // "glossaries": [],
|
|
3086
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
3087
|
+
* // }
|
|
3088
|
+
* }
|
|
3089
|
+
*
|
|
3090
|
+
* main().catch(e => {
|
|
3091
|
+
* console.error(e);
|
|
3092
|
+
* throw e;
|
|
3093
|
+
* });
|
|
3094
|
+
*
|
|
3095
|
+
* ```
|
|
2175
3096
|
*
|
|
2176
3097
|
* @param params - Parameters for request
|
|
2177
3098
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2181,11 +3102,11 @@ export namespace translate_v3beta1 {
|
|
|
2181
3102
|
list(
|
|
2182
3103
|
params: Params$Resource$Projects$Locations$Glossaries$List,
|
|
2183
3104
|
options: StreamMethodOptions
|
|
2184
|
-
):
|
|
3105
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2185
3106
|
list(
|
|
2186
3107
|
params?: Params$Resource$Projects$Locations$Glossaries$List,
|
|
2187
3108
|
options?: MethodOptions
|
|
2188
|
-
):
|
|
3109
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$ListGlossariesResponse>>;
|
|
2189
3110
|
list(
|
|
2190
3111
|
params: Params$Resource$Projects$Locations$Glossaries$List,
|
|
2191
3112
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -2218,8 +3139,8 @@ export namespace translate_v3beta1 {
|
|
|
2218
3139
|
| BodyResponseCallback<Readable>
|
|
2219
3140
|
):
|
|
2220
3141
|
| void
|
|
2221
|
-
|
|
|
2222
|
-
|
|
|
3142
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$ListGlossariesResponse>>
|
|
3143
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2223
3144
|
let params = (paramsOrCallback ||
|
|
2224
3145
|
{}) as Params$Resource$Projects$Locations$Glossaries$List;
|
|
2225
3146
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -2318,6 +3239,59 @@ export namespace translate_v3beta1 {
|
|
|
2318
3239
|
|
|
2319
3240
|
/**
|
|
2320
3241
|
* 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`.
|
|
3242
|
+
* @example
|
|
3243
|
+
* ```js
|
|
3244
|
+
* // Before running the sample:
|
|
3245
|
+
* // - Enable the API at:
|
|
3246
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3247
|
+
* // - Login into gcloud by running:
|
|
3248
|
+
* // ```sh
|
|
3249
|
+
* // $ gcloud auth application-default login
|
|
3250
|
+
* // ```
|
|
3251
|
+
* // - Install the npm module by running:
|
|
3252
|
+
* // ```sh
|
|
3253
|
+
* // $ npm install googleapis
|
|
3254
|
+
* // ```
|
|
3255
|
+
*
|
|
3256
|
+
* const {google} = require('googleapis');
|
|
3257
|
+
* const translate = google.translate('v3beta1');
|
|
3258
|
+
*
|
|
3259
|
+
* async function main() {
|
|
3260
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3261
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3262
|
+
* scopes: [
|
|
3263
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3264
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3265
|
+
* ],
|
|
3266
|
+
* });
|
|
3267
|
+
*
|
|
3268
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3269
|
+
* const authClient = await auth.getClient();
|
|
3270
|
+
* google.options({auth: authClient});
|
|
3271
|
+
*
|
|
3272
|
+
* // Do the magic
|
|
3273
|
+
* const res = await translate.projects.locations.operations.cancel({
|
|
3274
|
+
* // The name of the operation resource to be cancelled.
|
|
3275
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
3276
|
+
*
|
|
3277
|
+
* // Request body metadata
|
|
3278
|
+
* requestBody: {
|
|
3279
|
+
* // request body parameters
|
|
3280
|
+
* // {}
|
|
3281
|
+
* },
|
|
3282
|
+
* });
|
|
3283
|
+
* console.log(res.data);
|
|
3284
|
+
*
|
|
3285
|
+
* // Example response
|
|
3286
|
+
* // {}
|
|
3287
|
+
* }
|
|
3288
|
+
*
|
|
3289
|
+
* main().catch(e => {
|
|
3290
|
+
* console.error(e);
|
|
3291
|
+
* throw e;
|
|
3292
|
+
* });
|
|
3293
|
+
*
|
|
3294
|
+
* ```
|
|
2321
3295
|
*
|
|
2322
3296
|
* @param params - Parameters for request
|
|
2323
3297
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2327,11 +3301,11 @@ export namespace translate_v3beta1 {
|
|
|
2327
3301
|
cancel(
|
|
2328
3302
|
params: Params$Resource$Projects$Locations$Operations$Cancel,
|
|
2329
3303
|
options: StreamMethodOptions
|
|
2330
|
-
):
|
|
3304
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2331
3305
|
cancel(
|
|
2332
3306
|
params?: Params$Resource$Projects$Locations$Operations$Cancel,
|
|
2333
3307
|
options?: MethodOptions
|
|
2334
|
-
):
|
|
3308
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Empty>>;
|
|
2335
3309
|
cancel(
|
|
2336
3310
|
params: Params$Resource$Projects$Locations$Operations$Cancel,
|
|
2337
3311
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -2360,7 +3334,10 @@ export namespace translate_v3beta1 {
|
|
|
2360
3334
|
callback?:
|
|
2361
3335
|
| BodyResponseCallback<Schema$Empty>
|
|
2362
3336
|
| BodyResponseCallback<Readable>
|
|
2363
|
-
):
|
|
3337
|
+
):
|
|
3338
|
+
| void
|
|
3339
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Empty>>
|
|
3340
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2364
3341
|
let params = (paramsOrCallback ||
|
|
2365
3342
|
{}) as Params$Resource$Projects$Locations$Operations$Cancel;
|
|
2366
3343
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -2406,6 +3383,53 @@ export namespace translate_v3beta1 {
|
|
|
2406
3383
|
|
|
2407
3384
|
/**
|
|
2408
3385
|
* 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`.
|
|
3386
|
+
* @example
|
|
3387
|
+
* ```js
|
|
3388
|
+
* // Before running the sample:
|
|
3389
|
+
* // - Enable the API at:
|
|
3390
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3391
|
+
* // - Login into gcloud by running:
|
|
3392
|
+
* // ```sh
|
|
3393
|
+
* // $ gcloud auth application-default login
|
|
3394
|
+
* // ```
|
|
3395
|
+
* // - Install the npm module by running:
|
|
3396
|
+
* // ```sh
|
|
3397
|
+
* // $ npm install googleapis
|
|
3398
|
+
* // ```
|
|
3399
|
+
*
|
|
3400
|
+
* const {google} = require('googleapis');
|
|
3401
|
+
* const translate = google.translate('v3beta1');
|
|
3402
|
+
*
|
|
3403
|
+
* async function main() {
|
|
3404
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3405
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3406
|
+
* scopes: [
|
|
3407
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3408
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3409
|
+
* ],
|
|
3410
|
+
* });
|
|
3411
|
+
*
|
|
3412
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3413
|
+
* const authClient = await auth.getClient();
|
|
3414
|
+
* google.options({auth: authClient});
|
|
3415
|
+
*
|
|
3416
|
+
* // Do the magic
|
|
3417
|
+
* const res = await translate.projects.locations.operations.delete({
|
|
3418
|
+
* // The name of the operation resource to be deleted.
|
|
3419
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
3420
|
+
* });
|
|
3421
|
+
* console.log(res.data);
|
|
3422
|
+
*
|
|
3423
|
+
* // Example response
|
|
3424
|
+
* // {}
|
|
3425
|
+
* }
|
|
3426
|
+
*
|
|
3427
|
+
* main().catch(e => {
|
|
3428
|
+
* console.error(e);
|
|
3429
|
+
* throw e;
|
|
3430
|
+
* });
|
|
3431
|
+
*
|
|
3432
|
+
* ```
|
|
2409
3433
|
*
|
|
2410
3434
|
* @param params - Parameters for request
|
|
2411
3435
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2415,11 +3439,11 @@ export namespace translate_v3beta1 {
|
|
|
2415
3439
|
delete(
|
|
2416
3440
|
params: Params$Resource$Projects$Locations$Operations$Delete,
|
|
2417
3441
|
options: StreamMethodOptions
|
|
2418
|
-
):
|
|
3442
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2419
3443
|
delete(
|
|
2420
3444
|
params?: Params$Resource$Projects$Locations$Operations$Delete,
|
|
2421
3445
|
options?: MethodOptions
|
|
2422
|
-
):
|
|
3446
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Empty>>;
|
|
2423
3447
|
delete(
|
|
2424
3448
|
params: Params$Resource$Projects$Locations$Operations$Delete,
|
|
2425
3449
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -2448,7 +3472,10 @@ export namespace translate_v3beta1 {
|
|
|
2448
3472
|
callback?:
|
|
2449
3473
|
| BodyResponseCallback<Schema$Empty>
|
|
2450
3474
|
| BodyResponseCallback<Readable>
|
|
2451
|
-
):
|
|
3475
|
+
):
|
|
3476
|
+
| void
|
|
3477
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Empty>>
|
|
3478
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2452
3479
|
let params = (paramsOrCallback ||
|
|
2453
3480
|
{}) as Params$Resource$Projects$Locations$Operations$Delete;
|
|
2454
3481
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -2491,6 +3518,59 @@ export namespace translate_v3beta1 {
|
|
|
2491
3518
|
|
|
2492
3519
|
/**
|
|
2493
3520
|
* 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.
|
|
3521
|
+
* @example
|
|
3522
|
+
* ```js
|
|
3523
|
+
* // Before running the sample:
|
|
3524
|
+
* // - Enable the API at:
|
|
3525
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3526
|
+
* // - Login into gcloud by running:
|
|
3527
|
+
* // ```sh
|
|
3528
|
+
* // $ gcloud auth application-default login
|
|
3529
|
+
* // ```
|
|
3530
|
+
* // - Install the npm module by running:
|
|
3531
|
+
* // ```sh
|
|
3532
|
+
* // $ npm install googleapis
|
|
3533
|
+
* // ```
|
|
3534
|
+
*
|
|
3535
|
+
* const {google} = require('googleapis');
|
|
3536
|
+
* const translate = google.translate('v3beta1');
|
|
3537
|
+
*
|
|
3538
|
+
* async function main() {
|
|
3539
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3540
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3541
|
+
* scopes: [
|
|
3542
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3543
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3544
|
+
* ],
|
|
3545
|
+
* });
|
|
3546
|
+
*
|
|
3547
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3548
|
+
* const authClient = await auth.getClient();
|
|
3549
|
+
* google.options({auth: authClient});
|
|
3550
|
+
*
|
|
3551
|
+
* // Do the magic
|
|
3552
|
+
* const res = await translate.projects.locations.operations.get({
|
|
3553
|
+
* // The name of the operation resource.
|
|
3554
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
3555
|
+
* });
|
|
3556
|
+
* console.log(res.data);
|
|
3557
|
+
*
|
|
3558
|
+
* // Example response
|
|
3559
|
+
* // {
|
|
3560
|
+
* // "done": false,
|
|
3561
|
+
* // "error": {},
|
|
3562
|
+
* // "metadata": {},
|
|
3563
|
+
* // "name": "my_name",
|
|
3564
|
+
* // "response": {}
|
|
3565
|
+
* // }
|
|
3566
|
+
* }
|
|
3567
|
+
*
|
|
3568
|
+
* main().catch(e => {
|
|
3569
|
+
* console.error(e);
|
|
3570
|
+
* throw e;
|
|
3571
|
+
* });
|
|
3572
|
+
*
|
|
3573
|
+
* ```
|
|
2494
3574
|
*
|
|
2495
3575
|
* @param params - Parameters for request
|
|
2496
3576
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2500,11 +3580,11 @@ export namespace translate_v3beta1 {
|
|
|
2500
3580
|
get(
|
|
2501
3581
|
params: Params$Resource$Projects$Locations$Operations$Get,
|
|
2502
3582
|
options: StreamMethodOptions
|
|
2503
|
-
):
|
|
3583
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2504
3584
|
get(
|
|
2505
3585
|
params?: Params$Resource$Projects$Locations$Operations$Get,
|
|
2506
3586
|
options?: MethodOptions
|
|
2507
|
-
):
|
|
3587
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Operation>>;
|
|
2508
3588
|
get(
|
|
2509
3589
|
params: Params$Resource$Projects$Locations$Operations$Get,
|
|
2510
3590
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -2533,7 +3613,10 @@ export namespace translate_v3beta1 {
|
|
|
2533
3613
|
callback?:
|
|
2534
3614
|
| BodyResponseCallback<Schema$Operation>
|
|
2535
3615
|
| BodyResponseCallback<Readable>
|
|
2536
|
-
):
|
|
3616
|
+
):
|
|
3617
|
+
| void
|
|
3618
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Operation>>
|
|
3619
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2537
3620
|
let params = (paramsOrCallback ||
|
|
2538
3621
|
{}) as Params$Resource$Projects$Locations$Operations$Get;
|
|
2539
3622
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -2576,6 +3659,62 @@ export namespace translate_v3beta1 {
|
|
|
2576
3659
|
|
|
2577
3660
|
/**
|
|
2578
3661
|
* Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
|
|
3662
|
+
* @example
|
|
3663
|
+
* ```js
|
|
3664
|
+
* // Before running the sample:
|
|
3665
|
+
* // - Enable the API at:
|
|
3666
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3667
|
+
* // - Login into gcloud by running:
|
|
3668
|
+
* // ```sh
|
|
3669
|
+
* // $ gcloud auth application-default login
|
|
3670
|
+
* // ```
|
|
3671
|
+
* // - Install the npm module by running:
|
|
3672
|
+
* // ```sh
|
|
3673
|
+
* // $ npm install googleapis
|
|
3674
|
+
* // ```
|
|
3675
|
+
*
|
|
3676
|
+
* const {google} = require('googleapis');
|
|
3677
|
+
* const translate = google.translate('v3beta1');
|
|
3678
|
+
*
|
|
3679
|
+
* async function main() {
|
|
3680
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3681
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3682
|
+
* scopes: [
|
|
3683
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3684
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3685
|
+
* ],
|
|
3686
|
+
* });
|
|
3687
|
+
*
|
|
3688
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3689
|
+
* const authClient = await auth.getClient();
|
|
3690
|
+
* google.options({auth: authClient});
|
|
3691
|
+
*
|
|
3692
|
+
* // Do the magic
|
|
3693
|
+
* const res = await translate.projects.locations.operations.list({
|
|
3694
|
+
* // The standard list filter.
|
|
3695
|
+
* filter: 'placeholder-value',
|
|
3696
|
+
* // The name of the operation's parent resource.
|
|
3697
|
+
* name: 'projects/my-project/locations/my-location',
|
|
3698
|
+
* // The standard list page size.
|
|
3699
|
+
* pageSize: 'placeholder-value',
|
|
3700
|
+
* // The standard list page token.
|
|
3701
|
+
* pageToken: 'placeholder-value',
|
|
3702
|
+
* });
|
|
3703
|
+
* console.log(res.data);
|
|
3704
|
+
*
|
|
3705
|
+
* // Example response
|
|
3706
|
+
* // {
|
|
3707
|
+
* // "nextPageToken": "my_nextPageToken",
|
|
3708
|
+
* // "operations": []
|
|
3709
|
+
* // }
|
|
3710
|
+
* }
|
|
3711
|
+
*
|
|
3712
|
+
* main().catch(e => {
|
|
3713
|
+
* console.error(e);
|
|
3714
|
+
* throw e;
|
|
3715
|
+
* });
|
|
3716
|
+
*
|
|
3717
|
+
* ```
|
|
2579
3718
|
*
|
|
2580
3719
|
* @param params - Parameters for request
|
|
2581
3720
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2585,11 +3724,11 @@ export namespace translate_v3beta1 {
|
|
|
2585
3724
|
list(
|
|
2586
3725
|
params: Params$Resource$Projects$Locations$Operations$List,
|
|
2587
3726
|
options: StreamMethodOptions
|
|
2588
|
-
):
|
|
3727
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2589
3728
|
list(
|
|
2590
3729
|
params?: Params$Resource$Projects$Locations$Operations$List,
|
|
2591
3730
|
options?: MethodOptions
|
|
2592
|
-
):
|
|
3731
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$ListOperationsResponse>>;
|
|
2593
3732
|
list(
|
|
2594
3733
|
params: Params$Resource$Projects$Locations$Operations$List,
|
|
2595
3734
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -2622,8 +3761,8 @@ export namespace translate_v3beta1 {
|
|
|
2622
3761
|
| BodyResponseCallback<Readable>
|
|
2623
3762
|
):
|
|
2624
3763
|
| void
|
|
2625
|
-
|
|
|
2626
|
-
|
|
|
3764
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$ListOperationsResponse>>
|
|
3765
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2627
3766
|
let params = (paramsOrCallback ||
|
|
2628
3767
|
{}) as Params$Resource$Projects$Locations$Operations$List;
|
|
2629
3768
|
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
@@ -2669,6 +3808,67 @@ export namespace translate_v3beta1 {
|
|
|
2669
3808
|
|
|
2670
3809
|
/**
|
|
2671
3810
|
* 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.
|
|
3811
|
+
* @example
|
|
3812
|
+
* ```js
|
|
3813
|
+
* // Before running the sample:
|
|
3814
|
+
* // - Enable the API at:
|
|
3815
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3816
|
+
* // - Login into gcloud by running:
|
|
3817
|
+
* // ```sh
|
|
3818
|
+
* // $ gcloud auth application-default login
|
|
3819
|
+
* // ```
|
|
3820
|
+
* // - Install the npm module by running:
|
|
3821
|
+
* // ```sh
|
|
3822
|
+
* // $ npm install googleapis
|
|
3823
|
+
* // ```
|
|
3824
|
+
*
|
|
3825
|
+
* const {google} = require('googleapis');
|
|
3826
|
+
* const translate = google.translate('v3beta1');
|
|
3827
|
+
*
|
|
3828
|
+
* async function main() {
|
|
3829
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3830
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3831
|
+
* scopes: [
|
|
3832
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3833
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3834
|
+
* ],
|
|
3835
|
+
* });
|
|
3836
|
+
*
|
|
3837
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3838
|
+
* const authClient = await auth.getClient();
|
|
3839
|
+
* google.options({auth: authClient});
|
|
3840
|
+
*
|
|
3841
|
+
* // Do the magic
|
|
3842
|
+
* const res = await translate.projects.locations.operations.wait({
|
|
3843
|
+
* // The name of the operation resource to wait on.
|
|
3844
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
3845
|
+
*
|
|
3846
|
+
* // Request body metadata
|
|
3847
|
+
* requestBody: {
|
|
3848
|
+
* // request body parameters
|
|
3849
|
+
* // {
|
|
3850
|
+
* // "timeout": "my_timeout"
|
|
3851
|
+
* // }
|
|
3852
|
+
* },
|
|
3853
|
+
* });
|
|
3854
|
+
* console.log(res.data);
|
|
3855
|
+
*
|
|
3856
|
+
* // Example response
|
|
3857
|
+
* // {
|
|
3858
|
+
* // "done": false,
|
|
3859
|
+
* // "error": {},
|
|
3860
|
+
* // "metadata": {},
|
|
3861
|
+
* // "name": "my_name",
|
|
3862
|
+
* // "response": {}
|
|
3863
|
+
* // }
|
|
3864
|
+
* }
|
|
3865
|
+
*
|
|
3866
|
+
* main().catch(e => {
|
|
3867
|
+
* console.error(e);
|
|
3868
|
+
* throw e;
|
|
3869
|
+
* });
|
|
3870
|
+
*
|
|
3871
|
+
* ```
|
|
2672
3872
|
*
|
|
2673
3873
|
* @param params - Parameters for request
|
|
2674
3874
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2678,11 +3878,11 @@ export namespace translate_v3beta1 {
|
|
|
2678
3878
|
wait(
|
|
2679
3879
|
params: Params$Resource$Projects$Locations$Operations$Wait,
|
|
2680
3880
|
options: StreamMethodOptions
|
|
2681
|
-
):
|
|
3881
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2682
3882
|
wait(
|
|
2683
3883
|
params?: Params$Resource$Projects$Locations$Operations$Wait,
|
|
2684
3884
|
options?: MethodOptions
|
|
2685
|
-
):
|
|
3885
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$Operation>>;
|
|
2686
3886
|
wait(
|
|
2687
3887
|
params: Params$Resource$Projects$Locations$Operations$Wait,
|
|
2688
3888
|
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
@@ -2711,7 +3911,10 @@ export namespace translate_v3beta1 {
|
|
|
2711
3911
|
callback?:
|
|
2712
3912
|
| BodyResponseCallback<Schema$Operation>
|
|
2713
3913
|
| BodyResponseCallback<Readable>
|
|
2714
|
-
):
|
|
3914
|
+
):
|
|
3915
|
+
| void
|
|
3916
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$Operation>>
|
|
3917
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2715
3918
|
let params = (paramsOrCallback ||
|
|
2716
3919
|
{}) as Params$Resource$Projects$Locations$Operations$Wait;
|
|
2717
3920
|
let options = (optionsOrCallback || {}) as MethodOptions;
|