@googleapis/translate 6.0.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/v3.d.ts CHANGED
@@ -87,7 +87,7 @@ export declare namespace translate_v3 {
87
87
  */
88
88
  exampleCount?: number | null;
89
89
  /**
90
- * Required. The resource name of the dataset, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset_id\}`
90
+ * Identifier. The resource name of the dataset, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset_id\}`
91
91
  */
92
92
  name?: string | null;
93
93
  /**
@@ -120,7 +120,7 @@ export declare namespace translate_v3 {
120
120
  */
121
121
  entryCount?: number | null;
122
122
  /**
123
- * Required. The resource name of the file, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset\}/adaptiveMtFiles/{file\}`
123
+ * Identifier. The resource name of the file, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset\}/adaptiveMtFiles/{file\}`
124
124
  */
125
125
  name?: string | null;
126
126
  /**
@@ -137,7 +137,7 @@ export declare namespace translate_v3 {
137
137
  */
138
138
  createTime?: string | null;
139
139
  /**
140
- * Required. The resource name of the file, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset\}/adaptiveMtFiles/{file\}/adaptiveMtSentences/{sentence\}`
140
+ * Identifier. The resource name of the file, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset\}/adaptiveMtFiles/{file\}/adaptiveMtSentences/{sentence\}`
141
141
  */
142
142
  name?: string | null;
143
143
  /**
@@ -260,12 +260,16 @@ export declare namespace translate_v3 {
260
260
  * Required. Output configuration. If 2 input configs match to the same file (that is, same input path), we don't generate output for duplicate inputs.
261
261
  */
262
262
  outputConfig?: Schema$BatchDocumentOutputConfig;
263
+ /**
264
+ * Optional. If true, only native pdf pages will be translated.
265
+ */
266
+ pdfNativeOnly?: boolean | null;
263
267
  /**
264
268
  * Required. The ISO-639 language code of the input document if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages).
265
269
  */
266
270
  sourceLanguageCode?: string | null;
267
271
  /**
268
- * Required. The ISO-639 language code to use for translation of the input document. Specify up to 10 language codes here.
272
+ * Required. The ISO-639 language code to use for translation of the input document. Specify up to 10 language codes here. Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages).
269
273
  */
270
274
  targetLanguageCodes?: string[] | null;
271
275
  }
@@ -300,11 +304,11 @@ export declare namespace translate_v3 {
300
304
  */
301
305
  outputConfig?: Schema$OutputConfig;
302
306
  /**
303
- * Required. Source language code.
307
+ * Required. Source language code. Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages).
304
308
  */
305
309
  sourceLanguageCode?: string | null;
306
310
  /**
307
- * Required. Specify up to 10 language codes here.
311
+ * Required. Specify up to 10 language codes here. Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages).
308
312
  */
309
313
  targetLanguageCodes?: string[] | null;
310
314
  }
