-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): add example tags to generated samples (#561)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 408439482 Source-Link: googleapis/googleapis@b9f6184 Source-Link: googleapis/googleapis-gen@eb888bc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9
- Loading branch information
1 parent
72bb2b0
commit d20d763
Showing
9 changed files
with
359 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
"img.shields.io" | ||
], | ||
"silent": true, | ||
"concurrency": 10 | ||
"concurrency": 5 | ||
} |
57 changes: 57 additions & 0 deletions
57
packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.list_voices.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
62 changes: 62 additions & 0 deletions
62
packages/google-cloud-texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
58 changes: 58 additions & 0 deletions
58
packages/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.list_voices.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
66 changes: 66 additions & 0 deletions
66
...s/google-cloud-texttospeech/samples/generated/v1beta1/text_to_speech.synthesize_speech.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.