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

Commit a500ecb

Browse files
fix: restore GAPIC v2 retry configs (#143)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/b94bacd6-05ee-45c2-be4d-b0f667030fab/targets PiperOrigin-RevId: 312088359 Source-Link: googleapis/googleapis@5a90d46
1 parent b6110b5 commit a500ecb

15 files changed

+330
-322
lines changed

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

+71-69
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@
3434
* <pre>
3535
* <code>
3636
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
37-
* String languageCode = "";
38-
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
37+
* SynthesisInput input = SynthesisInput.newBuilder().build();
38+
* VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
39+
* AudioConfig audioConfig = AudioConfig.newBuilder().build();
40+
* SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(input, voice, audioConfig);
3941
* }
4042
* </code>
4143
* </pre>
@@ -143,73 +145,6 @@ public TextToSpeechStub getStub() {
143145
return stub;
144146
}
145147

146-
// AUTO-GENERATED DOCUMENTATION AND METHOD
147-
/**
148-
* Returns a list of Voice supported for synthesis.
149-
*
150-
* <p>Sample code:
151-
*
152-
* <pre><code>
153-
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
154-
* String languageCode = "";
155-
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
156-
* }
157-
* </code></pre>
158-
*
159-
* @param languageCode Optional. Recommended.
160-
* [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If specified, the
161-
* ListVoices call will only return voices that can be used to synthesize this language_code.
162-
* E.g. when specifying "en-NZ", you will get supported "en-&#42;" voices; when specifying
163-
* "no", you will get supported "no-&#42;" (Norwegian) and "nb-&#42;" (Norwegian Bokmal)
164-
* voices; specifying "zh" will also get supported "cmn-&#42;" voices; specifying "zh-hk" will
165-
* also get supported "yue-&#42;" voices.
166-
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
167-
*/
168-
public final ListVoicesResponse listVoices(String languageCode) {
169-
ListVoicesRequest request =
170-
ListVoicesRequest.newBuilder().setLanguageCode(languageCode).build();
171-
return listVoices(request);
172-
}
173-
174-
// AUTO-GENERATED DOCUMENTATION AND METHOD
175-
/**
176-
* Returns a list of Voice supported for synthesis.
177-
*
178-
* <p>Sample code:
179-
*
180-
* <pre><code>
181-
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
182-
* ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
183-
* ListVoicesResponse response = textToSpeechClient.listVoices(request);
184-
* }
185-
* </code></pre>
186-
*
187-
* @param request The request object containing all of the parameters for the API call.
188-
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
189-
*/
190-
public final ListVoicesResponse listVoices(ListVoicesRequest request) {
191-
return listVoicesCallable().call(request);
192-
}
193-
194-
// AUTO-GENERATED DOCUMENTATION AND METHOD
195-
/**
196-
* Returns a list of Voice supported for synthesis.
197-
*
198-
* <p>Sample code:
199-
*
200-
* <pre><code>
201-
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
202-
* ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
203-
* ApiFuture&lt;ListVoicesResponse&gt; future = textToSpeechClient.listVoicesCallable().futureCall(request);
204-
* // Do something
205-
* ListVoicesResponse response = future.get();
206-
* }
207-
* </code></pre>
208-
*/
209-
public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
210-
return stub.listVoicesCallable();
211-
}
212-
213148
// AUTO-GENERATED DOCUMENTATION AND METHOD
214149
/**
215150
* Synthesizes speech synchronously: receive results after all text input has been processed.
@@ -295,6 +230,73 @@ public final SynthesizeSpeechResponse synthesizeSpeech(SynthesizeSpeechRequest r
295230
return stub.synthesizeSpeechCallable();
296231
}
297232

233+
// AUTO-GENERATED DOCUMENTATION AND METHOD
234+
/**
235+
* Returns a list of Voice supported for synthesis.
236+
*
237+
* <p>Sample code:
238+
*
239+
* <pre><code>
240+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
241+
* String languageCode = "";
242+
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
243+
* }
244+
* </code></pre>
245+
*
246+
* @param languageCode Optional. Recommended.
247+
* [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If specified, the
248+
* ListVoices call will only return voices that can be used to synthesize this language_code.
249+
* E.g. when specifying "en-NZ", you will get supported "en-&#42;" voices; when specifying
250+
* "no", you will get supported "no-&#42;" (Norwegian) and "nb-&#42;" (Norwegian Bokmal)
251+
* voices; specifying "zh" will also get supported "cmn-&#42;" voices; specifying "zh-hk" will
252+
* also get supported "yue-&#42;" voices.
253+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
254+
*/
255+
public final ListVoicesResponse listVoices(String languageCode) {
256+
ListVoicesRequest request =
257+
ListVoicesRequest.newBuilder().setLanguageCode(languageCode).build();
258+
return listVoices(request);
259+
}
260+
261+
// AUTO-GENERATED DOCUMENTATION AND METHOD
262+
/**
263+
* Returns a list of Voice supported for synthesis.
264+
*
265+
* <p>Sample code:
266+
*
267+
* <pre><code>
268+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
269+
* ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
270+
* ListVoicesResponse response = textToSpeechClient.listVoices(request);
271+
* }
272+
* </code></pre>
273+
*
274+
* @param request The request object containing all of the parameters for the API call.
275+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
276+
*/
277+
public final ListVoicesResponse listVoices(ListVoicesRequest request) {
278+
return listVoicesCallable().call(request);
279+
}
280+
281+
// AUTO-GENERATED DOCUMENTATION AND METHOD
282+
/**
283+
* Returns a list of Voice supported for synthesis.
284+
*
285+
* <p>Sample code:
286+
*
287+
* <pre><code>
288+
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
289+
* ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
290+
* ApiFuture&lt;ListVoicesResponse&gt; future = textToSpeechClient.listVoicesCallable().futureCall(request);
291+
* // Do something
292+
* ListVoicesResponse response = future.get();
293+
* }
294+
* </code></pre>
295+
*/
296+
public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
297+
return stub.listVoicesCallable();
298+
}
299+
298300
@Override
299301
public final void close() {
300302
stub.close();

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

+13-13
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@
4545
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
4646
* build() is called, the tree of builders is called to create the complete settings object.
4747
*
48-
* <p>For example, to set the total timeout of listVoices to 30 seconds:
48+
* <p>For example, to set the total timeout of synthesizeSpeech to 30 seconds:
4949
*
5050
* <pre>
5151
* <code>
5252
* TextToSpeechSettings.Builder textToSpeechSettingsBuilder =
5353
* TextToSpeechSettings.newBuilder();
5454
* textToSpeechSettingsBuilder
55-
* .listVoicesSettings()
55+
* .synthesizeSpeechSettings()
5656
* .setRetrySettings(
57-
* textToSpeechSettingsBuilder.listVoicesSettings().getRetrySettings().toBuilder()
57+
* textToSpeechSettingsBuilder.synthesizeSpeechSettings().getRetrySettings().toBuilder()
5858
* .setTotalTimeout(Duration.ofSeconds(30))
5959
* .build());
6060
* TextToSpeechSettings textToSpeechSettings = textToSpeechSettingsBuilder.build();
@@ -64,17 +64,17 @@
6464
@Generated("by gapic-generator")
6565
@BetaApi
6666
public class TextToSpeechSettings extends ClientSettings<TextToSpeechSettings> {
67-
/** Returns the object with the settings used for calls to listVoices. */
68-
public UnaryCallSettings<ListVoicesRequest, ListVoicesResponse> listVoicesSettings() {
69-
return ((TextToSpeechStubSettings) getStubSettings()).listVoicesSettings();
70-
}
71-
7267
/** Returns the object with the settings used for calls to synthesizeSpeech. */
7368
public UnaryCallSettings<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
7469
synthesizeSpeechSettings() {
7570
return ((TextToSpeechStubSettings) getStubSettings()).synthesizeSpeechSettings();
7671
}
7772

73+
/** Returns the object with the settings used for calls to listVoices. */
74+
public UnaryCallSettings<ListVoicesRequest, ListVoicesResponse> listVoicesSettings() {
75+
return ((TextToSpeechStubSettings) getStubSettings()).listVoicesSettings();
76+
}
77+
7878
public static final TextToSpeechSettings create(TextToSpeechStubSettings stub)
7979
throws IOException {
8080
return new TextToSpeechSettings.Builder(stub.toBuilder()).build();
@@ -172,17 +172,17 @@ public Builder applyToAllUnaryMethods(
172172
return this;
173173
}
174174

175-
/** Returns the builder for the settings used for calls to listVoices. */
176-
public UnaryCallSettings.Builder<ListVoicesRequest, ListVoicesResponse> listVoicesSettings() {
177-
return getStubSettingsBuilder().listVoicesSettings();
178-
}
179-
180175
/** Returns the builder for the settings used for calls to synthesizeSpeech. */
181176
public UnaryCallSettings.Builder<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
182177
synthesizeSpeechSettings() {
183178
return getStubSettingsBuilder().synthesizeSpeechSettings();
184179
}
185180

181+
/** Returns the builder for the settings used for calls to listVoices. */
182+
public UnaryCallSettings.Builder<ListVoicesRequest, ListVoicesResponse> listVoicesSettings() {
183+
return getStubSettingsBuilder().listVoicesSettings();
184+
}
185+
186186
@Override
187187
public TextToSpeechSettings build() throws IOException {
188188
return new TextToSpeechSettings(this);

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
* <pre>
2929
* <code>
3030
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
31-
* String languageCode = "";
32-
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
31+
* SynthesisInput input = SynthesisInput.newBuilder().build();
32+
* VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
33+
* AudioConfig audioConfig = AudioConfig.newBuilder().build();
34+
* SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(input, voice, audioConfig);
3335
* }
3436
* </code>
3537
* </pre>

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

+20-20
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@
4242
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
4343
public class GrpcTextToSpeechStub extends TextToSpeechStub {
4444

45-
private static final MethodDescriptor<ListVoicesRequest, ListVoicesResponse>
46-
listVoicesMethodDescriptor =
47-
MethodDescriptor.<ListVoicesRequest, ListVoicesResponse>newBuilder()
48-
.setType(MethodDescriptor.MethodType.UNARY)
49-
.setFullMethodName("google.cloud.texttospeech.v1.TextToSpeech/ListVoices")
50-
.setRequestMarshaller(ProtoUtils.marshaller(ListVoicesRequest.getDefaultInstance()))
51-
.setResponseMarshaller(ProtoUtils.marshaller(ListVoicesResponse.getDefaultInstance()))
52-
.build();
5345
private static final MethodDescriptor<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
5446
synthesizeSpeechMethodDescriptor =
5547
MethodDescriptor.<SynthesizeSpeechRequest, SynthesizeSpeechResponse>newBuilder()
@@ -60,12 +52,20 @@ public class GrpcTextToSpeechStub extends TextToSpeechStub {
6052
.setResponseMarshaller(
6153
ProtoUtils.marshaller(SynthesizeSpeechResponse.getDefaultInstance()))
6254
.build();
55+
private static final MethodDescriptor<ListVoicesRequest, ListVoicesResponse>
56+
listVoicesMethodDescriptor =
57+
MethodDescriptor.<ListVoicesRequest, ListVoicesResponse>newBuilder()
58+
.setType(MethodDescriptor.MethodType.UNARY)
59+
.setFullMethodName("google.cloud.texttospeech.v1.TextToSpeech/ListVoices")
60+
.setRequestMarshaller(ProtoUtils.marshaller(ListVoicesRequest.getDefaultInstance()))
61+
.setResponseMarshaller(ProtoUtils.marshaller(ListVoicesResponse.getDefaultInstance()))
62+
.build();
6363

6464
private final BackgroundResource backgroundResources;
6565

66-
private final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable;
6766
private final UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
6867
synthesizeSpeechCallable;
68+
private final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable;
6969

7070
private final GrpcStubCallableFactory callableFactory;
7171

@@ -106,35 +106,35 @@ protected GrpcTextToSpeechStub(
106106
throws IOException {
107107
this.callableFactory = callableFactory;
108108

109-
GrpcCallSettings<ListVoicesRequest, ListVoicesResponse> listVoicesTransportSettings =
110-
GrpcCallSettings.<ListVoicesRequest, ListVoicesResponse>newBuilder()
111-
.setMethodDescriptor(listVoicesMethodDescriptor)
112-
.build();
113109
GrpcCallSettings<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
114110
synthesizeSpeechTransportSettings =
115111
GrpcCallSettings.<SynthesizeSpeechRequest, SynthesizeSpeechResponse>newBuilder()
116112
.setMethodDescriptor(synthesizeSpeechMethodDescriptor)
117113
.build();
114+
GrpcCallSettings<ListVoicesRequest, ListVoicesResponse> listVoicesTransportSettings =
115+
GrpcCallSettings.<ListVoicesRequest, ListVoicesResponse>newBuilder()
116+
.setMethodDescriptor(listVoicesMethodDescriptor)
117+
.build();
118118

119-
this.listVoicesCallable =
120-
callableFactory.createUnaryCallable(
121-
listVoicesTransportSettings, settings.listVoicesSettings(), clientContext);
122119
this.synthesizeSpeechCallable =
123120
callableFactory.createUnaryCallable(
124121
synthesizeSpeechTransportSettings, settings.synthesizeSpeechSettings(), clientContext);
122+
this.listVoicesCallable =
123+
callableFactory.createUnaryCallable(
124+
listVoicesTransportSettings, settings.listVoicesSettings(), clientContext);
125125

126126
backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
127127
}
128128

129-
public UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
130-
return listVoicesCallable;
131-
}
132-
133129
public UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
134130
synthesizeSpeechCallable() {
135131
return synthesizeSpeechCallable;
136132
}
137133

134+
public UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
135+
return listVoicesCallable;
136+
}
137+
138138
@Override
139139
public final void close() {
140140
shutdown();

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
3535
public abstract class TextToSpeechStub implements BackgroundResource {
3636

37-
public UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
38-
throw new UnsupportedOperationException("Not implemented: listVoicesCallable()");
39-
}
40-
4137
public UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
4238
synthesizeSpeechCallable() {
4339
throw new UnsupportedOperationException("Not implemented: synthesizeSpeechCallable()");
4440
}
4541

42+
public UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
43+
throw new UnsupportedOperationException("Not implemented: listVoicesCallable()");
44+
}
45+
4646
@Override
4747
public abstract void close();
4848
}

0 commit comments

Comments
 (0)