@googleapis/translate 4.0.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/v2.d.ts +280 -1
- package/build/v2.js +8 -1
- package/build/v2.js.map +1 -1
- package/build/v3.d.ts +2923 -1
- package/build/v3.js +26 -1
- package/build/v3.js.map +1 -1
- package/build/v3beta1.d.ts +1173 -1
- package/build/v3beta1.js +10 -1
- package/build/v3beta1.js.map +1 -1
- package/package.json +4 -4
- package/v2.ts +280 -0
- package/v3.ts +2923 -0
- package/v3beta1.ts +1173 -0
package/v3.ts
CHANGED
|
@@ -1331,6 +1331,66 @@ export namespace translate_v3 {
|
|
|
1331
1331
|
|
|
1332
1332
|
/**
|
|
1333
1333
|
* Detects the language of text within a request.
|
|
1334
|
+
* @example
|
|
1335
|
+
* ```js
|
|
1336
|
+
* // Before running the sample:
|
|
1337
|
+
* // - Enable the API at:
|
|
1338
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1339
|
+
* // - Login into gcloud by running:
|
|
1340
|
+
* // ```sh
|
|
1341
|
+
* // $ gcloud auth application-default login
|
|
1342
|
+
* // ```
|
|
1343
|
+
* // - Install the npm module by running:
|
|
1344
|
+
* // ```sh
|
|
1345
|
+
* // $ npm install googleapis
|
|
1346
|
+
* // ```
|
|
1347
|
+
*
|
|
1348
|
+
* const {google} = require('googleapis');
|
|
1349
|
+
* const translate = google.translate('v3');
|
|
1350
|
+
*
|
|
1351
|
+
* async function main() {
|
|
1352
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1353
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1354
|
+
* scopes: [
|
|
1355
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1356
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1357
|
+
* ],
|
|
1358
|
+
* });
|
|
1359
|
+
*
|
|
1360
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1361
|
+
* const authClient = await auth.getClient();
|
|
1362
|
+
* google.options({auth: authClient});
|
|
1363
|
+
*
|
|
1364
|
+
* // Do the magic
|
|
1365
|
+
* const res = await translate.projects.detectLanguage({
|
|
1366
|
+
* // 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.
|
|
1367
|
+
* parent: 'projects/my-project',
|
|
1368
|
+
*
|
|
1369
|
+
* // Request body metadata
|
|
1370
|
+
* requestBody: {
|
|
1371
|
+
* // request body parameters
|
|
1372
|
+
* // {
|
|
1373
|
+
* // "content": "my_content",
|
|
1374
|
+
* // "labels": {},
|
|
1375
|
+
* // "mimeType": "my_mimeType",
|
|
1376
|
+
* // "model": "my_model"
|
|
1377
|
+
* // }
|
|
1378
|
+
* },
|
|
1379
|
+
* });
|
|
1380
|
+
* console.log(res.data);
|
|
1381
|
+
*
|
|
1382
|
+
* // Example response
|
|
1383
|
+
* // {
|
|
1384
|
+
* // "languages": []
|
|
1385
|
+
* // }
|
|
1386
|
+
* }
|
|
1387
|
+
*
|
|
1388
|
+
* main().catch(e => {
|
|
1389
|
+
* console.error(e);
|
|
1390
|
+
* throw e;
|
|
1391
|
+
* });
|
|
1392
|
+
*
|
|
1393
|
+
* ```
|
|
1334
1394
|
*
|
|
1335
1395
|
* @param params - Parameters for request
|
|
1336
1396
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1426,6 +1486,59 @@ export namespace translate_v3 {
|
|
|
1426
1486
|
|
|
1427
1487
|
/**
|
|
1428
1488
|
* Returns a list of supported languages for translation.
|
|
1489
|
+
* @example
|
|
1490
|
+
* ```js
|
|
1491
|
+
* // Before running the sample:
|
|
1492
|
+
* // - Enable the API at:
|
|
1493
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1494
|
+
* // - Login into gcloud by running:
|
|
1495
|
+
* // ```sh
|
|
1496
|
+
* // $ gcloud auth application-default login
|
|
1497
|
+
* // ```
|
|
1498
|
+
* // - Install the npm module by running:
|
|
1499
|
+
* // ```sh
|
|
1500
|
+
* // $ npm install googleapis
|
|
1501
|
+
* // ```
|
|
1502
|
+
*
|
|
1503
|
+
* const {google} = require('googleapis');
|
|
1504
|
+
* const translate = google.translate('v3');
|
|
1505
|
+
*
|
|
1506
|
+
* async function main() {
|
|
1507
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1508
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1509
|
+
* scopes: [
|
|
1510
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1511
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1512
|
+
* ],
|
|
1513
|
+
* });
|
|
1514
|
+
*
|
|
1515
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1516
|
+
* const authClient = await auth.getClient();
|
|
1517
|
+
* google.options({auth: authClient});
|
|
1518
|
+
*
|
|
1519
|
+
* // Do the magic
|
|
1520
|
+
* const res = await translate.projects.getSupportedLanguages({
|
|
1521
|
+
* // 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.
|
|
1522
|
+
* displayLanguageCode: 'placeholder-value',
|
|
1523
|
+
* // 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.
|
|
1524
|
+
* model: 'placeholder-value',
|
|
1525
|
+
* // 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.
|
|
1526
|
+
* parent: 'projects/my-project',
|
|
1527
|
+
* });
|
|
1528
|
+
* console.log(res.data);
|
|
1529
|
+
*
|
|
1530
|
+
* // Example response
|
|
1531
|
+
* // {
|
|
1532
|
+
* // "languages": []
|
|
1533
|
+
* // }
|
|
1534
|
+
* }
|
|
1535
|
+
*
|
|
1536
|
+
* main().catch(e => {
|
|
1537
|
+
* console.error(e);
|
|
1538
|
+
* throw e;
|
|
1539
|
+
* });
|
|
1540
|
+
*
|
|
1541
|
+
* ```
|
|
1429
1542
|
*
|
|
1430
1543
|
* @param params - Parameters for request
|
|
1431
1544
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1519,6 +1632,64 @@ export namespace translate_v3 {
|
|
|
1519
1632
|
|
|
1520
1633
|
/**
|
|
1521
1634
|
* Romanize input text written in non-Latin scripts to Latin text.
|
|
1635
|
+
* @example
|
|
1636
|
+
* ```js
|
|
1637
|
+
* // Before running the sample:
|
|
1638
|
+
* // - Enable the API at:
|
|
1639
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1640
|
+
* // - Login into gcloud by running:
|
|
1641
|
+
* // ```sh
|
|
1642
|
+
* // $ gcloud auth application-default login
|
|
1643
|
+
* // ```
|
|
1644
|
+
* // - Install the npm module by running:
|
|
1645
|
+
* // ```sh
|
|
1646
|
+
* // $ npm install googleapis
|
|
1647
|
+
* // ```
|
|
1648
|
+
*
|
|
1649
|
+
* const {google} = require('googleapis');
|
|
1650
|
+
* const translate = google.translate('v3');
|
|
1651
|
+
*
|
|
1652
|
+
* async function main() {
|
|
1653
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1654
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1655
|
+
* scopes: [
|
|
1656
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1657
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1658
|
+
* ],
|
|
1659
|
+
* });
|
|
1660
|
+
*
|
|
1661
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1662
|
+
* const authClient = await auth.getClient();
|
|
1663
|
+
* google.options({auth: authClient});
|
|
1664
|
+
*
|
|
1665
|
+
* // Do the magic
|
|
1666
|
+
* const res = await translate.projects.romanizeText({
|
|
1667
|
+
* // 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\}`.
|
|
1668
|
+
* parent: 'projects/my-project',
|
|
1669
|
+
*
|
|
1670
|
+
* // Request body metadata
|
|
1671
|
+
* requestBody: {
|
|
1672
|
+
* // request body parameters
|
|
1673
|
+
* // {
|
|
1674
|
+
* // "contents": [],
|
|
1675
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode"
|
|
1676
|
+
* // }
|
|
1677
|
+
* },
|
|
1678
|
+
* });
|
|
1679
|
+
* console.log(res.data);
|
|
1680
|
+
*
|
|
1681
|
+
* // Example response
|
|
1682
|
+
* // {
|
|
1683
|
+
* // "romanizations": []
|
|
1684
|
+
* // }
|
|
1685
|
+
* }
|
|
1686
|
+
*
|
|
1687
|
+
* main().catch(e => {
|
|
1688
|
+
* console.error(e);
|
|
1689
|
+
* throw e;
|
|
1690
|
+
* });
|
|
1691
|
+
*
|
|
1692
|
+
* ```
|
|
1522
1693
|
*
|
|
1523
1694
|
* @param params - Parameters for request
|
|
1524
1695
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1614,6 +1785,71 @@ export namespace translate_v3 {
|
|
|
1614
1785
|
|
|
1615
1786
|
/**
|
|
1616
1787
|
* Translates input text and returns translated text.
|
|
1788
|
+
* @example
|
|
1789
|
+
* ```js
|
|
1790
|
+
* // Before running the sample:
|
|
1791
|
+
* // - Enable the API at:
|
|
1792
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
1793
|
+
* // - Login into gcloud by running:
|
|
1794
|
+
* // ```sh
|
|
1795
|
+
* // $ gcloud auth application-default login
|
|
1796
|
+
* // ```
|
|
1797
|
+
* // - Install the npm module by running:
|
|
1798
|
+
* // ```sh
|
|
1799
|
+
* // $ npm install googleapis
|
|
1800
|
+
* // ```
|
|
1801
|
+
*
|
|
1802
|
+
* const {google} = require('googleapis');
|
|
1803
|
+
* const translate = google.translate('v3');
|
|
1804
|
+
*
|
|
1805
|
+
* async function main() {
|
|
1806
|
+
* const auth = new google.auth.GoogleAuth({
|
|
1807
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
1808
|
+
* scopes: [
|
|
1809
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
1810
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
1811
|
+
* ],
|
|
1812
|
+
* });
|
|
1813
|
+
*
|
|
1814
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
1815
|
+
* const authClient = await auth.getClient();
|
|
1816
|
+
* google.options({auth: authClient});
|
|
1817
|
+
*
|
|
1818
|
+
* // Do the magic
|
|
1819
|
+
* const res = await translate.projects.translateText({
|
|
1820
|
+
* // 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.
|
|
1821
|
+
* parent: 'projects/my-project',
|
|
1822
|
+
*
|
|
1823
|
+
* // Request body metadata
|
|
1824
|
+
* requestBody: {
|
|
1825
|
+
* // request body parameters
|
|
1826
|
+
* // {
|
|
1827
|
+
* // "contents": [],
|
|
1828
|
+
* // "glossaryConfig": {},
|
|
1829
|
+
* // "labels": {},
|
|
1830
|
+
* // "mimeType": "my_mimeType",
|
|
1831
|
+
* // "model": "my_model",
|
|
1832
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
1833
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
1834
|
+
* // "transliterationConfig": {}
|
|
1835
|
+
* // }
|
|
1836
|
+
* },
|
|
1837
|
+
* });
|
|
1838
|
+
* console.log(res.data);
|
|
1839
|
+
*
|
|
1840
|
+
* // Example response
|
|
1841
|
+
* // {
|
|
1842
|
+
* // "glossaryTranslations": [],
|
|
1843
|
+
* // "translations": []
|
|
1844
|
+
* // }
|
|
1845
|
+
* }
|
|
1846
|
+
*
|
|
1847
|
+
* main().catch(e => {
|
|
1848
|
+
* console.error(e);
|
|
1849
|
+
* throw e;
|
|
1850
|
+
* });
|
|
1851
|
+
*
|
|
1852
|
+
* ```
|
|
1617
1853
|
*
|
|
1618
1854
|
* @param params - Parameters for request
|
|
1619
1855
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1783,6 +2019,68 @@ export namespace translate_v3 {
|
|
|
1783
2019
|
|
|
1784
2020
|
/**
|
|
1785
2021
|
* Translate text using Adaptive MT.
|
|
2022
|
+
* @example
|
|
2023
|
+
* ```js
|
|
2024
|
+
* // Before running the sample:
|
|
2025
|
+
* // - Enable the API at:
|
|
2026
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2027
|
+
* // - Login into gcloud by running:
|
|
2028
|
+
* // ```sh
|
|
2029
|
+
* // $ gcloud auth application-default login
|
|
2030
|
+
* // ```
|
|
2031
|
+
* // - Install the npm module by running:
|
|
2032
|
+
* // ```sh
|
|
2033
|
+
* // $ npm install googleapis
|
|
2034
|
+
* // ```
|
|
2035
|
+
*
|
|
2036
|
+
* const {google} = require('googleapis');
|
|
2037
|
+
* const translate = google.translate('v3');
|
|
2038
|
+
*
|
|
2039
|
+
* async function main() {
|
|
2040
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2041
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2042
|
+
* scopes: [
|
|
2043
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2044
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2045
|
+
* ],
|
|
2046
|
+
* });
|
|
2047
|
+
*
|
|
2048
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2049
|
+
* const authClient = await auth.getClient();
|
|
2050
|
+
* google.options({auth: authClient});
|
|
2051
|
+
*
|
|
2052
|
+
* // Do the magic
|
|
2053
|
+
* const res = await translate.projects.locations.adaptiveMtTranslate({
|
|
2054
|
+
* // Required. Location to make a regional call. Format: `projects/{project-number-or-id\}/locations/{location-id\}`.
|
|
2055
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2056
|
+
*
|
|
2057
|
+
* // Request body metadata
|
|
2058
|
+
* requestBody: {
|
|
2059
|
+
* // request body parameters
|
|
2060
|
+
* // {
|
|
2061
|
+
* // "content": [],
|
|
2062
|
+
* // "dataset": "my_dataset",
|
|
2063
|
+
* // "glossaryConfig": {},
|
|
2064
|
+
* // "referenceSentenceConfig": {}
|
|
2065
|
+
* // }
|
|
2066
|
+
* },
|
|
2067
|
+
* });
|
|
2068
|
+
* console.log(res.data);
|
|
2069
|
+
*
|
|
2070
|
+
* // Example response
|
|
2071
|
+
* // {
|
|
2072
|
+
* // "glossaryTranslations": [],
|
|
2073
|
+
* // "languageCode": "my_languageCode",
|
|
2074
|
+
* // "translations": []
|
|
2075
|
+
* // }
|
|
2076
|
+
* }
|
|
2077
|
+
*
|
|
2078
|
+
* main().catch(e => {
|
|
2079
|
+
* console.error(e);
|
|
2080
|
+
* throw e;
|
|
2081
|
+
* });
|
|
2082
|
+
*
|
|
2083
|
+
* ```
|
|
1786
2084
|
*
|
|
1787
2085
|
* @param params - Parameters for request
|
|
1788
2086
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1878,6 +2176,76 @@ export namespace translate_v3 {
|
|
|
1878
2176
|
|
|
1879
2177
|
/**
|
|
1880
2178
|
* 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.
|
|
2179
|
+
* @example
|
|
2180
|
+
* ```js
|
|
2181
|
+
* // Before running the sample:
|
|
2182
|
+
* // - Enable the API at:
|
|
2183
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2184
|
+
* // - Login into gcloud by running:
|
|
2185
|
+
* // ```sh
|
|
2186
|
+
* // $ gcloud auth application-default login
|
|
2187
|
+
* // ```
|
|
2188
|
+
* // - Install the npm module by running:
|
|
2189
|
+
* // ```sh
|
|
2190
|
+
* // $ npm install googleapis
|
|
2191
|
+
* // ```
|
|
2192
|
+
*
|
|
2193
|
+
* const {google} = require('googleapis');
|
|
2194
|
+
* const translate = google.translate('v3');
|
|
2195
|
+
*
|
|
2196
|
+
* async function main() {
|
|
2197
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2198
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2199
|
+
* scopes: [
|
|
2200
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2201
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2202
|
+
* ],
|
|
2203
|
+
* });
|
|
2204
|
+
*
|
|
2205
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2206
|
+
* const authClient = await auth.getClient();
|
|
2207
|
+
* google.options({auth: authClient});
|
|
2208
|
+
*
|
|
2209
|
+
* // Do the magic
|
|
2210
|
+
* const res = await translate.projects.locations.batchTranslateDocument({
|
|
2211
|
+
* // 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.
|
|
2212
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2213
|
+
*
|
|
2214
|
+
* // Request body metadata
|
|
2215
|
+
* requestBody: {
|
|
2216
|
+
* // request body parameters
|
|
2217
|
+
* // {
|
|
2218
|
+
* // "customizedAttribution": "my_customizedAttribution",
|
|
2219
|
+
* // "enableRotationCorrection": false,
|
|
2220
|
+
* // "enableShadowRemovalNativePdf": false,
|
|
2221
|
+
* // "formatConversions": {},
|
|
2222
|
+
* // "glossaries": {},
|
|
2223
|
+
* // "inputConfigs": [],
|
|
2224
|
+
* // "models": {},
|
|
2225
|
+
* // "outputConfig": {},
|
|
2226
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
2227
|
+
* // "targetLanguageCodes": []
|
|
2228
|
+
* // }
|
|
2229
|
+
* },
|
|
2230
|
+
* });
|
|
2231
|
+
* console.log(res.data);
|
|
2232
|
+
*
|
|
2233
|
+
* // Example response
|
|
2234
|
+
* // {
|
|
2235
|
+
* // "done": false,
|
|
2236
|
+
* // "error": {},
|
|
2237
|
+
* // "metadata": {},
|
|
2238
|
+
* // "name": "my_name",
|
|
2239
|
+
* // "response": {}
|
|
2240
|
+
* // }
|
|
2241
|
+
* }
|
|
2242
|
+
*
|
|
2243
|
+
* main().catch(e => {
|
|
2244
|
+
* console.error(e);
|
|
2245
|
+
* throw e;
|
|
2246
|
+
* });
|
|
2247
|
+
*
|
|
2248
|
+
* ```
|
|
1881
2249
|
*
|
|
1882
2250
|
* @param params - Parameters for request
|
|
1883
2251
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -1972,6 +2340,73 @@ export namespace translate_v3 {
|
|
|
1972
2340
|
|
|
1973
2341
|
/**
|
|
1974
2342
|
* 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.
|
|
2343
|
+
* @example
|
|
2344
|
+
* ```js
|
|
2345
|
+
* // Before running the sample:
|
|
2346
|
+
* // - Enable the API at:
|
|
2347
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2348
|
+
* // - Login into gcloud by running:
|
|
2349
|
+
* // ```sh
|
|
2350
|
+
* // $ gcloud auth application-default login
|
|
2351
|
+
* // ```
|
|
2352
|
+
* // - Install the npm module by running:
|
|
2353
|
+
* // ```sh
|
|
2354
|
+
* // $ npm install googleapis
|
|
2355
|
+
* // ```
|
|
2356
|
+
*
|
|
2357
|
+
* const {google} = require('googleapis');
|
|
2358
|
+
* const translate = google.translate('v3');
|
|
2359
|
+
*
|
|
2360
|
+
* async function main() {
|
|
2361
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2362
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2363
|
+
* scopes: [
|
|
2364
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2365
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2366
|
+
* ],
|
|
2367
|
+
* });
|
|
2368
|
+
*
|
|
2369
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2370
|
+
* const authClient = await auth.getClient();
|
|
2371
|
+
* google.options({auth: authClient});
|
|
2372
|
+
*
|
|
2373
|
+
* // Do the magic
|
|
2374
|
+
* const res = await translate.projects.locations.batchTranslateText({
|
|
2375
|
+
* // 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.
|
|
2376
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2377
|
+
*
|
|
2378
|
+
* // Request body metadata
|
|
2379
|
+
* requestBody: {
|
|
2380
|
+
* // request body parameters
|
|
2381
|
+
* // {
|
|
2382
|
+
* // "glossaries": {},
|
|
2383
|
+
* // "inputConfigs": [],
|
|
2384
|
+
* // "labels": {},
|
|
2385
|
+
* // "models": {},
|
|
2386
|
+
* // "outputConfig": {},
|
|
2387
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
2388
|
+
* // "targetLanguageCodes": []
|
|
2389
|
+
* // }
|
|
2390
|
+
* },
|
|
2391
|
+
* });
|
|
2392
|
+
* console.log(res.data);
|
|
2393
|
+
*
|
|
2394
|
+
* // Example response
|
|
2395
|
+
* // {
|
|
2396
|
+
* // "done": false,
|
|
2397
|
+
* // "error": {},
|
|
2398
|
+
* // "metadata": {},
|
|
2399
|
+
* // "name": "my_name",
|
|
2400
|
+
* // "response": {}
|
|
2401
|
+
* // }
|
|
2402
|
+
* }
|
|
2403
|
+
*
|
|
2404
|
+
* main().catch(e => {
|
|
2405
|
+
* console.error(e);
|
|
2406
|
+
* throw e;
|
|
2407
|
+
* });
|
|
2408
|
+
*
|
|
2409
|
+
* ```
|
|
1975
2410
|
*
|
|
1976
2411
|
* @param params - Parameters for request
|
|
1977
2412
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2063,6 +2498,66 @@ export namespace translate_v3 {
|
|
|
2063
2498
|
|
|
2064
2499
|
/**
|
|
2065
2500
|
* Detects the language of text within a request.
|
|
2501
|
+
* @example
|
|
2502
|
+
* ```js
|
|
2503
|
+
* // Before running the sample:
|
|
2504
|
+
* // - Enable the API at:
|
|
2505
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2506
|
+
* // - Login into gcloud by running:
|
|
2507
|
+
* // ```sh
|
|
2508
|
+
* // $ gcloud auth application-default login
|
|
2509
|
+
* // ```
|
|
2510
|
+
* // - Install the npm module by running:
|
|
2511
|
+
* // ```sh
|
|
2512
|
+
* // $ npm install googleapis
|
|
2513
|
+
* // ```
|
|
2514
|
+
*
|
|
2515
|
+
* const {google} = require('googleapis');
|
|
2516
|
+
* const translate = google.translate('v3');
|
|
2517
|
+
*
|
|
2518
|
+
* async function main() {
|
|
2519
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2520
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2521
|
+
* scopes: [
|
|
2522
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2523
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2524
|
+
* ],
|
|
2525
|
+
* });
|
|
2526
|
+
*
|
|
2527
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2528
|
+
* const authClient = await auth.getClient();
|
|
2529
|
+
* google.options({auth: authClient});
|
|
2530
|
+
*
|
|
2531
|
+
* // Do the magic
|
|
2532
|
+
* const res = await translate.projects.locations.detectLanguage({
|
|
2533
|
+
* // 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.
|
|
2534
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2535
|
+
*
|
|
2536
|
+
* // Request body metadata
|
|
2537
|
+
* requestBody: {
|
|
2538
|
+
* // request body parameters
|
|
2539
|
+
* // {
|
|
2540
|
+
* // "content": "my_content",
|
|
2541
|
+
* // "labels": {},
|
|
2542
|
+
* // "mimeType": "my_mimeType",
|
|
2543
|
+
* // "model": "my_model"
|
|
2544
|
+
* // }
|
|
2545
|
+
* },
|
|
2546
|
+
* });
|
|
2547
|
+
* console.log(res.data);
|
|
2548
|
+
*
|
|
2549
|
+
* // Example response
|
|
2550
|
+
* // {
|
|
2551
|
+
* // "languages": []
|
|
2552
|
+
* // }
|
|
2553
|
+
* }
|
|
2554
|
+
*
|
|
2555
|
+
* main().catch(e => {
|
|
2556
|
+
* console.error(e);
|
|
2557
|
+
* throw e;
|
|
2558
|
+
* });
|
|
2559
|
+
*
|
|
2560
|
+
* ```
|
|
2066
2561
|
*
|
|
2067
2562
|
* @param params - Parameters for request
|
|
2068
2563
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2158,6 +2653,59 @@ export namespace translate_v3 {
|
|
|
2158
2653
|
|
|
2159
2654
|
/**
|
|
2160
2655
|
* Gets information about a location.
|
|
2656
|
+
* @example
|
|
2657
|
+
* ```js
|
|
2658
|
+
* // Before running the sample:
|
|
2659
|
+
* // - Enable the API at:
|
|
2660
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2661
|
+
* // - Login into gcloud by running:
|
|
2662
|
+
* // ```sh
|
|
2663
|
+
* // $ gcloud auth application-default login
|
|
2664
|
+
* // ```
|
|
2665
|
+
* // - Install the npm module by running:
|
|
2666
|
+
* // ```sh
|
|
2667
|
+
* // $ npm install googleapis
|
|
2668
|
+
* // ```
|
|
2669
|
+
*
|
|
2670
|
+
* const {google} = require('googleapis');
|
|
2671
|
+
* const translate = google.translate('v3');
|
|
2672
|
+
*
|
|
2673
|
+
* async function main() {
|
|
2674
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2675
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2676
|
+
* scopes: [
|
|
2677
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2678
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2679
|
+
* ],
|
|
2680
|
+
* });
|
|
2681
|
+
*
|
|
2682
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2683
|
+
* const authClient = await auth.getClient();
|
|
2684
|
+
* google.options({auth: authClient});
|
|
2685
|
+
*
|
|
2686
|
+
* // Do the magic
|
|
2687
|
+
* const res = await translate.projects.locations.get({
|
|
2688
|
+
* // Resource name for the location.
|
|
2689
|
+
* name: 'projects/my-project/locations/my-location',
|
|
2690
|
+
* });
|
|
2691
|
+
* console.log(res.data);
|
|
2692
|
+
*
|
|
2693
|
+
* // Example response
|
|
2694
|
+
* // {
|
|
2695
|
+
* // "displayName": "my_displayName",
|
|
2696
|
+
* // "labels": {},
|
|
2697
|
+
* // "locationId": "my_locationId",
|
|
2698
|
+
* // "metadata": {},
|
|
2699
|
+
* // "name": "my_name"
|
|
2700
|
+
* // }
|
|
2701
|
+
* }
|
|
2702
|
+
*
|
|
2703
|
+
* main().catch(e => {
|
|
2704
|
+
* console.error(e);
|
|
2705
|
+
* throw e;
|
|
2706
|
+
* });
|
|
2707
|
+
*
|
|
2708
|
+
* ```
|
|
2161
2709
|
*
|
|
2162
2710
|
* @param params - Parameters for request
|
|
2163
2711
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2246,6 +2794,59 @@ export namespace translate_v3 {
|
|
|
2246
2794
|
|
|
2247
2795
|
/**
|
|
2248
2796
|
* Returns a list of supported languages for translation.
|
|
2797
|
+
* @example
|
|
2798
|
+
* ```js
|
|
2799
|
+
* // Before running the sample:
|
|
2800
|
+
* // - Enable the API at:
|
|
2801
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2802
|
+
* // - Login into gcloud by running:
|
|
2803
|
+
* // ```sh
|
|
2804
|
+
* // $ gcloud auth application-default login
|
|
2805
|
+
* // ```
|
|
2806
|
+
* // - Install the npm module by running:
|
|
2807
|
+
* // ```sh
|
|
2808
|
+
* // $ npm install googleapis
|
|
2809
|
+
* // ```
|
|
2810
|
+
*
|
|
2811
|
+
* const {google} = require('googleapis');
|
|
2812
|
+
* const translate = google.translate('v3');
|
|
2813
|
+
*
|
|
2814
|
+
* async function main() {
|
|
2815
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2816
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2817
|
+
* scopes: [
|
|
2818
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2819
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2820
|
+
* ],
|
|
2821
|
+
* });
|
|
2822
|
+
*
|
|
2823
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2824
|
+
* const authClient = await auth.getClient();
|
|
2825
|
+
* google.options({auth: authClient});
|
|
2826
|
+
*
|
|
2827
|
+
* // Do the magic
|
|
2828
|
+
* const res = await translate.projects.locations.getSupportedLanguages({
|
|
2829
|
+
* // 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.
|
|
2830
|
+
* displayLanguageCode: 'placeholder-value',
|
|
2831
|
+
* // 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.
|
|
2832
|
+
* model: 'placeholder-value',
|
|
2833
|
+
* // 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.
|
|
2834
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
2835
|
+
* });
|
|
2836
|
+
* console.log(res.data);
|
|
2837
|
+
*
|
|
2838
|
+
* // Example response
|
|
2839
|
+
* // {
|
|
2840
|
+
* // "languages": []
|
|
2841
|
+
* // }
|
|
2842
|
+
* }
|
|
2843
|
+
*
|
|
2844
|
+
* main().catch(e => {
|
|
2845
|
+
* console.error(e);
|
|
2846
|
+
* throw e;
|
|
2847
|
+
* });
|
|
2848
|
+
*
|
|
2849
|
+
* ```
|
|
2249
2850
|
*
|
|
2250
2851
|
* @param params - Parameters for request
|
|
2251
2852
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2339,6 +2940,64 @@ export namespace translate_v3 {
|
|
|
2339
2940
|
|
|
2340
2941
|
/**
|
|
2341
2942
|
* Lists information about the supported locations for this service.
|
|
2943
|
+
* @example
|
|
2944
|
+
* ```js
|
|
2945
|
+
* // Before running the sample:
|
|
2946
|
+
* // - Enable the API at:
|
|
2947
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
2948
|
+
* // - Login into gcloud by running:
|
|
2949
|
+
* // ```sh
|
|
2950
|
+
* // $ gcloud auth application-default login
|
|
2951
|
+
* // ```
|
|
2952
|
+
* // - Install the npm module by running:
|
|
2953
|
+
* // ```sh
|
|
2954
|
+
* // $ npm install googleapis
|
|
2955
|
+
* // ```
|
|
2956
|
+
*
|
|
2957
|
+
* const {google} = require('googleapis');
|
|
2958
|
+
* const translate = google.translate('v3');
|
|
2959
|
+
*
|
|
2960
|
+
* async function main() {
|
|
2961
|
+
* const auth = new google.auth.GoogleAuth({
|
|
2962
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
2963
|
+
* scopes: [
|
|
2964
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
2965
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
2966
|
+
* ],
|
|
2967
|
+
* });
|
|
2968
|
+
*
|
|
2969
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
2970
|
+
* const authClient = await auth.getClient();
|
|
2971
|
+
* google.options({auth: authClient});
|
|
2972
|
+
*
|
|
2973
|
+
* // Do the magic
|
|
2974
|
+
* const res = await translate.projects.locations.list({
|
|
2975
|
+
* // Optional. A list of extra location types that should be used as conditions for controlling the visibility of the locations.
|
|
2976
|
+
* extraLocationTypes: 'placeholder-value',
|
|
2977
|
+
* // 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).
|
|
2978
|
+
* filter: 'placeholder-value',
|
|
2979
|
+
* // The resource that owns the locations collection, if applicable.
|
|
2980
|
+
* name: 'projects/my-project',
|
|
2981
|
+
* // The maximum number of results to return. If not set, the service selects a default.
|
|
2982
|
+
* pageSize: 'placeholder-value',
|
|
2983
|
+
* // A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
|
|
2984
|
+
* pageToken: 'placeholder-value',
|
|
2985
|
+
* });
|
|
2986
|
+
* console.log(res.data);
|
|
2987
|
+
*
|
|
2988
|
+
* // Example response
|
|
2989
|
+
* // {
|
|
2990
|
+
* // "locations": [],
|
|
2991
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
2992
|
+
* // }
|
|
2993
|
+
* }
|
|
2994
|
+
*
|
|
2995
|
+
* main().catch(e => {
|
|
2996
|
+
* console.error(e);
|
|
2997
|
+
* throw e;
|
|
2998
|
+
* });
|
|
2999
|
+
*
|
|
3000
|
+
* ```
|
|
2342
3001
|
*
|
|
2343
3002
|
* @param params - Parameters for request
|
|
2344
3003
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2432,6 +3091,64 @@ export namespace translate_v3 {
|
|
|
2432
3091
|
|
|
2433
3092
|
/**
|
|
2434
3093
|
* Romanize input text written in non-Latin scripts to Latin text.
|
|
3094
|
+
* @example
|
|
3095
|
+
* ```js
|
|
3096
|
+
* // Before running the sample:
|
|
3097
|
+
* // - Enable the API at:
|
|
3098
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3099
|
+
* // - Login into gcloud by running:
|
|
3100
|
+
* // ```sh
|
|
3101
|
+
* // $ gcloud auth application-default login
|
|
3102
|
+
* // ```
|
|
3103
|
+
* // - Install the npm module by running:
|
|
3104
|
+
* // ```sh
|
|
3105
|
+
* // $ npm install googleapis
|
|
3106
|
+
* // ```
|
|
3107
|
+
*
|
|
3108
|
+
* const {google} = require('googleapis');
|
|
3109
|
+
* const translate = google.translate('v3');
|
|
3110
|
+
*
|
|
3111
|
+
* async function main() {
|
|
3112
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3113
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3114
|
+
* scopes: [
|
|
3115
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3116
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3117
|
+
* ],
|
|
3118
|
+
* });
|
|
3119
|
+
*
|
|
3120
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3121
|
+
* const authClient = await auth.getClient();
|
|
3122
|
+
* google.options({auth: authClient});
|
|
3123
|
+
*
|
|
3124
|
+
* // Do the magic
|
|
3125
|
+
* const res = await translate.projects.locations.romanizeText({
|
|
3126
|
+
* // 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\}`.
|
|
3127
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
3128
|
+
*
|
|
3129
|
+
* // Request body metadata
|
|
3130
|
+
* requestBody: {
|
|
3131
|
+
* // request body parameters
|
|
3132
|
+
* // {
|
|
3133
|
+
* // "contents": [],
|
|
3134
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode"
|
|
3135
|
+
* // }
|
|
3136
|
+
* },
|
|
3137
|
+
* });
|
|
3138
|
+
* console.log(res.data);
|
|
3139
|
+
*
|
|
3140
|
+
* // Example response
|
|
3141
|
+
* // {
|
|
3142
|
+
* // "romanizations": []
|
|
3143
|
+
* // }
|
|
3144
|
+
* }
|
|
3145
|
+
*
|
|
3146
|
+
* main().catch(e => {
|
|
3147
|
+
* console.error(e);
|
|
3148
|
+
* throw e;
|
|
3149
|
+
* });
|
|
3150
|
+
*
|
|
3151
|
+
* ```
|
|
2435
3152
|
*
|
|
2436
3153
|
* @param params - Parameters for request
|
|
2437
3154
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2527,6 +3244,76 @@ export namespace translate_v3 {
|
|
|
2527
3244
|
|
|
2528
3245
|
/**
|
|
2529
3246
|
* Translates documents in synchronous mode.
|
|
3247
|
+
* @example
|
|
3248
|
+
* ```js
|
|
3249
|
+
* // Before running the sample:
|
|
3250
|
+
* // - Enable the API at:
|
|
3251
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3252
|
+
* // - Login into gcloud by running:
|
|
3253
|
+
* // ```sh
|
|
3254
|
+
* // $ gcloud auth application-default login
|
|
3255
|
+
* // ```
|
|
3256
|
+
* // - Install the npm module by running:
|
|
3257
|
+
* // ```sh
|
|
3258
|
+
* // $ npm install googleapis
|
|
3259
|
+
* // ```
|
|
3260
|
+
*
|
|
3261
|
+
* const {google} = require('googleapis');
|
|
3262
|
+
* const translate = google.translate('v3');
|
|
3263
|
+
*
|
|
3264
|
+
* async function main() {
|
|
3265
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3266
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3267
|
+
* scopes: [
|
|
3268
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3269
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3270
|
+
* ],
|
|
3271
|
+
* });
|
|
3272
|
+
*
|
|
3273
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3274
|
+
* const authClient = await auth.getClient();
|
|
3275
|
+
* google.options({auth: authClient});
|
|
3276
|
+
*
|
|
3277
|
+
* // Do the magic
|
|
3278
|
+
* const res = await translate.projects.locations.translateDocument({
|
|
3279
|
+
* // 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` 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 the same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
|
|
3280
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
3281
|
+
*
|
|
3282
|
+
* // Request body metadata
|
|
3283
|
+
* requestBody: {
|
|
3284
|
+
* // request body parameters
|
|
3285
|
+
* // {
|
|
3286
|
+
* // "customizedAttribution": "my_customizedAttribution",
|
|
3287
|
+
* // "documentInputConfig": {},
|
|
3288
|
+
* // "documentOutputConfig": {},
|
|
3289
|
+
* // "enableRotationCorrection": false,
|
|
3290
|
+
* // "enableShadowRemovalNativePdf": false,
|
|
3291
|
+
* // "glossaryConfig": {},
|
|
3292
|
+
* // "isTranslateNativePdfOnly": false,
|
|
3293
|
+
* // "labels": {},
|
|
3294
|
+
* // "model": "my_model",
|
|
3295
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
3296
|
+
* // "targetLanguageCode": "my_targetLanguageCode"
|
|
3297
|
+
* // }
|
|
3298
|
+
* },
|
|
3299
|
+
* });
|
|
3300
|
+
* console.log(res.data);
|
|
3301
|
+
*
|
|
3302
|
+
* // Example response
|
|
3303
|
+
* // {
|
|
3304
|
+
* // "documentTranslation": {},
|
|
3305
|
+
* // "glossaryConfig": {},
|
|
3306
|
+
* // "glossaryDocumentTranslation": {},
|
|
3307
|
+
* // "model": "my_model"
|
|
3308
|
+
* // }
|
|
3309
|
+
* }
|
|
3310
|
+
*
|
|
3311
|
+
* main().catch(e => {
|
|
3312
|
+
* console.error(e);
|
|
3313
|
+
* throw e;
|
|
3314
|
+
* });
|
|
3315
|
+
*
|
|
3316
|
+
* ```
|
|
2530
3317
|
*
|
|
2531
3318
|
* @param params - Parameters for request
|
|
2532
3319
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2622,6 +3409,71 @@ export namespace translate_v3 {
|
|
|
2622
3409
|
|
|
2623
3410
|
/**
|
|
2624
3411
|
* Translates input text and returns translated text.
|
|
3412
|
+
* @example
|
|
3413
|
+
* ```js
|
|
3414
|
+
* // Before running the sample:
|
|
3415
|
+
* // - Enable the API at:
|
|
3416
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3417
|
+
* // - Login into gcloud by running:
|
|
3418
|
+
* // ```sh
|
|
3419
|
+
* // $ gcloud auth application-default login
|
|
3420
|
+
* // ```
|
|
3421
|
+
* // - Install the npm module by running:
|
|
3422
|
+
* // ```sh
|
|
3423
|
+
* // $ npm install googleapis
|
|
3424
|
+
* // ```
|
|
3425
|
+
*
|
|
3426
|
+
* const {google} = require('googleapis');
|
|
3427
|
+
* const translate = google.translate('v3');
|
|
3428
|
+
*
|
|
3429
|
+
* async function main() {
|
|
3430
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3431
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3432
|
+
* scopes: [
|
|
3433
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3434
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3435
|
+
* ],
|
|
3436
|
+
* });
|
|
3437
|
+
*
|
|
3438
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3439
|
+
* const authClient = await auth.getClient();
|
|
3440
|
+
* google.options({auth: authClient});
|
|
3441
|
+
*
|
|
3442
|
+
* // Do the magic
|
|
3443
|
+
* const res = await translate.projects.locations.translateText({
|
|
3444
|
+
* // 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.
|
|
3445
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
3446
|
+
*
|
|
3447
|
+
* // Request body metadata
|
|
3448
|
+
* requestBody: {
|
|
3449
|
+
* // request body parameters
|
|
3450
|
+
* // {
|
|
3451
|
+
* // "contents": [],
|
|
3452
|
+
* // "glossaryConfig": {},
|
|
3453
|
+
* // "labels": {},
|
|
3454
|
+
* // "mimeType": "my_mimeType",
|
|
3455
|
+
* // "model": "my_model",
|
|
3456
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
3457
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
3458
|
+
* // "transliterationConfig": {}
|
|
3459
|
+
* // }
|
|
3460
|
+
* },
|
|
3461
|
+
* });
|
|
3462
|
+
* console.log(res.data);
|
|
3463
|
+
*
|
|
3464
|
+
* // Example response
|
|
3465
|
+
* // {
|
|
3466
|
+
* // "glossaryTranslations": [],
|
|
3467
|
+
* // "translations": []
|
|
3468
|
+
* // }
|
|
3469
|
+
* }
|
|
3470
|
+
*
|
|
3471
|
+
* main().catch(e => {
|
|
3472
|
+
* console.error(e);
|
|
3473
|
+
* throw e;
|
|
3474
|
+
* });
|
|
3475
|
+
*
|
|
3476
|
+
* ```
|
|
2625
3477
|
*
|
|
2626
3478
|
* @param params - Parameters for request
|
|
2627
3479
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2864,6 +3716,75 @@ export namespace translate_v3 {
|
|
|
2864
3716
|
|
|
2865
3717
|
/**
|
|
2866
3718
|
* Creates an Adaptive MT dataset.
|
|
3719
|
+
* @example
|
|
3720
|
+
* ```js
|
|
3721
|
+
* // Before running the sample:
|
|
3722
|
+
* // - Enable the API at:
|
|
3723
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3724
|
+
* // - Login into gcloud by running:
|
|
3725
|
+
* // ```sh
|
|
3726
|
+
* // $ gcloud auth application-default login
|
|
3727
|
+
* // ```
|
|
3728
|
+
* // - Install the npm module by running:
|
|
3729
|
+
* // ```sh
|
|
3730
|
+
* // $ npm install googleapis
|
|
3731
|
+
* // ```
|
|
3732
|
+
*
|
|
3733
|
+
* const {google} = require('googleapis');
|
|
3734
|
+
* const translate = google.translate('v3');
|
|
3735
|
+
*
|
|
3736
|
+
* async function main() {
|
|
3737
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3738
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3739
|
+
* scopes: [
|
|
3740
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3741
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3742
|
+
* ],
|
|
3743
|
+
* });
|
|
3744
|
+
*
|
|
3745
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3746
|
+
* const authClient = await auth.getClient();
|
|
3747
|
+
* google.options({auth: authClient});
|
|
3748
|
+
*
|
|
3749
|
+
* // Do the magic
|
|
3750
|
+
* const res = await translate.projects.locations.adaptiveMtDatasets.create({
|
|
3751
|
+
* // Required. Name of the parent project. In form of `projects/{project-number-or-id\}/locations/{location-id\}`
|
|
3752
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
3753
|
+
*
|
|
3754
|
+
* // Request body metadata
|
|
3755
|
+
* requestBody: {
|
|
3756
|
+
* // request body parameters
|
|
3757
|
+
* // {
|
|
3758
|
+
* // "createTime": "my_createTime",
|
|
3759
|
+
* // "displayName": "my_displayName",
|
|
3760
|
+
* // "exampleCount": 0,
|
|
3761
|
+
* // "name": "my_name",
|
|
3762
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
3763
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
3764
|
+
* // "updateTime": "my_updateTime"
|
|
3765
|
+
* // }
|
|
3766
|
+
* },
|
|
3767
|
+
* });
|
|
3768
|
+
* console.log(res.data);
|
|
3769
|
+
*
|
|
3770
|
+
* // Example response
|
|
3771
|
+
* // {
|
|
3772
|
+
* // "createTime": "my_createTime",
|
|
3773
|
+
* // "displayName": "my_displayName",
|
|
3774
|
+
* // "exampleCount": 0,
|
|
3775
|
+
* // "name": "my_name",
|
|
3776
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
3777
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
3778
|
+
* // "updateTime": "my_updateTime"
|
|
3779
|
+
* // }
|
|
3780
|
+
* }
|
|
3781
|
+
*
|
|
3782
|
+
* main().catch(e => {
|
|
3783
|
+
* console.error(e);
|
|
3784
|
+
* throw e;
|
|
3785
|
+
* });
|
|
3786
|
+
*
|
|
3787
|
+
* ```
|
|
2867
3788
|
*
|
|
2868
3789
|
* @param params - Parameters for request
|
|
2869
3790
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -2956,6 +3877,53 @@ export namespace translate_v3 {
|
|
|
2956
3877
|
|
|
2957
3878
|
/**
|
|
2958
3879
|
* Deletes an Adaptive MT dataset, including all its entries and associated metadata.
|
|
3880
|
+
* @example
|
|
3881
|
+
* ```js
|
|
3882
|
+
* // Before running the sample:
|
|
3883
|
+
* // - Enable the API at:
|
|
3884
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
3885
|
+
* // - Login into gcloud by running:
|
|
3886
|
+
* // ```sh
|
|
3887
|
+
* // $ gcloud auth application-default login
|
|
3888
|
+
* // ```
|
|
3889
|
+
* // - Install the npm module by running:
|
|
3890
|
+
* // ```sh
|
|
3891
|
+
* // $ npm install googleapis
|
|
3892
|
+
* // ```
|
|
3893
|
+
*
|
|
3894
|
+
* const {google} = require('googleapis');
|
|
3895
|
+
* const translate = google.translate('v3');
|
|
3896
|
+
*
|
|
3897
|
+
* async function main() {
|
|
3898
|
+
* const auth = new google.auth.GoogleAuth({
|
|
3899
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
3900
|
+
* scopes: [
|
|
3901
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
3902
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
3903
|
+
* ],
|
|
3904
|
+
* });
|
|
3905
|
+
*
|
|
3906
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
3907
|
+
* const authClient = await auth.getClient();
|
|
3908
|
+
* google.options({auth: authClient});
|
|
3909
|
+
*
|
|
3910
|
+
* // Do the magic
|
|
3911
|
+
* const res = await translate.projects.locations.adaptiveMtDatasets.delete({
|
|
3912
|
+
* // Required. Name of the dataset. In the form of `projects/{project-number-or-id\}/locations/{location-id\}/adaptiveMtDatasets/{adaptive-mt-dataset-id\}`
|
|
3913
|
+
* name: 'projects/my-project/locations/my-location/adaptiveMtDatasets/my-adaptiveMtDataset',
|
|
3914
|
+
* });
|
|
3915
|
+
* console.log(res.data);
|
|
3916
|
+
*
|
|
3917
|
+
* // Example response
|
|
3918
|
+
* // {}
|
|
3919
|
+
* }
|
|
3920
|
+
*
|
|
3921
|
+
* main().catch(e => {
|
|
3922
|
+
* console.error(e);
|
|
3923
|
+
* throw e;
|
|
3924
|
+
* });
|
|
3925
|
+
*
|
|
3926
|
+
* ```
|
|
2959
3927
|
*
|
|
2960
3928
|
* @param params - Parameters for request
|
|
2961
3929
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3045,6 +4013,61 @@ export namespace translate_v3 {
|
|
|
3045
4013
|
|
|
3046
4014
|
/**
|
|
3047
4015
|
* Gets the Adaptive MT dataset.
|
|
4016
|
+
* @example
|
|
4017
|
+
* ```js
|
|
4018
|
+
* // Before running the sample:
|
|
4019
|
+
* // - Enable the API at:
|
|
4020
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
4021
|
+
* // - Login into gcloud by running:
|
|
4022
|
+
* // ```sh
|
|
4023
|
+
* // $ gcloud auth application-default login
|
|
4024
|
+
* // ```
|
|
4025
|
+
* // - Install the npm module by running:
|
|
4026
|
+
* // ```sh
|
|
4027
|
+
* // $ npm install googleapis
|
|
4028
|
+
* // ```
|
|
4029
|
+
*
|
|
4030
|
+
* const {google} = require('googleapis');
|
|
4031
|
+
* const translate = google.translate('v3');
|
|
4032
|
+
*
|
|
4033
|
+
* async function main() {
|
|
4034
|
+
* const auth = new google.auth.GoogleAuth({
|
|
4035
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
4036
|
+
* scopes: [
|
|
4037
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
4038
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
4039
|
+
* ],
|
|
4040
|
+
* });
|
|
4041
|
+
*
|
|
4042
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
4043
|
+
* const authClient = await auth.getClient();
|
|
4044
|
+
* google.options({auth: authClient});
|
|
4045
|
+
*
|
|
4046
|
+
* // Do the magic
|
|
4047
|
+
* const res = await translate.projects.locations.adaptiveMtDatasets.get({
|
|
4048
|
+
* // Required. Name of the dataset. In the form of `projects/{project-number-or-id\}/locations/{location-id\}/adaptiveMtDatasets/{adaptive-mt-dataset-id\}`
|
|
4049
|
+
* name: 'projects/my-project/locations/my-location/adaptiveMtDatasets/my-adaptiveMtDataset',
|
|
4050
|
+
* });
|
|
4051
|
+
* console.log(res.data);
|
|
4052
|
+
*
|
|
4053
|
+
* // Example response
|
|
4054
|
+
* // {
|
|
4055
|
+
* // "createTime": "my_createTime",
|
|
4056
|
+
* // "displayName": "my_displayName",
|
|
4057
|
+
* // "exampleCount": 0,
|
|
4058
|
+
* // "name": "my_name",
|
|
4059
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
4060
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
4061
|
+
* // "updateTime": "my_updateTime"
|
|
4062
|
+
* // }
|
|
4063
|
+
* }
|
|
4064
|
+
*
|
|
4065
|
+
* main().catch(e => {
|
|
4066
|
+
* console.error(e);
|
|
4067
|
+
* throw e;
|
|
4068
|
+
* });
|
|
4069
|
+
*
|
|
4070
|
+
* ```
|
|
3048
4071
|
*
|
|
3049
4072
|
* @param params - Parameters for request
|
|
3050
4073
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3134,6 +4157,66 @@ export namespace translate_v3 {
|
|
|
3134
4157
|
|
|
3135
4158
|
/**
|
|
3136
4159
|
* Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
|
|
4160
|
+
* @example
|
|
4161
|
+
* ```js
|
|
4162
|
+
* // Before running the sample:
|
|
4163
|
+
* // - Enable the API at:
|
|
4164
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
4165
|
+
* // - Login into gcloud by running:
|
|
4166
|
+
* // ```sh
|
|
4167
|
+
* // $ gcloud auth application-default login
|
|
4168
|
+
* // ```
|
|
4169
|
+
* // - Install the npm module by running:
|
|
4170
|
+
* // ```sh
|
|
4171
|
+
* // $ npm install googleapis
|
|
4172
|
+
* // ```
|
|
4173
|
+
*
|
|
4174
|
+
* const {google} = require('googleapis');
|
|
4175
|
+
* const translate = google.translate('v3');
|
|
4176
|
+
*
|
|
4177
|
+
* async function main() {
|
|
4178
|
+
* const auth = new google.auth.GoogleAuth({
|
|
4179
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
4180
|
+
* scopes: [
|
|
4181
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
4182
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
4183
|
+
* ],
|
|
4184
|
+
* });
|
|
4185
|
+
*
|
|
4186
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
4187
|
+
* const authClient = await auth.getClient();
|
|
4188
|
+
* google.options({auth: authClient});
|
|
4189
|
+
*
|
|
4190
|
+
* // Do the magic
|
|
4191
|
+
* const res =
|
|
4192
|
+
* await translate.projects.locations.adaptiveMtDatasets.importAdaptiveMtFile({
|
|
4193
|
+
* // Required. The resource name of the file, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset\}`
|
|
4194
|
+
* parent:
|
|
4195
|
+
* 'projects/my-project/locations/my-location/adaptiveMtDatasets/my-adaptiveMtDataset',
|
|
4196
|
+
*
|
|
4197
|
+
* // Request body metadata
|
|
4198
|
+
* requestBody: {
|
|
4199
|
+
* // request body parameters
|
|
4200
|
+
* // {
|
|
4201
|
+
* // "fileInputSource": {},
|
|
4202
|
+
* // "gcsInputSource": {}
|
|
4203
|
+
* // }
|
|
4204
|
+
* },
|
|
4205
|
+
* });
|
|
4206
|
+
* console.log(res.data);
|
|
4207
|
+
*
|
|
4208
|
+
* // Example response
|
|
4209
|
+
* // {
|
|
4210
|
+
* // "adaptiveMtFile": {}
|
|
4211
|
+
* // }
|
|
4212
|
+
* }
|
|
4213
|
+
*
|
|
4214
|
+
* main().catch(e => {
|
|
4215
|
+
* console.error(e);
|
|
4216
|
+
* throw e;
|
|
4217
|
+
* });
|
|
4218
|
+
*
|
|
4219
|
+
* ```
|
|
3137
4220
|
*
|
|
3138
4221
|
* @param params - Parameters for request
|
|
3139
4222
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3232,6 +4315,62 @@ export namespace translate_v3 {
|
|
|
3232
4315
|
|
|
3233
4316
|
/**
|
|
3234
4317
|
* Lists all Adaptive MT datasets for which the caller has read permission.
|
|
4318
|
+
* @example
|
|
4319
|
+
* ```js
|
|
4320
|
+
* // Before running the sample:
|
|
4321
|
+
* // - Enable the API at:
|
|
4322
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
4323
|
+
* // - Login into gcloud by running:
|
|
4324
|
+
* // ```sh
|
|
4325
|
+
* // $ gcloud auth application-default login
|
|
4326
|
+
* // ```
|
|
4327
|
+
* // - Install the npm module by running:
|
|
4328
|
+
* // ```sh
|
|
4329
|
+
* // $ npm install googleapis
|
|
4330
|
+
* // ```
|
|
4331
|
+
*
|
|
4332
|
+
* const {google} = require('googleapis');
|
|
4333
|
+
* const translate = google.translate('v3');
|
|
4334
|
+
*
|
|
4335
|
+
* async function main() {
|
|
4336
|
+
* const auth = new google.auth.GoogleAuth({
|
|
4337
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
4338
|
+
* scopes: [
|
|
4339
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
4340
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
4341
|
+
* ],
|
|
4342
|
+
* });
|
|
4343
|
+
*
|
|
4344
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
4345
|
+
* const authClient = await auth.getClient();
|
|
4346
|
+
* google.options({auth: authClient});
|
|
4347
|
+
*
|
|
4348
|
+
* // Do the magic
|
|
4349
|
+
* const res = await translate.projects.locations.adaptiveMtDatasets.list({
|
|
4350
|
+
* // Optional. An expression for filtering the results of the request. Filter is not supported yet.
|
|
4351
|
+
* filter: 'placeholder-value',
|
|
4352
|
+
* // Optional. Requested page size. The server may return fewer results than requested. If unspecified, the server picks an appropriate default.
|
|
4353
|
+
* pageSize: 'placeholder-value',
|
|
4354
|
+
* // Optional. A token identifying a page of results the server should return. Typically, this is the value of ListAdaptiveMtDatasetsResponse.next_page_token returned from the previous call to `ListAdaptiveMtDatasets` method. The first page is returned if `page_token`is empty or missing.
|
|
4355
|
+
* pageToken: 'placeholder-value',
|
|
4356
|
+
* // Required. The resource name of the project from which to list the Adaptive MT datasets. `projects/{project-number-or-id\}/locations/{location-id\}`
|
|
4357
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
4358
|
+
* });
|
|
4359
|
+
* console.log(res.data);
|
|
4360
|
+
*
|
|
4361
|
+
* // Example response
|
|
4362
|
+
* // {
|
|
4363
|
+
* // "adaptiveMtDatasets": [],
|
|
4364
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
4365
|
+
* // }
|
|
4366
|
+
* }
|
|
4367
|
+
*
|
|
4368
|
+
* main().catch(e => {
|
|
4369
|
+
* console.error(e);
|
|
4370
|
+
* throw e;
|
|
4371
|
+
* });
|
|
4372
|
+
*
|
|
4373
|
+
* ```
|
|
3235
4374
|
*
|
|
3236
4375
|
* @param params - Parameters for request
|
|
3237
4376
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3400,6 +4539,56 @@ export namespace translate_v3 {
|
|
|
3400
4539
|
|
|
3401
4540
|
/**
|
|
3402
4541
|
* Deletes an AdaptiveMtFile along with its sentences.
|
|
4542
|
+
* @example
|
|
4543
|
+
* ```js
|
|
4544
|
+
* // Before running the sample:
|
|
4545
|
+
* // - Enable the API at:
|
|
4546
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
4547
|
+
* // - Login into gcloud by running:
|
|
4548
|
+
* // ```sh
|
|
4549
|
+
* // $ gcloud auth application-default login
|
|
4550
|
+
* // ```
|
|
4551
|
+
* // - Install the npm module by running:
|
|
4552
|
+
* // ```sh
|
|
4553
|
+
* // $ npm install googleapis
|
|
4554
|
+
* // ```
|
|
4555
|
+
*
|
|
4556
|
+
* const {google} = require('googleapis');
|
|
4557
|
+
* const translate = google.translate('v3');
|
|
4558
|
+
*
|
|
4559
|
+
* async function main() {
|
|
4560
|
+
* const auth = new google.auth.GoogleAuth({
|
|
4561
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
4562
|
+
* scopes: [
|
|
4563
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
4564
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
4565
|
+
* ],
|
|
4566
|
+
* });
|
|
4567
|
+
*
|
|
4568
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
4569
|
+
* const authClient = await auth.getClient();
|
|
4570
|
+
* google.options({auth: authClient});
|
|
4571
|
+
*
|
|
4572
|
+
* // Do the magic
|
|
4573
|
+
* const res =
|
|
4574
|
+
* await translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.delete(
|
|
4575
|
+
* {
|
|
4576
|
+
* // Required. The resource name of the file to delete, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset\}/adaptiveMtFiles/{file\}`
|
|
4577
|
+
* name: 'projects/my-project/locations/my-location/adaptiveMtDatasets/my-adaptiveMtDataset/adaptiveMtFiles/my-adaptiveMtFile',
|
|
4578
|
+
* },
|
|
4579
|
+
* );
|
|
4580
|
+
* console.log(res.data);
|
|
4581
|
+
*
|
|
4582
|
+
* // Example response
|
|
4583
|
+
* // {}
|
|
4584
|
+
* }
|
|
4585
|
+
*
|
|
4586
|
+
* main().catch(e => {
|
|
4587
|
+
* console.error(e);
|
|
4588
|
+
* throw e;
|
|
4589
|
+
* });
|
|
4590
|
+
*
|
|
4591
|
+
* ```
|
|
3403
4592
|
*
|
|
3404
4593
|
* @param params - Parameters for request
|
|
3405
4594
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3489,6 +4678,60 @@ export namespace translate_v3 {
|
|
|
3489
4678
|
|
|
3490
4679
|
/**
|
|
3491
4680
|
* Gets and AdaptiveMtFile
|
|
4681
|
+
* @example
|
|
4682
|
+
* ```js
|
|
4683
|
+
* // Before running the sample:
|
|
4684
|
+
* // - Enable the API at:
|
|
4685
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
4686
|
+
* // - Login into gcloud by running:
|
|
4687
|
+
* // ```sh
|
|
4688
|
+
* // $ gcloud auth application-default login
|
|
4689
|
+
* // ```
|
|
4690
|
+
* // - Install the npm module by running:
|
|
4691
|
+
* // ```sh
|
|
4692
|
+
* // $ npm install googleapis
|
|
4693
|
+
* // ```
|
|
4694
|
+
*
|
|
4695
|
+
* const {google} = require('googleapis');
|
|
4696
|
+
* const translate = google.translate('v3');
|
|
4697
|
+
*
|
|
4698
|
+
* async function main() {
|
|
4699
|
+
* const auth = new google.auth.GoogleAuth({
|
|
4700
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
4701
|
+
* scopes: [
|
|
4702
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
4703
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
4704
|
+
* ],
|
|
4705
|
+
* });
|
|
4706
|
+
*
|
|
4707
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
4708
|
+
* const authClient = await auth.getClient();
|
|
4709
|
+
* google.options({auth: authClient});
|
|
4710
|
+
*
|
|
4711
|
+
* // Do the magic
|
|
4712
|
+
* const res =
|
|
4713
|
+
* await translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.get({
|
|
4714
|
+
* // Required. The resource name of the file, in form of `projects/{project-number-or-id\}/locations/{location_id\}/adaptiveMtDatasets/{dataset\}/adaptiveMtFiles/{file\}`
|
|
4715
|
+
* name: 'projects/my-project/locations/my-location/adaptiveMtDatasets/my-adaptiveMtDataset/adaptiveMtFiles/my-adaptiveMtFile',
|
|
4716
|
+
* });
|
|
4717
|
+
* console.log(res.data);
|
|
4718
|
+
*
|
|
4719
|
+
* // Example response
|
|
4720
|
+
* // {
|
|
4721
|
+
* // "createTime": "my_createTime",
|
|
4722
|
+
* // "displayName": "my_displayName",
|
|
4723
|
+
* // "entryCount": 0,
|
|
4724
|
+
* // "name": "my_name",
|
|
4725
|
+
* // "updateTime": "my_updateTime"
|
|
4726
|
+
* // }
|
|
4727
|
+
* }
|
|
4728
|
+
*
|
|
4729
|
+
* main().catch(e => {
|
|
4730
|
+
* console.error(e);
|
|
4731
|
+
* throw e;
|
|
4732
|
+
* });
|
|
4733
|
+
*
|
|
4734
|
+
* ```
|
|
3492
4735
|
*
|
|
3493
4736
|
* @param params - Parameters for request
|
|
3494
4737
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3578,6 +4821,62 @@ export namespace translate_v3 {
|
|
|
3578
4821
|
|
|
3579
4822
|
/**
|
|
3580
4823
|
* Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
|
4824
|
+
* @example
|
|
4825
|
+
* ```js
|
|
4826
|
+
* // Before running the sample:
|
|
4827
|
+
* // - Enable the API at:
|
|
4828
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
4829
|
+
* // - Login into gcloud by running:
|
|
4830
|
+
* // ```sh
|
|
4831
|
+
* // $ gcloud auth application-default login
|
|
4832
|
+
* // ```
|
|
4833
|
+
* // - Install the npm module by running:
|
|
4834
|
+
* // ```sh
|
|
4835
|
+
* // $ npm install googleapis
|
|
4836
|
+
* // ```
|
|
4837
|
+
*
|
|
4838
|
+
* const {google} = require('googleapis');
|
|
4839
|
+
* const translate = google.translate('v3');
|
|
4840
|
+
*
|
|
4841
|
+
* async function main() {
|
|
4842
|
+
* const auth = new google.auth.GoogleAuth({
|
|
4843
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
4844
|
+
* scopes: [
|
|
4845
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
4846
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
4847
|
+
* ],
|
|
4848
|
+
* });
|
|
4849
|
+
*
|
|
4850
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
4851
|
+
* const authClient = await auth.getClient();
|
|
4852
|
+
* google.options({auth: authClient});
|
|
4853
|
+
*
|
|
4854
|
+
* // Do the magic
|
|
4855
|
+
* const res =
|
|
4856
|
+
* await translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.list({
|
|
4857
|
+
* // Optional.
|
|
4858
|
+
* pageSize: 'placeholder-value',
|
|
4859
|
+
* // Optional. A token identifying a page of results the server should return. Typically, this is the value of ListAdaptiveMtFilesResponse.next_page_token returned from the previous call to `ListAdaptiveMtFiles` method. The first page is returned if `page_token`is empty or missing.
|
|
4860
|
+
* pageToken: 'placeholder-value',
|
|
4861
|
+
* // Required. The resource name of the project from which to list the Adaptive MT files. `projects/{project\}/locations/{location\}/adaptiveMtDatasets/{dataset\}`
|
|
4862
|
+
* parent:
|
|
4863
|
+
* 'projects/my-project/locations/my-location/adaptiveMtDatasets/my-adaptiveMtDataset',
|
|
4864
|
+
* });
|
|
4865
|
+
* console.log(res.data);
|
|
4866
|
+
*
|
|
4867
|
+
* // Example response
|
|
4868
|
+
* // {
|
|
4869
|
+
* // "adaptiveMtFiles": [],
|
|
4870
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
4871
|
+
* // }
|
|
4872
|
+
* }
|
|
4873
|
+
*
|
|
4874
|
+
* main().catch(e => {
|
|
4875
|
+
* console.error(e);
|
|
4876
|
+
* throw e;
|
|
4877
|
+
* });
|
|
4878
|
+
*
|
|
4879
|
+
* ```
|
|
3581
4880
|
*
|
|
3582
4881
|
* @param params - Parameters for request
|
|
3583
4882
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3711,6 +5010,63 @@ export namespace translate_v3 {
|
|
|
3711
5010
|
|
|
3712
5011
|
/**
|
|
3713
5012
|
* Lists all AdaptiveMtSentences under a given file/dataset.
|
|
5013
|
+
* @example
|
|
5014
|
+
* ```js
|
|
5015
|
+
* // Before running the sample:
|
|
5016
|
+
* // - Enable the API at:
|
|
5017
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
5018
|
+
* // - Login into gcloud by running:
|
|
5019
|
+
* // ```sh
|
|
5020
|
+
* // $ gcloud auth application-default login
|
|
5021
|
+
* // ```
|
|
5022
|
+
* // - Install the npm module by running:
|
|
5023
|
+
* // ```sh
|
|
5024
|
+
* // $ npm install googleapis
|
|
5025
|
+
* // ```
|
|
5026
|
+
*
|
|
5027
|
+
* const {google} = require('googleapis');
|
|
5028
|
+
* const translate = google.translate('v3');
|
|
5029
|
+
*
|
|
5030
|
+
* async function main() {
|
|
5031
|
+
* const auth = new google.auth.GoogleAuth({
|
|
5032
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
5033
|
+
* scopes: [
|
|
5034
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
5035
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
5036
|
+
* ],
|
|
5037
|
+
* });
|
|
5038
|
+
*
|
|
5039
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
5040
|
+
* const authClient = await auth.getClient();
|
|
5041
|
+
* google.options({auth: authClient});
|
|
5042
|
+
*
|
|
5043
|
+
* // Do the magic
|
|
5044
|
+
* const res =
|
|
5045
|
+
* await translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.adaptiveMtSentences.list(
|
|
5046
|
+
* {
|
|
5047
|
+
* pageSize: 'placeholder-value',
|
|
5048
|
+
* // A token identifying a page of results the server should return. Typically, this is the value of ListAdaptiveMtSentencesRequest.next_page_token returned from the previous call to `ListTranslationMemories` method. The first page is returned if `page_token` is empty or missing.
|
|
5049
|
+
* pageToken: 'placeholder-value',
|
|
5050
|
+
* // Required. The resource name of the project from which to list the Adaptive MT files. The following format lists all sentences under a file. `projects/{project\}/locations/{location\}/adaptiveMtDatasets/{dataset\}/adaptiveMtFiles/{file\}` The following format lists all sentences within a dataset. `projects/{project\}/locations/{location\}/adaptiveMtDatasets/{dataset\}`
|
|
5051
|
+
* parent:
|
|
5052
|
+
* 'projects/my-project/locations/my-location/adaptiveMtDatasets/my-adaptiveMtDataset/adaptiveMtFiles/my-adaptiveMtFile',
|
|
5053
|
+
* },
|
|
5054
|
+
* );
|
|
5055
|
+
* console.log(res.data);
|
|
5056
|
+
*
|
|
5057
|
+
* // Example response
|
|
5058
|
+
* // {
|
|
5059
|
+
* // "adaptiveMtSentences": [],
|
|
5060
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
5061
|
+
* // }
|
|
5062
|
+
* }
|
|
5063
|
+
*
|
|
5064
|
+
* main().catch(e => {
|
|
5065
|
+
* console.error(e);
|
|
5066
|
+
* throw e;
|
|
5067
|
+
* });
|
|
5068
|
+
*
|
|
5069
|
+
* ```
|
|
3714
5070
|
*
|
|
3715
5071
|
* @param params - Parameters for request
|
|
3716
5072
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3832,6 +5188,63 @@ export namespace translate_v3 {
|
|
|
3832
5188
|
|
|
3833
5189
|
/**
|
|
3834
5190
|
* Lists all AdaptiveMtSentences under a given file/dataset.
|
|
5191
|
+
* @example
|
|
5192
|
+
* ```js
|
|
5193
|
+
* // Before running the sample:
|
|
5194
|
+
* // - Enable the API at:
|
|
5195
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
5196
|
+
* // - Login into gcloud by running:
|
|
5197
|
+
* // ```sh
|
|
5198
|
+
* // $ gcloud auth application-default login
|
|
5199
|
+
* // ```
|
|
5200
|
+
* // - Install the npm module by running:
|
|
5201
|
+
* // ```sh
|
|
5202
|
+
* // $ npm install googleapis
|
|
5203
|
+
* // ```
|
|
5204
|
+
*
|
|
5205
|
+
* const {google} = require('googleapis');
|
|
5206
|
+
* const translate = google.translate('v3');
|
|
5207
|
+
*
|
|
5208
|
+
* async function main() {
|
|
5209
|
+
* const auth = new google.auth.GoogleAuth({
|
|
5210
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
5211
|
+
* scopes: [
|
|
5212
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
5213
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
5214
|
+
* ],
|
|
5215
|
+
* });
|
|
5216
|
+
*
|
|
5217
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
5218
|
+
* const authClient = await auth.getClient();
|
|
5219
|
+
* google.options({auth: authClient});
|
|
5220
|
+
*
|
|
5221
|
+
* // Do the magic
|
|
5222
|
+
* const res =
|
|
5223
|
+
* await translate.projects.locations.adaptiveMtDatasets.adaptiveMtSentences.list(
|
|
5224
|
+
* {
|
|
5225
|
+
* pageSize: 'placeholder-value',
|
|
5226
|
+
* // A token identifying a page of results the server should return. Typically, this is the value of ListAdaptiveMtSentencesRequest.next_page_token returned from the previous call to `ListTranslationMemories` method. The first page is returned if `page_token` is empty or missing.
|
|
5227
|
+
* pageToken: 'placeholder-value',
|
|
5228
|
+
* // Required. The resource name of the project from which to list the Adaptive MT files. The following format lists all sentences under a file. `projects/{project\}/locations/{location\}/adaptiveMtDatasets/{dataset\}/adaptiveMtFiles/{file\}` The following format lists all sentences within a dataset. `projects/{project\}/locations/{location\}/adaptiveMtDatasets/{dataset\}`
|
|
5229
|
+
* parent:
|
|
5230
|
+
* 'projects/my-project/locations/my-location/adaptiveMtDatasets/my-adaptiveMtDataset',
|
|
5231
|
+
* },
|
|
5232
|
+
* );
|
|
5233
|
+
* console.log(res.data);
|
|
5234
|
+
*
|
|
5235
|
+
* // Example response
|
|
5236
|
+
* // {
|
|
5237
|
+
* // "adaptiveMtSentences": [],
|
|
5238
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
5239
|
+
* // }
|
|
5240
|
+
* }
|
|
5241
|
+
*
|
|
5242
|
+
* main().catch(e => {
|
|
5243
|
+
* console.error(e);
|
|
5244
|
+
* throw e;
|
|
5245
|
+
* });
|
|
5246
|
+
*
|
|
5247
|
+
* ```
|
|
3835
5248
|
*
|
|
3836
5249
|
* @param params - Parameters for request
|
|
3837
5250
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -3957,6 +5370,76 @@ export namespace translate_v3 {
|
|
|
3957
5370
|
|
|
3958
5371
|
/**
|
|
3959
5372
|
* Creates a Dataset.
|
|
5373
|
+
* @example
|
|
5374
|
+
* ```js
|
|
5375
|
+
* // Before running the sample:
|
|
5376
|
+
* // - Enable the API at:
|
|
5377
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
5378
|
+
* // - Login into gcloud by running:
|
|
5379
|
+
* // ```sh
|
|
5380
|
+
* // $ gcloud auth application-default login
|
|
5381
|
+
* // ```
|
|
5382
|
+
* // - Install the npm module by running:
|
|
5383
|
+
* // ```sh
|
|
5384
|
+
* // $ npm install googleapis
|
|
5385
|
+
* // ```
|
|
5386
|
+
*
|
|
5387
|
+
* const {google} = require('googleapis');
|
|
5388
|
+
* const translate = google.translate('v3');
|
|
5389
|
+
*
|
|
5390
|
+
* async function main() {
|
|
5391
|
+
* const auth = new google.auth.GoogleAuth({
|
|
5392
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
5393
|
+
* scopes: [
|
|
5394
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
5395
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
5396
|
+
* ],
|
|
5397
|
+
* });
|
|
5398
|
+
*
|
|
5399
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
5400
|
+
* const authClient = await auth.getClient();
|
|
5401
|
+
* google.options({auth: authClient});
|
|
5402
|
+
*
|
|
5403
|
+
* // Do the magic
|
|
5404
|
+
* const res = await translate.projects.locations.datasets.create({
|
|
5405
|
+
* // Required. The project name.
|
|
5406
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
5407
|
+
*
|
|
5408
|
+
* // Request body metadata
|
|
5409
|
+
* requestBody: {
|
|
5410
|
+
* // request body parameters
|
|
5411
|
+
* // {
|
|
5412
|
+
* // "createTime": "my_createTime",
|
|
5413
|
+
* // "displayName": "my_displayName",
|
|
5414
|
+
* // "exampleCount": 0,
|
|
5415
|
+
* // "name": "my_name",
|
|
5416
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
5417
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
5418
|
+
* // "testExampleCount": 0,
|
|
5419
|
+
* // "trainExampleCount": 0,
|
|
5420
|
+
* // "updateTime": "my_updateTime",
|
|
5421
|
+
* // "validateExampleCount": 0
|
|
5422
|
+
* // }
|
|
5423
|
+
* },
|
|
5424
|
+
* });
|
|
5425
|
+
* console.log(res.data);
|
|
5426
|
+
*
|
|
5427
|
+
* // Example response
|
|
5428
|
+
* // {
|
|
5429
|
+
* // "done": false,
|
|
5430
|
+
* // "error": {},
|
|
5431
|
+
* // "metadata": {},
|
|
5432
|
+
* // "name": "my_name",
|
|
5433
|
+
* // "response": {}
|
|
5434
|
+
* // }
|
|
5435
|
+
* }
|
|
5436
|
+
*
|
|
5437
|
+
* main().catch(e => {
|
|
5438
|
+
* console.error(e);
|
|
5439
|
+
* throw e;
|
|
5440
|
+
* });
|
|
5441
|
+
*
|
|
5442
|
+
* ```
|
|
3960
5443
|
*
|
|
3961
5444
|
* @param params - Parameters for request
|
|
3962
5445
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4048,6 +5531,59 @@ export namespace translate_v3 {
|
|
|
4048
5531
|
|
|
4049
5532
|
/**
|
|
4050
5533
|
* Deletes a dataset and all of its contents.
|
|
5534
|
+
* @example
|
|
5535
|
+
* ```js
|
|
5536
|
+
* // Before running the sample:
|
|
5537
|
+
* // - Enable the API at:
|
|
5538
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
5539
|
+
* // - Login into gcloud by running:
|
|
5540
|
+
* // ```sh
|
|
5541
|
+
* // $ gcloud auth application-default login
|
|
5542
|
+
* // ```
|
|
5543
|
+
* // - Install the npm module by running:
|
|
5544
|
+
* // ```sh
|
|
5545
|
+
* // $ npm install googleapis
|
|
5546
|
+
* // ```
|
|
5547
|
+
*
|
|
5548
|
+
* const {google} = require('googleapis');
|
|
5549
|
+
* const translate = google.translate('v3');
|
|
5550
|
+
*
|
|
5551
|
+
* async function main() {
|
|
5552
|
+
* const auth = new google.auth.GoogleAuth({
|
|
5553
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
5554
|
+
* scopes: [
|
|
5555
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
5556
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
5557
|
+
* ],
|
|
5558
|
+
* });
|
|
5559
|
+
*
|
|
5560
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
5561
|
+
* const authClient = await auth.getClient();
|
|
5562
|
+
* google.options({auth: authClient});
|
|
5563
|
+
*
|
|
5564
|
+
* // Do the magic
|
|
5565
|
+
* const res = await translate.projects.locations.datasets.delete({
|
|
5566
|
+
* // Required. The name of the dataset to delete.
|
|
5567
|
+
* name: 'projects/my-project/locations/my-location/datasets/my-dataset',
|
|
5568
|
+
* });
|
|
5569
|
+
* console.log(res.data);
|
|
5570
|
+
*
|
|
5571
|
+
* // Example response
|
|
5572
|
+
* // {
|
|
5573
|
+
* // "done": false,
|
|
5574
|
+
* // "error": {},
|
|
5575
|
+
* // "metadata": {},
|
|
5576
|
+
* // "name": "my_name",
|
|
5577
|
+
* // "response": {}
|
|
5578
|
+
* // }
|
|
5579
|
+
* }
|
|
5580
|
+
*
|
|
5581
|
+
* main().catch(e => {
|
|
5582
|
+
* console.error(e);
|
|
5583
|
+
* throw e;
|
|
5584
|
+
* });
|
|
5585
|
+
*
|
|
5586
|
+
* ```
|
|
4051
5587
|
*
|
|
4052
5588
|
* @param params - Parameters for request
|
|
4053
5589
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4136,6 +5672,67 @@ export namespace translate_v3 {
|
|
|
4136
5672
|
|
|
4137
5673
|
/**
|
|
4138
5674
|
* Exports dataset's data to the provided output location.
|
|
5675
|
+
* @example
|
|
5676
|
+
* ```js
|
|
5677
|
+
* // Before running the sample:
|
|
5678
|
+
* // - Enable the API at:
|
|
5679
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
5680
|
+
* // - Login into gcloud by running:
|
|
5681
|
+
* // ```sh
|
|
5682
|
+
* // $ gcloud auth application-default login
|
|
5683
|
+
* // ```
|
|
5684
|
+
* // - Install the npm module by running:
|
|
5685
|
+
* // ```sh
|
|
5686
|
+
* // $ npm install googleapis
|
|
5687
|
+
* // ```
|
|
5688
|
+
*
|
|
5689
|
+
* const {google} = require('googleapis');
|
|
5690
|
+
* const translate = google.translate('v3');
|
|
5691
|
+
*
|
|
5692
|
+
* async function main() {
|
|
5693
|
+
* const auth = new google.auth.GoogleAuth({
|
|
5694
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
5695
|
+
* scopes: [
|
|
5696
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
5697
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
5698
|
+
* ],
|
|
5699
|
+
* });
|
|
5700
|
+
*
|
|
5701
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
5702
|
+
* const authClient = await auth.getClient();
|
|
5703
|
+
* google.options({auth: authClient});
|
|
5704
|
+
*
|
|
5705
|
+
* // Do the magic
|
|
5706
|
+
* const res = await translate.projects.locations.datasets.exportData({
|
|
5707
|
+
* // Required. Name of the dataset. In form of `projects/{project-number-or-id\}/locations/{location-id\}/datasets/{dataset-id\}`
|
|
5708
|
+
* dataset: 'projects/my-project/locations/my-location/datasets/my-dataset',
|
|
5709
|
+
*
|
|
5710
|
+
* // Request body metadata
|
|
5711
|
+
* requestBody: {
|
|
5712
|
+
* // request body parameters
|
|
5713
|
+
* // {
|
|
5714
|
+
* // "outputConfig": {}
|
|
5715
|
+
* // }
|
|
5716
|
+
* },
|
|
5717
|
+
* });
|
|
5718
|
+
* console.log(res.data);
|
|
5719
|
+
*
|
|
5720
|
+
* // Example response
|
|
5721
|
+
* // {
|
|
5722
|
+
* // "done": false,
|
|
5723
|
+
* // "error": {},
|
|
5724
|
+
* // "metadata": {},
|
|
5725
|
+
* // "name": "my_name",
|
|
5726
|
+
* // "response": {}
|
|
5727
|
+
* // }
|
|
5728
|
+
* }
|
|
5729
|
+
*
|
|
5730
|
+
* main().catch(e => {
|
|
5731
|
+
* console.error(e);
|
|
5732
|
+
* throw e;
|
|
5733
|
+
* });
|
|
5734
|
+
*
|
|
5735
|
+
* ```
|
|
4139
5736
|
*
|
|
4140
5737
|
* @param params - Parameters for request
|
|
4141
5738
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4227,6 +5824,64 @@ export namespace translate_v3 {
|
|
|
4227
5824
|
|
|
4228
5825
|
/**
|
|
4229
5826
|
* Gets a Dataset.
|
|
5827
|
+
* @example
|
|
5828
|
+
* ```js
|
|
5829
|
+
* // Before running the sample:
|
|
5830
|
+
* // - Enable the API at:
|
|
5831
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
5832
|
+
* // - Login into gcloud by running:
|
|
5833
|
+
* // ```sh
|
|
5834
|
+
* // $ gcloud auth application-default login
|
|
5835
|
+
* // ```
|
|
5836
|
+
* // - Install the npm module by running:
|
|
5837
|
+
* // ```sh
|
|
5838
|
+
* // $ npm install googleapis
|
|
5839
|
+
* // ```
|
|
5840
|
+
*
|
|
5841
|
+
* const {google} = require('googleapis');
|
|
5842
|
+
* const translate = google.translate('v3');
|
|
5843
|
+
*
|
|
5844
|
+
* async function main() {
|
|
5845
|
+
* const auth = new google.auth.GoogleAuth({
|
|
5846
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
5847
|
+
* scopes: [
|
|
5848
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
5849
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
5850
|
+
* ],
|
|
5851
|
+
* });
|
|
5852
|
+
*
|
|
5853
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
5854
|
+
* const authClient = await auth.getClient();
|
|
5855
|
+
* google.options({auth: authClient});
|
|
5856
|
+
*
|
|
5857
|
+
* // Do the magic
|
|
5858
|
+
* const res = await translate.projects.locations.datasets.get({
|
|
5859
|
+
* // Required. The resource name of the dataset to retrieve.
|
|
5860
|
+
* name: 'projects/my-project/locations/my-location/datasets/my-dataset',
|
|
5861
|
+
* });
|
|
5862
|
+
* console.log(res.data);
|
|
5863
|
+
*
|
|
5864
|
+
* // Example response
|
|
5865
|
+
* // {
|
|
5866
|
+
* // "createTime": "my_createTime",
|
|
5867
|
+
* // "displayName": "my_displayName",
|
|
5868
|
+
* // "exampleCount": 0,
|
|
5869
|
+
* // "name": "my_name",
|
|
5870
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
5871
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
5872
|
+
* // "testExampleCount": 0,
|
|
5873
|
+
* // "trainExampleCount": 0,
|
|
5874
|
+
* // "updateTime": "my_updateTime",
|
|
5875
|
+
* // "validateExampleCount": 0
|
|
5876
|
+
* // }
|
|
5877
|
+
* }
|
|
5878
|
+
*
|
|
5879
|
+
* main().catch(e => {
|
|
5880
|
+
* console.error(e);
|
|
5881
|
+
* throw e;
|
|
5882
|
+
* });
|
|
5883
|
+
*
|
|
5884
|
+
* ```
|
|
4230
5885
|
*
|
|
4231
5886
|
* @param params - Parameters for request
|
|
4232
5887
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4315,6 +5970,67 @@ export namespace translate_v3 {
|
|
|
4315
5970
|
|
|
4316
5971
|
/**
|
|
4317
5972
|
* Import sentence pairs into translation Dataset.
|
|
5973
|
+
* @example
|
|
5974
|
+
* ```js
|
|
5975
|
+
* // Before running the sample:
|
|
5976
|
+
* // - Enable the API at:
|
|
5977
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
5978
|
+
* // - Login into gcloud by running:
|
|
5979
|
+
* // ```sh
|
|
5980
|
+
* // $ gcloud auth application-default login
|
|
5981
|
+
* // ```
|
|
5982
|
+
* // - Install the npm module by running:
|
|
5983
|
+
* // ```sh
|
|
5984
|
+
* // $ npm install googleapis
|
|
5985
|
+
* // ```
|
|
5986
|
+
*
|
|
5987
|
+
* const {google} = require('googleapis');
|
|
5988
|
+
* const translate = google.translate('v3');
|
|
5989
|
+
*
|
|
5990
|
+
* async function main() {
|
|
5991
|
+
* const auth = new google.auth.GoogleAuth({
|
|
5992
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
5993
|
+
* scopes: [
|
|
5994
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
5995
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
5996
|
+
* ],
|
|
5997
|
+
* });
|
|
5998
|
+
*
|
|
5999
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
6000
|
+
* const authClient = await auth.getClient();
|
|
6001
|
+
* google.options({auth: authClient});
|
|
6002
|
+
*
|
|
6003
|
+
* // Do the magic
|
|
6004
|
+
* const res = await translate.projects.locations.datasets.importData({
|
|
6005
|
+
* // Required. Name of the dataset. In form of `projects/{project-number-or-id\}/locations/{location-id\}/datasets/{dataset-id\}`
|
|
6006
|
+
* dataset: 'projects/my-project/locations/my-location/datasets/my-dataset',
|
|
6007
|
+
*
|
|
6008
|
+
* // Request body metadata
|
|
6009
|
+
* requestBody: {
|
|
6010
|
+
* // request body parameters
|
|
6011
|
+
* // {
|
|
6012
|
+
* // "inputConfig": {}
|
|
6013
|
+
* // }
|
|
6014
|
+
* },
|
|
6015
|
+
* });
|
|
6016
|
+
* console.log(res.data);
|
|
6017
|
+
*
|
|
6018
|
+
* // Example response
|
|
6019
|
+
* // {
|
|
6020
|
+
* // "done": false,
|
|
6021
|
+
* // "error": {},
|
|
6022
|
+
* // "metadata": {},
|
|
6023
|
+
* // "name": "my_name",
|
|
6024
|
+
* // "response": {}
|
|
6025
|
+
* // }
|
|
6026
|
+
* }
|
|
6027
|
+
*
|
|
6028
|
+
* main().catch(e => {
|
|
6029
|
+
* console.error(e);
|
|
6030
|
+
* throw e;
|
|
6031
|
+
* });
|
|
6032
|
+
*
|
|
6033
|
+
* ```
|
|
4318
6034
|
*
|
|
4319
6035
|
* @param params - Parameters for request
|
|
4320
6036
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4406,6 +6122,60 @@ export namespace translate_v3 {
|
|
|
4406
6122
|
|
|
4407
6123
|
/**
|
|
4408
6124
|
* Lists datasets.
|
|
6125
|
+
* @example
|
|
6126
|
+
* ```js
|
|
6127
|
+
* // Before running the sample:
|
|
6128
|
+
* // - Enable the API at:
|
|
6129
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
6130
|
+
* // - Login into gcloud by running:
|
|
6131
|
+
* // ```sh
|
|
6132
|
+
* // $ gcloud auth application-default login
|
|
6133
|
+
* // ```
|
|
6134
|
+
* // - Install the npm module by running:
|
|
6135
|
+
* // ```sh
|
|
6136
|
+
* // $ npm install googleapis
|
|
6137
|
+
* // ```
|
|
6138
|
+
*
|
|
6139
|
+
* const {google} = require('googleapis');
|
|
6140
|
+
* const translate = google.translate('v3');
|
|
6141
|
+
*
|
|
6142
|
+
* async function main() {
|
|
6143
|
+
* const auth = new google.auth.GoogleAuth({
|
|
6144
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
6145
|
+
* scopes: [
|
|
6146
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
6147
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
6148
|
+
* ],
|
|
6149
|
+
* });
|
|
6150
|
+
*
|
|
6151
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
6152
|
+
* const authClient = await auth.getClient();
|
|
6153
|
+
* google.options({auth: authClient});
|
|
6154
|
+
*
|
|
6155
|
+
* // Do the magic
|
|
6156
|
+
* const res = await translate.projects.locations.datasets.list({
|
|
6157
|
+
* // Optional. Requested page size. The server can return fewer results than requested.
|
|
6158
|
+
* pageSize: 'placeholder-value',
|
|
6159
|
+
* // Optional. A token identifying a page of results for the server to return. Typically obtained from next_page_token field in the response of a ListDatasets call.
|
|
6160
|
+
* pageToken: 'placeholder-value',
|
|
6161
|
+
* // Required. Name of the parent project. In form of `projects/{project-number-or-id\}/locations/{location-id\}`
|
|
6162
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
6163
|
+
* });
|
|
6164
|
+
* console.log(res.data);
|
|
6165
|
+
*
|
|
6166
|
+
* // Example response
|
|
6167
|
+
* // {
|
|
6168
|
+
* // "datasets": [],
|
|
6169
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
6170
|
+
* // }
|
|
6171
|
+
* }
|
|
6172
|
+
*
|
|
6173
|
+
* main().catch(e => {
|
|
6174
|
+
* console.error(e);
|
|
6175
|
+
* throw e;
|
|
6176
|
+
* });
|
|
6177
|
+
*
|
|
6178
|
+
* ```
|
|
4409
6179
|
*
|
|
4410
6180
|
* @param params - Parameters for request
|
|
4411
6181
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4572,6 +6342,62 @@ export namespace translate_v3 {
|
|
|
4572
6342
|
|
|
4573
6343
|
/**
|
|
4574
6344
|
* Lists sentence pairs in the dataset.
|
|
6345
|
+
* @example
|
|
6346
|
+
* ```js
|
|
6347
|
+
* // Before running the sample:
|
|
6348
|
+
* // - Enable the API at:
|
|
6349
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
6350
|
+
* // - Login into gcloud by running:
|
|
6351
|
+
* // ```sh
|
|
6352
|
+
* // $ gcloud auth application-default login
|
|
6353
|
+
* // ```
|
|
6354
|
+
* // - Install the npm module by running:
|
|
6355
|
+
* // ```sh
|
|
6356
|
+
* // $ npm install googleapis
|
|
6357
|
+
* // ```
|
|
6358
|
+
*
|
|
6359
|
+
* const {google} = require('googleapis');
|
|
6360
|
+
* const translate = google.translate('v3');
|
|
6361
|
+
*
|
|
6362
|
+
* async function main() {
|
|
6363
|
+
* const auth = new google.auth.GoogleAuth({
|
|
6364
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
6365
|
+
* scopes: [
|
|
6366
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
6367
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
6368
|
+
* ],
|
|
6369
|
+
* });
|
|
6370
|
+
*
|
|
6371
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
6372
|
+
* const authClient = await auth.getClient();
|
|
6373
|
+
* google.options({auth: authClient});
|
|
6374
|
+
*
|
|
6375
|
+
* // Do the magic
|
|
6376
|
+
* const res = await translate.projects.locations.datasets.examples.list({
|
|
6377
|
+
* // Optional. An expression for filtering the examples that will be returned. Example filter: * `usage=TRAIN`
|
|
6378
|
+
* filter: 'placeholder-value',
|
|
6379
|
+
* // Optional. Requested page size. The server can return fewer results than requested.
|
|
6380
|
+
* pageSize: 'placeholder-value',
|
|
6381
|
+
* // Optional. A token identifying a page of results for the server to return. Typically obtained from next_page_token field in the response of a ListExamples call.
|
|
6382
|
+
* pageToken: 'placeholder-value',
|
|
6383
|
+
* // Required. Name of the parent dataset. In form of `projects/{project-number-or-id\}/locations/{location-id\}/datasets/{dataset-id\}`
|
|
6384
|
+
* parent: 'projects/my-project/locations/my-location/datasets/my-dataset',
|
|
6385
|
+
* });
|
|
6386
|
+
* console.log(res.data);
|
|
6387
|
+
*
|
|
6388
|
+
* // Example response
|
|
6389
|
+
* // {
|
|
6390
|
+
* // "examples": [],
|
|
6391
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
6392
|
+
* // }
|
|
6393
|
+
* }
|
|
6394
|
+
*
|
|
6395
|
+
* main().catch(e => {
|
|
6396
|
+
* console.error(e);
|
|
6397
|
+
* throw e;
|
|
6398
|
+
* });
|
|
6399
|
+
*
|
|
6400
|
+
* ```
|
|
4575
6401
|
*
|
|
4576
6402
|
* @param params - Parameters for request
|
|
4577
6403
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4698,6 +6524,74 @@ export namespace translate_v3 {
|
|
|
4698
6524
|
|
|
4699
6525
|
/**
|
|
4700
6526
|
* Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
|
|
6527
|
+
* @example
|
|
6528
|
+
* ```js
|
|
6529
|
+
* // Before running the sample:
|
|
6530
|
+
* // - Enable the API at:
|
|
6531
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
6532
|
+
* // - Login into gcloud by running:
|
|
6533
|
+
* // ```sh
|
|
6534
|
+
* // $ gcloud auth application-default login
|
|
6535
|
+
* // ```
|
|
6536
|
+
* // - Install the npm module by running:
|
|
6537
|
+
* // ```sh
|
|
6538
|
+
* // $ npm install googleapis
|
|
6539
|
+
* // ```
|
|
6540
|
+
*
|
|
6541
|
+
* const {google} = require('googleapis');
|
|
6542
|
+
* const translate = google.translate('v3');
|
|
6543
|
+
*
|
|
6544
|
+
* async function main() {
|
|
6545
|
+
* const auth = new google.auth.GoogleAuth({
|
|
6546
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
6547
|
+
* scopes: [
|
|
6548
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
6549
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
6550
|
+
* ],
|
|
6551
|
+
* });
|
|
6552
|
+
*
|
|
6553
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
6554
|
+
* const authClient = await auth.getClient();
|
|
6555
|
+
* google.options({auth: authClient});
|
|
6556
|
+
*
|
|
6557
|
+
* // Do the magic
|
|
6558
|
+
* const res = await translate.projects.locations.glossaries.create({
|
|
6559
|
+
* // Required. The project name.
|
|
6560
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
6561
|
+
*
|
|
6562
|
+
* // Request body metadata
|
|
6563
|
+
* requestBody: {
|
|
6564
|
+
* // request body parameters
|
|
6565
|
+
* // {
|
|
6566
|
+
* // "displayName": "my_displayName",
|
|
6567
|
+
* // "endTime": "my_endTime",
|
|
6568
|
+
* // "entryCount": 0,
|
|
6569
|
+
* // "inputConfig": {},
|
|
6570
|
+
* // "languageCodesSet": {},
|
|
6571
|
+
* // "languagePair": {},
|
|
6572
|
+
* // "name": "my_name",
|
|
6573
|
+
* // "submitTime": "my_submitTime"
|
|
6574
|
+
* // }
|
|
6575
|
+
* },
|
|
6576
|
+
* });
|
|
6577
|
+
* console.log(res.data);
|
|
6578
|
+
*
|
|
6579
|
+
* // Example response
|
|
6580
|
+
* // {
|
|
6581
|
+
* // "done": false,
|
|
6582
|
+
* // "error": {},
|
|
6583
|
+
* // "metadata": {},
|
|
6584
|
+
* // "name": "my_name",
|
|
6585
|
+
* // "response": {}
|
|
6586
|
+
* // }
|
|
6587
|
+
* }
|
|
6588
|
+
*
|
|
6589
|
+
* main().catch(e => {
|
|
6590
|
+
* console.error(e);
|
|
6591
|
+
* throw e;
|
|
6592
|
+
* });
|
|
6593
|
+
*
|
|
6594
|
+
* ```
|
|
4701
6595
|
*
|
|
4702
6596
|
* @param params - Parameters for request
|
|
4703
6597
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4789,6 +6683,59 @@ export namespace translate_v3 {
|
|
|
4789
6683
|
|
|
4790
6684
|
/**
|
|
4791
6685
|
* Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
|
|
6686
|
+
* @example
|
|
6687
|
+
* ```js
|
|
6688
|
+
* // Before running the sample:
|
|
6689
|
+
* // - Enable the API at:
|
|
6690
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
6691
|
+
* // - Login into gcloud by running:
|
|
6692
|
+
* // ```sh
|
|
6693
|
+
* // $ gcloud auth application-default login
|
|
6694
|
+
* // ```
|
|
6695
|
+
* // - Install the npm module by running:
|
|
6696
|
+
* // ```sh
|
|
6697
|
+
* // $ npm install googleapis
|
|
6698
|
+
* // ```
|
|
6699
|
+
*
|
|
6700
|
+
* const {google} = require('googleapis');
|
|
6701
|
+
* const translate = google.translate('v3');
|
|
6702
|
+
*
|
|
6703
|
+
* async function main() {
|
|
6704
|
+
* const auth = new google.auth.GoogleAuth({
|
|
6705
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
6706
|
+
* scopes: [
|
|
6707
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
6708
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
6709
|
+
* ],
|
|
6710
|
+
* });
|
|
6711
|
+
*
|
|
6712
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
6713
|
+
* const authClient = await auth.getClient();
|
|
6714
|
+
* google.options({auth: authClient});
|
|
6715
|
+
*
|
|
6716
|
+
* // Do the magic
|
|
6717
|
+
* const res = await translate.projects.locations.glossaries.delete({
|
|
6718
|
+
* // Required. The name of the glossary to delete.
|
|
6719
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
6720
|
+
* });
|
|
6721
|
+
* console.log(res.data);
|
|
6722
|
+
*
|
|
6723
|
+
* // Example response
|
|
6724
|
+
* // {
|
|
6725
|
+
* // "done": false,
|
|
6726
|
+
* // "error": {},
|
|
6727
|
+
* // "metadata": {},
|
|
6728
|
+
* // "name": "my_name",
|
|
6729
|
+
* // "response": {}
|
|
6730
|
+
* // }
|
|
6731
|
+
* }
|
|
6732
|
+
*
|
|
6733
|
+
* main().catch(e => {
|
|
6734
|
+
* console.error(e);
|
|
6735
|
+
* throw e;
|
|
6736
|
+
* });
|
|
6737
|
+
*
|
|
6738
|
+
* ```
|
|
4792
6739
|
*
|
|
4793
6740
|
* @param params - Parameters for request
|
|
4794
6741
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4877,6 +6824,62 @@ export namespace translate_v3 {
|
|
|
4877
6824
|
|
|
4878
6825
|
/**
|
|
4879
6826
|
* Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
|
|
6827
|
+
* @example
|
|
6828
|
+
* ```js
|
|
6829
|
+
* // Before running the sample:
|
|
6830
|
+
* // - Enable the API at:
|
|
6831
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
6832
|
+
* // - Login into gcloud by running:
|
|
6833
|
+
* // ```sh
|
|
6834
|
+
* // $ gcloud auth application-default login
|
|
6835
|
+
* // ```
|
|
6836
|
+
* // - Install the npm module by running:
|
|
6837
|
+
* // ```sh
|
|
6838
|
+
* // $ npm install googleapis
|
|
6839
|
+
* // ```
|
|
6840
|
+
*
|
|
6841
|
+
* const {google} = require('googleapis');
|
|
6842
|
+
* const translate = google.translate('v3');
|
|
6843
|
+
*
|
|
6844
|
+
* async function main() {
|
|
6845
|
+
* const auth = new google.auth.GoogleAuth({
|
|
6846
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
6847
|
+
* scopes: [
|
|
6848
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
6849
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
6850
|
+
* ],
|
|
6851
|
+
* });
|
|
6852
|
+
*
|
|
6853
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
6854
|
+
* const authClient = await auth.getClient();
|
|
6855
|
+
* google.options({auth: authClient});
|
|
6856
|
+
*
|
|
6857
|
+
* // Do the magic
|
|
6858
|
+
* const res = await translate.projects.locations.glossaries.get({
|
|
6859
|
+
* // Required. The name of the glossary to retrieve.
|
|
6860
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
6861
|
+
* });
|
|
6862
|
+
* console.log(res.data);
|
|
6863
|
+
*
|
|
6864
|
+
* // Example response
|
|
6865
|
+
* // {
|
|
6866
|
+
* // "displayName": "my_displayName",
|
|
6867
|
+
* // "endTime": "my_endTime",
|
|
6868
|
+
* // "entryCount": 0,
|
|
6869
|
+
* // "inputConfig": {},
|
|
6870
|
+
* // "languageCodesSet": {},
|
|
6871
|
+
* // "languagePair": {},
|
|
6872
|
+
* // "name": "my_name",
|
|
6873
|
+
* // "submitTime": "my_submitTime"
|
|
6874
|
+
* // }
|
|
6875
|
+
* }
|
|
6876
|
+
*
|
|
6877
|
+
* main().catch(e => {
|
|
6878
|
+
* console.error(e);
|
|
6879
|
+
* throw e;
|
|
6880
|
+
* });
|
|
6881
|
+
*
|
|
6882
|
+
* ```
|
|
4880
6883
|
*
|
|
4881
6884
|
* @param params - Parameters for request
|
|
4882
6885
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -4965,6 +6968,62 @@ export namespace translate_v3 {
|
|
|
4965
6968
|
|
|
4966
6969
|
/**
|
|
4967
6970
|
* Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
|
|
6971
|
+
* @example
|
|
6972
|
+
* ```js
|
|
6973
|
+
* // Before running the sample:
|
|
6974
|
+
* // - Enable the API at:
|
|
6975
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
6976
|
+
* // - Login into gcloud by running:
|
|
6977
|
+
* // ```sh
|
|
6978
|
+
* // $ gcloud auth application-default login
|
|
6979
|
+
* // ```
|
|
6980
|
+
* // - Install the npm module by running:
|
|
6981
|
+
* // ```sh
|
|
6982
|
+
* // $ npm install googleapis
|
|
6983
|
+
* // ```
|
|
6984
|
+
*
|
|
6985
|
+
* const {google} = require('googleapis');
|
|
6986
|
+
* const translate = google.translate('v3');
|
|
6987
|
+
*
|
|
6988
|
+
* async function main() {
|
|
6989
|
+
* const auth = new google.auth.GoogleAuth({
|
|
6990
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
6991
|
+
* scopes: [
|
|
6992
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
6993
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
6994
|
+
* ],
|
|
6995
|
+
* });
|
|
6996
|
+
*
|
|
6997
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
6998
|
+
* const authClient = await auth.getClient();
|
|
6999
|
+
* google.options({auth: authClient});
|
|
7000
|
+
*
|
|
7001
|
+
* // Do the magic
|
|
7002
|
+
* const res = await translate.projects.locations.glossaries.list({
|
|
7003
|
+
* // 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.
|
|
7004
|
+
* filter: 'placeholder-value',
|
|
7005
|
+
* // Optional. Requested page size. The server may return fewer glossaries than requested. If unspecified, the server picks an appropriate default.
|
|
7006
|
+
* pageSize: 'placeholder-value',
|
|
7007
|
+
* // 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.
|
|
7008
|
+
* pageToken: 'placeholder-value',
|
|
7009
|
+
* // Required. The name of the project from which to list all of the glossaries.
|
|
7010
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
7011
|
+
* });
|
|
7012
|
+
* console.log(res.data);
|
|
7013
|
+
*
|
|
7014
|
+
* // Example response
|
|
7015
|
+
* // {
|
|
7016
|
+
* // "glossaries": [],
|
|
7017
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
7018
|
+
* // }
|
|
7019
|
+
* }
|
|
7020
|
+
*
|
|
7021
|
+
* main().catch(e => {
|
|
7022
|
+
* console.error(e);
|
|
7023
|
+
* throw e;
|
|
7024
|
+
* });
|
|
7025
|
+
*
|
|
7026
|
+
* ```
|
|
4968
7027
|
*
|
|
4969
7028
|
* @param params - Parameters for request
|
|
4970
7029
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5058,6 +7117,76 @@ export namespace translate_v3 {
|
|
|
5058
7117
|
|
|
5059
7118
|
/**
|
|
5060
7119
|
* Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
|
|
7120
|
+
* @example
|
|
7121
|
+
* ```js
|
|
7122
|
+
* // Before running the sample:
|
|
7123
|
+
* // - Enable the API at:
|
|
7124
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
7125
|
+
* // - Login into gcloud by running:
|
|
7126
|
+
* // ```sh
|
|
7127
|
+
* // $ gcloud auth application-default login
|
|
7128
|
+
* // ```
|
|
7129
|
+
* // - Install the npm module by running:
|
|
7130
|
+
* // ```sh
|
|
7131
|
+
* // $ npm install googleapis
|
|
7132
|
+
* // ```
|
|
7133
|
+
*
|
|
7134
|
+
* const {google} = require('googleapis');
|
|
7135
|
+
* const translate = google.translate('v3');
|
|
7136
|
+
*
|
|
7137
|
+
* async function main() {
|
|
7138
|
+
* const auth = new google.auth.GoogleAuth({
|
|
7139
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
7140
|
+
* scopes: [
|
|
7141
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
7142
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
7143
|
+
* ],
|
|
7144
|
+
* });
|
|
7145
|
+
*
|
|
7146
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
7147
|
+
* const authClient = await auth.getClient();
|
|
7148
|
+
* google.options({auth: authClient});
|
|
7149
|
+
*
|
|
7150
|
+
* // Do the magic
|
|
7151
|
+
* const res = await translate.projects.locations.glossaries.patch({
|
|
7152
|
+
* // Required. The resource name of the glossary. Glossary names have the form `projects/{project-number-or-id\}/locations/{location-id\}/glossaries/{glossary-id\}`.
|
|
7153
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
7154
|
+
* // The list of fields to be updated. Currently only `display_name` and 'input_config'
|
|
7155
|
+
* updateMask: 'placeholder-value',
|
|
7156
|
+
*
|
|
7157
|
+
* // Request body metadata
|
|
7158
|
+
* requestBody: {
|
|
7159
|
+
* // request body parameters
|
|
7160
|
+
* // {
|
|
7161
|
+
* // "displayName": "my_displayName",
|
|
7162
|
+
* // "endTime": "my_endTime",
|
|
7163
|
+
* // "entryCount": 0,
|
|
7164
|
+
* // "inputConfig": {},
|
|
7165
|
+
* // "languageCodesSet": {},
|
|
7166
|
+
* // "languagePair": {},
|
|
7167
|
+
* // "name": "my_name",
|
|
7168
|
+
* // "submitTime": "my_submitTime"
|
|
7169
|
+
* // }
|
|
7170
|
+
* },
|
|
7171
|
+
* });
|
|
7172
|
+
* console.log(res.data);
|
|
7173
|
+
*
|
|
7174
|
+
* // Example response
|
|
7175
|
+
* // {
|
|
7176
|
+
* // "done": false,
|
|
7177
|
+
* // "error": {},
|
|
7178
|
+
* // "metadata": {},
|
|
7179
|
+
* // "name": "my_name",
|
|
7180
|
+
* // "response": {}
|
|
7181
|
+
* // }
|
|
7182
|
+
* }
|
|
7183
|
+
*
|
|
7184
|
+
* main().catch(e => {
|
|
7185
|
+
* console.error(e);
|
|
7186
|
+
* throw e;
|
|
7187
|
+
* });
|
|
7188
|
+
*
|
|
7189
|
+
* ```
|
|
5061
7190
|
*
|
|
5062
7191
|
* @param params - Parameters for request
|
|
5063
7192
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5215,6 +7344,71 @@ export namespace translate_v3 {
|
|
|
5215
7344
|
|
|
5216
7345
|
/**
|
|
5217
7346
|
* Creates a glossary entry.
|
|
7347
|
+
* @example
|
|
7348
|
+
* ```js
|
|
7349
|
+
* // Before running the sample:
|
|
7350
|
+
* // - Enable the API at:
|
|
7351
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
7352
|
+
* // - Login into gcloud by running:
|
|
7353
|
+
* // ```sh
|
|
7354
|
+
* // $ gcloud auth application-default login
|
|
7355
|
+
* // ```
|
|
7356
|
+
* // - Install the npm module by running:
|
|
7357
|
+
* // ```sh
|
|
7358
|
+
* // $ npm install googleapis
|
|
7359
|
+
* // ```
|
|
7360
|
+
*
|
|
7361
|
+
* const {google} = require('googleapis');
|
|
7362
|
+
* const translate = google.translate('v3');
|
|
7363
|
+
*
|
|
7364
|
+
* async function main() {
|
|
7365
|
+
* const auth = new google.auth.GoogleAuth({
|
|
7366
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
7367
|
+
* scopes: [
|
|
7368
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
7369
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
7370
|
+
* ],
|
|
7371
|
+
* });
|
|
7372
|
+
*
|
|
7373
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
7374
|
+
* const authClient = await auth.getClient();
|
|
7375
|
+
* google.options({auth: authClient});
|
|
7376
|
+
*
|
|
7377
|
+
* // Do the magic
|
|
7378
|
+
* const res =
|
|
7379
|
+
* await translate.projects.locations.glossaries.glossaryEntries.create({
|
|
7380
|
+
* // Required. The resource name of the glossary to create the entry under.
|
|
7381
|
+
* parent:
|
|
7382
|
+
* 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
7383
|
+
*
|
|
7384
|
+
* // Request body metadata
|
|
7385
|
+
* requestBody: {
|
|
7386
|
+
* // request body parameters
|
|
7387
|
+
* // {
|
|
7388
|
+
* // "description": "my_description",
|
|
7389
|
+
* // "name": "my_name",
|
|
7390
|
+
* // "termsPair": {},
|
|
7391
|
+
* // "termsSet": {}
|
|
7392
|
+
* // }
|
|
7393
|
+
* },
|
|
7394
|
+
* });
|
|
7395
|
+
* console.log(res.data);
|
|
7396
|
+
*
|
|
7397
|
+
* // Example response
|
|
7398
|
+
* // {
|
|
7399
|
+
* // "description": "my_description",
|
|
7400
|
+
* // "name": "my_name",
|
|
7401
|
+
* // "termsPair": {},
|
|
7402
|
+
* // "termsSet": {}
|
|
7403
|
+
* // }
|
|
7404
|
+
* }
|
|
7405
|
+
*
|
|
7406
|
+
* main().catch(e => {
|
|
7407
|
+
* console.error(e);
|
|
7408
|
+
* throw e;
|
|
7409
|
+
* });
|
|
7410
|
+
*
|
|
7411
|
+
* ```
|
|
5218
7412
|
*
|
|
5219
7413
|
* @param params - Parameters for request
|
|
5220
7414
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5307,6 +7501,54 @@ export namespace translate_v3 {
|
|
|
5307
7501
|
|
|
5308
7502
|
/**
|
|
5309
7503
|
* Deletes a single entry from the glossary
|
|
7504
|
+
* @example
|
|
7505
|
+
* ```js
|
|
7506
|
+
* // Before running the sample:
|
|
7507
|
+
* // - Enable the API at:
|
|
7508
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
7509
|
+
* // - Login into gcloud by running:
|
|
7510
|
+
* // ```sh
|
|
7511
|
+
* // $ gcloud auth application-default login
|
|
7512
|
+
* // ```
|
|
7513
|
+
* // - Install the npm module by running:
|
|
7514
|
+
* // ```sh
|
|
7515
|
+
* // $ npm install googleapis
|
|
7516
|
+
* // ```
|
|
7517
|
+
*
|
|
7518
|
+
* const {google} = require('googleapis');
|
|
7519
|
+
* const translate = google.translate('v3');
|
|
7520
|
+
*
|
|
7521
|
+
* async function main() {
|
|
7522
|
+
* const auth = new google.auth.GoogleAuth({
|
|
7523
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
7524
|
+
* scopes: [
|
|
7525
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
7526
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
7527
|
+
* ],
|
|
7528
|
+
* });
|
|
7529
|
+
*
|
|
7530
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
7531
|
+
* const authClient = await auth.getClient();
|
|
7532
|
+
* google.options({auth: authClient});
|
|
7533
|
+
*
|
|
7534
|
+
* // Do the magic
|
|
7535
|
+
* const res =
|
|
7536
|
+
* await translate.projects.locations.glossaries.glossaryEntries.delete({
|
|
7537
|
+
* // Required. The resource name of the glossary entry to delete
|
|
7538
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie/glossaryEntries/my-glossaryEntrie',
|
|
7539
|
+
* });
|
|
7540
|
+
* console.log(res.data);
|
|
7541
|
+
*
|
|
7542
|
+
* // Example response
|
|
7543
|
+
* // {}
|
|
7544
|
+
* }
|
|
7545
|
+
*
|
|
7546
|
+
* main().catch(e => {
|
|
7547
|
+
* console.error(e);
|
|
7548
|
+
* throw e;
|
|
7549
|
+
* });
|
|
7550
|
+
*
|
|
7551
|
+
* ```
|
|
5310
7552
|
*
|
|
5311
7553
|
* @param params - Parameters for request
|
|
5312
7554
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5396,6 +7638,60 @@ export namespace translate_v3 {
|
|
|
5396
7638
|
|
|
5397
7639
|
/**
|
|
5398
7640
|
* Gets a single glossary entry by the given id.
|
|
7641
|
+
* @example
|
|
7642
|
+
* ```js
|
|
7643
|
+
* // Before running the sample:
|
|
7644
|
+
* // - Enable the API at:
|
|
7645
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
7646
|
+
* // - Login into gcloud by running:
|
|
7647
|
+
* // ```sh
|
|
7648
|
+
* // $ gcloud auth application-default login
|
|
7649
|
+
* // ```
|
|
7650
|
+
* // - Install the npm module by running:
|
|
7651
|
+
* // ```sh
|
|
7652
|
+
* // $ npm install googleapis
|
|
7653
|
+
* // ```
|
|
7654
|
+
*
|
|
7655
|
+
* const {google} = require('googleapis');
|
|
7656
|
+
* const translate = google.translate('v3');
|
|
7657
|
+
*
|
|
7658
|
+
* async function main() {
|
|
7659
|
+
* const auth = new google.auth.GoogleAuth({
|
|
7660
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
7661
|
+
* scopes: [
|
|
7662
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
7663
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
7664
|
+
* ],
|
|
7665
|
+
* });
|
|
7666
|
+
*
|
|
7667
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
7668
|
+
* const authClient = await auth.getClient();
|
|
7669
|
+
* google.options({auth: authClient});
|
|
7670
|
+
*
|
|
7671
|
+
* // Do the magic
|
|
7672
|
+
* const res = await translate.projects.locations.glossaries.glossaryEntries.get(
|
|
7673
|
+
* {
|
|
7674
|
+
* // Required. The resource name of the glossary entry to get
|
|
7675
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie/glossaryEntries/my-glossaryEntrie',
|
|
7676
|
+
* },
|
|
7677
|
+
* );
|
|
7678
|
+
* console.log(res.data);
|
|
7679
|
+
*
|
|
7680
|
+
* // Example response
|
|
7681
|
+
* // {
|
|
7682
|
+
* // "description": "my_description",
|
|
7683
|
+
* // "name": "my_name",
|
|
7684
|
+
* // "termsPair": {},
|
|
7685
|
+
* // "termsSet": {}
|
|
7686
|
+
* // }
|
|
7687
|
+
* }
|
|
7688
|
+
*
|
|
7689
|
+
* main().catch(e => {
|
|
7690
|
+
* console.error(e);
|
|
7691
|
+
* throw e;
|
|
7692
|
+
* });
|
|
7693
|
+
*
|
|
7694
|
+
* ```
|
|
5399
7695
|
*
|
|
5400
7696
|
* @param params - Parameters for request
|
|
5401
7697
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5485,6 +7781,62 @@ export namespace translate_v3 {
|
|
|
5485
7781
|
|
|
5486
7782
|
/**
|
|
5487
7783
|
* List the entries for the glossary.
|
|
7784
|
+
* @example
|
|
7785
|
+
* ```js
|
|
7786
|
+
* // Before running the sample:
|
|
7787
|
+
* // - Enable the API at:
|
|
7788
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
7789
|
+
* // - Login into gcloud by running:
|
|
7790
|
+
* // ```sh
|
|
7791
|
+
* // $ gcloud auth application-default login
|
|
7792
|
+
* // ```
|
|
7793
|
+
* // - Install the npm module by running:
|
|
7794
|
+
* // ```sh
|
|
7795
|
+
* // $ npm install googleapis
|
|
7796
|
+
* // ```
|
|
7797
|
+
*
|
|
7798
|
+
* const {google} = require('googleapis');
|
|
7799
|
+
* const translate = google.translate('v3');
|
|
7800
|
+
*
|
|
7801
|
+
* async function main() {
|
|
7802
|
+
* const auth = new google.auth.GoogleAuth({
|
|
7803
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
7804
|
+
* scopes: [
|
|
7805
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
7806
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
7807
|
+
* ],
|
|
7808
|
+
* });
|
|
7809
|
+
*
|
|
7810
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
7811
|
+
* const authClient = await auth.getClient();
|
|
7812
|
+
* google.options({auth: authClient});
|
|
7813
|
+
*
|
|
7814
|
+
* // Do the magic
|
|
7815
|
+
* const res =
|
|
7816
|
+
* await translate.projects.locations.glossaries.glossaryEntries.list({
|
|
7817
|
+
* // Optional. Requested page size. The server may return fewer glossary entries than requested. If unspecified, the server picks an appropriate default.
|
|
7818
|
+
* pageSize: 'placeholder-value',
|
|
7819
|
+
* // Optional. A token identifying a page of results the server should return. Typically, this is the value of [ListGlossaryEntriesResponse.next_page_token] returned from the previous call. The first page is returned if `page_token`is empty or missing.
|
|
7820
|
+
* pageToken: 'placeholder-value',
|
|
7821
|
+
* // Required. The parent glossary resource name for listing the glossary's entries.
|
|
7822
|
+
* parent:
|
|
7823
|
+
* 'projects/my-project/locations/my-location/glossaries/my-glossarie',
|
|
7824
|
+
* });
|
|
7825
|
+
* console.log(res.data);
|
|
7826
|
+
*
|
|
7827
|
+
* // Example response
|
|
7828
|
+
* // {
|
|
7829
|
+
* // "glossaryEntries": [],
|
|
7830
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
7831
|
+
* // }
|
|
7832
|
+
* }
|
|
7833
|
+
*
|
|
7834
|
+
* main().catch(e => {
|
|
7835
|
+
* console.error(e);
|
|
7836
|
+
* throw e;
|
|
7837
|
+
* });
|
|
7838
|
+
*
|
|
7839
|
+
* ```
|
|
5488
7840
|
*
|
|
5489
7841
|
* @param params - Parameters for request
|
|
5490
7842
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5581,6 +7933,70 @@ export namespace translate_v3 {
|
|
|
5581
7933
|
|
|
5582
7934
|
/**
|
|
5583
7935
|
* Updates a glossary entry.
|
|
7936
|
+
* @example
|
|
7937
|
+
* ```js
|
|
7938
|
+
* // Before running the sample:
|
|
7939
|
+
* // - Enable the API at:
|
|
7940
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
7941
|
+
* // - Login into gcloud by running:
|
|
7942
|
+
* // ```sh
|
|
7943
|
+
* // $ gcloud auth application-default login
|
|
7944
|
+
* // ```
|
|
7945
|
+
* // - Install the npm module by running:
|
|
7946
|
+
* // ```sh
|
|
7947
|
+
* // $ npm install googleapis
|
|
7948
|
+
* // ```
|
|
7949
|
+
*
|
|
7950
|
+
* const {google} = require('googleapis');
|
|
7951
|
+
* const translate = google.translate('v3');
|
|
7952
|
+
*
|
|
7953
|
+
* async function main() {
|
|
7954
|
+
* const auth = new google.auth.GoogleAuth({
|
|
7955
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
7956
|
+
* scopes: [
|
|
7957
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
7958
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
7959
|
+
* ],
|
|
7960
|
+
* });
|
|
7961
|
+
*
|
|
7962
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
7963
|
+
* const authClient = await auth.getClient();
|
|
7964
|
+
* google.options({auth: authClient});
|
|
7965
|
+
*
|
|
7966
|
+
* // Do the magic
|
|
7967
|
+
* const res =
|
|
7968
|
+
* await translate.projects.locations.glossaries.glossaryEntries.patch({
|
|
7969
|
+
* // Identifier. The resource name of the entry. Format: `projects/x/locations/x/glossaries/x/glossaryEntries/x`
|
|
7970
|
+
* name: 'projects/my-project/locations/my-location/glossaries/my-glossarie/glossaryEntries/my-glossaryEntrie',
|
|
7971
|
+
*
|
|
7972
|
+
* // Request body metadata
|
|
7973
|
+
* requestBody: {
|
|
7974
|
+
* // request body parameters
|
|
7975
|
+
* // {
|
|
7976
|
+
* // "description": "my_description",
|
|
7977
|
+
* // "name": "my_name",
|
|
7978
|
+
* // "termsPair": {},
|
|
7979
|
+
* // "termsSet": {}
|
|
7980
|
+
* // }
|
|
7981
|
+
* },
|
|
7982
|
+
* });
|
|
7983
|
+
* console.log(res.data);
|
|
7984
|
+
*
|
|
7985
|
+
* // Example response
|
|
7986
|
+
* // {
|
|
7987
|
+
* // "description": "my_description",
|
|
7988
|
+
* // "name": "my_name",
|
|
7989
|
+
* // "termsPair": {},
|
|
7990
|
+
* // "termsSet": {}
|
|
7991
|
+
* // }
|
|
7992
|
+
* }
|
|
7993
|
+
*
|
|
7994
|
+
* main().catch(e => {
|
|
7995
|
+
* console.error(e);
|
|
7996
|
+
* throw e;
|
|
7997
|
+
* });
|
|
7998
|
+
*
|
|
7999
|
+
* ```
|
|
5584
8000
|
*
|
|
5585
8001
|
* @param params - Parameters for request
|
|
5586
8002
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5731,6 +8147,76 @@ export namespace translate_v3 {
|
|
|
5731
8147
|
|
|
5732
8148
|
/**
|
|
5733
8149
|
* Creates a Model.
|
|
8150
|
+
* @example
|
|
8151
|
+
* ```js
|
|
8152
|
+
* // Before running the sample:
|
|
8153
|
+
* // - Enable the API at:
|
|
8154
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
8155
|
+
* // - Login into gcloud by running:
|
|
8156
|
+
* // ```sh
|
|
8157
|
+
* // $ gcloud auth application-default login
|
|
8158
|
+
* // ```
|
|
8159
|
+
* // - Install the npm module by running:
|
|
8160
|
+
* // ```sh
|
|
8161
|
+
* // $ npm install googleapis
|
|
8162
|
+
* // ```
|
|
8163
|
+
*
|
|
8164
|
+
* const {google} = require('googleapis');
|
|
8165
|
+
* const translate = google.translate('v3');
|
|
8166
|
+
*
|
|
8167
|
+
* async function main() {
|
|
8168
|
+
* const auth = new google.auth.GoogleAuth({
|
|
8169
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
8170
|
+
* scopes: [
|
|
8171
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
8172
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
8173
|
+
* ],
|
|
8174
|
+
* });
|
|
8175
|
+
*
|
|
8176
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
8177
|
+
* const authClient = await auth.getClient();
|
|
8178
|
+
* google.options({auth: authClient});
|
|
8179
|
+
*
|
|
8180
|
+
* // Do the magic
|
|
8181
|
+
* const res = await translate.projects.locations.models.create({
|
|
8182
|
+
* // Required. The project name, in form of `projects/{project\}/locations/{location\}`
|
|
8183
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
8184
|
+
*
|
|
8185
|
+
* // Request body metadata
|
|
8186
|
+
* requestBody: {
|
|
8187
|
+
* // request body parameters
|
|
8188
|
+
* // {
|
|
8189
|
+
* // "createTime": "my_createTime",
|
|
8190
|
+
* // "dataset": "my_dataset",
|
|
8191
|
+
* // "displayName": "my_displayName",
|
|
8192
|
+
* // "name": "my_name",
|
|
8193
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
8194
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
8195
|
+
* // "testExampleCount": 0,
|
|
8196
|
+
* // "trainExampleCount": 0,
|
|
8197
|
+
* // "updateTime": "my_updateTime",
|
|
8198
|
+
* // "validateExampleCount": 0
|
|
8199
|
+
* // }
|
|
8200
|
+
* },
|
|
8201
|
+
* });
|
|
8202
|
+
* console.log(res.data);
|
|
8203
|
+
*
|
|
8204
|
+
* // Example response
|
|
8205
|
+
* // {
|
|
8206
|
+
* // "done": false,
|
|
8207
|
+
* // "error": {},
|
|
8208
|
+
* // "metadata": {},
|
|
8209
|
+
* // "name": "my_name",
|
|
8210
|
+
* // "response": {}
|
|
8211
|
+
* // }
|
|
8212
|
+
* }
|
|
8213
|
+
*
|
|
8214
|
+
* main().catch(e => {
|
|
8215
|
+
* console.error(e);
|
|
8216
|
+
* throw e;
|
|
8217
|
+
* });
|
|
8218
|
+
*
|
|
8219
|
+
* ```
|
|
5734
8220
|
*
|
|
5735
8221
|
* @param params - Parameters for request
|
|
5736
8222
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5822,6 +8308,59 @@ export namespace translate_v3 {
|
|
|
5822
8308
|
|
|
5823
8309
|
/**
|
|
5824
8310
|
* Deletes a model.
|
|
8311
|
+
* @example
|
|
8312
|
+
* ```js
|
|
8313
|
+
* // Before running the sample:
|
|
8314
|
+
* // - Enable the API at:
|
|
8315
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
8316
|
+
* // - Login into gcloud by running:
|
|
8317
|
+
* // ```sh
|
|
8318
|
+
* // $ gcloud auth application-default login
|
|
8319
|
+
* // ```
|
|
8320
|
+
* // - Install the npm module by running:
|
|
8321
|
+
* // ```sh
|
|
8322
|
+
* // $ npm install googleapis
|
|
8323
|
+
* // ```
|
|
8324
|
+
*
|
|
8325
|
+
* const {google} = require('googleapis');
|
|
8326
|
+
* const translate = google.translate('v3');
|
|
8327
|
+
*
|
|
8328
|
+
* async function main() {
|
|
8329
|
+
* const auth = new google.auth.GoogleAuth({
|
|
8330
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
8331
|
+
* scopes: [
|
|
8332
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
8333
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
8334
|
+
* ],
|
|
8335
|
+
* });
|
|
8336
|
+
*
|
|
8337
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
8338
|
+
* const authClient = await auth.getClient();
|
|
8339
|
+
* google.options({auth: authClient});
|
|
8340
|
+
*
|
|
8341
|
+
* // Do the magic
|
|
8342
|
+
* const res = await translate.projects.locations.models.delete({
|
|
8343
|
+
* // Required. The name of the model to delete.
|
|
8344
|
+
* name: 'projects/my-project/locations/my-location/models/my-model',
|
|
8345
|
+
* });
|
|
8346
|
+
* console.log(res.data);
|
|
8347
|
+
*
|
|
8348
|
+
* // Example response
|
|
8349
|
+
* // {
|
|
8350
|
+
* // "done": false,
|
|
8351
|
+
* // "error": {},
|
|
8352
|
+
* // "metadata": {},
|
|
8353
|
+
* // "name": "my_name",
|
|
8354
|
+
* // "response": {}
|
|
8355
|
+
* // }
|
|
8356
|
+
* }
|
|
8357
|
+
*
|
|
8358
|
+
* main().catch(e => {
|
|
8359
|
+
* console.error(e);
|
|
8360
|
+
* throw e;
|
|
8361
|
+
* });
|
|
8362
|
+
*
|
|
8363
|
+
* ```
|
|
5825
8364
|
*
|
|
5826
8365
|
* @param params - Parameters for request
|
|
5827
8366
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5910,6 +8449,64 @@ export namespace translate_v3 {
|
|
|
5910
8449
|
|
|
5911
8450
|
/**
|
|
5912
8451
|
* Gets a model.
|
|
8452
|
+
* @example
|
|
8453
|
+
* ```js
|
|
8454
|
+
* // Before running the sample:
|
|
8455
|
+
* // - Enable the API at:
|
|
8456
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
8457
|
+
* // - Login into gcloud by running:
|
|
8458
|
+
* // ```sh
|
|
8459
|
+
* // $ gcloud auth application-default login
|
|
8460
|
+
* // ```
|
|
8461
|
+
* // - Install the npm module by running:
|
|
8462
|
+
* // ```sh
|
|
8463
|
+
* // $ npm install googleapis
|
|
8464
|
+
* // ```
|
|
8465
|
+
*
|
|
8466
|
+
* const {google} = require('googleapis');
|
|
8467
|
+
* const translate = google.translate('v3');
|
|
8468
|
+
*
|
|
8469
|
+
* async function main() {
|
|
8470
|
+
* const auth = new google.auth.GoogleAuth({
|
|
8471
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
8472
|
+
* scopes: [
|
|
8473
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
8474
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
8475
|
+
* ],
|
|
8476
|
+
* });
|
|
8477
|
+
*
|
|
8478
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
8479
|
+
* const authClient = await auth.getClient();
|
|
8480
|
+
* google.options({auth: authClient});
|
|
8481
|
+
*
|
|
8482
|
+
* // Do the magic
|
|
8483
|
+
* const res = await translate.projects.locations.models.get({
|
|
8484
|
+
* // Required. The resource name of the model to retrieve.
|
|
8485
|
+
* name: 'projects/my-project/locations/my-location/models/my-model',
|
|
8486
|
+
* });
|
|
8487
|
+
* console.log(res.data);
|
|
8488
|
+
*
|
|
8489
|
+
* // Example response
|
|
8490
|
+
* // {
|
|
8491
|
+
* // "createTime": "my_createTime",
|
|
8492
|
+
* // "dataset": "my_dataset",
|
|
8493
|
+
* // "displayName": "my_displayName",
|
|
8494
|
+
* // "name": "my_name",
|
|
8495
|
+
* // "sourceLanguageCode": "my_sourceLanguageCode",
|
|
8496
|
+
* // "targetLanguageCode": "my_targetLanguageCode",
|
|
8497
|
+
* // "testExampleCount": 0,
|
|
8498
|
+
* // "trainExampleCount": 0,
|
|
8499
|
+
* // "updateTime": "my_updateTime",
|
|
8500
|
+
* // "validateExampleCount": 0
|
|
8501
|
+
* // }
|
|
8502
|
+
* }
|
|
8503
|
+
*
|
|
8504
|
+
* main().catch(e => {
|
|
8505
|
+
* console.error(e);
|
|
8506
|
+
* throw e;
|
|
8507
|
+
* });
|
|
8508
|
+
*
|
|
8509
|
+
* ```
|
|
5913
8510
|
*
|
|
5914
8511
|
* @param params - Parameters for request
|
|
5915
8512
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -5998,6 +8595,62 @@ export namespace translate_v3 {
|
|
|
5998
8595
|
|
|
5999
8596
|
/**
|
|
6000
8597
|
* Lists models.
|
|
8598
|
+
* @example
|
|
8599
|
+
* ```js
|
|
8600
|
+
* // Before running the sample:
|
|
8601
|
+
* // - Enable the API at:
|
|
8602
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
8603
|
+
* // - Login into gcloud by running:
|
|
8604
|
+
* // ```sh
|
|
8605
|
+
* // $ gcloud auth application-default login
|
|
8606
|
+
* // ```
|
|
8607
|
+
* // - Install the npm module by running:
|
|
8608
|
+
* // ```sh
|
|
8609
|
+
* // $ npm install googleapis
|
|
8610
|
+
* // ```
|
|
8611
|
+
*
|
|
8612
|
+
* const {google} = require('googleapis');
|
|
8613
|
+
* const translate = google.translate('v3');
|
|
8614
|
+
*
|
|
8615
|
+
* async function main() {
|
|
8616
|
+
* const auth = new google.auth.GoogleAuth({
|
|
8617
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
8618
|
+
* scopes: [
|
|
8619
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
8620
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
8621
|
+
* ],
|
|
8622
|
+
* });
|
|
8623
|
+
*
|
|
8624
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
8625
|
+
* const authClient = await auth.getClient();
|
|
8626
|
+
* google.options({auth: authClient});
|
|
8627
|
+
*
|
|
8628
|
+
* // Do the magic
|
|
8629
|
+
* const res = await translate.projects.locations.models.list({
|
|
8630
|
+
* // Optional. An expression for filtering the models that will be returned. Supported filter: `dataset_id=${dataset_id\}`
|
|
8631
|
+
* filter: 'placeholder-value',
|
|
8632
|
+
* // Optional. Requested page size. The server can return fewer results than requested.
|
|
8633
|
+
* pageSize: 'placeholder-value',
|
|
8634
|
+
* // Optional. A token identifying a page of results for the server to return. Typically obtained from next_page_token field in the response of a ListModels call.
|
|
8635
|
+
* pageToken: 'placeholder-value',
|
|
8636
|
+
* // Required. Name of the parent project. In form of `projects/{project-number-or-id\}/locations/{location-id\}`
|
|
8637
|
+
* parent: 'projects/my-project/locations/my-location',
|
|
8638
|
+
* });
|
|
8639
|
+
* console.log(res.data);
|
|
8640
|
+
*
|
|
8641
|
+
* // Example response
|
|
8642
|
+
* // {
|
|
8643
|
+
* // "models": [],
|
|
8644
|
+
* // "nextPageToken": "my_nextPageToken"
|
|
8645
|
+
* // }
|
|
8646
|
+
* }
|
|
8647
|
+
*
|
|
8648
|
+
* main().catch(e => {
|
|
8649
|
+
* console.error(e);
|
|
8650
|
+
* throw e;
|
|
8651
|
+
* });
|
|
8652
|
+
*
|
|
8653
|
+
* ```
|
|
6001
8654
|
*
|
|
6002
8655
|
* @param params - Parameters for request
|
|
6003
8656
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -6142,6 +8795,59 @@ export namespace translate_v3 {
|
|
|
6142
8795
|
|
|
6143
8796
|
/**
|
|
6144
8797
|
* 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`.
|
|
8798
|
+
* @example
|
|
8799
|
+
* ```js
|
|
8800
|
+
* // Before running the sample:
|
|
8801
|
+
* // - Enable the API at:
|
|
8802
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
8803
|
+
* // - Login into gcloud by running:
|
|
8804
|
+
* // ```sh
|
|
8805
|
+
* // $ gcloud auth application-default login
|
|
8806
|
+
* // ```
|
|
8807
|
+
* // - Install the npm module by running:
|
|
8808
|
+
* // ```sh
|
|
8809
|
+
* // $ npm install googleapis
|
|
8810
|
+
* // ```
|
|
8811
|
+
*
|
|
8812
|
+
* const {google} = require('googleapis');
|
|
8813
|
+
* const translate = google.translate('v3');
|
|
8814
|
+
*
|
|
8815
|
+
* async function main() {
|
|
8816
|
+
* const auth = new google.auth.GoogleAuth({
|
|
8817
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
8818
|
+
* scopes: [
|
|
8819
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
8820
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
8821
|
+
* ],
|
|
8822
|
+
* });
|
|
8823
|
+
*
|
|
8824
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
8825
|
+
* const authClient = await auth.getClient();
|
|
8826
|
+
* google.options({auth: authClient});
|
|
8827
|
+
*
|
|
8828
|
+
* // Do the magic
|
|
8829
|
+
* const res = await translate.projects.locations.operations.cancel({
|
|
8830
|
+
* // The name of the operation resource to be cancelled.
|
|
8831
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
8832
|
+
*
|
|
8833
|
+
* // Request body metadata
|
|
8834
|
+
* requestBody: {
|
|
8835
|
+
* // request body parameters
|
|
8836
|
+
* // {}
|
|
8837
|
+
* },
|
|
8838
|
+
* });
|
|
8839
|
+
* console.log(res.data);
|
|
8840
|
+
*
|
|
8841
|
+
* // Example response
|
|
8842
|
+
* // {}
|
|
8843
|
+
* }
|
|
8844
|
+
*
|
|
8845
|
+
* main().catch(e => {
|
|
8846
|
+
* console.error(e);
|
|
8847
|
+
* throw e;
|
|
8848
|
+
* });
|
|
8849
|
+
*
|
|
8850
|
+
* ```
|
|
6145
8851
|
*
|
|
6146
8852
|
* @param params - Parameters for request
|
|
6147
8853
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -6230,6 +8936,53 @@ export namespace translate_v3 {
|
|
|
6230
8936
|
|
|
6231
8937
|
/**
|
|
6232
8938
|
* 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`.
|
|
8939
|
+
* @example
|
|
8940
|
+
* ```js
|
|
8941
|
+
* // Before running the sample:
|
|
8942
|
+
* // - Enable the API at:
|
|
8943
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
8944
|
+
* // - Login into gcloud by running:
|
|
8945
|
+
* // ```sh
|
|
8946
|
+
* // $ gcloud auth application-default login
|
|
8947
|
+
* // ```
|
|
8948
|
+
* // - Install the npm module by running:
|
|
8949
|
+
* // ```sh
|
|
8950
|
+
* // $ npm install googleapis
|
|
8951
|
+
* // ```
|
|
8952
|
+
*
|
|
8953
|
+
* const {google} = require('googleapis');
|
|
8954
|
+
* const translate = google.translate('v3');
|
|
8955
|
+
*
|
|
8956
|
+
* async function main() {
|
|
8957
|
+
* const auth = new google.auth.GoogleAuth({
|
|
8958
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
8959
|
+
* scopes: [
|
|
8960
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
8961
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
8962
|
+
* ],
|
|
8963
|
+
* });
|
|
8964
|
+
*
|
|
8965
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
8966
|
+
* const authClient = await auth.getClient();
|
|
8967
|
+
* google.options({auth: authClient});
|
|
8968
|
+
*
|
|
8969
|
+
* // Do the magic
|
|
8970
|
+
* const res = await translate.projects.locations.operations.delete({
|
|
8971
|
+
* // The name of the operation resource to be deleted.
|
|
8972
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
8973
|
+
* });
|
|
8974
|
+
* console.log(res.data);
|
|
8975
|
+
*
|
|
8976
|
+
* // Example response
|
|
8977
|
+
* // {}
|
|
8978
|
+
* }
|
|
8979
|
+
*
|
|
8980
|
+
* main().catch(e => {
|
|
8981
|
+
* console.error(e);
|
|
8982
|
+
* throw e;
|
|
8983
|
+
* });
|
|
8984
|
+
*
|
|
8985
|
+
* ```
|
|
6233
8986
|
*
|
|
6234
8987
|
* @param params - Parameters for request
|
|
6235
8988
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -6318,6 +9071,59 @@ export namespace translate_v3 {
|
|
|
6318
9071
|
|
|
6319
9072
|
/**
|
|
6320
9073
|
* 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.
|
|
9074
|
+
* @example
|
|
9075
|
+
* ```js
|
|
9076
|
+
* // Before running the sample:
|
|
9077
|
+
* // - Enable the API at:
|
|
9078
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
9079
|
+
* // - Login into gcloud by running:
|
|
9080
|
+
* // ```sh
|
|
9081
|
+
* // $ gcloud auth application-default login
|
|
9082
|
+
* // ```
|
|
9083
|
+
* // - Install the npm module by running:
|
|
9084
|
+
* // ```sh
|
|
9085
|
+
* // $ npm install googleapis
|
|
9086
|
+
* // ```
|
|
9087
|
+
*
|
|
9088
|
+
* const {google} = require('googleapis');
|
|
9089
|
+
* const translate = google.translate('v3');
|
|
9090
|
+
*
|
|
9091
|
+
* async function main() {
|
|
9092
|
+
* const auth = new google.auth.GoogleAuth({
|
|
9093
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
9094
|
+
* scopes: [
|
|
9095
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
9096
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
9097
|
+
* ],
|
|
9098
|
+
* });
|
|
9099
|
+
*
|
|
9100
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
9101
|
+
* const authClient = await auth.getClient();
|
|
9102
|
+
* google.options({auth: authClient});
|
|
9103
|
+
*
|
|
9104
|
+
* // Do the magic
|
|
9105
|
+
* const res = await translate.projects.locations.operations.get({
|
|
9106
|
+
* // The name of the operation resource.
|
|
9107
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
9108
|
+
* });
|
|
9109
|
+
* console.log(res.data);
|
|
9110
|
+
*
|
|
9111
|
+
* // Example response
|
|
9112
|
+
* // {
|
|
9113
|
+
* // "done": false,
|
|
9114
|
+
* // "error": {},
|
|
9115
|
+
* // "metadata": {},
|
|
9116
|
+
* // "name": "my_name",
|
|
9117
|
+
* // "response": {}
|
|
9118
|
+
* // }
|
|
9119
|
+
* }
|
|
9120
|
+
*
|
|
9121
|
+
* main().catch(e => {
|
|
9122
|
+
* console.error(e);
|
|
9123
|
+
* throw e;
|
|
9124
|
+
* });
|
|
9125
|
+
*
|
|
9126
|
+
* ```
|
|
6321
9127
|
*
|
|
6322
9128
|
* @param params - Parameters for request
|
|
6323
9129
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -6406,6 +9212,62 @@ export namespace translate_v3 {
|
|
|
6406
9212
|
|
|
6407
9213
|
/**
|
|
6408
9214
|
* Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
|
|
9215
|
+
* @example
|
|
9216
|
+
* ```js
|
|
9217
|
+
* // Before running the sample:
|
|
9218
|
+
* // - Enable the API at:
|
|
9219
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
9220
|
+
* // - Login into gcloud by running:
|
|
9221
|
+
* // ```sh
|
|
9222
|
+
* // $ gcloud auth application-default login
|
|
9223
|
+
* // ```
|
|
9224
|
+
* // - Install the npm module by running:
|
|
9225
|
+
* // ```sh
|
|
9226
|
+
* // $ npm install googleapis
|
|
9227
|
+
* // ```
|
|
9228
|
+
*
|
|
9229
|
+
* const {google} = require('googleapis');
|
|
9230
|
+
* const translate = google.translate('v3');
|
|
9231
|
+
*
|
|
9232
|
+
* async function main() {
|
|
9233
|
+
* const auth = new google.auth.GoogleAuth({
|
|
9234
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
9235
|
+
* scopes: [
|
|
9236
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
9237
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
9238
|
+
* ],
|
|
9239
|
+
* });
|
|
9240
|
+
*
|
|
9241
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
9242
|
+
* const authClient = await auth.getClient();
|
|
9243
|
+
* google.options({auth: authClient});
|
|
9244
|
+
*
|
|
9245
|
+
* // Do the magic
|
|
9246
|
+
* const res = await translate.projects.locations.operations.list({
|
|
9247
|
+
* // The standard list filter.
|
|
9248
|
+
* filter: 'placeholder-value',
|
|
9249
|
+
* // The name of the operation's parent resource.
|
|
9250
|
+
* name: 'projects/my-project/locations/my-location',
|
|
9251
|
+
* // The standard list page size.
|
|
9252
|
+
* pageSize: 'placeholder-value',
|
|
9253
|
+
* // The standard list page token.
|
|
9254
|
+
* pageToken: 'placeholder-value',
|
|
9255
|
+
* });
|
|
9256
|
+
* console.log(res.data);
|
|
9257
|
+
*
|
|
9258
|
+
* // Example response
|
|
9259
|
+
* // {
|
|
9260
|
+
* // "nextPageToken": "my_nextPageToken",
|
|
9261
|
+
* // "operations": []
|
|
9262
|
+
* // }
|
|
9263
|
+
* }
|
|
9264
|
+
*
|
|
9265
|
+
* main().catch(e => {
|
|
9266
|
+
* console.error(e);
|
|
9267
|
+
* throw e;
|
|
9268
|
+
* });
|
|
9269
|
+
*
|
|
9270
|
+
* ```
|
|
6409
9271
|
*
|
|
6410
9272
|
* @param params - Parameters for request
|
|
6411
9273
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|
|
@@ -6499,6 +9361,67 @@ export namespace translate_v3 {
|
|
|
6499
9361
|
|
|
6500
9362
|
/**
|
|
6501
9363
|
* 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.
|
|
9364
|
+
* @example
|
|
9365
|
+
* ```js
|
|
9366
|
+
* // Before running the sample:
|
|
9367
|
+
* // - Enable the API at:
|
|
9368
|
+
* // https://console.developers.google.com/apis/api/translate.googleapis.com
|
|
9369
|
+
* // - Login into gcloud by running:
|
|
9370
|
+
* // ```sh
|
|
9371
|
+
* // $ gcloud auth application-default login
|
|
9372
|
+
* // ```
|
|
9373
|
+
* // - Install the npm module by running:
|
|
9374
|
+
* // ```sh
|
|
9375
|
+
* // $ npm install googleapis
|
|
9376
|
+
* // ```
|
|
9377
|
+
*
|
|
9378
|
+
* const {google} = require('googleapis');
|
|
9379
|
+
* const translate = google.translate('v3');
|
|
9380
|
+
*
|
|
9381
|
+
* async function main() {
|
|
9382
|
+
* const auth = new google.auth.GoogleAuth({
|
|
9383
|
+
* // Scopes can be specified either as an array or as a single, space-delimited string.
|
|
9384
|
+
* scopes: [
|
|
9385
|
+
* 'https://www.googleapis.com/auth/cloud-platform',
|
|
9386
|
+
* 'https://www.googleapis.com/auth/cloud-translation',
|
|
9387
|
+
* ],
|
|
9388
|
+
* });
|
|
9389
|
+
*
|
|
9390
|
+
* // Acquire an auth client, and bind it to all future calls
|
|
9391
|
+
* const authClient = await auth.getClient();
|
|
9392
|
+
* google.options({auth: authClient});
|
|
9393
|
+
*
|
|
9394
|
+
* // Do the magic
|
|
9395
|
+
* const res = await translate.projects.locations.operations.wait({
|
|
9396
|
+
* // The name of the operation resource to wait on.
|
|
9397
|
+
* name: 'projects/my-project/locations/my-location/operations/my-operation',
|
|
9398
|
+
*
|
|
9399
|
+
* // Request body metadata
|
|
9400
|
+
* requestBody: {
|
|
9401
|
+
* // request body parameters
|
|
9402
|
+
* // {
|
|
9403
|
+
* // "timeout": "my_timeout"
|
|
9404
|
+
* // }
|
|
9405
|
+
* },
|
|
9406
|
+
* });
|
|
9407
|
+
* console.log(res.data);
|
|
9408
|
+
*
|
|
9409
|
+
* // Example response
|
|
9410
|
+
* // {
|
|
9411
|
+
* // "done": false,
|
|
9412
|
+
* // "error": {},
|
|
9413
|
+
* // "metadata": {},
|
|
9414
|
+
* // "name": "my_name",
|
|
9415
|
+
* // "response": {}
|
|
9416
|
+
* // }
|
|
9417
|
+
* }
|
|
9418
|
+
*
|
|
9419
|
+
* main().catch(e => {
|
|
9420
|
+
* console.error(e);
|
|
9421
|
+
* throw e;
|
|
9422
|
+
* });
|
|
9423
|
+
*
|
|
9424
|
+
* ```
|
|
6502
9425
|
*
|
|
6503
9426
|
* @param params - Parameters for request
|
|
6504
9427
|
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
|