From d20d76333dee6a62259182d585ee0ec2e306e382 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Wed, 10 Nov 2021 21:52:24 +0000
Subject: [PATCH] docs(samples): add example tags to generated samples (#561)
- [ ] Regenerate this pull request now.
PiperOrigin-RevId: 408439482
Source-Link: https://github.com/googleapis/googleapis/commit/b9f61843dc80c7c285fc34fd3a40aae55082c2b9
Source-Link: https://github.com/googleapis/googleapis-gen/commit/eb888bc214efc7bf43bf4634b470254565a659a5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9
---
.../linkinator.config.json | 2 +-
.../v1/text_to_speech.list_voices.js | 57 ++++++++++
.../v1/text_to_speech.synthesize_speech.js | 62 +++++++++++
.../v1beta1/text_to_speech.list_voices.js | 58 ++++++++++
.../text_to_speech.synthesize_speech.js | 66 ++++++++++++
.../src/v1/text_to_speech_client.ts | 96 +++++++++--------
.../src/v1beta1/text_to_speech_client.ts | 102 +++++++++---------
.../test/gapic_text_to_speech_v1.ts | 12 +--
.../test/gapic_text_to_speech_v1beta1.ts | 12 +--
9 files changed, 359 insertions(+), 108 deletions(-)
create mode 100644 packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.list_voices.js
create mode 100644 packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js
create mode 100644 packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.list_voices.js
create mode 100644 packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js
diff --git a/packages/google-cloud-texttospeech/linkinator.config.json b/packages/google-cloud-texttospeech/linkinator.config.json
index 29a223b6db6..0121dfa684f 100644
--- a/packages/google-cloud-texttospeech/linkinator.config.json
+++ b/packages/google-cloud-texttospeech/linkinator.config.json
@@ -6,5 +6,5 @@
"img.shields.io"
],
"silent": true,
- "concurrency": 10
+ "concurrency": 5
}
diff --git a/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.list_voices.js b/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.list_voices.js
new file mode 100644
index 00000000000..a777ea279a0
--- /dev/null
+++ b/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.list_voices.js
@@ -0,0 +1,57 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+'use strict';
+
+function main() {
+ // [START texttospeech_v1_generated_TextToSpeech_ListVoices_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Optional. Recommended.
+ * BCP-47 (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If
+ * specified, the ListVoices call will only return voices that can be used to
+ * synthesize this language_code. E.g. when specifying "en-NZ", you will get
+ * supported "en-\*" voices; when specifying "no", you will get supported
+ * "no-\*" (Norwegian) and "nb-\*" (Norwegian Bokmal) voices; specifying "zh"
+ * will also get supported "cmn-\*" voices; specifying "zh-hk" will also get
+ * supported "yue-\*" voices.
+ */
+ // const languageCode = 'abc123'
+
+ // Imports the Texttospeech library
+ const {TextToSpeechClient} = require('@google-cloud/text-to-speech').v1;
+
+ // Instantiates a client
+ const texttospeechClient = new TextToSpeechClient();
+
+ async function callListVoices() {
+ // Construct request
+ const request = {};
+
+ // Run request
+ const response = await texttospeechClient.listVoices(request);
+ console.log(response);
+ }
+
+ callListVoices();
+ // [END texttospeech_v1_generated_TextToSpeech_ListVoices_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js b/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js
new file mode 100644
index 00000000000..f57805958cc
--- /dev/null
+++ b/packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js
@@ -0,0 +1,62 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+'use strict';
+
+function main(input, voice, audioConfig) {
+ // [START texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The Synthesizer requires either plain text or SSML as input.
+ */
+ // const input = {}
+ /**
+ * Required. The desired voice of the synthesized audio.
+ */
+ // const voice = {}
+ /**
+ * Required. The configuration of the synthesized audio.
+ */
+ // const audioConfig = {}
+
+ // Imports the Texttospeech library
+ const {TextToSpeechClient} = require('@google-cloud/text-to-speech').v1;
+
+ // Instantiates a client
+ const texttospeechClient = new TextToSpeechClient();
+
+ async function callSynthesizeSpeech() {
+ // Construct request
+ const request = {
+ input,
+ voice,
+ audioConfig,
+ };
+
+ // Run request
+ const response = await texttospeechClient.synthesizeSpeech(request);
+ console.log(response);
+ }
+
+ callSynthesizeSpeech();
+ // [END texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.list_voices.js b/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.list_voices.js
new file mode 100644
index 00000000000..28c422320f6
--- /dev/null
+++ b/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.list_voices.js
@@ -0,0 +1,58 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+'use strict';
+
+function main() {
+ // [START texttospeech_v1beta1_generated_TextToSpeech_ListVoices_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * 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. E.g. when specifying "en-NZ", you will
+ * get supported "en-NZ" voices; when specifying "no", you will get supported
+ * "no-\*" (Norwegian) and "nb-\*" (Norwegian Bokmal) voices; specifying "zh"
+ * will also get supported "cmn-\*" voices; specifying "zh-hk" will also get
+ * supported "yue-hk" voices.
+ */
+ // const languageCode = 'abc123'
+
+ // Imports the Texttospeech library
+ const {TextToSpeechClient} = require('@google-cloud/text-to-speech').v1beta1;
+
+ // Instantiates a client
+ const texttospeechClient = new TextToSpeechClient();
+
+ async function callListVoices() {
+ // Construct request
+ const request = {};
+
+ // Run request
+ const response = await texttospeechClient.listVoices(request);
+ console.log(response);
+ }
+
+ callListVoices();
+ // [END texttospeech_v1beta1_generated_TextToSpeech_ListVoices_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js b/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js
new file mode 100644
index 00000000000..a43e1ffa5d1
--- /dev/null
+++ b/packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js
@@ -0,0 +1,66 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+'use strict';
+
+function main(input, voice, audioConfig) {
+ // [START texttospeech_v1beta1_generated_TextToSpeech_SynthesizeSpeech_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The Synthesizer requires either plain text or SSML as input.
+ */
+ // const input = {}
+ /**
+ * Required. The desired voice of the synthesized audio.
+ */
+ // const voice = {}
+ /**
+ * Required. The configuration of the synthesized audio.
+ */
+ // const audioConfig = {}
+ /**
+ * Whether and what timepoints are returned in the response.
+ */
+ // const enableTimePointing = 1234
+
+ // Imports the Texttospeech library
+ const {TextToSpeechClient} = require('@google-cloud/text-to-speech').v1beta1;
+
+ // Instantiates a client
+ const texttospeechClient = new TextToSpeechClient();
+
+ async function callSynthesizeSpeech() {
+ // Construct request
+ const request = {
+ input,
+ voice,
+ audioConfig,
+ };
+
+ // Run request
+ const response = await texttospeechClient.synthesizeSpeech(request);
+ console.log(response);
+ }
+
+ callSynthesizeSpeech();
+ // [END texttospeech_v1beta1_generated_TextToSpeech_SynthesizeSpeech_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-texttospeech/src/v1/text_to_speech_client.ts b/packages/google-cloud-texttospeech/src/v1/text_to_speech_client.ts
index f4d7eff5ef0..32cce887ef4 100644
--- a/packages/google-cloud-texttospeech/src/v1/text_to_speech_client.ts
+++ b/packages/google-cloud-texttospeech/src/v1/text_to_speech_client.ts
@@ -281,6 +281,30 @@ export class TextToSpeechClient {
// -------------------
// -- Service calls --
// -------------------
+ /**
+ * Returns a list of Voice supported for synthesis.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} [request.languageCode]
+ * Optional. Recommended.
+ * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If
+ * specified, the ListVoices call will only return voices that can be used to
+ * synthesize this language_code. E.g. when specifying "en-NZ", you will get
+ * supported "en-\*" voices; when specifying "no", you will get supported
+ * "no-\*" (Norwegian) and "nb-\*" (Norwegian Bokmal) voices; specifying "zh"
+ * will also get supported "cmn-\*" voices; specifying "zh-hk" will also get
+ * supported "yue-\*" voices.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [ListVoicesResponse]{@link google.cloud.texttospeech.v1.ListVoicesResponse}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example
include:samples/generated/v1/text_to_speech.list_voices.js
+ * region_tag:texttospeech_v1_generated_TextToSpeech_ListVoices_async
+ */
listVoices(
request?: protos.google.cloud.texttospeech.v1.IListVoicesRequest,
options?: CallOptions
@@ -308,30 +332,6 @@ export class TextToSpeechClient {
{} | null | undefined
>
): void;
- /**
- * Returns a list of Voice supported for synthesis.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} [request.languageCode]
- * Optional. Recommended.
- * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If
- * specified, the ListVoices call will only return voices that can be used to
- * synthesize this language_code. E.g. when specifying "en-NZ", you will get
- * supported "en-\*" voices; when specifying "no", you will get supported
- * "no-\*" (Norwegian) and "nb-\*" (Norwegian Bokmal) voices; specifying "zh"
- * will also get supported "cmn-\*" voices; specifying "zh-hk" will also get
- * supported "yue-\*" voices.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [ListVoicesResponse]{@link google.cloud.texttospeech.v1.ListVoicesResponse}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.listVoices(request);
- */
listVoices(
request?: protos.google.cloud.texttospeech.v1.IListVoicesRequest,
optionsOrCallback?:
@@ -364,9 +364,33 @@ export class TextToSpeechClient {
options = optionsOrCallback as CallOptions;
}
options = options || {};
+ options.otherArgs = options.otherArgs || {};
+ options.otherArgs.headers = options.otherArgs.headers || {};
this.initialize();
return this.innerApiCalls.listVoices(request, options, callback);
}
+ /**
+ * Synthesizes speech synchronously: receive results after all text input
+ * has been processed.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {google.cloud.texttospeech.v1.SynthesisInput} request.input
+ * Required. The Synthesizer requires either plain text or SSML as input.
+ * @param {google.cloud.texttospeech.v1.VoiceSelectionParams} request.voice
+ * Required. The desired voice of the synthesized audio.
+ * @param {google.cloud.texttospeech.v1.AudioConfig} request.audioConfig
+ * Required. The configuration of the synthesized audio.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [SynthesizeSpeechResponse]{@link google.cloud.texttospeech.v1.SynthesizeSpeechResponse}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1/text_to_speech.synthesize_speech.js
+ * region_tag:texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async
+ */
synthesizeSpeech(
request?: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest,
options?: CallOptions
@@ -398,28 +422,6 @@ export class TextToSpeechClient {
{} | null | undefined
>
): void;
- /**
- * Synthesizes speech synchronously: receive results after all text input
- * has been processed.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {google.cloud.texttospeech.v1.SynthesisInput} request.input
- * Required. The Synthesizer requires either plain text or SSML as input.
- * @param {google.cloud.texttospeech.v1.VoiceSelectionParams} request.voice
- * Required. The desired voice of the synthesized audio.
- * @param {google.cloud.texttospeech.v1.AudioConfig} request.audioConfig
- * Required. The configuration of the synthesized audio.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [SynthesizeSpeechResponse]{@link google.cloud.texttospeech.v1.SynthesizeSpeechResponse}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.synthesizeSpeech(request);
- */
synthesizeSpeech(
request?: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest,
optionsOrCallback?:
@@ -454,6 +456,8 @@ export class TextToSpeechClient {
options = optionsOrCallback as CallOptions;
}
options = options || {};
+ options.otherArgs = options.otherArgs || {};
+ options.otherArgs.headers = options.otherArgs.headers || {};
this.initialize();
return this.innerApiCalls.synthesizeSpeech(request, options, callback);
}
diff --git a/packages/google-cloud-texttospeech/src/v1beta1/text_to_speech_client.ts b/packages/google-cloud-texttospeech/src/v1beta1/text_to_speech_client.ts
index e20a52738c7..91db5964c4e 100644
--- a/packages/google-cloud-texttospeech/src/v1beta1/text_to_speech_client.ts
+++ b/packages/google-cloud-texttospeech/src/v1beta1/text_to_speech_client.ts
@@ -281,6 +281,31 @@ export class TextToSpeechClient {
// -------------------
// -- Service calls --
// -------------------
+ /**
+ * Returns a list of Voice supported for synthesis.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} [request.languageCode]
+ * 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. E.g. when specifying "en-NZ", you will
+ * get supported "en-NZ" voices; when specifying "no", you will get supported
+ * "no-\*" (Norwegian) and "nb-\*" (Norwegian Bokmal) voices; specifying "zh"
+ * will also get supported "cmn-\*" voices; specifying "zh-hk" will also get
+ * supported "yue-hk" voices.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [ListVoicesResponse]{@link google.cloud.texttospeech.v1beta1.ListVoicesResponse}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta1/text_to_speech.list_voices.js
+ * region_tag:texttospeech_v1beta1_generated_TextToSpeech_ListVoices_async
+ */
listVoices(
request?: protos.google.cloud.texttospeech.v1beta1.IListVoicesRequest,
options?: CallOptions
@@ -312,31 +337,6 @@ export class TextToSpeechClient {
{} | null | undefined
>
): void;
- /**
- * Returns a list of Voice supported for synthesis.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} [request.languageCode]
- * 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. E.g. when specifying "en-NZ", you will
- * get supported "en-NZ" voices; when specifying "no", you will get supported
- * "no-\*" (Norwegian) and "nb-\*" (Norwegian Bokmal) voices; specifying "zh"
- * will also get supported "cmn-\*" voices; specifying "zh-hk" will also get
- * supported "yue-hk" voices.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [ListVoicesResponse]{@link google.cloud.texttospeech.v1beta1.ListVoicesResponse}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.listVoices(request);
- */
listVoices(
request?: protos.google.cloud.texttospeech.v1beta1.IListVoicesRequest,
optionsOrCallback?:
@@ -371,9 +371,35 @@ export class TextToSpeechClient {
options = optionsOrCallback as CallOptions;
}
options = options || {};
+ options.otherArgs = options.otherArgs || {};
+ options.otherArgs.headers = options.otherArgs.headers || {};
this.initialize();
return this.innerApiCalls.listVoices(request, options, callback);
}
+ /**
+ * Synthesizes speech synchronously: receive results after all text input
+ * has been processed.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {google.cloud.texttospeech.v1beta1.SynthesisInput} request.input
+ * Required. The Synthesizer requires either plain text or SSML as input.
+ * @param {google.cloud.texttospeech.v1beta1.VoiceSelectionParams} request.voice
+ * Required. The desired voice of the synthesized audio.
+ * @param {google.cloud.texttospeech.v1beta1.AudioConfig} request.audioConfig
+ * Required. The configuration of the synthesized audio.
+ * @param {number[]} request.enableTimePointing
+ * Whether and what timepoints are returned in the response.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [SynthesizeSpeechResponse]{@link google.cloud.texttospeech.v1beta1.SynthesizeSpeechResponse}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta1/text_to_speech.synthesize_speech.js
+ * region_tag:texttospeech_v1beta1_generated_TextToSpeech_SynthesizeSpeech_async
+ */
synthesizeSpeech(
request?: protos.google.cloud.texttospeech.v1beta1.ISynthesizeSpeechRequest,
options?: CallOptions
@@ -408,30 +434,6 @@ export class TextToSpeechClient {
{} | null | undefined
>
): void;
- /**
- * Synthesizes speech synchronously: receive results after all text input
- * has been processed.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {google.cloud.texttospeech.v1beta1.SynthesisInput} request.input
- * Required. The Synthesizer requires either plain text or SSML as input.
- * @param {google.cloud.texttospeech.v1beta1.VoiceSelectionParams} request.voice
- * Required. The desired voice of the synthesized audio.
- * @param {google.cloud.texttospeech.v1beta1.AudioConfig} request.audioConfig
- * Required. The configuration of the synthesized audio.
- * @param {number[]} request.enableTimePointing
- * Whether and what timepoints are returned in the response.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [SynthesizeSpeechResponse]{@link google.cloud.texttospeech.v1beta1.SynthesizeSpeechResponse}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.synthesizeSpeech(request);
- */
synthesizeSpeech(
request?: protos.google.cloud.texttospeech.v1beta1.ISynthesizeSpeechRequest,
optionsOrCallback?:
@@ -469,6 +471,8 @@ export class TextToSpeechClient {
options = optionsOrCallback as CallOptions;
}
options = options || {};
+ options.otherArgs = options.otherArgs || {};
+ options.otherArgs.headers = options.otherArgs.headers || {};
this.initialize();
return this.innerApiCalls.synthesizeSpeech(request, options, callback);
}
diff --git a/packages/google-cloud-texttospeech/test/gapic_text_to_speech_v1.ts b/packages/google-cloud-texttospeech/test/gapic_text_to_speech_v1.ts
index dc20c16c335..e43883e582f 100644
--- a/packages/google-cloud-texttospeech/test/gapic_text_to_speech_v1.ts
+++ b/packages/google-cloud-texttospeech/test/gapic_text_to_speech_v1.ts
@@ -140,7 +140,7 @@ describe('v1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.ListVoicesRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedResponse = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.ListVoicesResponse()
);
@@ -163,7 +163,7 @@ describe('v1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.ListVoicesRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedResponse = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.ListVoicesResponse()
);
@@ -202,7 +202,7 @@ describe('v1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.ListVoicesRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedError = new Error('expected');
client.innerApiCalls.listVoices = stubSimpleCall(
undefined,
@@ -227,7 +227,7 @@ describe('v1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedResponse = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.SynthesizeSpeechResponse()
);
@@ -250,7 +250,7 @@ describe('v1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedResponse = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.SynthesizeSpeechResponse()
);
@@ -289,7 +289,7 @@ describe('v1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedError = new Error('expected');
client.innerApiCalls.synthesizeSpeech = stubSimpleCall(
undefined,
diff --git a/packages/google-cloud-texttospeech/test/gapic_text_to_speech_v1beta1.ts b/packages/google-cloud-texttospeech/test/gapic_text_to_speech_v1beta1.ts
index 496ad07fbaf..c87be04d506 100644
--- a/packages/google-cloud-texttospeech/test/gapic_text_to_speech_v1beta1.ts
+++ b/packages/google-cloud-texttospeech/test/gapic_text_to_speech_v1beta1.ts
@@ -142,7 +142,7 @@ describe('v1beta1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.ListVoicesRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedResponse = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.ListVoicesResponse()
);
@@ -165,7 +165,7 @@ describe('v1beta1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.ListVoicesRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedResponse = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.ListVoicesResponse()
);
@@ -204,7 +204,7 @@ describe('v1beta1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.ListVoicesRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedError = new Error('expected');
client.innerApiCalls.listVoices = stubSimpleCall(
undefined,
@@ -229,7 +229,7 @@ describe('v1beta1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.SynthesizeSpeechRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedResponse = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.SynthesizeSpeechResponse()
);
@@ -252,7 +252,7 @@ describe('v1beta1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.SynthesizeSpeechRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedResponse = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.SynthesizeSpeechResponse()
);
@@ -291,7 +291,7 @@ describe('v1beta1.TextToSpeechClient', () => {
const request = generateSampleMessage(
new protos.google.cloud.texttospeech.v1beta1.SynthesizeSpeechRequest()
);
- const expectedOptions = {};
+ const expectedOptions = {otherArgs: {headers: {}}};
const expectedError = new Error('expected');
client.innerApiCalls.synthesizeSpeech = stubSimpleCall(
undefined,