diff --git a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechClient.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechClient.java index ab3f9d09..6f524b9b 100644 --- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechClient.java +++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechClient.java @@ -34,8 +34,10 @@ *
  * 
  * 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);
  * }
  * 
  * 
@@ -143,73 +145,6 @@ 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. @@ -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. + * + *

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/v1/TextToSpeechSettings.java b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechSettings.java index 2b95bbb2..544ae14d 100644 --- a/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/TextToSpeechSettings.java +++ b/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/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 listVoices to 30 seconds: + *

For example, to set the total timeout of synthesizeSpeech to 30 seconds: * *

  * 
  * 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 {
-  /** 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 dec469ad..bcf8e6a6 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,8 +28,10 @@
  * 
  * 
  * 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);
  * }
  * 
  * 
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 49f1df42..cae8a8b4 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,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 - 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() @@ -60,12 +52,20 @@ 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.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 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 aba64451..1235f555 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 33be79f7..0ad23be2 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 listVoices to 30 seconds: + *

For example, to set the total timeout of synthesizeSpeech to 30 seconds: * *

  * 
  * TextToSpeechStubSettings.Builder textToSpeechSettingsBuilder =
  *     TextToSpeechStubSettings.newBuilder();
  * textToSpeechSettingsBuilder
- *     .listVoicesSettings()
+ *     .synthesizeSpeechSettings()
  *     .setRetrySettings(
- *         textToSpeechSettingsBuilder.listVoicesSettings().getRetrySettings().toBuilder()
+ *         textToSpeechSettingsBuilder.synthesizeSpeechSettings().getRetrySettings().toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * TextToSpeechStubSettings textToSpeechSettings = textToSpeechSettingsBuilder.build();
@@ -81,14 +81,9 @@ 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;
-
-  /** Returns the object with the settings used for calls to listVoices. */
-  public UnaryCallSettings listVoicesSettings() {
-    return listVoicesSettings;
-  }
+  private final UnaryCallSettings listVoicesSettings;
 
   /** Returns the object with the settings used for calls to synthesizeSpeech. */
   public UnaryCallSettings
@@ -96,6 +91,11 @@ public UnaryCallSettings listVoicesSettin
     return synthesizeSpeechSettings;
   }
 
+  /** Returns the object with the settings used for calls to listVoices. */
+  public UnaryCallSettings 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);
 
-    listVoicesSettings = settingsBuilder.listVoicesSettings().build();
     synthesizeSpeechSettings = settingsBuilder.synthesizeSpeechSettings().build();
+    listVoicesSettings = settingsBuilder.listVoicesSettings().build();
   }
 
   /** Builder for TextToSpeechStubSettings. */
   public static class Builder extends StubSettings.Builder {
     private final ImmutableList> unaryMethodSettingsBuilders;
 
-    private final UnaryCallSettings.Builder
-        listVoicesSettings;
     private final UnaryCallSettings.Builder
         synthesizeSpeechSettings;
+    private final UnaryCallSettings.Builder
+        listVoicesSettings;
 
     private static final ImmutableMap>
         RETRYABLE_CODE_DEFINITIONS;
@@ -219,13 +219,13 @@ protected Builder() {
     protected Builder(ClientContext clientContext) {
       super(clientContext);
 
-      listVoicesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
-
       synthesizeSpeechSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
 
+      listVoicesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
       unaryMethodSettingsBuilders =
           ImmutableList.>of(
-              listVoicesSettings, synthesizeSpeechSettings);
+              synthesizeSpeechSettings, listVoicesSettings);
 
       initDefaults(this);
     }
@@ -242,13 +242,13 @@ private static Builder createDefault() {
     private static Builder initDefaults(Builder builder) {
 
       builder
-          .listVoicesSettings()
+          .synthesizeSpeechSettings()
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
 
       builder
-          .synthesizeSpeechSettings()
-          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+          .listVoicesSettings()
+          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
 
       return builder;
@@ -257,12 +257,12 @@ private static Builder initDefaults(Builder builder) {
     protected Builder(TextToSpeechStubSettings settings) {
       super(settings);
 
-      listVoicesSettings = settings.listVoicesSettings.toBuilder();
       synthesizeSpeechSettings = settings.synthesizeSpeechSettings.toBuilder();
+      listVoicesSettings = settings.listVoicesSettings.toBuilder();
 
       unaryMethodSettingsBuilders =
           ImmutableList.>of(
-              listVoicesSettings, synthesizeSpeechSettings);
+              synthesizeSpeechSettings, listVoicesSettings);
     }
 
     // NEXT_MAJOR_VER: remove 'throws Exception'
@@ -281,17 +281,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 80791b89..877fadd1 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,8 +34,10 @@
  * 
  * 
  * 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);
  * }
  * 
  * 
@@ -143,73 +145,6 @@ 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. @@ -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. + * + *

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 5fb246e2..6d9e010c 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 listVoices to 30 seconds: + *

For example, to set the total timeout of synthesizeSpeech to 30 seconds: * *

  * 
  * 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 {
-  /** 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 52c0edaa..f48330e1 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,8 +28,10 @@
  * 
  * 
  * 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);
  * }
  * 
  * 
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 8f27a4e3..b2f72018 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,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 - 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() @@ -60,12 +52,20 @@ 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.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 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 1839b82b..74104a6f 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 dd1f464b..937d83b9 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 listVoices to 30 seconds: + *

For example, to set the total timeout of synthesizeSpeech to 30 seconds: * *

  * 
  * TextToSpeechStubSettings.Builder textToSpeechSettingsBuilder =
  *     TextToSpeechStubSettings.newBuilder();
  * textToSpeechSettingsBuilder
- *     .listVoicesSettings()
+ *     .synthesizeSpeechSettings()
  *     .setRetrySettings(
- *         textToSpeechSettingsBuilder.listVoicesSettings().getRetrySettings().toBuilder()
+ *         textToSpeechSettingsBuilder.synthesizeSpeechSettings().getRetrySettings().toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * TextToSpeechStubSettings textToSpeechSettings = textToSpeechSettingsBuilder.build();
@@ -81,14 +81,9 @@ 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;
-
-  /** Returns the object with the settings used for calls to listVoices. */
-  public UnaryCallSettings listVoicesSettings() {
-    return listVoicesSettings;
-  }
+  private final UnaryCallSettings listVoicesSettings;
 
   /** Returns the object with the settings used for calls to synthesizeSpeech. */
   public UnaryCallSettings
@@ -96,6 +91,11 @@ public UnaryCallSettings listVoicesSettin
     return synthesizeSpeechSettings;
   }
 
+  /** Returns the object with the settings used for calls to listVoices. */
+  public UnaryCallSettings 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);
 
