Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
docs: generate sample code in the Java microgenerator (#363)
Browse files Browse the repository at this point in the history
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/b5715173-fa09-4f29-8c69-530ae787b970/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 356341083
Source-Link: googleapis/googleapis@8d8c008
  • Loading branch information
yoshi-automation committed Feb 9, 2021
1 parent 70755ee commit 7f9ecc0
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 5 deletions.
Expand Up @@ -32,6 +32,13 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "languageCode-2092349083";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the TextToSpeechClient object to clean up resources such
* as threads. In the example above, try-with-resources is used, which automatically calls close().
*
Expand Down Expand Up @@ -134,6 +141,15 @@ public TextToSpeechStub getStub() {
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "languageCode-2092349083";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
* }</pre>
*
* @param 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.
Expand All @@ -153,6 +169,16 @@ public final ListVoicesResponse listVoices(String languageCode) {
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* ListVoicesRequest request =
* ListVoicesRequest.newBuilder().setLanguageCode("languageCode-2092349083").build();
* ListVoicesResponse response = textToSpeechClient.listVoices(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -165,6 +191,17 @@ public final ListVoicesResponse listVoices(ListVoicesRequest request) {
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* ListVoicesRequest request =
* ListVoicesRequest.newBuilder().setLanguageCode("languageCode-2092349083").build();
* ApiFuture<ListVoicesResponse> future =
* textToSpeechClient.listVoicesCallable().futureCall(request);
* // Do something.
* ListVoicesResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
return stub.listVoicesCallable();
Expand All @@ -174,6 +211,18 @@ public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCall
/**
* Synthesizes speech synchronously: receive results after all text input has been processed.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* SynthesisInput input = SynthesisInput.newBuilder().build();
* VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
* AudioConfig audioConfig = AudioConfig.newBuilder().build();
* SynthesizeSpeechResponse response =
* textToSpeechClient.synthesizeSpeech(input, voice, audioConfig);
* }
* }</pre>
*
* @param input Required. The Synthesizer requires either plain text or SSML as input.
* @param voice Required. The desired voice of the synthesized audio.
* @param audioConfig Required. The configuration of the synthesized audio.
Expand All @@ -194,6 +243,20 @@ public final SynthesizeSpeechResponse synthesizeSpeech(
/**
* Synthesizes speech synchronously: receive results after all text input has been processed.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* SynthesizeSpeechRequest request =
* SynthesizeSpeechRequest.newBuilder()
* .setInput(SynthesisInput.newBuilder().build())
* .setVoice(VoiceSelectionParams.newBuilder().build())
* .setAudioConfig(AudioConfig.newBuilder().build())
* .build();
* SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -206,6 +269,21 @@ public final SynthesizeSpeechResponse synthesizeSpeech(SynthesizeSpeechRequest r
* Synthesizes speech synchronously: receive results after all text input has been processed.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* SynthesizeSpeechRequest request =
* SynthesizeSpeechRequest.newBuilder()
* .setInput(SynthesisInput.newBuilder().build())
* .setVoice(VoiceSelectionParams.newBuilder().build())
* .setAudioConfig(AudioConfig.newBuilder().build())
* .build();
* ApiFuture<SynthesizeSpeechResponse> future =
* textToSpeechClient.synthesizeSpeechCallable().futureCall(request);
* // Do something.
* SynthesizeSpeechResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechCallable() {
Expand Down
Expand Up @@ -22,6 +22,13 @@
* <p>Service Description: Service that implements Google Cloud Text-to-Speech API.
*
* <p>Sample for TextToSpeechClient:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "languageCode-2092349083";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.texttospeech.v1;
Expand Down
Expand Up @@ -32,6 +32,13 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "languageCode-2092349083";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the TextToSpeechClient object to clean up resources such
* as threads. In the example above, try-with-resources is used, which automatically calls close().
*
Expand Down Expand Up @@ -135,6 +142,15 @@ public TextToSpeechStub getStub() {
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "languageCode-2092349083";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
* }</pre>
*
* @param 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.
Expand All @@ -154,6 +170,16 @@ public final ListVoicesResponse listVoices(String languageCode) {
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* ListVoicesRequest request =
* ListVoicesRequest.newBuilder().setLanguageCode("languageCode-2092349083").build();
* ListVoicesResponse response = textToSpeechClient.listVoices(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -166,6 +192,17 @@ public final ListVoicesResponse listVoices(ListVoicesRequest request) {
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* ListVoicesRequest request =
* ListVoicesRequest.newBuilder().setLanguageCode("languageCode-2092349083").build();
* ApiFuture<ListVoicesResponse> future =
* textToSpeechClient.listVoicesCallable().futureCall(request);
* // Do something.
* ListVoicesResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
return stub.listVoicesCallable();
Expand All @@ -175,6 +212,18 @@ public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCall
/**
* Synthesizes speech synchronously: receive results after all text input has been processed.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* SynthesisInput input = SynthesisInput.newBuilder().build();
* VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
* AudioConfig audioConfig = AudioConfig.newBuilder().build();
* SynthesizeSpeechResponse response =
* textToSpeechClient.synthesizeSpeech(input, voice, audioConfig);
* }
* }</pre>
*
* @param input Required. The Synthesizer requires either plain text or SSML as input.
* @param voice Required. The desired voice of the synthesized audio.
* @param audioConfig Required. The configuration of the synthesized audio.
Expand All @@ -195,6 +244,21 @@ public final SynthesizeSpeechResponse synthesizeSpeech(
/**
* Synthesizes speech synchronously: receive results after all text input has been processed.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* SynthesizeSpeechRequest request =
* SynthesizeSpeechRequest.newBuilder()
* .setInput(SynthesisInput.newBuilder().build())
* .setVoice(VoiceSelectionParams.newBuilder().build())
* .setAudioConfig(AudioConfig.newBuilder().build())
* .addAllEnableTimePointing(new ArrayList<SynthesizeSpeechRequest.TimepointType>())
* .build();
* SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand All @@ -207,6 +271,22 @@ public final SynthesizeSpeechResponse synthesizeSpeech(SynthesizeSpeechRequest r
* Synthesizes speech synchronously: receive results after all text input has been processed.
*
* <p>Sample code:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* SynthesizeSpeechRequest request =
* SynthesizeSpeechRequest.newBuilder()
* .setInput(SynthesisInput.newBuilder().build())
* .setVoice(VoiceSelectionParams.newBuilder().build())
* .setAudioConfig(AudioConfig.newBuilder().build())
* .addAllEnableTimePointing(new ArrayList<SynthesizeSpeechRequest.TimepointType>())
* .build();
* ApiFuture<SynthesizeSpeechResponse> future =
* textToSpeechClient.synthesizeSpeechCallable().futureCall(request);
* // Do something.
* SynthesizeSpeechResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechCallable() {
Expand Down
Expand Up @@ -22,6 +22,13 @@
* <p>Service Description: Service that implements Google Cloud Text-to-Speech API.
*
* <p>Sample for TextToSpeechClient:
*
* <pre>{@code
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "languageCode-2092349083";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.texttospeech.v1beta1;
Expand Down
10 changes: 5 additions & 5 deletions synth.metadata
Expand Up @@ -4,23 +4,23 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-texttospeech.git",
"sha": "ba26ec55c76f1d3af8f35a4d381a06693bf3f1b3"
"sha": "70755ee60d48cee73d7726b22cbb6f3c5c7fd487"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3",
"internalRef": "350949863"
"sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb",
"internalRef": "356341083"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3",
"internalRef": "350949863"
"sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb",
"internalRef": "356341083"
}
},
{
Expand Down

0 comments on commit 7f9ecc0

Please sign in to comment.