@googleapis/translate 7.0.1 → 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/CHANGELOG.md +7 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/v3.d.ts +165 -21
- package/build/v3.js +32 -0
- package/build/v3.js.map +1 -1
- package/build/v3beta1.d.ts +149 -11
- package/build/v3beta1.js +32 -0
- package/build/v3beta1.js.map +1 -1
- package/package.json +1 -1
- package/v3.ts +243 -21
- package/v3beta1.ts +227 -11
package/v3beta1.ts
CHANGED
|
@@ -178,12 +178,16 @@ export namespace translate_v3beta1 {
|
|
|
178
178
|
* 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.
|
|
179
179
|
*/
|
|
180
180
|
outputConfig?: Schema$BatchDocumentOutputConfig;
|
|
181
|
+
/**
|
|
182
|
+
* Optional. If true, only native pdf pages will be translated.
|
|
183
|
+
*/
|
|
184
|
+
pdfNativeOnly?: boolean | null;
|
|
181
185
|
/**
|
|
182
186
|
* Required. The BCP-47 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).
|
|
183
187
|
*/
|
|
184
188
|
sourceLanguageCode?: string | null;
|
|
185
189
|
/**
|
|
186
|
-
* Required. The BCP-47 language code to use for translation of the input document. Specify up to 10 language codes here.
|
|
190
|
+
* Required. The BCP-47 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).
|
|
187
191
|
*/
|
|
188
192
|
targetLanguageCodes?: string[] | null;
|
|
189
193
|
}
|
|
@@ -212,11 +216,11 @@ export namespace translate_v3beta1 {
|
|
|
212
216
|
*/
|
|
213
217
|
outputConfig?: Schema$OutputConfig;
|
|
214
218
|
/**
|
|
215
|
-
* Required. Source language code.
|
|
219
|
+
* Required. Source language code. Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages).
|
|
216
220
|
*/
|
|
217
221
|
sourceLanguageCode?: string | null;
|
|
218
222
|
/**
|
|
219
|
-
* Required. Specify up to 10 language codes here.
|
|
223
|
+
* Required. Specify up to 10 language codes here. Supported language codes are listed in [Language Support](https://cloud.google.com/translate/docs/languages).
|
|
220
224
|
*/
|
|
221
225
|
targetLanguageCodes?: string[] | null;
|
|
222
226
|
}
|
|
@@ -451,6 +455,10 @@ export namespace translate_v3beta1 {
|
|
|
451
455
|
* A list of operations that matches the specified filter in the request.
|
|
452
456
|
*/
|
|
453
457
|
operations?: Schema$Operation[];
|
|
458
|
+
/**
|
|
459
|
+
* 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.
|
|
460
|
+
*/
|
|
461
|
+
unreachable?: string[] | null;
|
|
454
462
|
}
|
|
455
463
|
/**
|
|
456
464
|
* A resource that represents a Google Cloud location.
|
|
@@ -511,6 +519,45 @@ export namespace translate_v3beta1 {
|
|
|
511
519
|
*/
|
|
512
520
|
gcsDestination?: Schema$GcsDestination;
|
|
513
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* A single refinement entry for RefineTextRequest.
|
|
524
|
+
*/
|
|
525
|
+
export interface Schema$RefinementEntry {
|
|
526
|
+
/**
|
|
527
|
+
* Required. The original translation of the source text.
|
|
528
|
+
*/
|
|
529
|
+
originalTranslation?: string | null;
|
|
530
|
+
/**
|
|
531
|
+
* Required. The source text to be refined.
|
|
532
|
+
*/
|
|
533
|
+
sourceText?: string | null;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Request message for RefineText.
|
|
537
|
+
*/
|
|
538
|
+
export interface Schema$RefineTextRequest {
|
|
539
|
+
/**
|
|
540
|
+
* Required. The source texts and original translations in the source and target languages.
|
|
541
|
+
*/
|
|
542
|
+
refinementEntries?: Schema$RefinementEntry[];
|
|
543
|
+
/**
|
|
544
|
+
* Required. The BCP-47 language code of the source text in the request, for example, "en-US".
|
|
545
|
+
*/
|
|
546
|
+
sourceLanguageCode?: string | null;
|
|
547
|
+
/**
|
|
548
|
+
* Required. The BCP-47 language code for translation output, for example, "zh-CN".
|
|
549
|
+
*/
|
|
550
|
+
targetLanguageCode?: string | null;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Response message for RefineText.
|
|
554
|
+
*/
|
|
555
|
+
export interface Schema$RefineTextResponse {
|
|
556
|
+
/**
|
|
557
|
+
* The refined translations obtained from the original translations.
|
|
558
|
+
*/
|
|
559
|
+
refinedTranslations?: string[] | null;
|
|
560
|
+
}
|
|
514
561
|
/**
|
|
515
562
|
* The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
|
|
516
563
|
*/
|
|
@@ -599,11 +646,11 @@ export namespace translate_v3beta1 {
|
|
|
599
646
|
*/
|
|
600
647
|
model?: string | null;
|
|
601
648
|
/**
|
|
602
|
-
* Optional. The BCP-47 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.
|
|
649
|
+
* Optional. The BCP-47 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.
|
|
603
650
|
*/
|
|
604
651
|
sourceLanguageCode?: string | null;
|
|
605
652
|
/**
|
|
606
|
-
* Required. The BCP-47 language code to use for translation of the input document, set to one of the language codes listed in Language Support.
|
|
653
|
+
* Required. The BCP-47 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).
|
|
607
654
|
*/
|
|
608
655
|
targetLanguageCode?: string | null;
|
|
609
656
|
}
|
|
@@ -629,7 +676,7 @@ export namespace translate_v3beta1 {
|
|
|
629
676
|
model?: string | null;
|
|
630
677
|
}
|
|
631
678
|
/**
|
|
632
|
-
*
|
|
679
|
+
* Configures which glossary should be used for a specific target language, and defines options for applying that glossary.
|
|
633
680
|
*/
|
|
634
681
|
export interface Schema$TranslateTextGlossaryConfig {
|
|
635
682
|
/**
|
|
@@ -670,11 +717,11 @@ export namespace translate_v3beta1 {
|
|
|
670
717
|
*/
|
|
671
718
|
model?: string | null;
|
|
672
719
|
/**
|
|
673
|
-
* Optional. The BCP-47 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.
|
|
720
|
+
* Optional. The BCP-47 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.
|
|
674
721
|
*/
|
|
675
722
|
sourceLanguageCode?: string | null;
|
|
676
723
|
/**
|
|
677
|
-
* Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support.
|
|
724
|
+
* Required. The BCP-47 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).
|
|
678
725
|
*/
|
|
679
726
|
targetLanguageCode?: string | null;
|
|
680
727
|
}
|
|
@@ -1288,6 +1335,7 @@ export namespace translate_v3beta1 {
|
|
|
1288
1335
|
* // "inputConfigs": [],
|
|
1289
1336
|
* // "models": {},
|
|
1290
1337
|
* // "outputConfig": {},
|
|
1338
|
+
* // "pdfNativeOnly": false,
|
|
1291
1339
|
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1292
1340
|
* // "targetLanguageCodes": []
|
|
1293
1341
|
* // }
|
|
@@ -2036,7 +2084,7 @@ export namespace translate_v3beta1 {
|
|
|
2036
2084
|
*
|
|
2037
2085
|
* // Do the magic
|
|
2038
2086
|
* const res = await translate.projects.locations.list({
|
|
2039
|
-
* // Optional.
|
|
2087
|
+
* // Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
|
|
2040
2088
|
* extraLocationTypes: 'placeholder-value',
|
|
2041
2089
|
* // 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).
|
|
2042
2090
|
* filter: 'placeholder-value',
|
|
@@ -2153,6 +2201,156 @@ export namespace translate_v3beta1 {
|
|
|
2153
2201
|
}
|
|
2154
2202
|
}
|
|
2155
2203
|
|
|
2204
|
+
/**
|
|
2205
|
+
* Refines the input translated text to improve the quality.
|
|
2206
|
+
* @example
|
|
2207
|
+
* ```js
|
|
2208
|
+
* // Before running the sample:
|
|
2209
|
+
* // - Enable the API at:
|
|
2210
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2211
|
+
* // - Login into gcloud by running:
|
|
2212
|
+
* // ```sh
|
|
2213
|
+
* // $ gcloud auth application-default login
|
|
2214
|
+
* // ```
|
|
2215
|
+
* // - Install the npm module by running:
|
|
2216
|
+
* // ```sh
|
|
2217
|
+
* // $ npm install googleapis
|
|
2218
|
+
* // ```
|
|
2219
|
+
*
|
|
2220
|
+
* const {google} = require('googleapis');
|
|
2221
|
+
* const translate = google.translate('v3beta1');
|
|
2222
|
+
*
|
|
2223
|
+
* async function main() {
|
|
2224
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2225
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2226
|
+
* scopes: [
|
|
2227
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2228
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2229
|
+
* ],
|
|
2230
|
+
* });
|
|
2231
|
+
*
|
|
2232
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2233
|
+
* const authClient = await auth.getClient();
|
|
2234
|
+
* google.options({auth: authClient});
|
|
2235
|
+
*
|
|
2236
|
+
* // Do the magic
|
|
2237
|
+
* const res = await translate.projects.locations.refineText({
|
|
2238
|
+
* // 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\}`.
|
|
2239
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2240
|
+
*
|
|
2241
|
+
* // Request body metadata
|
|
2242
|
+
* requestBody: {
|
|
2243
|
+
* // request body parameters
|
|
2244
|
+
* // {
|
|
2245
|
+
* // "refinementEntries": [],
|
|
2246
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
2247
|
+
* // "targetLanguageCode": "my_targetLanguageCode"
|
|
2248
|
+
* // }
|
|
2249
|
+
* },
|
|
2250
|
+
* });
|
|
2251
|
+
* console.log(res.data);
|
|
2252
|
+
*
|
|
2253
|
+
* // Example response
|
|
2254
|
+
* // {
|
|
2255
|
+
* // "refinedTranslations": []
|
|
2256
|
+
* // }
|
|
2257
|
+
* }
|
|
2258
|
+
*
|
|
2259
|
+
* main().catch(e => {
|
|
2260
|
+
* console.error(e);
|
|
2261
|
+
* throw e;
|
|
2262
|
+
* });
|
|
2263
|
+
*
|
|
2264
|
+
* ```
|
|
2265
|
+
*
|
|
2266
|
+
* @param params - Parameters for request
|
|
2267
|
+
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
2268
|
+
* @param callback - Optional callback that handles the response.
|
|
2269
|
+
* @returns A promise if used with async/await, or void if used with a callback.
|
|
2270
|
+
*/
|
|
2271
|
+
refineText(
|
|
2272
|
+
params: Params$Resource$Projects$Locations$Refinetext,
|
|
2273
|
+
options: StreamMethodOptions
|
|
2274
|
+
): Promise<GaxiosResponseWithHTTP2<Readable>>;
|
|
2275
|
+
refineText(
|
|
2276
|
+
params?: Params$Resource$Projects$Locations$Refinetext,
|
|
2277
|
+
options?: MethodOptions
|
|
2278
|
+
): Promise<GaxiosResponseWithHTTP2<Schema$RefineTextResponse>>;
|
|
2279
|
+
refineText(
|
|
2280
|
+
params: Params$Resource$Projects$Locations$Refinetext,
|
|
2281
|
+
options: StreamMethodOptions | BodyResponseCallback<Readable>,
|
|
2282
|
+
callback: BodyResponseCallback<Readable>
|
|
2283
|
+
): void;
|
|
2284
|
+
refineText(
|
|
2285
|
+
params: Params$Resource$Projects$Locations$Refinetext,
|
|
2286
|
+
options: MethodOptions | BodyResponseCallback<Schema$RefineTextResponse>,
|
|
2287
|
+
callback: BodyResponseCallback<Schema$RefineTextResponse>
|
|
2288
|
+
): void;
|
|
2289
|
+
refineText(
|
|
2290
|
+
params: Params$Resource$Projects$Locations$Refinetext,
|
|
2291
|
+
callback: BodyResponseCallback<Schema$RefineTextResponse>
|
|
2292
|
+
): void;
|
|
2293
|
+
refineText(callback: BodyResponseCallback<Schema$RefineTextResponse>): void;
|
|
2294
|
+
refineText(
|
|
2295
|
+
paramsOrCallback?:
|
|
2296
|
+
| Params$Resource$Projects$Locations$Refinetext
|
|
2297
|
+
| BodyResponseCallback<Schema$RefineTextResponse>
|
|
2298
|
+
| BodyResponseCallback<Readable>,
|
|
2299
|
+
optionsOrCallback?:
|
|
2300
|
+
| MethodOptions
|
|
2301
|
+
| StreamMethodOptions
|
|
2302
|
+
| BodyResponseCallback<Schema$RefineTextResponse>
|
|
2303
|
+
| BodyResponseCallback<Readable>,
|
|
2304
|
+
callback?:
|
|
2305
|
+
| BodyResponseCallback<Schema$RefineTextResponse>
|
|
2306
|
+
| BodyResponseCallback<Readable>
|
|
2307
|
+
):
|
|
2308
|
+
| void
|
|
2309
|
+
| Promise<GaxiosResponseWithHTTP2<Schema$RefineTextResponse>>
|
|
2310
|
+
| Promise<GaxiosResponseWithHTTP2<Readable>> {
|
|
2311
|
+
let params = (paramsOrCallback ||
|
|
2312
|
+
{}) as Params$Resource$Projects$Locations$Refinetext;
|
|
2313
|
+
let options = (optionsOrCallback || {}) as MethodOptions;
|
|
2314
|
+
|
|
2315
|
+
if (typeof paramsOrCallback === 'function') {
|
|
2316
|
+
callback = paramsOrCallback;
|
|
2317
|
+
params = {} as Params$Resource$Projects$Locations$Refinetext;
|
|
2318
|
+
options = {};
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
if (typeof optionsOrCallback === 'function') {
|
|
2322
|
+
callback = optionsOrCallback;
|
|
2323
|
+
options = {};
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
const rootUrl = options.rootUrl || 'https://translation.googleapis.com/';
|
|
2327
|
+
const parameters = {
|
|
2328
|
+
options: Object.assign(
|
|
2329
|
+
{
|
|
2330
|
+
url: (rootUrl + '/v3beta1/{+parent}:refineText').replace(
|
|
2331
|
+
/([^:]\/)\/+/g,
|
|
2332
|
+
'$1'
|
|
2333
|
+
),
|
|
2334
|
+
method: 'POST',
|
|
2335
|
+
apiVersion: '',
|
|
2336
|
+
},
|
|
2337
|
+
options
|
|
2338
|
+
),
|
|
2339
|
+
params,
|
|
2340
|
+
requiredParams: ['parent'],
|
|
2341
|
+
pathParams: ['parent'],
|
|
2342
|
+
context: this.context,
|
|
2343
|
+
};
|
|
2344
|
+
if (callback) {
|
|
2345
|
+
createAPIRequest<Schema$RefineTextResponse>(
|
|
2346
|
+
parameters,
|
|
2347
|
+
callback as BodyResponseCallback<unknown>
|
|
2348
|
+
);
|
|
2349
|
+
} else {
|
|
2350
|
+
return createAPIRequest<Schema$RefineTextResponse>(parameters);
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2156
2354
|
/**
|
|
2157
2355
|
* Translates documents in synchronous mode.
|
|
2158
2356
|
* @example
|
|
@@ -2533,7 +2731,7 @@ export namespace translate_v3beta1 {
|
|
|
2533
2731
|
}
|
|
2534
2732
|
export interface Params$Resource$Projects$Locations$List extends StandardParameters {
|
|
2535
2733
|
/**
|
|
2536
|
-
* Optional.
|
|
2734
|
+
* Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
|
|
2537
2735
|
*/
|
|
2538
2736
|
extraLocationTypes?: string[];
|
|
2539
2737
|
/**
|
|
@@ -2553,6 +2751,17 @@ export namespace translate_v3beta1 {
|
|
|
2553
2751
|
*/
|
|
2554
2752
|
pageToken?: string;
|
|
2555
2753
|
}
|
|
2754
|
+
export interface Params$Resource$Projects$Locations$Refinetext extends StandardParameters {
|
|
2755
|
+
/**
|
|
2756
|
+
* 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\}`.
|
|
2757
|
+
*/
|
|
2758
|
+
parent?: string;
|
|
2759
|
+
|
|
2760
|
+
/**
|
|
2761
|
+
* Request body metadata
|
|
2762
|
+
*/
|
|
2763
|
+
requestBody?: Schema$RefineTextRequest;
|
|
2764
|
+
}
|
|
2556
2765
|
export interface Params$Resource$Projects$Locations$Translatedocument extends StandardParameters {
|
|
2557
2766
|
/**
|
|
2558
2767
|
* 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.
|
|
@@ -3684,13 +3893,16 @@ export namespace translate_v3beta1 {
|
|
|
3684
3893
|
* pageSize: 'placeholder-value',
|
|
3685
3894
|
* // The standard list page token.
|
|
3686
3895
|
* pageToken: 'placeholder-value',
|
|
3896
|
+
* // 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.
|
|
3897
|
+
* returnPartialSuccess: 'placeholder-value',
|
|
3687
3898
|
* });
|
|
3688
3899
|
* console.log(res.data);
|
|
3689
3900
|
*
|
|
3690
3901
|
* // Example response
|
|
3691
3902
|
* // {
|
|
3692
3903
|
* // "nextPageToken": "my_nextPageToken",
|
|
3693
|
-
* // "operations": []
|
|
3904
|
+
* // "operations": [],
|
|
3905
|
+
* // "unreachable": []
|
|
3694
3906
|
* // }
|
|
3695
3907
|
* }
|
|
3696
3908
|
*
|
|
@@ -3984,6 +4196,10 @@ export namespace translate_v3beta1 {
|
|
|
3984
4196
|
* The standard list page token.
|
|
3985
4197
|
*/
|
|
3986
4198
|
pageToken?: string;
|
|
4199
|
+
/**
|
|
4200
|
+
* 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.
|
|
4201
|
+
*/
|
|
4202
|
+
returnPartialSuccess?: boolean;
|
|
3987
4203
|
}
|
|
3988
4204
|
export interface Params$Resource$Projects$Locations$Operations$Wait extends StandardParameters {
|
|
3989
4205
|
/**
|