Skip to content
Permalink
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
  • Loading branch information
yoshi-automation committed Jun 3, 2020
1 parent b6110b5 commit a500ecbd982b182d81b49b717192a2088e8cdc0b
Showing with 330 additions and 322 deletions.
  1. +71 −69 google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechClient.java
  2. +13 −13 google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechSettings.java
  3. +4 −2 google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/package-info.java
  4. +20 −20 ...-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/GrpcTextToSpeechStub.java
  5. +4 −4 google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStub.java
  6. +25 −25 ...ud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStubSettings.java
  7. +71 −69 ...le-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClient.java
  8. +13 −13 ...-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechSettings.java
  9. +4 −2 google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java
  10. +20 −20 ...d-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechStub.java
  11. +4 −4 ...cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStub.java
  12. +25 −25 ...xttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStubSettings.java
  13. +26 −26 google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1/TextToSpeechClientTest.java
  14. +26 −26 ...loud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClientTest.java
  15. +4 −4 synth.metadata
@@ -34,8 +34,10 @@
* <pre>
* <code>
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* SynthesisInput input = SynthesisInput.newBuilder().build();
* VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
* AudioConfig audioConfig = AudioConfig.newBuilder().build();
* SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(input, voice, audioConfig);
* }
* </code>
* </pre>
@@ -143,73 +145,6 @@ public TextToSpeechStub getStub() {
return stub;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre><code>
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
* </code></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.
* E.g. when specifying "en-NZ", you will get supported "en-&#42;" voices; when specifying
* "no", you will get supported "no-&#42;" (Norwegian) and "nb-&#42;" (Norwegian Bokmal)
* voices; specifying "zh" will also get supported "cmn-&#42;" voices; specifying "zh-hk" will
* also get supported "yue-&#42;" voices.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListVoicesResponse listVoices(String languageCode) {
ListVoicesRequest request =
ListVoicesRequest.newBuilder().setLanguageCode(languageCode).build();
return listVoices(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre><code>
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
* ListVoicesResponse response = textToSpeechClient.listVoices(request);
* }
* </code></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
*/
public final ListVoicesResponse listVoices(ListVoicesRequest request) {
return listVoicesCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre><code>
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
* ApiFuture&lt;ListVoicesResponse&gt; future = textToSpeechClient.listVoicesCallable().futureCall(request);
* // Do something
* ListVoicesResponse response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
return stub.listVoicesCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Synthesizes speech synchronously: receive results after all text input has been processed.
@@ -295,6 +230,73 @@ public final SynthesizeSpeechResponse synthesizeSpeech(SynthesizeSpeechRequest r
return stub.synthesizeSpeechCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre><code>
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
* </code></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.
* E.g. when specifying "en-NZ", you will get supported "en-&#42;" voices; when specifying
* "no", you will get supported "no-&#42;" (Norwegian) and "nb-&#42;" (Norwegian Bokmal)
* voices; specifying "zh" will also get supported "cmn-&#42;" voices; specifying "zh-hk" will
* also get supported "yue-&#42;" voices.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListVoicesResponse listVoices(String languageCode) {
ListVoicesRequest request =
ListVoicesRequest.newBuilder().setLanguageCode(languageCode).build();
return listVoices(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre><code>
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
* ListVoicesResponse response = textToSpeechClient.listVoices(request);
* }
* </code></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
*/
public final ListVoicesResponse listVoices(ListVoicesRequest request) {
return listVoicesCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns a list of Voice supported for synthesis.
*
* <p>Sample code:
*
* <pre><code>
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
* ApiFuture&lt;ListVoicesResponse&gt; future = textToSpeechClient.listVoicesCallable().futureCall(request);
* // Do something
* ListVoicesResponse response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
return stub.listVoicesCallable();
}

@Override
public final void close() {
stub.close();
@@ -45,16 +45,16 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of listVoices to 30 seconds:
* <p>For example, to set the total timeout of synthesizeSpeech to 30 seconds:
*
* <pre>
* <code>
* TextToSpeechSettings.Builder textToSpeechSettingsBuilder =
* TextToSpeechSettings.newBuilder();
* textToSpeechSettingsBuilder
* .listVoicesSettings()
* .synthesizeSpeechSettings()
* .setRetrySettings(
* textToSpeechSettingsBuilder.listVoicesSettings().getRetrySettings().toBuilder()
* textToSpeechSettingsBuilder.synthesizeSpeechSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* TextToSpeechSettings textToSpeechSettings = textToSpeechSettingsBuilder.build();
@@ -64,17 +64,17 @@
@Generated("by gapic-generator")
@BetaApi
public class TextToSpeechSettings extends ClientSettings<TextToSpeechSettings> {
/** Returns the object with the settings used for calls to listVoices. */
public UnaryCallSettings<ListVoicesRequest, ListVoicesResponse> listVoicesSettings() {
return ((TextToSpeechStubSettings) getStubSettings()).listVoicesSettings();
}

/** Returns the object with the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechSettings() {
return ((TextToSpeechStubSettings) getStubSettings()).synthesizeSpeechSettings();
}

/** Returns the object with the settings used for calls to listVoices. */
public UnaryCallSettings<ListVoicesRequest, ListVoicesResponse> listVoicesSettings() {
return ((TextToSpeechStubSettings) getStubSettings()).listVoicesSettings();
}

public static final TextToSpeechSettings create(TextToSpeechStubSettings stub)
throws IOException {
return new TextToSpeechSettings.Builder(stub.toBuilder()).build();
@@ -172,17 +172,17 @@ public Builder applyToAllUnaryMethods(
return this;
}

/** Returns the builder for the settings used for calls to listVoices. */
public UnaryCallSettings.Builder<ListVoicesRequest, ListVoicesResponse> listVoicesSettings() {
return getStubSettingsBuilder().listVoicesSettings();
}

/** Returns the builder for the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings.Builder<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechSettings() {
return getStubSettingsBuilder().synthesizeSpeechSettings();
}

/** Returns the builder for the settings used for calls to listVoices. */
public UnaryCallSettings.Builder<ListVoicesRequest, ListVoicesResponse> listVoicesSettings() {
return getStubSettingsBuilder().listVoicesSettings();
}

@Override
public TextToSpeechSettings build() throws IOException {
return new TextToSpeechSettings(this);
@@ -28,8 +28,10 @@
* <pre>
* <code>
* try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
* String languageCode = "";
* ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* SynthesisInput input = SynthesisInput.newBuilder().build();
* VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
* AudioConfig audioConfig = AudioConfig.newBuilder().build();
* SynthesizeSpeechResponse response = textToSpeechClient.synthesizeSpeech(input, voice, audioConfig);
* }
* </code>
* </pre>
@@ -42,14 +42,6 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public class GrpcTextToSpeechStub extends TextToSpeechStub {

private static final MethodDescriptor<ListVoicesRequest, ListVoicesResponse>
listVoicesMethodDescriptor =
MethodDescriptor.<ListVoicesRequest, ListVoicesResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.texttospeech.v1.TextToSpeech/ListVoices")
.setRequestMarshaller(ProtoUtils.marshaller(ListVoicesRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ListVoicesResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechMethodDescriptor =
MethodDescriptor.<SynthesizeSpeechRequest, SynthesizeSpeechResponse>newBuilder()
@@ -60,12 +52,20 @@ public class GrpcTextToSpeechStub extends TextToSpeechStub {
.setResponseMarshaller(
ProtoUtils.marshaller(SynthesizeSpeechResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor<ListVoicesRequest, ListVoicesResponse>
listVoicesMethodDescriptor =
MethodDescriptor.<ListVoicesRequest, ListVoicesResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.texttospeech.v1.TextToSpeech/ListVoices")
.setRequestMarshaller(ProtoUtils.marshaller(ListVoicesRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ListVoicesResponse.getDefaultInstance()))
.build();

private final BackgroundResource backgroundResources;

private final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable;
private final UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechCallable;
private final UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable;

private final GrpcStubCallableFactory callableFactory;

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

GrpcCallSettings<ListVoicesRequest, ListVoicesResponse> listVoicesTransportSettings =
GrpcCallSettings.<ListVoicesRequest, ListVoicesResponse>newBuilder()
.setMethodDescriptor(listVoicesMethodDescriptor)
.build();
GrpcCallSettings<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechTransportSettings =
GrpcCallSettings.<SynthesizeSpeechRequest, SynthesizeSpeechResponse>newBuilder()
.setMethodDescriptor(synthesizeSpeechMethodDescriptor)
.build();
GrpcCallSettings<ListVoicesRequest, ListVoicesResponse> listVoicesTransportSettings =
GrpcCallSettings.<ListVoicesRequest, ListVoicesResponse>newBuilder()
.setMethodDescriptor(listVoicesMethodDescriptor)
.build();

this.listVoicesCallable =
callableFactory.createUnaryCallable(
listVoicesTransportSettings, settings.listVoicesSettings(), clientContext);
this.synthesizeSpeechCallable =
callableFactory.createUnaryCallable(
synthesizeSpeechTransportSettings, settings.synthesizeSpeechSettings(), clientContext);
this.listVoicesCallable =
callableFactory.createUnaryCallable(
listVoicesTransportSettings, settings.listVoicesSettings(), clientContext);

backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}

public UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
return listVoicesCallable;
}

public UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechCallable() {
return synthesizeSpeechCallable;
}

public UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
return listVoicesCallable;
}

@Override
public final void close() {
shutdown();
@@ -34,15 +34,15 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class TextToSpeechStub implements BackgroundResource {

public UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
throw new UnsupportedOperationException("Not implemented: listVoicesCallable()");
}

public UnaryCallable<SynthesizeSpeechRequest, SynthesizeSpeechResponse>
synthesizeSpeechCallable() {
throw new UnsupportedOperationException("Not implemented: synthesizeSpeechCallable()");
}

public UnaryCallable<ListVoicesRequest, ListVoicesResponse> listVoicesCallable() {
throw new UnsupportedOperationException("Not implemented: listVoicesCallable()");
}

@Override
public abstract void close();
}

0 comments on commit a500ecb

Please sign in to comment.