diff --git a/README.md b/README.md
index ad46aa81..f7244648 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
*
* 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);
+ * String languageCode = "";
+ * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
*
*
@@ -145,6 +143,73 @@ public TextToSpeechStub getStub() {
return stub;
}
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns a list of Voice supported for synthesis.
+ *
+ * Sample code: + * + *
+ * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
+ * String languageCode = "";
+ * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
+ * }
+ *
+ *
+ * @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-*" 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.
+ * @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.
+ *
+ * Sample code: + * + *
+ * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
+ * ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
+ * ListVoicesResponse response = textToSpeechClient.listVoices(request);
+ * }
+ *
+ *
+ * @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.
+ *
+ * Sample code: + * + *
+ * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
+ * ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
+ * ApiFuture<ListVoicesResponse> future = textToSpeechClient.listVoicesCallable().futureCall(request);
+ * // Do something
+ * ListVoicesResponse response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallableSample code: - * - *
- * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
- * String languageCode = "";
- * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
- * }
- *
- *
- * @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-*" 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.
- * @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.
- *
- * Sample code: - * - *
- * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
- * ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
- * ListVoicesResponse response = textToSpeechClient.listVoices(request);
- * }
- *
- *
- * @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.
- *
- * Sample code: - * - *
- * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
- * ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
- * ApiFuture<ListVoicesResponse> future = textToSpeechClient.listVoicesCallable().futureCall(request);
- * // Do something
- * ListVoicesResponse response = future.get();
- * }
- *
- */
- public final UnaryCallableThe 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. * - *
For example, to set the total timeout of synthesizeSpeech to 30 seconds: + *
For example, to set the total timeout of listVoices to 30 seconds: * *
*
* TextToSpeechSettings.Builder textToSpeechSettingsBuilder =
* TextToSpeechSettings.newBuilder();
* textToSpeechSettingsBuilder
- * .synthesizeSpeechSettings()
+ * .listVoicesSettings()
* .setRetrySettings(
- * textToSpeechSettingsBuilder.synthesizeSpeechSettings().getRetrySettings().toBuilder()
+ * textToSpeechSettingsBuilder.listVoicesSettings().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 {
+ /** Returns the object with the settings used for calls to listVoices. */
+ public UnaryCallSettings listVoicesSettings() {
+ return ((TextToSpeechStubSettings) getStubSettings()).listVoicesSettings();
+ }
+
/** Returns the object with the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings
synthesizeSpeechSettings() {
return ((TextToSpeechStubSettings) getStubSettings()).synthesizeSpeechSettings();
}
- /** Returns the object with the settings used for calls to listVoices. */
- public UnaryCallSettings 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 listVoicesSettings() {
+ return getStubSettingsBuilder().listVoicesSettings();
+ }
+
/** Returns the builder for the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings.Builder
synthesizeSpeechSettings() {
return getStubSettingsBuilder().synthesizeSpeechSettings();
}
- /** Returns the builder for the settings used for calls to listVoices. */
- public UnaryCallSettings.Builder listVoicesSettings() {
- return getStubSettingsBuilder().listVoicesSettings();
- }
-
@Override
public TextToSpeechSettings build() throws IOException {
return new TextToSpeechSettings(this);
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/package-info.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/package-info.java
index bcf8e6a6..dec469ad 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/package-info.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/package-info.java
@@ -28,10 +28,8 @@
*
*
* 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);
+ * String languageCode = "";
+ * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
*
*
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/GrpcTextToSpeechStub.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/GrpcTextToSpeechStub.java
index cae8a8b4..49f1df42 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/GrpcTextToSpeechStub.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/GrpcTextToSpeechStub.java
@@ -42,6 +42,14 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public class GrpcTextToSpeechStub extends TextToSpeechStub {
+ private static final MethodDescriptor
+ listVoicesMethodDescriptor =
+ MethodDescriptor.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
synthesizeSpeechMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -52,20 +60,12 @@ public class GrpcTextToSpeechStub extends TextToSpeechStub {
.setResponseMarshaller(
ProtoUtils.marshaller(SynthesizeSpeechResponse.getDefaultInstance()))
.build();
- private static final MethodDescriptor
- listVoicesMethodDescriptor =
- MethodDescriptor.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 listVoicesCallable;
private final UnaryCallable
synthesizeSpeechCallable;
- private final UnaryCallable listVoicesCallable;
private final GrpcStubCallableFactory callableFactory;
@@ -106,35 +106,35 @@ protected GrpcTextToSpeechStub(
throws IOException {
this.callableFactory = callableFactory;
+ GrpcCallSettings listVoicesTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(listVoicesMethodDescriptor)
+ .build();
GrpcCallSettings
synthesizeSpeechTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(synthesizeSpeechMethodDescriptor)
.build();
- GrpcCallSettings listVoicesTransportSettings =
- GrpcCallSettings.newBuilder()
- .setMethodDescriptor(listVoicesMethodDescriptor)
- .build();
- this.synthesizeSpeechCallable =
- callableFactory.createUnaryCallable(
- synthesizeSpeechTransportSettings, settings.synthesizeSpeechSettings(), clientContext);
this.listVoicesCallable =
callableFactory.createUnaryCallable(
listVoicesTransportSettings, settings.listVoicesSettings(), clientContext);
+ this.synthesizeSpeechCallable =
+ callableFactory.createUnaryCallable(
+ synthesizeSpeechTransportSettings, settings.synthesizeSpeechSettings(), clientContext);
backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
+ public UnaryCallable listVoicesCallable() {
+ return listVoicesCallable;
+ }
+
public UnaryCallable
synthesizeSpeechCallable() {
return synthesizeSpeechCallable;
}
- public UnaryCallable listVoicesCallable() {
- return listVoicesCallable;
- }
-
@Override
public final void close() {
shutdown();
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStub.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStub.java
index 1235f555..aba64451 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStub.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStub.java
@@ -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 listVoicesCallable() {
+ throw new UnsupportedOperationException("Not implemented: listVoicesCallable()");
+ }
+
public UnaryCallable
synthesizeSpeechCallable() {
throw new UnsupportedOperationException("Not implemented: synthesizeSpeechCallable()");
}
- public UnaryCallable listVoicesCallable() {
- throw new UnsupportedOperationException("Not implemented: listVoicesCallable()");
- }
-
@Override
public abstract void close();
}
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStubSettings.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStubSettings.java
index 0ad23be2..c03fde5b 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStubSettings.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/TextToSpeechStubSettings.java
@@ -58,16 +58,16 @@
* 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.
*
- *
For example, to set the total timeout of synthesizeSpeech to 30 seconds:
+ *
For example, to set the total timeout of listVoices to 30 seconds:
*
*
*
* TextToSpeechStubSettings.Builder textToSpeechSettingsBuilder =
* TextToSpeechStubSettings.newBuilder();
* textToSpeechSettingsBuilder
- * .synthesizeSpeechSettings()
+ * .listVoicesSettings()
* .setRetrySettings(
- * textToSpeechSettingsBuilder.synthesizeSpeechSettings().getRetrySettings().toBuilder()
+ * textToSpeechSettingsBuilder.listVoicesSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* TextToSpeechStubSettings textToSpeechSettings = textToSpeechSettingsBuilder.build();
@@ -81,9 +81,14 @@ public class TextToSpeechStubSettings extends StubSettings DEFAULT_SERVICE_SCOPES =
ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build();
+ private final UnaryCallSettings listVoicesSettings;
private final UnaryCallSettings
synthesizeSpeechSettings;
- private final UnaryCallSettings listVoicesSettings;
+
+ /** Returns the object with the settings used for calls to listVoices. */
+ public UnaryCallSettings listVoicesSettings() {
+ return listVoicesSettings;
+ }
/** Returns the object with the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings
@@ -91,11 +96,6 @@ public class TextToSpeechStubSettings extends StubSettings listVoicesSettings() {
- return listVoicesSettings;
- }
-
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public TextToSpeechStub createStub() throws IOException {
if (getTransportChannelProvider()
@@ -165,18 +165,18 @@ public Builder toBuilder() {
protected TextToSpeechStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
- synthesizeSpeechSettings = settingsBuilder.synthesizeSpeechSettings().build();
listVoicesSettings = settingsBuilder.listVoicesSettings().build();
+ synthesizeSpeechSettings = settingsBuilder.synthesizeSpeechSettings().build();
}
/** Builder for TextToSpeechStubSettings. */
public static class Builder extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
- private final UnaryCallSettings.Builder
- synthesizeSpeechSettings;
private final UnaryCallSettings.Builder
listVoicesSettings;
+ private final UnaryCallSettings.Builder
+ synthesizeSpeechSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -185,11 +185,11 @@ public static class Builder extends StubSettings.Builder> definitions =
ImmutableMap.builder();
definitions.put(
- "idempotent",
+ "retry_policy_1_codes",
ImmutableSet.copyOf(
Lists.newArrayList(
- StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
- definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList()));
+ StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED)));
+ definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -203,12 +203,14 @@ public static class Builder extends StubSettings.Builder>of(
- synthesizeSpeechSettings, listVoicesSettings);
+ listVoicesSettings, synthesizeSpeechSettings);
initDefaults(this);
}
@@ -242,14 +244,14 @@ private static Builder createDefault() {
private static Builder initDefaults(Builder builder) {
builder
- .synthesizeSpeechSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .listVoicesSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
- .listVoicesSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .synthesizeSpeechSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
return builder;
}
@@ -257,12 +259,12 @@ private static Builder initDefaults(Builder builder) {
protected Builder(TextToSpeechStubSettings settings) {
super(settings);
- synthesizeSpeechSettings = settings.synthesizeSpeechSettings.toBuilder();
listVoicesSettings = settings.listVoicesSettings.toBuilder();
+ synthesizeSpeechSettings = settings.synthesizeSpeechSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
- synthesizeSpeechSettings, listVoicesSettings);
+ listVoicesSettings, synthesizeSpeechSettings);
}
// NEXT_MAJOR_VER: remove 'throws Exception'
@@ -281,17 +283,17 @@ public Builder applyToAllUnaryMethods(
return unaryMethodSettingsBuilders;
}
+ /** Returns the builder for the settings used for calls to listVoices. */
+ public UnaryCallSettings.Builder listVoicesSettings() {
+ return listVoicesSettings;
+ }
+
/** Returns the builder for the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings.Builder
synthesizeSpeechSettings() {
return synthesizeSpeechSettings;
}
- /** Returns the builder for the settings used for calls to listVoices. */
- public UnaryCallSettings.Builder listVoicesSettings() {
- return listVoicesSettings;
- }
-
@Override
public TextToSpeechStubSettings build() throws IOException {
return new TextToSpeechStubSettings(this);
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClient.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClient.java
index 877fadd1..80791b89 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClient.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClient.java
@@ -34,10 +34,8 @@
*
*
* 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);
+ * String languageCode = "";
+ * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
*
*
@@ -145,6 +143,73 @@ public TextToSpeechStub getStub() {
return stub;
}
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns a list of Voice supported for synthesis.
+ *
+ * Sample code:
+ *
+ *
+ * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
+ * String languageCode = "";
+ * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
+ * }
+ *
+ *
+ * @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-*" 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.
+ * @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.
+ *
+ * Sample code:
+ *
+ *
+ * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
+ * ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
+ * ListVoicesResponse response = textToSpeechClient.listVoices(request);
+ * }
+ *
+ *
+ * @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.
+ *
+ * Sample code:
+ *
+ *
+ * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
+ * ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
+ * ApiFuture<ListVoicesResponse> future = textToSpeechClient.listVoicesCallable().futureCall(request);
+ * // Do something
+ * ListVoicesResponse response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable listVoicesCallable() {
+ return stub.listVoicesCallable();
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Synthesizes speech synchronously: receive results after all text input has been processed.
@@ -230,73 +295,6 @@ public final SynthesizeSpeechResponse synthesizeSpeech(SynthesizeSpeechRequest r
return stub.synthesizeSpeechCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Returns a list of Voice supported for synthesis.
- *
- * Sample code:
- *
- *
- * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
- * String languageCode = "";
- * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
- * }
- *
- *
- * @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-*" 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.
- * @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.
- *
- * Sample code:
- *
- *
- * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
- * ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
- * ListVoicesResponse response = textToSpeechClient.listVoices(request);
- * }
- *
- *
- * @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.
- *
- * Sample code:
- *
- *
- * try (TextToSpeechClient textToSpeechClient = TextToSpeechClient.create()) {
- * ListVoicesRequest request = ListVoicesRequest.newBuilder().build();
- * ApiFuture<ListVoicesResponse> future = textToSpeechClient.listVoicesCallable().futureCall(request);
- * // Do something
- * ListVoicesResponse response = future.get();
- * }
- *
- */
- public final UnaryCallable listVoicesCallable() {
- return stub.listVoicesCallable();
- }
-
@Override
public final void close() {
stub.close();
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechSettings.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechSettings.java
index 6d9e010c..5fb246e2 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechSettings.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechSettings.java
@@ -45,16 +45,16 @@
* 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.
*
- *
For example, to set the total timeout of synthesizeSpeech to 30 seconds:
+ *
For example, to set the total timeout of listVoices to 30 seconds:
*
*
*
* TextToSpeechSettings.Builder textToSpeechSettingsBuilder =
* TextToSpeechSettings.newBuilder();
* textToSpeechSettingsBuilder
- * .synthesizeSpeechSettings()
+ * .listVoicesSettings()
* .setRetrySettings(
- * textToSpeechSettingsBuilder.synthesizeSpeechSettings().getRetrySettings().toBuilder()
+ * textToSpeechSettingsBuilder.listVoicesSettings().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 {
+ /** Returns the object with the settings used for calls to listVoices. */
+ public UnaryCallSettings listVoicesSettings() {
+ return ((TextToSpeechStubSettings) getStubSettings()).listVoicesSettings();
+ }
+
/** Returns the object with the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings
synthesizeSpeechSettings() {
return ((TextToSpeechStubSettings) getStubSettings()).synthesizeSpeechSettings();
}
- /** Returns the object with the settings used for calls to listVoices. */
- public UnaryCallSettings 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 listVoicesSettings() {
+ return getStubSettingsBuilder().listVoicesSettings();
+ }
+
/** Returns the builder for the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings.Builder
synthesizeSpeechSettings() {
return getStubSettingsBuilder().synthesizeSpeechSettings();
}
- /** Returns the builder for the settings used for calls to listVoices. */
- public UnaryCallSettings.Builder listVoicesSettings() {
- return getStubSettingsBuilder().listVoicesSettings();
- }
-
@Override
public TextToSpeechSettings build() throws IOException {
return new TextToSpeechSettings(this);
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java
index f48330e1..52c0edaa 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java
@@ -28,10 +28,8 @@
*
*
* 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);
+ * String languageCode = "";
+ * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode);
* }
*
*
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechStub.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechStub.java
index b2f72018..8f27a4e3 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechStub.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechStub.java
@@ -42,6 +42,14 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public class GrpcTextToSpeechStub extends TextToSpeechStub {
+ private static final MethodDescriptor
+ listVoicesMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.texttospeech.v1beta1.TextToSpeech/ListVoices")
+ .setRequestMarshaller(ProtoUtils.marshaller(ListVoicesRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(ListVoicesResponse.getDefaultInstance()))
+ .build();
private static final MethodDescriptor
synthesizeSpeechMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -52,20 +60,12 @@ public class GrpcTextToSpeechStub extends TextToSpeechStub {
.setResponseMarshaller(
ProtoUtils.marshaller(SynthesizeSpeechResponse.getDefaultInstance()))
.build();
- private static final MethodDescriptor
- listVoicesMethodDescriptor =
- MethodDescriptor.newBuilder()
- .setType(MethodDescriptor.MethodType.UNARY)
- .setFullMethodName("google.cloud.texttospeech.v1beta1.TextToSpeech/ListVoices")
- .setRequestMarshaller(ProtoUtils.marshaller(ListVoicesRequest.getDefaultInstance()))
- .setResponseMarshaller(ProtoUtils.marshaller(ListVoicesResponse.getDefaultInstance()))
- .build();
private final BackgroundResource backgroundResources;
+ private final UnaryCallable listVoicesCallable;
private final UnaryCallable
synthesizeSpeechCallable;
- private final UnaryCallable listVoicesCallable;
private final GrpcStubCallableFactory callableFactory;
@@ -106,35 +106,35 @@ protected GrpcTextToSpeechStub(
throws IOException {
this.callableFactory = callableFactory;
+ GrpcCallSettings listVoicesTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(listVoicesMethodDescriptor)
+ .build();
GrpcCallSettings
synthesizeSpeechTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(synthesizeSpeechMethodDescriptor)
.build();
- GrpcCallSettings listVoicesTransportSettings =
- GrpcCallSettings.newBuilder()
- .setMethodDescriptor(listVoicesMethodDescriptor)
- .build();
- this.synthesizeSpeechCallable =
- callableFactory.createUnaryCallable(
- synthesizeSpeechTransportSettings, settings.synthesizeSpeechSettings(), clientContext);
this.listVoicesCallable =
callableFactory.createUnaryCallable(
listVoicesTransportSettings, settings.listVoicesSettings(), clientContext);
+ this.synthesizeSpeechCallable =
+ callableFactory.createUnaryCallable(
+ synthesizeSpeechTransportSettings, settings.synthesizeSpeechSettings(), clientContext);
backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
+ public UnaryCallable listVoicesCallable() {
+ return listVoicesCallable;
+ }
+
public UnaryCallable
synthesizeSpeechCallable() {
return synthesizeSpeechCallable;
}
- public UnaryCallable listVoicesCallable() {
- return listVoicesCallable;
- }
-
@Override
public final void close() {
shutdown();
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStub.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStub.java
index 74104a6f..1839b82b 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStub.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStub.java
@@ -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 listVoicesCallable() {
+ throw new UnsupportedOperationException("Not implemented: listVoicesCallable()");
+ }
+
public UnaryCallable
synthesizeSpeechCallable() {
throw new UnsupportedOperationException("Not implemented: synthesizeSpeechCallable()");
}
- public UnaryCallable listVoicesCallable() {
- throw new UnsupportedOperationException("Not implemented: listVoicesCallable()");
- }
-
@Override
public abstract void close();
}
diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStubSettings.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStubSettings.java
index 937d83b9..25b2c989 100644
--- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStubSettings.java
+++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechStubSettings.java
@@ -58,16 +58,16 @@
* 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.
*
- *
For example, to set the total timeout of synthesizeSpeech to 30 seconds:
+ *
For example, to set the total timeout of listVoices to 30 seconds:
*
*
*
* TextToSpeechStubSettings.Builder textToSpeechSettingsBuilder =
* TextToSpeechStubSettings.newBuilder();
* textToSpeechSettingsBuilder
- * .synthesizeSpeechSettings()
+ * .listVoicesSettings()
* .setRetrySettings(
- * textToSpeechSettingsBuilder.synthesizeSpeechSettings().getRetrySettings().toBuilder()
+ * textToSpeechSettingsBuilder.listVoicesSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* TextToSpeechStubSettings textToSpeechSettings = textToSpeechSettingsBuilder.build();
@@ -81,9 +81,14 @@ public class TextToSpeechStubSettings extends StubSettings DEFAULT_SERVICE_SCOPES =
ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build();
+ private final UnaryCallSettings listVoicesSettings;
private final UnaryCallSettings
synthesizeSpeechSettings;
- private final UnaryCallSettings listVoicesSettings;
+
+ /** Returns the object with the settings used for calls to listVoices. */
+ public UnaryCallSettings listVoicesSettings() {
+ return listVoicesSettings;
+ }
/** Returns the object with the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings
@@ -91,11 +96,6 @@ public class TextToSpeechStubSettings extends StubSettings listVoicesSettings() {
- return listVoicesSettings;
- }
-
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public TextToSpeechStub createStub() throws IOException {
if (getTransportChannelProvider()
@@ -165,18 +165,18 @@ public Builder toBuilder() {
protected TextToSpeechStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
- synthesizeSpeechSettings = settingsBuilder.synthesizeSpeechSettings().build();
listVoicesSettings = settingsBuilder.listVoicesSettings().build();
+ synthesizeSpeechSettings = settingsBuilder.synthesizeSpeechSettings().build();
}
/** Builder for TextToSpeechStubSettings. */
public static class Builder extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
- private final UnaryCallSettings.Builder
- synthesizeSpeechSettings;
private final UnaryCallSettings.Builder
listVoicesSettings;
+ private final UnaryCallSettings.Builder
+ synthesizeSpeechSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -185,11 +185,11 @@ public static class Builder extends StubSettings.Builder> definitions =
ImmutableMap.builder();
definitions.put(
- "idempotent",
+ "retry_policy_1_codes",
ImmutableSet.copyOf(
Lists.newArrayList(
- StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
- definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList()));
+ StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED)));
+ definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -203,12 +203,14 @@ public static class Builder extends StubSettings.Builder>of(
- synthesizeSpeechSettings, listVoicesSettings);
+ listVoicesSettings, synthesizeSpeechSettings);
initDefaults(this);
}
@@ -242,14 +244,14 @@ private static Builder createDefault() {
private static Builder initDefaults(Builder builder) {
builder
- .synthesizeSpeechSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .listVoicesSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
- .listVoicesSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .synthesizeSpeechSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
return builder;
}
@@ -257,12 +259,12 @@ private static Builder initDefaults(Builder builder) {
protected Builder(TextToSpeechStubSettings settings) {
super(settings);
- synthesizeSpeechSettings = settings.synthesizeSpeechSettings.toBuilder();
listVoicesSettings = settings.listVoicesSettings.toBuilder();
+ synthesizeSpeechSettings = settings.synthesizeSpeechSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
- synthesizeSpeechSettings, listVoicesSettings);
+ listVoicesSettings, synthesizeSpeechSettings);
}
// NEXT_MAJOR_VER: remove 'throws Exception'
@@ -281,17 +283,17 @@ public Builder applyToAllUnaryMethods(
return unaryMethodSettingsBuilders;
}
+ /** Returns the builder for the settings used for calls to listVoices. */
+ public UnaryCallSettings.Builder listVoicesSettings() {
+ return listVoicesSettings;
+ }
+
/** Returns the builder for the settings used for calls to synthesizeSpeech. */
public UnaryCallSettings.Builder
synthesizeSpeechSettings() {
return synthesizeSpeechSettings;
}
- /** Returns the builder for the settings used for calls to listVoices. */
- public UnaryCallSettings.Builder listVoicesSettings() {
- return listVoicesSettings;
- }
-
@Override
public TextToSpeechStubSettings build() throws IOException {
return new TextToSpeechStubSettings(this);
diff --git a/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1/TextToSpeechClientTest.java b/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1/TextToSpeechClientTest.java
index 106b2b34..e202451d 100644
--- a/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1/TextToSpeechClientTest.java
+++ b/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1/TextToSpeechClientTest.java
@@ -77,26 +77,20 @@ public void tearDown() throws Exception {
@Test
@SuppressWarnings("all")
- public void synthesizeSpeechTest() {
- ByteString audioContent = ByteString.copyFromUtf8("16");
- SynthesizeSpeechResponse expectedResponse =
- SynthesizeSpeechResponse.newBuilder().setAudioContent(audioContent).build();
+ public void listVoicesTest() {
+ ListVoicesResponse expectedResponse = ListVoicesResponse.newBuilder().build();
mockTextToSpeech.addResponse(expectedResponse);
- SynthesisInput input = SynthesisInput.newBuilder().build();
- VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
- AudioConfig audioConfig = AudioConfig.newBuilder().build();
+ String languageCode = "languageCode-412800396";
- SynthesizeSpeechResponse actualResponse = client.synthesizeSpeech(input, voice, audioConfig);
+ ListVoicesResponse actualResponse = client.listVoices(languageCode);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockTextToSpeech.getRequests();
Assert.assertEquals(1, actualRequests.size());
- SynthesizeSpeechRequest actualRequest = (SynthesizeSpeechRequest) actualRequests.get(0);
+ ListVoicesRequest actualRequest = (ListVoicesRequest) actualRequests.get(0);
- Assert.assertEquals(input, actualRequest.getInput());
- Assert.assertEquals(voice, actualRequest.getVoice());
- Assert.assertEquals(audioConfig, actualRequest.getAudioConfig());
+ Assert.assertEquals(languageCode, actualRequest.getLanguageCode());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -105,16 +99,14 @@ public void synthesizeSpeechTest() {
@Test
@SuppressWarnings("all")
- public void synthesizeSpeechExceptionTest() throws Exception {
+ public void listVoicesExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockTextToSpeech.addException(exception);
try {
- SynthesisInput input = SynthesisInput.newBuilder().build();
- VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
- AudioConfig audioConfig = AudioConfig.newBuilder().build();
+ String languageCode = "languageCode-412800396";
- client.synthesizeSpeech(input, voice, audioConfig);
+ client.listVoices(languageCode);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -123,20 +115,26 @@ public void synthesizeSpeechExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
- public void listVoicesTest() {
- ListVoicesResponse expectedResponse = ListVoicesResponse.newBuilder().build();
+ public void synthesizeSpeechTest() {
+ ByteString audioContent = ByteString.copyFromUtf8("16");
+ SynthesizeSpeechResponse expectedResponse =
+ SynthesizeSpeechResponse.newBuilder().setAudioContent(audioContent).build();
mockTextToSpeech.addResponse(expectedResponse);
- String languageCode = "languageCode-412800396";
+ SynthesisInput input = SynthesisInput.newBuilder().build();
+ VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
+ AudioConfig audioConfig = AudioConfig.newBuilder().build();
- ListVoicesResponse actualResponse = client.listVoices(languageCode);
+ SynthesizeSpeechResponse actualResponse = client.synthesizeSpeech(input, voice, audioConfig);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockTextToSpeech.getRequests();
Assert.assertEquals(1, actualRequests.size());
- ListVoicesRequest actualRequest = (ListVoicesRequest) actualRequests.get(0);
+ SynthesizeSpeechRequest actualRequest = (SynthesizeSpeechRequest) actualRequests.get(0);
- Assert.assertEquals(languageCode, actualRequest.getLanguageCode());
+ Assert.assertEquals(input, actualRequest.getInput());
+ Assert.assertEquals(voice, actualRequest.getVoice());
+ Assert.assertEquals(audioConfig, actualRequest.getAudioConfig());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -145,14 +143,16 @@ public void listVoicesTest() {
@Test
@SuppressWarnings("all")
- public void listVoicesExceptionTest() throws Exception {
+ public void synthesizeSpeechExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockTextToSpeech.addException(exception);
try {
- String languageCode = "languageCode-412800396";
+ SynthesisInput input = SynthesisInput.newBuilder().build();
+ VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
+ AudioConfig audioConfig = AudioConfig.newBuilder().build();
- client.listVoices(languageCode);
+ client.synthesizeSpeech(input, voice, audioConfig);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
diff --git a/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClientTest.java b/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClientTest.java
index 86ad9f68..24d1301b 100644
--- a/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClientTest.java
+++ b/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechClientTest.java
@@ -77,26 +77,20 @@ public void tearDown() throws Exception {
@Test
@SuppressWarnings("all")
- public void synthesizeSpeechTest() {
- ByteString audioContent = ByteString.copyFromUtf8("16");
- SynthesizeSpeechResponse expectedResponse =
- SynthesizeSpeechResponse.newBuilder().setAudioContent(audioContent).build();
+ public void listVoicesTest() {
+ ListVoicesResponse expectedResponse = ListVoicesResponse.newBuilder().build();
mockTextToSpeech.addResponse(expectedResponse);
- SynthesisInput input = SynthesisInput.newBuilder().build();
- VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
- AudioConfig audioConfig = AudioConfig.newBuilder().build();
+ String languageCode = "languageCode-412800396";
- SynthesizeSpeechResponse actualResponse = client.synthesizeSpeech(input, voice, audioConfig);
+ ListVoicesResponse actualResponse = client.listVoices(languageCode);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockTextToSpeech.getRequests();
Assert.assertEquals(1, actualRequests.size());
- SynthesizeSpeechRequest actualRequest = (SynthesizeSpeechRequest) actualRequests.get(0);
+ ListVoicesRequest actualRequest = (ListVoicesRequest) actualRequests.get(0);
- Assert.assertEquals(input, actualRequest.getInput());
- Assert.assertEquals(voice, actualRequest.getVoice());
- Assert.assertEquals(audioConfig, actualRequest.getAudioConfig());
+ Assert.assertEquals(languageCode, actualRequest.getLanguageCode());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -105,16 +99,14 @@ public void synthesizeSpeechTest() {
@Test
@SuppressWarnings("all")
- public void synthesizeSpeechExceptionTest() throws Exception {
+ public void listVoicesExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockTextToSpeech.addException(exception);
try {
- SynthesisInput input = SynthesisInput.newBuilder().build();
- VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
- AudioConfig audioConfig = AudioConfig.newBuilder().build();
+ String languageCode = "languageCode-412800396";
- client.synthesizeSpeech(input, voice, audioConfig);
+ client.listVoices(languageCode);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
@@ -123,20 +115,26 @@ public void synthesizeSpeechExceptionTest() throws Exception {
@Test
@SuppressWarnings("all")
- public void listVoicesTest() {
- ListVoicesResponse expectedResponse = ListVoicesResponse.newBuilder().build();
+ public void synthesizeSpeechTest() {
+ ByteString audioContent = ByteString.copyFromUtf8("16");
+ SynthesizeSpeechResponse expectedResponse =
+ SynthesizeSpeechResponse.newBuilder().setAudioContent(audioContent).build();
mockTextToSpeech.addResponse(expectedResponse);
- String languageCode = "languageCode-412800396";
+ SynthesisInput input = SynthesisInput.newBuilder().build();
+ VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
+ AudioConfig audioConfig = AudioConfig.newBuilder().build();
- ListVoicesResponse actualResponse = client.listVoices(languageCode);
+ SynthesizeSpeechResponse actualResponse = client.synthesizeSpeech(input, voice, audioConfig);
Assert.assertEquals(expectedResponse, actualResponse);
List actualRequests = mockTextToSpeech.getRequests();
Assert.assertEquals(1, actualRequests.size());
- ListVoicesRequest actualRequest = (ListVoicesRequest) actualRequests.get(0);
+ SynthesizeSpeechRequest actualRequest = (SynthesizeSpeechRequest) actualRequests.get(0);
- Assert.assertEquals(languageCode, actualRequest.getLanguageCode());
+ Assert.assertEquals(input, actualRequest.getInput());
+ Assert.assertEquals(voice, actualRequest.getVoice());
+ Assert.assertEquals(audioConfig, actualRequest.getAudioConfig());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -145,14 +143,16 @@ public void listVoicesTest() {
@Test
@SuppressWarnings("all")
- public void listVoicesExceptionTest() throws Exception {
+ public void synthesizeSpeechExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockTextToSpeech.addException(exception);
try {
- String languageCode = "languageCode-412800396";
+ SynthesisInput input = SynthesisInput.newBuilder().build();
+ VoiceSelectionParams voice = VoiceSelectionParams.newBuilder().build();
+ AudioConfig audioConfig = AudioConfig.newBuilder().build();
- client.listVoices(languageCode);
+ client.synthesizeSpeech(input, voice, audioConfig);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
diff --git a/synth.metadata b/synth.metadata
index f545c27b..0bc3c1c3 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -4,23 +4,23 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-texttospeech.git",
- "sha": "261c9e03eddaf5b3cec217a5f5cf6b0a6d4a24f2"
+ "sha": "7c1548c9d8c545a15589525588fa99125bf5c4d7"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "55094be6405640329ddc93730962b9f7e68a0fc1",
- "internalRef": "314438331"
+ "sha": "bccd840c699996dc3356b537c883a4a09791fdd3",
+ "internalRef": "317110345"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "55094be6405640329ddc93730962b9f7e68a0fc1",
- "internalRef": "314438331"
+ "sha": "bccd840c699996dc3356b537c883a4a09791fdd3",
+ "internalRef": "317110345"
}
},
{