@@ -397,6 +401,10 @@ export declare namespace translate_v3 {
397
401
  * The content of the input stored as a string.
398
402
  */
399
403
  content?: string | null;
404
+ /**
405
+ * Optional. The document configuration of the input.
406
+ */
407
+ documentInputConfig?: Schema$DocumentInputConfig;
400
408
  /**
401
409
  * Optional. The labels with user-defined metadata for the request. Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter. See https://cloud.google.com/translate/docs/advanced/labels for more information.
402
410
  */
@@ -585,7 +593,7 @@ export declare namespace translate_v3 {
585
593
  */
586
594
  languagePair?: Schema$LanguageCodePair;
587
595
  /**
588
- * Required. The resource name of the glossary. Glossary names have the form `projects/{project-number-or-id\}/locations/{location-id\}/glossaries/{glossary-id\}`.
596
+ * Identifier. The resource name of the glossary. Glossary names have the form `projects/{project-number-or-id\}/locations/{location-id\}/glossaries/{glossary-id\}`.
589
597
  */
590
598
  name?: string | null;
591
599
  /**
@@ -750,7 +758,7 @@ export declare namespace translate_v3 {
750
758
  */
751
759
  export interface Schema$LanguageCodesSet {
752
760
  /**
753
- * The ISO-639 language code(s) for terms defined in the glossary. All entries are unique. The list contains at least two entries. Expected to be an exact match for GlossaryTerm.language_code.
761
+ * Optional. The ISO-639 language code(s) for terms defined in the glossary. All entries are unique. The list contains at least two entries. Expected to be an exact match for GlossaryTerm.language_code.
754
762
  */
755
763
  languageCodes?: string[] | null;
756
764
  }
@@ -883,6 +891,10 @@ export declare namespace translate_v3 {
883
891
  * A list of operations that matches the specified filter in the request.
884
892
  */
885
893
  operations?: Schema$Operation[];
894
+ /**
895
+ * Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
896
+ */
897
+ unreachable?: string[] | null;
886
898
  }
887
899
  /**
888
900
  * A resource that represents a Google Cloud location.
@@ -922,7 +934,7 @@ export declare namespace translate_v3 {
922
934
  */
923
935
  createTime?: string | null;
924
936
  /**
925
- * The dataset from which the model is trained, in form of `projects/{project-number-or-id\}/locations/{location_id\}/datasets/{dataset_id\}`
937
+ * Required. The dataset from which the model is trained, in form of `projects/{project-number-or-id\}/locations/{location_id\}/datasets/{dataset_id\}`
926
938
  */
927
939
  dataset?: string | null;
928
940
  /**
@@ -1035,6 +1047,45 @@ export declare namespace translate_v3 {
1035
1047
  */
1036
1048
  referenceSentencePairs?: Schema$ReferenceSentencePair[];
1037
1049
  }
1050
+ /**
1051
+ * A single refinement entry for RefineTextRequest.
1052
+ */
1053
+ export interface Schema$RefinementEntry {
1054
+ /**
1055
+ * Required. The original translation of the source text.
1056
+ */
1057
+ originalTranslation?: string | null;
1058
+ /**
1059
+ * Required. The source text to be refined.
1060
+ */
1061
+ sourceText?: string | null;
1062
+ }
1063
+ /**
1064
+ * Request message for RefineText.
1065
+ */
1066
+ export interface Schema$RefineTextRequest {
1067
+ /**
1068
+ * Required. The source texts and original translations in the source and target languages.
1069
+ */
1070
+ refinementEntries?: Schema$RefinementEntry[];
1071
+ /**
1072
+ * Required. The BCP-47 language code of the source text in the request, for example, "en-US".
1073
+ */
1074
+ sourceLanguageCode?: string | null;
1075
+ /**
1076
+ * Required. The BCP-47 language code for translation output, for example, "zh-CN".
1077
+ */
1078
+ targetLanguageCode?: string | null;
1079
+ }
1080
+ /**
1081
+ * Response message for RefineText.
1082
+ */
1083
+ export interface Schema$RefineTextResponse {
1084
+ /**
1085
+ * The refined translations obtained from the original translations.
1086
+ */
1087
+ refinedTranslations?: string[] | null;
1088
+ }
1038
1089
  /**
1039
1090
  * A single romanization response.
1040
1091
  */
@@ -1057,7 +1108,7 @@ export declare namespace translate_v3 {
1057
1108
  */
1058
1109
  contents?: string[] | null;
1059
1110
  /**
1060
- * Optional. The ISO-639 language code of the input text if known, for example, "hi" or "zh". If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language for each content in the response.
1111
+ * Optional. The ISO-639 language code of the input text if known, for example, "hi" or "zh". Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages#roman). If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language for each content in the response.
1061
1112
  */
1062
1113
  sourceLanguageCode?: string | null;
1063
1114
  }
@@ -1162,11 +1213,11 @@ export declare namespace translate_v3 {
1162
1213
  */
1163
1214
  model?: string | null;
1164
1215
  /**
1165
- * Optional. The ISO-639 language code of the input document if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response. Source language must be specified if the request contains a glossary or a custom model.
1216
+ * Optional. The ISO-639 language code of the input document if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages). If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response. Source language must be specified if the request contains a glossary or a custom model.
1166
1217
  */
1167
1218
  sourceLanguageCode?: string | null;
1168
1219
  /**
1169
- * Required. The ISO-639 language code to use for translation of the input document, set to one of the language codes listed in Language Support.
1220
+ * Required. The ISO-639 language code to use for translation of the input document, set to one of the language codes listed in [Language Support](https://cloud.google.com/translate/docs/languages).
1170
1221
  */
1171
1222
  targetLanguageCode?: string | null;
1172
1223
  }
@@ -1235,11 +1286,11 @@ export declare namespace translate_v3 {
1235
1286
  */
1236
1287
  model?: string | null;
1237
1288
  /**
1238
- * Optional. The ISO-639 language code of the input text if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response.
1289
+ * Optional. The ISO-639 language code of the input text if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages). If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response.
1239
1290
  */
1240
1291
  sourceLanguageCode?: string | null;
1241
1292
  /**
1242
- * Required. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in Language Support.
1293
+ * Required. The ISO-639 language code to use for translation of the input text, set to one of the language codes listed in [Language Support](https://cloud.google.com/translate/docs/languages).
1243
1294
  */
1244
1295
  targetLanguageCode?: string | null;
1245
1296
  /**
@@ -1342,6 +1393,7 @@ export declare namespace translate_v3 {
1342
1393
  * // request body parameters
1343
1394
  * // {
1344
1395
  * // "content": "my_content",
1396
+ * // "documentInputConfig": {},
1345
1397
  * // "labels": {},
1346
1398
  * // "mimeType": "my_mimeType",
1347
1399
  * // "model": "my_model"
@@ -1770,6 +1822,7 @@ export declare namespace translate_v3 {
1770
1822
  * // "inputConfigs": [],
1771
1823
  * // "models": {},
1772
1824
  * // "outputConfig": {},
1825
+ * // "pdfNativeOnly": false,
1773
1826
  * // "sourceLanguageCode": "my_sourceLanguageCode",
1774
1827
  * // "targetLanguageCodes": []
1775
1828
  * // }
@@ -1928,6 +1981,7 @@ export declare namespace translate_v3 {
1928
1981
  * // request body parameters
1929
1982
  * // {
1930
1983
  * // "content": "my_content",
1984
+ * // "documentInputConfig": {},
1931
1985
  * // "labels": {},
1932
1986
  * // "mimeType": "my_mimeType",
1933
1987
  * // "model": "my_model"
@@ -2128,7 +2182,7 @@ export declare namespace translate_v3 {
2128
2182
  *
2129
2183
  * // Do the magic
2130
2184
  * const res = await translate.projects.locations.list({
2131
- * // Optional. A list of extra location types that should be used as conditions for controlling the visibility of the locations.
2185
+ * // Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
2132
2186
  * extraLocationTypes: 'placeholder-value',
2133
2187
  * // 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).
2134
2188
  * filter: 'placeholder-value',
@@ -2166,6 +2220,79 @@ export declare namespace translate_v3 {
2166
2220
  list(params: Params$Resource$Projects$Locations$List, options: MethodOptions | BodyResponseCallback<Schema$ListLocationsResponse>, callback: BodyResponseCallback<Schema$ListLocationsResponse>): void;
2167
2221
  list(params: Params$Resource$Projects$Locations$List, callback: BodyResponseCallback<Schema$ListLocationsResponse>): void;
2168
2222
  list(callback: BodyResponseCallback<Schema$ListLocationsResponse>): void;
2223
+ /**
2224
+ * Refines the input translated text to improve the quality.
2225
+ * @example
2226
+ * ```js
2227
+ * // Before running the sample:
2228
+ * // - Enable the API at:
2229
+ * // https://console.developers.google.com/apis/api/translate.googleapis.com
2230
+ * // - Login into gcloud by running:
2231
+ * // ```sh
2232
+ * // $ gcloud auth application-default login
2233
+ * // ```
2234
+ * // - Install the npm module by running:
2235
+ * // ```sh
2236
+ * // $ npm install googleapis
2237
+ * // ```
2238
+ *
2239
+ * const {google} = require('googleapis');
2240
+ * const translate = google.translate('v3');
2241
+ *
2242
+ * async function main() {
2243
+ * const auth = new google.auth.GoogleAuth({
2244
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
2245
+ * scopes: [
2246
+ * 'https://www.googleapis.com/auth/cloud-platform',
2247
+ * 'https://www.googleapis.com/auth/cloud-translation',
2248
+ * ],
2249
+ * });
2250
+ *
2251
+ * // Acquire an auth client, and bind it to all future calls
2252
+ * const authClient = await auth.getClient();
2253
+ * google.options({auth: authClient});
2254
+ *
2255
+ * // Do the magic
2256
+ * const res = await translate.projects.locations.refineText({
2257
+ * // Required. Project or location to make a call. Must refer to a caller's project. Format: `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\}`.
2258
+ * parent: 'projects/my-project/locations/my-location',
2259
+ *
2260
+ * // Request body metadata
2261
+ * requestBody: {
2262
+ * // request body parameters
2263
+ * // {
2264
+ * // "refinementEntries": [],
2265
+ * // "sourceLanguageCode": "my_sourceLanguageCode",
2266
+ * // "targetLanguageCode": "my_targetLanguageCode"
2267
+ * // }
2268
+ * },
2269
+ * });
2270
+ * console.log(res.data);
2271
+ *
2272
+ * // Example response
2273
+ * // {
2274
+ * // "refinedTranslations": []
2275
+ * // }
2276
+ * }
2277
+ *
2278
+ * main().catch(e => {
2279
+ * console.error(e);
2280
+ * throw e;
2281
+ * });
2282
+ *
2283
+ * ```
2284
+ *
2285
+ * @param params - Parameters for request
2286
+ * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
2287
+ * @param callback - Optional callback that handles the response.
2288
+ * @returns A promise if used with async/await, or void if used with a callback.
2289
+ */
2290
+ refineText(params: Params$Resource$Projects$Locations$Refinetext, options: StreamMethodOptions): Promise<GaxiosResponseWithHTTP2<Readable>>;
2291
+ refineText(params?: Params$Resource$Projects$Locations$Refinetext, options?: MethodOptions): Promise<GaxiosResponseWithHTTP2<Schema$RefineTextResponse>>;
2292
+ refineText(params: Params$Resource$Projects$Locations$Refinetext, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
2293
+ refineText(params: Params$Resource$Projects$Locations$Refinetext, options: MethodOptions | BodyResponseCallback<Schema$RefineTextResponse>, callback: BodyResponseCallback<Schema$RefineTextResponse>): void;
2294
+ refineText(params: Params$Resource$Projects$Locations$Refinetext, callback: BodyResponseCallback<Schema$RefineTextResponse>): void;
2295
+ refineText(callback: BodyResponseCallback<Schema$RefineTextResponse>): void;
2169
2296
  /**
2170
2297
  * Romanize input text written in non-Latin scripts to Latin text.
2171
2298
  * @example
@@ -2464,7 +2591,7 @@ export declare namespace translate_v3 {
2464
2591
  }
2465
2592
  export interface Params$Resource$Projects$Locations$List extends StandardParameters {
2466
2593
  /**
2467
- * Optional. A list of extra location types that should be used as conditions for controlling the visibility of the locations.
2594
+ * Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
2468
2595
  */
2469
2596
  extraLocationTypes?: string[];
2470
2597
  /**
@@ -2484,6 +2611,16 @@ export declare namespace translate_v3 {
2484
2611
  */
2485
2612
  pageToken?: string;
2486
2613
  }
2614
+ export interface Params$Resource$Projects$Locations$Refinetext extends StandardParameters {
2615
+ /**
2616
+ * Required. Project or location to make a call. Must refer to a caller's project. Format: `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\}`.
2617
+ */
2618
+ parent?: string;
2619
+ /**
2620
+ * Request body metadata
2621
+ */
2622
+ requestBody?: Schema$RefineTextRequest;
2623
+ }
2487
2624
  export interface Params$Resource$Projects$Locations$Romanizetext extends StandardParameters {
2488
2625
  /**
2489
2626
  * 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\}`.
@@ -4259,9 +4396,9 @@ export declare namespace translate_v3 {
4259
4396
  *
4260
4397
  * // Do the magic
4261
4398
  * const res = await translate.projects.locations.glossaries.patch({
4262
- * // Required. The resource name of the glossary. Glossary names have the form `projects/{project-number-or-id\}/locations/{location-id\}/glossaries/{glossary-id\}`.
4399
+ * // Identifier. The resource name of the glossary. Glossary names have the form `projects/{project-number-or-id\}/locations/{location-id\}/glossaries/{glossary-id\}`.
4263
4400
  * name: 'projects/my-project/locations/my-location/glossaries/my-glossarie',
4264
- * // The list of fields to be updated. Currently only `display_name` and 'input_config'
4401
+ * // The list of fields to be updated. Currently, only `display_name` and `input_config` are supported.
4265
4402
  * updateMask: 'placeholder-value',
4266
4403
  *
4267
4404
  * // Request body metadata
@@ -4352,11 +4489,11 @@ export declare namespace translate_v3 {
4352
4489
  }
4353
4490
  export interface Params$Resource$Projects$Locations$Glossaries$Patch extends StandardParameters {
4354
4491
  /**
4355
- * Required. The resource name of the glossary. Glossary names have the form `projects/{project-number-or-id\}/locations/{location-id\}/glossaries/{glossary-id\}`.
4492
+ * Identifier. The resource name of the glossary. Glossary names have the form `projects/{project-number-or-id\}/locations/{location-id\}/glossaries/{glossary-id\}`.
4356
4493
  */
4357
4494
  name?: string;
4358
4495
  /**
4359
- * The list of fields to be updated. Currently only `display_name` and 'input_config'
4496
+ * The list of fields to be updated. Currently, only `display_name` and `input_config` are supported.
4360
4497
  */
4361
4498
  updateMask?: string;
4362
4499
  /**
@@ -5348,13 +5485,16 @@ export declare namespace translate_v3 {
5348
5485
  * pageSize: 'placeholder-value',
5349
5486
  * // The standard list page token.
5350
5487
  * pageToken: 'placeholder-value',
5488
+ * // When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
5489
+ * returnPartialSuccess: 'placeholder-value',
5351
5490
  * });
5352
5491
  * console.log(res.data);
5353
5492
  *
5354
5493
  * // Example response
5355
5494
  * // {
5356
5495
  * // "nextPageToken": "my_nextPageToken",
5357
- * // "operations": []
5496
+ * // "operations": [],
5497
+ * // "unreachable": []
5358
5498
  * // }
5359
5499
  * }
5360
5500
  *
@@ -5491,6 +5631,10 @@ export declare namespace translate_v3 {
5491
5631
  * The standard list page token.
5492
5632
  */
5493
5633
  pageToken?: string;
5634
+ /**
5635
+ * When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
5636
+ */
5637
+ returnPartialSuccess?: boolean;
5494
5638
  }
5495
5639
  export interface Params$Resource$Projects$Locations$Operations$Wait extends StandardParameters {
5496
5640
  /**
package/build/v3.js CHANGED
@@ -422,6 +422,38 @@ var translate_v3;
422
422
  return (0, googleapis_common_1.createAPIRequest)(parameters);
423
423
  }
424
424
  }
425
+ refineText(paramsOrCallback, optionsOrCallback, callback) {
426
+ let params = (paramsOrCallback ||
427
+ {});
428
+ let options = (optionsOrCallback || {});
429
+ if (typeof paramsOrCallback === 'function') {
430
+ callback = paramsOrCallback;
431
+ params = {};
432
+ options = {};
433
+ }
434
+ if (typeof optionsOrCallback === 'function') {
435
+ callback = optionsOrCallback;
436
+ options = {};
437
+ }
438
+ const rootUrl = options.rootUrl || 'https://translation.googleapis.com/';
439
+ const parameters = {
440
+ options: Object.assign({
441
+ url: (rootUrl + '/v3/{+parent}:refineText').replace(/([^:]\/)\/+/g, '$1'),
442
+ method: 'POST',
443
+ apiVersion: '',
444
+ }, options),
445
+ params,
446
+ requiredParams: ['parent'],
447
+ pathParams: ['parent'],
448
+ context: this.context,
449
+ };
450
+ if (callback) {
451
+ (0, googleapis_common_1.createAPIRequest)(parameters, callback);
452
+ }
453
+ else {
454
+ return (0, googleapis_common_1.createAPIRequest)(parameters);
455
+ }
456
+ }
425
457
  romanizeText(paramsOrCallback, optionsOrCallback, callback) {
426
458
  let params = (paramsOrCallback ||
427
459
  {});