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

Commit 7f9ecc0

Browse files
docs: generate sample code in the Java microgenerator (#363)
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
1 parent 70755ee commit 7f9ecc0

File tree

5 files changed

+177
-5
lines changed

5 files changed

+177
-5
lines changed

Diff for: google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechClient.java

+78
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
* <p>This class provides the ability to make remote calls to the backing service through method
3333
* calls that map to API methods. Sample code to get started:
3434
*
35+
* <pre>{@code
36+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
37+
* String languageCode = "languageCode-2092349083";
38+
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
39+
* }
40+
* }</pre>
41+
*
3542
* <p>Note: close() needs to be called on the TextToSpeechClient object to clean up resources such
3643
* as threads. In the example above, try-with-resources is used, which automatically calls close().
3744
*
@@ -134,6 +141,15 @@ public TextToSpeechStub getStub() {
134141
/**
135142
* Returns a list of Voice supported for synthesis.
136143
*
144+
* <p>Sample code:
145+
*
146+
* <pre>{@code
147+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
148+
* String languageCode = "languageCode-2092349083";
149+
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
150+
* }
151+
* }</pre>
152+
*
137153
* @param languageCode Optional. Recommended.
138154
* [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If specified, the
139155
* ListVoices call will only return voices that can be used to synthesize this language_code.
@@ -153,6 +169,16 @@ public final ListVoicesResponse listVoices(String languageCode) {
153169
/**
154170
* Returns a list of Voice supported for synthesis.
155171
*
172+
* <p>Sample code:
173+
*
174+
* <pre>{@code
175+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
176+
* ListVoicesRequest request =
177+
* ListVoicesRequest.newBuilder().setLanguageCode("languageCode-2092349083").build();
178+
* ListVoicesResponse response = textToSpeechClient.listVoices(request);
179+
* }
180+
* }</pre>
181+
*
156182
* @param request The request object containing all of the parameters for the API call.
157183
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
158184
*/
@@ -165,6 +191,17 @@ public final ListVoicesResponse listVoices(ListVoicesRequest request) {
165191
* Returns a list of Voice supported for synthesis.
166192
*
167193
* <p>Sample code:
194+
*
195+
* <pre>{@code
196+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
197+
* ListVoicesRequest request =
198+
* ListVoicesRequest.newBuilder().setLanguageCode("languageCode-2092349083").build();
199+
* ApiFuture<ListVoicesResponse> future =
200+
* textToSpeechClient.listVoicesCallable().futureCall(request);
201+
* // Do something.
202+
* ListVoicesResponse response = future.get();
203+
* }
204+
* }</pre>
168205
*/
169206
public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
170207
return stub.listVoicesCallable();
@@ -174,6 +211,18 @@ public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCall
174211
/**
175212
* Synthesizes speech synchronously: receive results after all text input has been processed.
176213
*
214+
* <p>Sample code:
215+
*
216+
* <pre>{@code
217+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
218+
* SynthesisInput input = SynthesisInput.newBuilder().build();
219+
* VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
220+
* AudioConfig audioConfig = AudioConfig.newBuilder().build();
221+
* SynthesizeSpeechResponse response =
222+
* textToSpeechClient.synthesizeSpeech(input, voice, audioConfig);
223+
* }
224+
* }</pre>
225+
*
177226
* @param input Required. The Synthesizer requires either plain text or SSML as input.
178227
* @param voice Required. The desired voice of the synthesized audio.
179228
* @param audioConfig Required. The configuration of the synthesized audio.
@@ -194,6 +243,20 @@ public final SynthesizeSpeechResponse synthesizeSpeech(
194243
/**
195244
* Synthesizes speech synchronously: receive results after all text input has been processed.
196245
*
246+
* <p>Sample code:
247+
*
248+
* <pre>{@code
249+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
250+
* SynthesizeSpeechRequest request =
251+
* SynthesizeSpeechRequest.newBuilder()
252+
* .setInput(SynthesisInput.newBuilder().build())
253+
* .setVoice(VoiceSelectionParams.newBuilder().build())
254+
* .setAudioConfig(AudioConfig.newBuilder().build())
255+
* .build();
256+
* SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(request);
257+
* }
258+
* }</pre>
259+
*
197260
* @param request The request object containing all of the parameters for the API call.
198261
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
199262
*/
@@ -206,6 +269,21 @@ public final SynthesizeSpeechResponse synthesizeSpeech(SynthesizeSpeechRequest r
206269
* Synthesizes speech synchronously: receive results after all text input has been processed.
207270
*
208271
* <p>Sample code:
272+
*
273+
* <pre>{@code
274+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
275+
* SynthesizeSpeechRequest request =
276+
* SynthesizeSpeechRequest.newBuilder()
277+
* .setInput(SynthesisInput.newBuilder().build())
278+
* .setVoice(VoiceSelectionParams.newBuilder().build())
279+
* .setAudioConfig(AudioConfig.newBuilder().build())
280+
* .build();
281+
* ApiFuture<SynthesizeSpeechResponse> future =
282+
* textToSpeechClient.synthesizeSpeechCallable().futureCall(request);
283+
* // Do something.
284+
* SynthesizeSpeechResponse response = future.get();
285+
* }
286+
* }</pre>
209287
*/
210288
public final UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
211289
synthesizeSpeechCallable() {

Diff for: google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/package-info.java

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
* <p>Service Description: Service that implements Google Cloud Text-to-Speech API.
2323
*
2424
* <p>Sample for TextToSpeechClient:
25+
*
26+
* <pre>{@code
27+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
28+
* String languageCode = "languageCode-2092349083";
29+
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
30+
* }
31+
* }</pre>
2532
*/
2633
@Generated("by gapic-generator-java")
2734
package com.google.cloud.texttospeech.v1;

Diff for: google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClient.java

+80
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
* <p>This class provides the ability to make remote calls to the backing service through method
3333
* calls that map to API methods. Sample code to get started:
3434
*
35+
* <pre>{@code
36+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
37+
* String languageCode = "languageCode-2092349083";
38+
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
39+
* }
40+
* }</pre>
41+
*
3542
* <p>Note: close() needs to be called on the TextToSpeechClient object to clean up resources such
3643
* as threads. In the example above, try-with-resources is used, which automatically calls close().
3744
*
@@ -135,6 +142,15 @@ public TextToSpeechStub getStub() {
135142
/**
136143
* Returns a list of Voice supported for synthesis.
137144
*
145+
* <p>Sample code:
146+
*
147+
* <pre>{@code
148+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
149+
* String languageCode = "languageCode-2092349083";
150+
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
151+
* }
152+
* }</pre>
153+
*
138154
* @param languageCode Optional. Recommended.
139155
* [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If specified, the
140156
* ListVoices call will only return voices that can be used to synthesize this language_code.
@@ -154,6 +170,16 @@ public final ListVoicesResponse listVoices(String languageCode) {
154170
/**
155171
* Returns a list of Voice supported for synthesis.
156172
*
173+
* <p>Sample code:
174+
*
175+
* <pre>{@code
176+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
177+
* ListVoicesRequest request =
178+
* ListVoicesRequest.newBuilder().setLanguageCode("languageCode-2092349083").build();
179+
* ListVoicesResponse response = textToSpeechClient.listVoices(request);
180+
* }
181+
* }</pre>
182+
*
157183
* @param request The request object containing all of the parameters for the API call.
158184
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
159185
*/
@@ -166,6 +192,17 @@ public final ListVoicesResponse listVoices(ListVoicesRequest request) {
166192
* Returns a list of Voice supported for synthesis.
167193
*
168194
* <p>Sample code:
195+
*
196+
* <pre>{@code
197+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
198+
* ListVoicesRequest request =
199+
* ListVoicesRequest.newBuilder().setLanguageCode("languageCode-2092349083").build();
200+
* ApiFuture<ListVoicesResponse> future =
201+
* textToSpeechClient.listVoicesCallable().futureCall(request);
202+
* // Do something.
203+
* ListVoicesResponse response = future.get();
204+
* }
205+
* }</pre>
169206
*/
170207
public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
171208
return stub.listVoicesCallable();
@@ -175,6 +212,18 @@ public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCall
175212
/**
176213
* Synthesizes speech synchronously: receive results after all text input has been processed.
177214
*
215+
* <p>Sample code:
216+
*
217+
* <pre>{@code
218+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
219+
* SynthesisInput input = SynthesisInput.newBuilder().build();
220+
* VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
221+
* AudioConfig audioConfig = AudioConfig.newBuilder().build();
222+
* SynthesizeSpeechResponse response =
223+
* textToSpeechClient.synthesizeSpeech(input, voice, audioConfig);
224+
* }
225+
* }</pre>
226+
*
178227
* @param input Required. The Synthesizer requires either plain text or SSML as input.
179228
* @param voice Required. The desired voice of the synthesized audio.
180229
* @param audioConfig Required. The configuration of the synthesized audio.
@@ -195,6 +244,21 @@ public final SynthesizeSpeechResponse synthesizeSpeech(
195244
/**
196245
* Synthesizes speech synchronously: receive results after all text input has been processed.
197246
*
247+
* <p>Sample code:
248+
*
249+
* <pre>{@code
250+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
251+
* SynthesizeSpeechRequest request =
252+
* SynthesizeSpeechRequest.newBuilder()
253+
* .setInput(SynthesisInput.newBuilder().build())
254+
* .setVoice(VoiceSelectionParams.newBuilder().build())
255+
* .setAudioConfig(AudioConfig.newBuilder().build())
256+
* .addAllEnableTimePointing(new ArrayList<SynthesizeSpeechRequest.TimepointType>())
257+
* .build();
258+
* SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(request);
259+
* }
260+
* }</pre>
261+
*
198262
* @param request The request object containing all of the parameters for the API call.
199263
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
200264
*/
@@ -207,6 +271,22 @@ public final SynthesizeSpeechResponse synthesizeSpeech(SynthesizeSpeechRequest r
207271
* Synthesizes speech synchronously: receive results after all text input has been processed.
208272
*
209273
* <p>Sample code:
274+
*
275+
* <pre>{@code
276+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
277+
* SynthesizeSpeechRequest request =
278+
* SynthesizeSpeechRequest.newBuilder()
279+
* .setInput(SynthesisInput.newBuilder().build())
280+
* .setVoice(VoiceSelectionParams.newBuilder().build())
281+
* .setAudioConfig(AudioConfig.newBuilder().build())
282+
* .addAllEnableTimePointing(new ArrayList<SynthesizeSpeechRequest.TimepointType>())
283+
* .build();
284+
* ApiFuture<SynthesizeSpeechResponse> future =
285+
* textToSpeechClient.synthesizeSpeechCallable().futureCall(request);
286+
* // Do something.
287+
* SynthesizeSpeechResponse response = future.get();
288+
* }
289+
* }</pre>
210290
*/
211291
public final UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
212292
synthesizeSpeechCallable() {

Diff for: google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
* <p>Service Description: Service that implements Google Cloud Text-to-Speech API.
2323
*
2424
* <p>Sample for TextToSpeechClient:
25+
*
26+
* <pre>{@code
27+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
28+
* String languageCode = "languageCode-2092349083";
29+
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
30+
* }
31+
* }</pre>
2532
*/
2633
@Generated("by gapic-generator-java")
2734
package com.google.cloud.texttospeech.v1beta1;

Diff for: synth.metadata

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/java-texttospeech.git",
7-
"sha": "ba26ec55c76f1d3af8f35a4d381a06693bf3f1b3"
7+
"sha": "70755ee60d48cee73d7726b22cbb6f3c5c7fd487"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3",
15-
"internalRef": "350949863"
14+
"sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb",
15+
"internalRef": "356341083"
1616
}
1717
},
1818
{
1919
"git": {
2020
"name": "googleapis",
2121
"remote": "https://github.com/googleapis/googleapis.git",
22-
"sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3",
23-
"internalRef": "350949863"
22+
"sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb",
23+
"internalRef": "356341083"
2424
}
2525
},
2626
{

0 commit comments

Comments
 (0)