@googleapis/texttospeech 3.0.1 → 5.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/v1.ts CHANGED
@@ -453,6 +453,10 @@ export namespace texttospeech_v1 {
453
453
  * Required. The language (and potentially also the region) of the voice expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g. "en-US". This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".
454
454
  */
455
455
  languageCode?: string | null;
456
+ /**
457
+ * Optional. The name of the model. If set, the service will choose the model matching the specified configuration.
458
+ */
459
+ modelName?: string | null;
456
460
  /**
457
461
  * The name of the voice. If both the name and the gender are not set, the service will choose a voice based on the other parameters such as language_code.
458
462
  */
@@ -475,6 +479,56 @@ export namespace texttospeech_v1 {
475
479
 
476
480
  /**
477
481
  * 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`.
482
+ * @example
483
+ * ```js
484
+ * // Before running the sample:
485
+ * // - Enable the API at:
486
+ * // https://console.developers.google.com/apis/api/texttospeech.googleapis.com
487
+ * // - Login into gcloud by running:
488
+ * // ```sh
489
+ * // $ gcloud auth application-default login
490
+ * // ```
491
+ * // - Install the npm module by running:
492
+ * // ```sh
493
+ * // $ npm install googleapis
494
+ * // ```
495
+ *
496
+ * const {google} = require('googleapis');
497
+ * const texttospeech = google.texttospeech('v1');
498
+ *
499
+ * async function main() {
500
+ * const auth = new google.auth.GoogleAuth({
501
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
502
+ * scopes: ['https://www.googleapis.com/auth/cloud-platform'],
503
+ * });
504
+ *
505
+ * // Acquire an auth client, and bind it to all future calls
506
+ * const authClient = await auth.getClient();
507
+ * google.options({auth: authClient});
508
+ *
509
+ * // Do the magic
510
+ * const res = await texttospeech.operations.cancel({
511
+ * // The name of the operation resource to be cancelled.
512
+ * name: 'operations/.*',
513
+ *
514
+ * // Request body metadata
515
+ * requestBody: {
516
+ * // request body parameters
517
+ * // {}
518
+ * },
519
+ * });
520
+ * console.log(res.data);
521
+ *
522
+ * // Example response
523
+ * // {}
524
+ * }
525
+ *
526
+ * main().catch(e => {
527
+ * console.error(e);
528
+ * throw e;
529
+ * });
530
+ *
531
+ * ```
478
532
  *
479
533
  * @param params - Parameters for request
480
534
  * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -563,6 +617,50 @@ export namespace texttospeech_v1 {
563
617
 
564
618
  /**
565
619
  * 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`.
620
+ * @example
621
+ * ```js
622
+ * // Before running the sample:
623
+ * // - Enable the API at:
624
+ * // https://console.developers.google.com/apis/api/texttospeech.googleapis.com
625
+ * // - Login into gcloud by running:
626
+ * // ```sh
627
+ * // $ gcloud auth application-default login
628
+ * // ```
629
+ * // - Install the npm module by running:
630
+ * // ```sh
631
+ * // $ npm install googleapis
632
+ * // ```
633
+ *
634
+ * const {google} = require('googleapis');
635
+ * const texttospeech = google.texttospeech('v1');
636
+ *
637
+ * async function main() {
638
+ * const auth = new google.auth.GoogleAuth({
639
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
640
+ * scopes: ['https://www.googleapis.com/auth/cloud-platform'],
641
+ * });
642
+ *
643
+ * // Acquire an auth client, and bind it to all future calls
644
+ * const authClient = await auth.getClient();
645
+ * google.options({auth: authClient});
646
+ *
647
+ * // Do the magic
648
+ * const res = await texttospeech.operations.delete({
649
+ * // The name of the operation resource to be deleted.
650
+ * name: 'operations/.*',
651
+ * });
652
+ * console.log(res.data);
653
+ *
654
+ * // Example response
655
+ * // {}
656
+ * }
657
+ *
658
+ * main().catch(e => {
659
+ * console.error(e);
660
+ * throw e;
661
+ * });
662
+ *
663
+ * ```
566
664
  *
567
665
  * @param params - Parameters for request
568
666
  * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -691,6 +789,67 @@ export namespace texttospeech_v1 {
691
789
 
692
790
  /**
693
791
  * Synthesizes long form text asynchronously.
792
+ * @example
793
+ * ```js
794
+ * // Before running the sample:
795
+ * // - Enable the API at:
796
+ * // https://console.developers.google.com/apis/api/texttospeech.googleapis.com
797
+ * // - Login into gcloud by running:
798
+ * // ```sh
799
+ * // $ gcloud auth application-default login
800
+ * // ```
801
+ * // - Install the npm module by running:
802
+ * // ```sh
803
+ * // $ npm install googleapis
804
+ * // ```
805
+ *
806
+ * const {google} = require('googleapis');
807
+ * const texttospeech = google.texttospeech('v1');
808
+ *
809
+ * async function main() {
810
+ * const auth = new google.auth.GoogleAuth({
811
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
812
+ * scopes: ['https://www.googleapis.com/auth/cloud-platform'],
813
+ * });
814
+ *
815
+ * // Acquire an auth client, and bind it to all future calls
816
+ * const authClient = await auth.getClient();
817
+ * google.options({auth: authClient});
818
+ *
819
+ * // Do the magic
820
+ * const res = await texttospeech.projects.locations.synthesizeLongAudio({
821
+ * // The resource states of the request in the form of `projects/x/locations/x`.
822
+ * parent: 'projects/my-project/locations/my-location',
823
+ *
824
+ * // Request body metadata
825
+ * requestBody: {
826
+ * // request body parameters
827
+ * // {
828
+ * // "audioConfig": {},
829
+ * // "input": {},
830
+ * // "outputGcsUri": "my_outputGcsUri",
831
+ * // "voice": {}
832
+ * // }
833
+ * },
834
+ * });
835
+ * console.log(res.data);
836
+ *
837
+ * // Example response
838
+ * // {
839
+ * // "done": false,
840
+ * // "error": {},
841
+ * // "metadata": {},
842
+ * // "name": "my_name",
843
+ * // "response": {}
844
+ * // }
845
+ * }
846
+ *
847
+ * main().catch(e => {
848
+ * console.error(e);
849
+ * throw e;
850
+ * });
851
+ *
852
+ * ```
694
853
  *
695
854
  * @param params - Parameters for request
696
855
  * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -802,6 +961,56 @@ export namespace texttospeech_v1 {
802
961
 
803
962
  /**
804
963
  * 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.
964
+ * @example
965
+ * ```js
966
+ * // Before running the sample:
967
+ * // - Enable the API at:
968
+ * // https://console.developers.google.com/apis/api/texttospeech.googleapis.com
969
+ * // - Login into gcloud by running:
970
+ * // ```sh
971
+ * // $ gcloud auth application-default login
972
+ * // ```
973
+ * // - Install the npm module by running:
974
+ * // ```sh
975
+ * // $ npm install googleapis
976
+ * // ```
977
+ *
978
+ * const {google} = require('googleapis');
979
+ * const texttospeech = google.texttospeech('v1');
980
+ *
981
+ * async function main() {
982
+ * const auth = new google.auth.GoogleAuth({
983
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
984
+ * scopes: ['https://www.googleapis.com/auth/cloud-platform'],
985
+ * });
986
+ *
987
+ * // Acquire an auth client, and bind it to all future calls
988
+ * const authClient = await auth.getClient();
989
+ * google.options({auth: authClient});
990
+ *
991
+ * // Do the magic
992
+ * const res = await texttospeech.projects.locations.operations.get({
993
+ * // The name of the operation resource.
994
+ * name: 'projects/my-project/locations/my-location/operations/my-operation',
995
+ * });
996
+ * console.log(res.data);
997
+ *
998
+ * // Example response
999
+ * // {
1000
+ * // "done": false,
1001
+ * // "error": {},
1002
+ * // "metadata": {},
1003
+ * // "name": "my_name",
1004
+ * // "response": {}
1005
+ * // }
1006
+ * }
1007
+ *
1008
+ * main().catch(e => {
1009
+ * console.error(e);
1010
+ * throw e;
1011
+ * });
1012
+ *
1013
+ * ```
805
1014
  *
806
1015
  * @param params - Parameters for request
807
1016
  * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -890,6 +1099,59 @@ export namespace texttospeech_v1 {
890
1099
 
891
1100
  /**
892
1101
  * Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1102
+ * @example
1103
+ * ```js
1104
+ * // Before running the sample:
1105
+ * // - Enable the API at:
1106
+ * // https://console.developers.google.com/apis/api/texttospeech.googleapis.com
1107
+ * // - Login into gcloud by running:
1108
+ * // ```sh
1109
+ * // $ gcloud auth application-default login
1110
+ * // ```
1111
+ * // - Install the npm module by running:
1112
+ * // ```sh
1113
+ * // $ npm install googleapis
1114
+ * // ```
1115
+ *
1116
+ * const {google} = require('googleapis');
1117
+ * const texttospeech = google.texttospeech('v1');
1118
+ *
1119
+ * async function main() {
1120
+ * const auth = new google.auth.GoogleAuth({
1121
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
1122
+ * scopes: ['https://www.googleapis.com/auth/cloud-platform'],
1123
+ * });
1124
+ *
1125
+ * // Acquire an auth client, and bind it to all future calls
1126
+ * const authClient = await auth.getClient();
1127
+ * google.options({auth: authClient});
1128
+ *
1129
+ * // Do the magic
1130
+ * const res = await texttospeech.projects.locations.operations.list({
1131
+ * // The standard list filter.
1132
+ * filter: 'placeholder-value',
1133
+ * // The name of the operation's parent resource.
1134
+ * name: 'projects/my-project/locations/my-location',
1135
+ * // The standard list page size.
1136
+ * pageSize: 'placeholder-value',
1137
+ * // The standard list page token.
1138
+ * pageToken: 'placeholder-value',
1139
+ * });
1140
+ * console.log(res.data);
1141
+ *
1142
+ * // Example response
1143
+ * // {
1144
+ * // "nextPageToken": "my_nextPageToken",
1145
+ * // "operations": []
1146
+ * // }
1147
+ * }
1148
+ *
1149
+ * main().catch(e => {
1150
+ * console.error(e);
1151
+ * throw e;
1152
+ * });
1153
+ *
1154
+ * ```
893
1155
  *
894
1156
  * @param params - Parameters for request
895
1157
  * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -1017,6 +1279,60 @@ export namespace texttospeech_v1 {
1017
1279
 
1018
1280
  /**
1019
1281
  * Synthesizes speech synchronously: receive results after all text input has been processed.
1282
+ * @example
1283
+ * ```js
1284
+ * // Before running the sample:
1285
+ * // - Enable the API at:
1286
+ * // https://console.developers.google.com/apis/api/texttospeech.googleapis.com
1287
+ * // - Login into gcloud by running:
1288
+ * // ```sh
1289
+ * // $ gcloud auth application-default login
1290
+ * // ```
1291
+ * // - Install the npm module by running:
1292
+ * // ```sh
1293
+ * // $ npm install googleapis
1294
+ * // ```
1295
+ *
1296
+ * const {google} = require('googleapis');
1297
+ * const texttospeech = google.texttospeech('v1');
1298
+ *
1299
+ * async function main() {
1300
+ * const auth = new google.auth.GoogleAuth({
1301
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
1302
+ * scopes: ['https://www.googleapis.com/auth/cloud-platform'],
1303
+ * });
1304
+ *
1305
+ * // Acquire an auth client, and bind it to all future calls
1306
+ * const authClient = await auth.getClient();
1307
+ * google.options({auth: authClient});
1308
+ *
1309
+ * // Do the magic
1310
+ * const res = await texttospeech.text.synthesize({
1311
+ * // Request body metadata
1312
+ * requestBody: {
1313
+ * // request body parameters
1314
+ * // {
1315
+ * // "advancedVoiceOptions": {},
1316
+ * // "audioConfig": {},
1317
+ * // "input": {},
1318
+ * // "voice": {}
1319
+ * // }
1320
+ * },
1321
+ * });
1322
+ * console.log(res.data);
1323
+ *
1324
+ * // Example response
1325
+ * // {
1326
+ * // "audioContent": "my_audioContent"
1327
+ * // }
1328
+ * }
1329
+ *
1330
+ * main().catch(e => {
1331
+ * console.error(e);
1332
+ * throw e;
1333
+ * });
1334
+ *
1335
+ * ```
1020
1336
  *
1021
1337
  * @param params - Parameters for request
1022
1338
  * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
@@ -1125,6 +1441,52 @@ export namespace texttospeech_v1 {
1125
1441
 
1126
1442
  /**
1127
1443
  * Returns a list of Voice supported for synthesis.
1444
+ * @example
1445
+ * ```js
1446
+ * // Before running the sample:
1447
+ * // - Enable the API at:
1448
+ * // https://console.developers.google.com/apis/api/texttospeech.googleapis.com
1449
+ * // - Login into gcloud by running:
1450
+ * // ```sh
1451
+ * // $ gcloud auth application-default login
1452
+ * // ```
1453
+ * // - Install the npm module by running:
1454
+ * // ```sh
1455
+ * // $ npm install googleapis
1456
+ * // ```
1457
+ *
1458
+ * const {google} = require('googleapis');
1459
+ * const texttospeech = google.texttospeech('v1');
1460
+ *
1461
+ * async function main() {
1462
+ * const auth = new google.auth.GoogleAuth({
1463
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
1464
+ * scopes: ['https://www.googleapis.com/auth/cloud-platform'],
1465
+ * });
1466
+ *
1467
+ * // Acquire an auth client, and bind it to all future calls
1468
+ * const authClient = await auth.getClient();
1469
+ * google.options({auth: authClient});
1470
+ *
1471
+ * // Do the magic
1472
+ * const res = await texttospeech.voices.list({
1473
+ * // Optional. Recommended. [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If not specified, the API will return all supported voices. If specified, the ListVoices call will only return voices that can be used to synthesize this language_code. For example, if you specify `"en-NZ"`, all `"en-NZ"` voices will be returned. If you specify `"no"`, both `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be returned.
1474
+ * languageCode: 'placeholder-value',
1475
+ * });
1476
+ * console.log(res.data);
1477
+ *
1478
+ * // Example response
1479
+ * // {
1480
+ * // "voices": []
1481
+ * // }
1482
+ * }
1483
+ *
1484
+ * main().catch(e => {
1485
+ * console.error(e);
1486
+ * throw e;
1487
+ * });
1488
+ *
1489
+ * ```
1128
1490
  *
1129
1491
  * @param params - Parameters for request
1130
1492
  * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.