-    listVoicesSettings = settingsBuilder.listVoicesSettings().build();
     synthesizeSpeechSettings = settingsBuilder.synthesizeSpeechSettings().build();
+    listVoicesSettings = settingsBuilder.listVoicesSettings().build();
   }
 
   /** Builder for TextToSpeechStubSettings. */
   public static class Builder extends StubSettings.Builder {
     private final ImmutableList> unaryMethodSettingsBuilders;
 
-    private final UnaryCallSettings.Builder
-        listVoicesSettings;
     private final UnaryCallSettings.Builder
         synthesizeSpeechSettings;
+    private final UnaryCallSettings.Builder
+        listVoicesSettings;
 
     private static final ImmutableMap>
         RETRYABLE_CODE_DEFINITIONS;
@@ -219,13 +219,13 @@ protected Builder() {
     protected Builder(ClientContext clientContext) {
       super(clientContext);
 
-      listVoicesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
-
       synthesizeSpeechSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
 
+      listVoicesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
       unaryMethodSettingsBuilders =
           ImmutableList.>of(
-              listVoicesSettings, synthesizeSpeechSettings);
+              synthesizeSpeechSettings, listVoicesSettings);
 
       initDefaults(this);
     }
@@ -242,13 +242,13 @@ private static Builder createDefault() {
     private static Builder initDefaults(Builder builder) {
 
       builder
-          .listVoicesSettings()
+          .synthesizeSpeechSettings()
           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
 
       builder
-          .synthesizeSpeechSettings()
-          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+          .listVoicesSettings()
+          .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
 
       return builder;
@@ -257,12 +257,12 @@ private static Builder initDefaults(Builder builder) {
     protected Builder(TextToSpeechStubSettings settings) {
       super(settings);
 
-      listVoicesSettings = settings.listVoicesSettings.toBuilder();
       synthesizeSpeechSettings = settings.synthesizeSpeechSettings.toBuilder();
+      listVoicesSettings = settings.listVoicesSettings.toBuilder();
 
       unaryMethodSettingsBuilders =
           ImmutableList.>of(
-              listVoicesSettings, synthesizeSpeechSettings);
+              synthesizeSpeechSettings, listVoicesSettings);
     }
 
     // NEXT_MAJOR_VER: remove 'throws Exception'
@@ -281,17 +281,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 e202451d..106b2b34 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,20 +77,26 @@ public void tearDown() 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(),
@@ -99,14 +105,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
@@ -115,26 +123,20 @@ public void listVoicesExceptionTest() 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(),
@@ -143,16 +145,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
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 24d1301b..86ad9f68 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,20 +77,26 @@ public void tearDown() 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(),
@@ -99,14 +105,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
@@ -115,26 +123,20 @@ public void listVoicesExceptionTest() 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(),
@@ -143,16 +145,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
diff --git a/synth.metadata b/synth.metadata
index 2f050ef3..24b1c675 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -11,16 +11,16 @@
       "git": {
         "name": "googleapis",
         "remote": "https://github.com/googleapis/googleapis.git",
-        "sha": "aed11c01e52921613b9ee469c2d85f5f33175fb7",
-        "internalRef": "310660461"
+        "sha": "5a90d467aa65e7f038f87585e8fbb45d74475e7c",
+        "internalRef": "312088359"
       }
     },
     {
       "git": {
         "name": "googleapis",
         "remote": "https://github.com/googleapis/googleapis.git",
-        "sha": "aed11c01e52921613b9ee469c2d85f5f33175fb7",
-        "internalRef": "310660461"
+        "sha": "5a90d467aa65e7f038f87585e8fbb45d74475e7c",
+        "internalRef": "312088359"
       }
     },
     {