diff --git a/java-texttospeech/README.md b/java-texttospeech/README.md index 0ef195cfb5f0..644dcd756c27 100644 --- a/java-texttospeech/README.md +++ b/java-texttospeech/README.md @@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-texttospeech - 2.6.0 + 2.7.0 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-texttospeech:2.6.0' +implementation 'com.google.cloud:google-cloud-texttospeech:2.7.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-texttospeech" % "2.6.0" +libraryDependencies += "com.google.cloud" % "google-cloud-texttospeech" % "2.7.0" ``` ## Authentication @@ -159,16 +159,16 @@ Java is a registered trademark of Oracle and/or its affiliates. [product-docs]: https://cloud.google.com/text-to-speech [javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-texttospeech/latest/overview -[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java7.svg -[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java7.html -[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java8.svg -[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java8.html -[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java8-osx.svg -[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java8-osx.html -[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java8-win.svg -[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java8-win.html -[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java11.svg -[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-texttospeech/java11.html +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-texttospeech.svg [maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-texttospeech&core=gav @@ -180,9 +180,9 @@ Java is a registered trademark of Oracle and/or its affiliates. [create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects [cloud-sdk]: https://cloud.google.com/sdk/ [troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting -[contributing]: https://github.com/googleapis/java-texttospeech/blob/main/CONTRIBUTING.md -[code-of-conduct]: https://github.com/googleapis/java-texttospeech/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct -[license]: https://github.com/googleapis/java-texttospeech/blob/main/LICENSE +[contributing]: https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/google-cloud-java/blob/main/LICENSE [enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com [libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/HttpJsonTextToSpeechStub.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/HttpJsonTextToSpeechStub.java index 3ab1aefb7663..08253a7bcbe4 100644 --- a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/HttpJsonTextToSpeechStub.java +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1/stub/HttpJsonTextToSpeechStub.java @@ -75,6 +75,7 @@ public class HttpJsonTextToSpeechStub extends TextToSpeechStub { ProtoRestSerializer.create(); serializer.putQueryParam( fields, "languageCode", request.getLanguageCode()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) @@ -107,12 +108,13 @@ public class HttpJsonTextToSpeechStub extends TextToSpeechStub { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) + .toBody("*", request.toBuilder().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClient.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClient.java new file mode 100644 index 000000000000..9a0d8c14d9da --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClient.java @@ -0,0 +1,349 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.texttospeech.v1beta1.stub.TextToSpeechLongAudioSynthesizeStub; +import com.google.cloud.texttospeech.v1beta1.stub.TextToSpeechLongAudioSynthesizeStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Service that implements Google Cloud Text-to-Speech API. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient =
+ *     TextToSpeechLongAudioSynthesizeClient.create()) {
+ *   SynthesizeLongAudioRequest request =
+ *       SynthesizeLongAudioRequest.newBuilder()
+ *           .setParent("parent-995424086")
+ *           .setInput(SynthesisInput.newBuilder().build())
+ *           .setAudioConfig(AudioConfig.newBuilder().build())
+ *           .setOutputGcsUri("outputGcsUri-489598154")
+ *           .setVoice(VoiceSelectionParams.newBuilder().build())
+ *           .build();
+ *   SynthesizeLongAudioResponse response =
+ *       textToSpeechLongAudioSynthesizeClient.synthesizeLongAudioAsync(request).get();
+ * }
+ * }
+ * + *

Note: close() needs to be called on the TextToSpeechLongAudioSynthesizeClient object to clean + * up resources such as threads. In the example above, try-with-resources is used, which + * automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of + * TextToSpeechLongAudioSynthesizeSettings to create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings =
+ *     TextToSpeechLongAudioSynthesizeSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient =
+ *     TextToSpeechLongAudioSynthesizeClient.create(textToSpeechLongAudioSynthesizeSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings =
+ *     TextToSpeechLongAudioSynthesizeSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient =
+ *     TextToSpeechLongAudioSynthesizeClient.create(textToSpeechLongAudioSynthesizeSettings);
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings =
+ *     TextToSpeechLongAudioSynthesizeSettings.newHttpJsonBuilder().build();
+ * TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient =
+ *     TextToSpeechLongAudioSynthesizeClient.create(textToSpeechLongAudioSynthesizeSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class TextToSpeechLongAudioSynthesizeClient implements BackgroundResource { + private final TextToSpeechLongAudioSynthesizeSettings settings; + private final TextToSpeechLongAudioSynthesizeStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of TextToSpeechLongAudioSynthesizeClient with default settings. */ + public static final TextToSpeechLongAudioSynthesizeClient create() throws IOException { + return create(TextToSpeechLongAudioSynthesizeSettings.newBuilder().build()); + } + + /** + * Constructs an instance of TextToSpeechLongAudioSynthesizeClient, using the given settings. The + * channels are created based on the settings passed in, or defaults for any settings that are not + * set. + */ + public static final TextToSpeechLongAudioSynthesizeClient create( + TextToSpeechLongAudioSynthesizeSettings settings) throws IOException { + return new TextToSpeechLongAudioSynthesizeClient(settings); + } + + /** + * Constructs an instance of TextToSpeechLongAudioSynthesizeClient, using the given stub for + * making calls. This is for advanced usage - prefer using + * create(TextToSpeechLongAudioSynthesizeSettings). + */ + public static final TextToSpeechLongAudioSynthesizeClient create( + TextToSpeechLongAudioSynthesizeStub stub) { + return new TextToSpeechLongAudioSynthesizeClient(stub); + } + + /** + * Constructs an instance of TextToSpeechLongAudioSynthesizeClient, using the given settings. This + * is protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected TextToSpeechLongAudioSynthesizeClient(TextToSpeechLongAudioSynthesizeSettings settings) + throws IOException { + this.settings = settings; + this.stub = + ((TextToSpeechLongAudioSynthesizeStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected TextToSpeechLongAudioSynthesizeClient(TextToSpeechLongAudioSynthesizeStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final TextToSpeechLongAudioSynthesizeSettings getSettings() { + return settings; + } + + public TextToSpeechLongAudioSynthesizeStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Synthesizes long form text asynchronously. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient =
+   *     TextToSpeechLongAudioSynthesizeClient.create()) {
+   *   SynthesizeLongAudioRequest request =
+   *       SynthesizeLongAudioRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInput(SynthesisInput.newBuilder().build())
+   *           .setAudioConfig(AudioConfig.newBuilder().build())
+   *           .setOutputGcsUri("outputGcsUri-489598154")
+   *           .setVoice(VoiceSelectionParams.newBuilder().build())
+   *           .build();
+   *   SynthesizeLongAudioResponse response =
+   *       textToSpeechLongAudioSynthesizeClient.synthesizeLongAudioAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture + synthesizeLongAudioAsync(SynthesizeLongAudioRequest request) { + return synthesizeLongAudioOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Synthesizes long form text asynchronously. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient =
+   *     TextToSpeechLongAudioSynthesizeClient.create()) {
+   *   SynthesizeLongAudioRequest request =
+   *       SynthesizeLongAudioRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInput(SynthesisInput.newBuilder().build())
+   *           .setAudioConfig(AudioConfig.newBuilder().build())
+   *           .setOutputGcsUri("outputGcsUri-489598154")
+   *           .setVoice(VoiceSelectionParams.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       textToSpeechLongAudioSynthesizeClient
+   *           .synthesizeLongAudioOperationCallable()
+   *           .futureCall(request);
+   *   // Do something.
+   *   SynthesizeLongAudioResponse response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationCallable() { + return stub.synthesizeLongAudioOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Synthesizes long form text asynchronously. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient =
+   *     TextToSpeechLongAudioSynthesizeClient.create()) {
+   *   SynthesizeLongAudioRequest request =
+   *       SynthesizeLongAudioRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setInput(SynthesisInput.newBuilder().build())
+   *           .setAudioConfig(AudioConfig.newBuilder().build())
+   *           .setOutputGcsUri("outputGcsUri-489598154")
+   *           .setVoice(VoiceSelectionParams.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       textToSpeechLongAudioSynthesizeClient.synthesizeLongAudioCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable synthesizeLongAudioCallable() { + return stub.synthesizeLongAudioCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeSettings.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeSettings.java new file mode 100644 index 000000000000..be44fc28c531 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeSettings.java @@ -0,0 +1,228 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.texttospeech.v1beta1.stub.TextToSpeechLongAudioSynthesizeStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link TextToSpeechLongAudioSynthesizeClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (texttospeech.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

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 synthesizeLongAudio to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TextToSpeechLongAudioSynthesizeSettings.Builder textToSpeechLongAudioSynthesizeSettingsBuilder =
+ *     TextToSpeechLongAudioSynthesizeSettings.newBuilder();
+ * textToSpeechLongAudioSynthesizeSettingsBuilder
+ *     .synthesizeLongAudioSettings()
+ *     .setRetrySettings(
+ *         textToSpeechLongAudioSynthesizeSettingsBuilder
+ *             .synthesizeLongAudioSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings =
+ *     textToSpeechLongAudioSynthesizeSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class TextToSpeechLongAudioSynthesizeSettings + extends ClientSettings { + + /** Returns the object with the settings used for calls to synthesizeLongAudio. */ + public UnaryCallSettings synthesizeLongAudioSettings() { + return ((TextToSpeechLongAudioSynthesizeStubSettings) getStubSettings()) + .synthesizeLongAudioSettings(); + } + + /** Returns the object with the settings used for calls to synthesizeLongAudio. */ + public OperationCallSettings< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationSettings() { + return ((TextToSpeechLongAudioSynthesizeStubSettings) getStubSettings()) + .synthesizeLongAudioOperationSettings(); + } + + public static final TextToSpeechLongAudioSynthesizeSettings create( + TextToSpeechLongAudioSynthesizeStubSettings stub) throws IOException { + return new TextToSpeechLongAudioSynthesizeSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TextToSpeechLongAudioSynthesizeStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TextToSpeechLongAudioSynthesizeStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TextToSpeechLongAudioSynthesizeStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TextToSpeechLongAudioSynthesizeStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return TextToSpeechLongAudioSynthesizeStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TextToSpeechLongAudioSynthesizeStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TextToSpeechLongAudioSynthesizeStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TextToSpeechLongAudioSynthesizeStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TextToSpeechLongAudioSynthesizeSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TextToSpeechLongAudioSynthesizeSettings. */ + public static class Builder + extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(TextToSpeechLongAudioSynthesizeStubSettings.newBuilder(clientContext)); + } + + protected Builder(TextToSpeechLongAudioSynthesizeSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TextToSpeechLongAudioSynthesizeStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(TextToSpeechLongAudioSynthesizeStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(TextToSpeechLongAudioSynthesizeStubSettings.newHttpJsonBuilder()); + } + + public TextToSpeechLongAudioSynthesizeStubSettings.Builder getStubSettingsBuilder() { + return ((TextToSpeechLongAudioSynthesizeStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to synthesizeLongAudio. */ + public UnaryCallSettings.Builder + synthesizeLongAudioSettings() { + return getStubSettingsBuilder().synthesizeLongAudioSettings(); + } + + /** Returns the builder for the settings used for calls to synthesizeLongAudio. */ + public OperationCallSettings.Builder< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationSettings() { + return getStubSettingsBuilder().synthesizeLongAudioOperationSettings(); + } + + @Override + public TextToSpeechLongAudioSynthesizeSettings build() throws IOException { + return new TextToSpeechLongAudioSynthesizeSettings(this); + } + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/gapic_metadata.json b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/gapic_metadata.json index e968db41928e..d2599b62558b 100644 --- a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/gapic_metadata.json +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/gapic_metadata.json @@ -19,6 +19,18 @@ } } } + }, + "TextToSpeechLongAudioSynthesize": { + "clients": { + "grpc": { + "libraryClient": "TextToSpeechLongAudioSynthesizeClient", + "rpcs": { + "SynthesizeLongAudio": { + "methods": ["synthesizeLongAudioAsync", "synthesizeLongAudioOperationCallable", "synthesizeLongAudioCallable"] + } + } + } + } } } } \ No newline at end of file diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java index d5ec079725be..f9ea4d9932ee 100644 --- a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/package-info.java @@ -36,6 +36,33 @@ * ListVoicesResponse response = textToSpeechClient.listVoices(languageCode); * } * } + * + *

======================= TextToSpeechLongAudioSynthesizeClient ======================= + * + *

Service Description: Service that implements Google Cloud Text-to-Speech API. + * + *

Sample for TextToSpeechLongAudioSynthesizeClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient =
+ *     TextToSpeechLongAudioSynthesizeClient.create()) {
+ *   SynthesizeLongAudioRequest request =
+ *       SynthesizeLongAudioRequest.newBuilder()
+ *           .setParent("parent-995424086")
+ *           .setInput(SynthesisInput.newBuilder().build())
+ *           .setAudioConfig(AudioConfig.newBuilder().build())
+ *           .setOutputGcsUri("outputGcsUri-489598154")
+ *           .setVoice(VoiceSelectionParams.newBuilder().build())
+ *           .build();
+ *   SynthesizeLongAudioResponse response =
+ *       textToSpeechLongAudioSynthesizeClient.synthesizeLongAudioAsync(request).get();
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.texttospeech.v1beta1; diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechLongAudioSynthesizeCallableFactory.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechLongAudioSynthesizeCallableFactory.java new file mode 100644 index 000000000000..b19db3ba9886 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechLongAudioSynthesizeCallableFactory.java @@ -0,0 +1,115 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the TextToSpeechLongAudioSynthesize service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcTextToSpeechLongAudioSynthesizeCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechLongAudioSynthesizeStub.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechLongAudioSynthesizeStub.java new file mode 100644 index 000000000000..eb62874fdb65 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/GrpcTextToSpeechLongAudioSynthesizeStub.java @@ -0,0 +1,189 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the TextToSpeechLongAudioSynthesize service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class GrpcTextToSpeechLongAudioSynthesizeStub extends TextToSpeechLongAudioSynthesizeStub { + private static final MethodDescriptor + synthesizeLongAudioMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio") + .setRequestMarshaller( + ProtoUtils.marshaller(SynthesizeLongAudioRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final UnaryCallable synthesizeLongAudioCallable; + private final OperationCallable< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcTextToSpeechLongAudioSynthesizeStub create( + TextToSpeechLongAudioSynthesizeStubSettings settings) throws IOException { + return new GrpcTextToSpeechLongAudioSynthesizeStub(settings, ClientContext.create(settings)); + } + + public static final GrpcTextToSpeechLongAudioSynthesizeStub create(ClientContext clientContext) + throws IOException { + return new GrpcTextToSpeechLongAudioSynthesizeStub( + TextToSpeechLongAudioSynthesizeStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcTextToSpeechLongAudioSynthesizeStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcTextToSpeechLongAudioSynthesizeStub( + TextToSpeechLongAudioSynthesizeStubSettings.newBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of GrpcTextToSpeechLongAudioSynthesizeStub, using the given settings. + * This is protected so that it is easy to make a subclass, but otherwise, the static factory + * methods should be preferred. + */ + protected GrpcTextToSpeechLongAudioSynthesizeStub( + TextToSpeechLongAudioSynthesizeStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcTextToSpeechLongAudioSynthesizeCallableFactory()); + } + + /** + * Constructs an instance of GrpcTextToSpeechLongAudioSynthesizeStub, using the given settings. + * This is protected so that it is easy to make a subclass, but otherwise, the static factory + * methods should be preferred. + */ + protected GrpcTextToSpeechLongAudioSynthesizeStub( + TextToSpeechLongAudioSynthesizeStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings synthesizeLongAudioTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(synthesizeLongAudioMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + + this.synthesizeLongAudioCallable = + callableFactory.createUnaryCallable( + synthesizeLongAudioTransportSettings, + settings.synthesizeLongAudioSettings(), + clientContext); + this.synthesizeLongAudioOperationCallable = + callableFactory.createOperationCallable( + synthesizeLongAudioTransportSettings, + settings.synthesizeLongAudioOperationSettings(), + clientContext, + operationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable synthesizeLongAudioCallable() { + return synthesizeLongAudioCallable; + } + + @Override + public OperationCallable< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationCallable() { + return synthesizeLongAudioOperationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechLongAudioSynthesizeCallableFactory.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechLongAudioSynthesizeCallableFactory.java new file mode 100644 index 000000000000..f3cce5877511 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechLongAudioSynthesizeCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the TextToSpeechLongAudioSynthesize service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonTextToSpeechLongAudioSynthesizeCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechLongAudioSynthesizeStub.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechLongAudioSynthesizeStub.java new file mode 100644 index 000000000000..de9af0328634 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechLongAudioSynthesizeStub.java @@ -0,0 +1,239 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse; +import com.google.longrunning.Operation; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the TextToSpeechLongAudioSynthesize service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonTextToSpeechLongAudioSynthesizeStub + extends TextToSpeechLongAudioSynthesizeStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(SynthesizeLongAudioResponse.getDescriptor()) + .add(SynthesizeLongAudioMetadata.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + synthesizeLongAudioMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*/voices/*}:SynthesizeLongAudio", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (SynthesizeLongAudioRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private final UnaryCallable synthesizeLongAudioCallable; + private final OperationCallable< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTextToSpeechLongAudioSynthesizeStub create( + TextToSpeechLongAudioSynthesizeStubSettings settings) throws IOException { + return new HttpJsonTextToSpeechLongAudioSynthesizeStub( + settings, ClientContext.create(settings)); + } + + public static final HttpJsonTextToSpeechLongAudioSynthesizeStub create( + ClientContext clientContext) throws IOException { + return new HttpJsonTextToSpeechLongAudioSynthesizeStub( + TextToSpeechLongAudioSynthesizeStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonTextToSpeechLongAudioSynthesizeStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTextToSpeechLongAudioSynthesizeStub( + TextToSpeechLongAudioSynthesizeStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonTextToSpeechLongAudioSynthesizeStub, using the given + * settings. This is protected so that it is easy to make a subclass, but otherwise, the static + * factory methods should be preferred. + */ + protected HttpJsonTextToSpeechLongAudioSynthesizeStub( + TextToSpeechLongAudioSynthesizeStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonTextToSpeechLongAudioSynthesizeCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTextToSpeechLongAudioSynthesizeStub, using the given + * settings. This is protected so that it is easy to make a subclass, but otherwise, the static + * factory methods should be preferred. + */ + protected HttpJsonTextToSpeechLongAudioSynthesizeStub( + TextToSpeechLongAudioSynthesizeStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + synthesizeLongAudioTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(synthesizeLongAudioMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.synthesizeLongAudioCallable = + callableFactory.createUnaryCallable( + synthesizeLongAudioTransportSettings, + settings.synthesizeLongAudioSettings(), + clientContext); + this.synthesizeLongAudioOperationCallable = + callableFactory.createOperationCallable( + synthesizeLongAudioTransportSettings, + settings.synthesizeLongAudioOperationSettings(), + clientContext, + httpJsonOperationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(synthesizeLongAudioMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable synthesizeLongAudioCallable() { + return synthesizeLongAudioCallable; + } + + @Override + public OperationCallable< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationCallable() { + return synthesizeLongAudioOperationCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechStub.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechStub.java index a53e031d01fb..4ea2acd3d0bc 100644 --- a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechStub.java +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/HttpJsonTextToSpeechStub.java @@ -75,6 +75,7 @@ public class HttpJsonTextToSpeechStub extends TextToSpeechStub { ProtoRestSerializer.create(); serializer.putQueryParam( fields, "languageCode", request.getLanguageCode()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor(request -> null) @@ -107,12 +108,13 @@ public class HttpJsonTextToSpeechStub extends TextToSpeechStub { Map> fields = new HashMap<>(); ProtoRestSerializer serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); return fields; }) .setRequestBodyExtractor( request -> ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) + .toBody("*", request.toBuilder().build(), true)) .build()) .setResponseParser( ProtoMessageResponseParser.newBuilder() diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechLongAudioSynthesizeStub.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechLongAudioSynthesizeStub.java new file mode 100644 index 000000000000..a6d7843de475 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechLongAudioSynthesizeStub.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the TextToSpeechLongAudioSynthesize service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public abstract class TextToSpeechLongAudioSynthesizeStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + + public OperationCallable< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: synthesizeLongAudioOperationCallable()"); + } + + public UnaryCallable synthesizeLongAudioCallable() { + throw new UnsupportedOperationException("Not implemented: synthesizeLongAudioCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechLongAudioSynthesizeStubSettings.java b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechLongAudioSynthesizeStubSettings.java new file mode 100644 index 000000000000..c5c7f06405fc --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/main/java/com/google/cloud/texttospeech/v1beta1/stub/TextToSpeechLongAudioSynthesizeStubSettings.java @@ -0,0 +1,391 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link TextToSpeechLongAudioSynthesizeStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (texttospeech.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

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 synthesizeLongAudio to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TextToSpeechLongAudioSynthesizeStubSettings.Builder
+ *     textToSpeechLongAudioSynthesizeSettingsBuilder =
+ *         TextToSpeechLongAudioSynthesizeStubSettings.newBuilder();
+ * textToSpeechLongAudioSynthesizeSettingsBuilder
+ *     .synthesizeLongAudioSettings()
+ *     .setRetrySettings(
+ *         textToSpeechLongAudioSynthesizeSettingsBuilder
+ *             .synthesizeLongAudioSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * TextToSpeechLongAudioSynthesizeStubSettings textToSpeechLongAudioSynthesizeSettings =
+ *     textToSpeechLongAudioSynthesizeSettingsBuilder.build();
+ * }
+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class TextToSpeechLongAudioSynthesizeStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings + synthesizeLongAudioSettings; + private final OperationCallSettings< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationSettings; + + /** Returns the object with the settings used for calls to synthesizeLongAudio. */ + public UnaryCallSettings synthesizeLongAudioSettings() { + return synthesizeLongAudioSettings; + } + + /** Returns the object with the settings used for calls to synthesizeLongAudio. */ + public OperationCallSettings< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationSettings() { + return synthesizeLongAudioOperationSettings; + } + + public TextToSpeechLongAudioSynthesizeStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcTextToSpeechLongAudioSynthesizeStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTextToSpeechLongAudioSynthesizeStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "texttospeech.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "texttospeech.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", + GaxProperties.getLibraryVersion(TextToSpeechLongAudioSynthesizeStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", + GaxProperties.getLibraryVersion(TextToSpeechLongAudioSynthesizeStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TextToSpeechLongAudioSynthesizeStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TextToSpeechLongAudioSynthesizeStubSettings(Builder settingsBuilder) + throws IOException { + super(settingsBuilder); + + synthesizeLongAudioSettings = settingsBuilder.synthesizeLongAudioSettings().build(); + synthesizeLongAudioOperationSettings = + settingsBuilder.synthesizeLongAudioOperationSettings().build(); + } + + /** Builder for TextToSpeechLongAudioSynthesizeStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder + synthesizeLongAudioSettings; + private final OperationCallSettings.Builder< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRpcTimeout(Duration.ofMillis(5000000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(5000000L)) + .setTotalTimeout(Duration.ofMillis(5000000L)) + .build(); + definitions.put("no_retry_1_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + synthesizeLongAudioSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + synthesizeLongAudioOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(synthesizeLongAudioSettings); + initDefaults(this); + } + + protected Builder(TextToSpeechLongAudioSynthesizeStubSettings settings) { + super(settings); + + synthesizeLongAudioSettings = settings.synthesizeLongAudioSettings.toBuilder(); + synthesizeLongAudioOperationSettings = + settings.synthesizeLongAudioOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(synthesizeLongAudioSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .synthesizeLongAudioSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .synthesizeLongAudioOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create( + SynthesizeLongAudioResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create( + SynthesizeLongAudioMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to synthesizeLongAudio. */ + public UnaryCallSettings.Builder + synthesizeLongAudioSettings() { + return synthesizeLongAudioSettings; + } + + /** Returns the builder for the settings used for calls to synthesizeLongAudio. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + SynthesizeLongAudioRequest, SynthesizeLongAudioResponse, SynthesizeLongAudioMetadata> + synthesizeLongAudioOperationSettings() { + return synthesizeLongAudioOperationSettings; + } + + @Override + public TextToSpeechLongAudioSynthesizeStubSettings build() throws IOException { + return new TextToSpeechLongAudioSynthesizeStubSettings(this); + } + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/MockTextToSpeechLongAudioSynthesize.java b/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/MockTextToSpeechLongAudioSynthesize.java new file mode 100644 index 000000000000..30b736f393e9 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/MockTextToSpeechLongAudioSynthesize.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockTextToSpeechLongAudioSynthesize implements MockGrpcService { + private final MockTextToSpeechLongAudioSynthesizeImpl serviceImpl; + + public MockTextToSpeechLongAudioSynthesize() { + serviceImpl = new MockTextToSpeechLongAudioSynthesizeImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/MockTextToSpeechLongAudioSynthesizeImpl.java b/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/MockTextToSpeechLongAudioSynthesizeImpl.java new file mode 100644 index 000000000000..151d6f6cc275 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/MockTextToSpeechLongAudioSynthesizeImpl.java @@ -0,0 +1,83 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeGrpc.TextToSpeechLongAudioSynthesizeImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockTextToSpeechLongAudioSynthesizeImpl + extends TextToSpeechLongAudioSynthesizeImplBase { + private List requests; + private Queue responses; + + public MockTextToSpeechLongAudioSynthesizeImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void synthesizeLongAudio( + SynthesizeLongAudioRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method SynthesizeLongAudio, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClientHttpJsonTest.java b/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClientHttpJsonTest.java new file mode 100644 index 000000000000..efe5996130a0 --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClientHttpJsonTest.java @@ -0,0 +1,135 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.texttospeech.v1beta1.stub.HttpJsonTextToSpeechLongAudioSynthesizeStub; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class TextToSpeechLongAudioSynthesizeClientHttpJsonTest { + private static MockHttpService mockService; + private static TextToSpeechLongAudioSynthesizeClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonTextToSpeechLongAudioSynthesizeStub.getMethodDescriptors(), + TextToSpeechLongAudioSynthesizeSettings.getDefaultEndpoint()); + TextToSpeechLongAudioSynthesizeSettings settings = + TextToSpeechLongAudioSynthesizeSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + TextToSpeechLongAudioSynthesizeSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TextToSpeechLongAudioSynthesizeClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void synthesizeLongAudioTest() throws Exception { + SynthesizeLongAudioResponse expectedResponse = SynthesizeLongAudioResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("synthesizeLongAudioTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + SynthesizeLongAudioRequest request = + SynthesizeLongAudioRequest.newBuilder() + .setParent("projects/project-5698/locations/location-5698/voices/voice-5698") + .setInput(SynthesisInput.newBuilder().build()) + .setAudioConfig(AudioConfig.newBuilder().build()) + .setOutputGcsUri("outputGcsUri-489598154") + .setVoice(VoiceSelectionParams.newBuilder().build()) + .build(); + + SynthesizeLongAudioResponse actualResponse = client.synthesizeLongAudioAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void synthesizeLongAudioExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SynthesizeLongAudioRequest request = + SynthesizeLongAudioRequest.newBuilder() + .setParent("projects/project-5698/locations/location-5698/voices/voice-5698") + .setInput(SynthesisInput.newBuilder().build()) + .setAudioConfig(AudioConfig.newBuilder().build()) + .setOutputGcsUri("outputGcsUri-489598154") + .setVoice(VoiceSelectionParams.newBuilder().build()) + .build(); + client.synthesizeLongAudioAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } +} diff --git a/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClientTest.java b/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClientTest.java new file mode 100644 index 000000000000..a26dc243aeaf --- /dev/null +++ b/java-texttospeech/google-cloud-texttospeech/src/test/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeClientTest.java @@ -0,0 +1,143 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class TextToSpeechLongAudioSynthesizeClientTest { + private static MockServiceHelper mockServiceHelper; + private static MockTextToSpeechLongAudioSynthesize mockTextToSpeechLongAudioSynthesize; + private LocalChannelProvider channelProvider; + private TextToSpeechLongAudioSynthesizeClient client; + + @BeforeClass + public static void startStaticServer() { + mockTextToSpeechLongAudioSynthesize = new MockTextToSpeechLongAudioSynthesize(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockTextToSpeechLongAudioSynthesize)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + TextToSpeechLongAudioSynthesizeSettings settings = + TextToSpeechLongAudioSynthesizeSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TextToSpeechLongAudioSynthesizeClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void synthesizeLongAudioTest() throws Exception { + SynthesizeLongAudioResponse expectedResponse = SynthesizeLongAudioResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("synthesizeLongAudioTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockTextToSpeechLongAudioSynthesize.addResponse(resultOperation); + + SynthesizeLongAudioRequest request = + SynthesizeLongAudioRequest.newBuilder() + .setParent("parent-995424086") + .setInput(SynthesisInput.newBuilder().build()) + .setAudioConfig(AudioConfig.newBuilder().build()) + .setOutputGcsUri("outputGcsUri-489598154") + .setVoice(VoiceSelectionParams.newBuilder().build()) + .build(); + + SynthesizeLongAudioResponse actualResponse = client.synthesizeLongAudioAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTextToSpeechLongAudioSynthesize.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SynthesizeLongAudioRequest actualRequest = ((SynthesizeLongAudioRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getInput(), actualRequest.getInput()); + Assert.assertEquals(request.getAudioConfig(), actualRequest.getAudioConfig()); + Assert.assertEquals(request.getOutputGcsUri(), actualRequest.getOutputGcsUri()); + Assert.assertEquals(request.getVoice(), actualRequest.getVoice()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void synthesizeLongAudioExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTextToSpeechLongAudioSynthesize.addException(exception); + + try { + SynthesizeLongAudioRequest request = + SynthesizeLongAudioRequest.newBuilder() + .setParent("parent-995424086") + .setInput(SynthesisInput.newBuilder().build()) + .setAudioConfig(AudioConfig.newBuilder().build()) + .setOutputGcsUri("outputGcsUri-489598154") + .setVoice(VoiceSelectionParams.newBuilder().build()) + .build(); + client.synthesizeLongAudioAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/java-texttospeech/grpc-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeGrpc.java b/java-texttospeech/grpc-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeGrpc.java new file mode 100644 index 000000000000..2195103291f7 --- /dev/null +++ b/java-texttospeech/grpc-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesizeGrpc.java @@ -0,0 +1,373 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.texttospeech.v1beta1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Service that implements Google Cloud Text-to-Speech API.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class TextToSpeechLongAudioSynthesizeGrpc { + + private TextToSpeechLongAudioSynthesizeGrpc() {} + + public static final String SERVICE_NAME = + "google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesize"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest, + com.google.longrunning.Operation> + getSynthesizeLongAudioMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SynthesizeLongAudio", + requestType = com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest, + com.google.longrunning.Operation> + getSynthesizeLongAudioMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest, + com.google.longrunning.Operation> + getSynthesizeLongAudioMethod; + if ((getSynthesizeLongAudioMethod = + TextToSpeechLongAudioSynthesizeGrpc.getSynthesizeLongAudioMethod) + == null) { + synchronized (TextToSpeechLongAudioSynthesizeGrpc.class) { + if ((getSynthesizeLongAudioMethod = + TextToSpeechLongAudioSynthesizeGrpc.getSynthesizeLongAudioMethod) + == null) { + TextToSpeechLongAudioSynthesizeGrpc.getSynthesizeLongAudioMethod = + getSynthesizeLongAudioMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "SynthesizeLongAudio")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new TextToSpeechLongAudioSynthesizeMethodDescriptorSupplier( + "SynthesizeLongAudio")) + .build(); + } + } + } + return getSynthesizeLongAudioMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static TextToSpeechLongAudioSynthesizeStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public TextToSpeechLongAudioSynthesizeStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TextToSpeechLongAudioSynthesizeStub(channel, callOptions); + } + }; + return TextToSpeechLongAudioSynthesizeStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static TextToSpeechLongAudioSynthesizeBlockingStub newBlockingStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public TextToSpeechLongAudioSynthesizeBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TextToSpeechLongAudioSynthesizeBlockingStub(channel, callOptions); + } + }; + return TextToSpeechLongAudioSynthesizeBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static TextToSpeechLongAudioSynthesizeFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public TextToSpeechLongAudioSynthesizeFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TextToSpeechLongAudioSynthesizeFutureStub(channel, callOptions); + } + }; + return TextToSpeechLongAudioSynthesizeFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Service that implements Google Cloud Text-to-Speech API.
+   * 
+ */ + public abstract static class TextToSpeechLongAudioSynthesizeImplBase + implements io.grpc.BindableService { + + /** + * + * + *
+     * Synthesizes long form text asynchronously.
+     * 
+ */ + public void synthesizeLongAudio( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getSynthesizeLongAudioMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getSynthesizeLongAudioMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest, + com.google.longrunning.Operation>(this, METHODID_SYNTHESIZE_LONG_AUDIO))) + .build(); + } + } + + /** + * + * + *
+   * Service that implements Google Cloud Text-to-Speech API.
+   * 
+ */ + public static final class TextToSpeechLongAudioSynthesizeStub + extends io.grpc.stub.AbstractAsyncStub { + private TextToSpeechLongAudioSynthesizeStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TextToSpeechLongAudioSynthesizeStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TextToSpeechLongAudioSynthesizeStub(channel, callOptions); + } + + /** + * + * + *
+     * Synthesizes long form text asynchronously.
+     * 
+ */ + public void synthesizeLongAudio( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getSynthesizeLongAudioMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Service that implements Google Cloud Text-to-Speech API.
+   * 
+ */ + public static final class TextToSpeechLongAudioSynthesizeBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private TextToSpeechLongAudioSynthesizeBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TextToSpeechLongAudioSynthesizeBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TextToSpeechLongAudioSynthesizeBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Synthesizes long form text asynchronously.
+     * 
+ */ + public com.google.longrunning.Operation synthesizeLongAudio( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSynthesizeLongAudioMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service that implements Google Cloud Text-to-Speech API.
+   * 
+ */ + public static final class TextToSpeechLongAudioSynthesizeFutureStub + extends io.grpc.stub.AbstractFutureStub { + private TextToSpeechLongAudioSynthesizeFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TextToSpeechLongAudioSynthesizeFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TextToSpeechLongAudioSynthesizeFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Synthesizes long form text asynchronously.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + synthesizeLongAudio( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSynthesizeLongAudioMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_SYNTHESIZE_LONG_AUDIO = 0; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final TextToSpeechLongAudioSynthesizeImplBase serviceImpl; + private final int methodId; + + MethodHandlers(TextToSpeechLongAudioSynthesizeImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_SYNTHESIZE_LONG_AUDIO: + serviceImpl.synthesizeLongAudio( + (com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class TextToSpeechLongAudioSynthesizeBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + TextToSpeechLongAudioSynthesizeBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("TextToSpeechLongAudioSynthesize"); + } + } + + private static final class TextToSpeechLongAudioSynthesizeFileDescriptorSupplier + extends TextToSpeechLongAudioSynthesizeBaseDescriptorSupplier { + TextToSpeechLongAudioSynthesizeFileDescriptorSupplier() {} + } + + private static final class TextToSpeechLongAudioSynthesizeMethodDescriptorSupplier + extends TextToSpeechLongAudioSynthesizeBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + TextToSpeechLongAudioSynthesizeMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (TextToSpeechLongAudioSynthesizeGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor( + new TextToSpeechLongAudioSynthesizeFileDescriptorSupplier()) + .addMethod(getSynthesizeLongAudioMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioConfig.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioConfig.java index c7a8ef534fc7..ec8b637fc129 100644 --- a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioConfig.java +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioConfig.java @@ -194,7 +194,7 @@ public double getVolumeGainDb() { * converting to the desired sample rate (which might result in worse audio * quality), unless the specified sample rate is not supported for the * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][]. + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. * * * int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; @@ -1090,7 +1090,7 @@ public Builder clearVolumeGainDb() { * converting to the desired sample rate (which might result in worse audio * quality), unless the specified sample rate is not supported for the * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][]. + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. * * * int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; @@ -1111,7 +1111,7 @@ public int getSampleRateHertz() { * converting to the desired sample rate (which might result in worse audio * quality), unless the specified sample rate is not supported for the * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][]. + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. * * * int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; @@ -1135,7 +1135,7 @@ public Builder setSampleRateHertz(int value) { * converting to the desired sample rate (which might result in worse audio * quality), unless the specified sample rate is not supported for the * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][]. + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. * * * int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioConfigOrBuilder.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioConfigOrBuilder.java index 3825c9ff6646..87720ddfe83d 100644 --- a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioConfigOrBuilder.java +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioConfigOrBuilder.java @@ -119,7 +119,7 @@ public interface AudioConfigOrBuilder * converting to the desired sample rate (which might result in worse audio * quality), unless the specified sample rate is not supported for the * encoding chosen, in which case it will fail the request and return - * [google.rpc.Code.INVALID_ARGUMENT][]. + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. * * * int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioEncoding.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioEncoding.java index 706e6f33b503..a8fc663fe9a3 100644 --- a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioEncoding.java +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/AudioEncoding.java @@ -33,7 +33,7 @@ public enum AudioEncoding implements com.google.protobuf.ProtocolMessageEnum { * * *
-   * Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][].
+   * Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
    * 
* * AUDIO_ENCODING_UNSPECIFIED = 0; @@ -112,7 +112,7 @@ public enum AudioEncoding implements com.google.protobuf.ProtocolMessageEnum { * * *
-   * Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][].
+   * Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
    * 
* * AUDIO_ENCODING_UNSPECIFIED = 0; diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesisInput.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesisInput.java index 951558f9d34b..aa3ca7b6f3e2 100644 --- a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesisInput.java +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesisInput.java @@ -24,8 +24,8 @@ *
  * Contains text input to be synthesized. Either `text` or `ssml` must be
  * supplied. Supplying both or neither returns
- * [google.rpc.Code.INVALID_ARGUMENT][]. The input size is limited to 5000
- * characters.
+ * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. The input size is limited to 5000
+ * bytes.
  * 
* * Protobuf type {@code google.cloud.texttospeech.v1beta1.SynthesisInput} @@ -192,7 +192,7 @@ public com.google.protobuf.ByteString getTextBytes() { *
    * The SSML document to be synthesized. The SSML document must be valid
    * and well-formed. Otherwise the RPC will fail and return
-   * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+   * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
    * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
    * 
* @@ -209,7 +209,7 @@ public boolean hasSsml() { *
    * The SSML document to be synthesized. The SSML document must be valid
    * and well-formed. Otherwise the RPC will fail and return
-   * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+   * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
    * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
    * 
* @@ -239,7 +239,7 @@ public java.lang.String getSsml() { *
    * The SSML document to be synthesized. The SSML document must be valid
    * and well-formed. Otherwise the RPC will fail and return
-   * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+   * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
    * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
    * 
* @@ -455,8 +455,8 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build *
    * Contains text input to be synthesized. Either `text` or `ssml` must be
    * supplied. Supplying both or neither returns
-   * [google.rpc.Code.INVALID_ARGUMENT][]. The input size is limited to 5000
-   * characters.
+   * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. The input size is limited to 5000
+   * bytes.
    * 
* * Protobuf type {@code google.cloud.texttospeech.v1beta1.SynthesisInput} @@ -807,7 +807,7 @@ public Builder setTextBytes(com.google.protobuf.ByteString value) { *
      * The SSML document to be synthesized. The SSML document must be valid
      * and well-formed. Otherwise the RPC will fail and return
-     * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+     * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
      * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
      * 
* @@ -825,7 +825,7 @@ public boolean hasSsml() { *
      * The SSML document to be synthesized. The SSML document must be valid
      * and well-formed. Otherwise the RPC will fail and return
-     * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+     * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
      * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
      * 
* @@ -856,7 +856,7 @@ public java.lang.String getSsml() { *
      * The SSML document to be synthesized. The SSML document must be valid
      * and well-formed. Otherwise the RPC will fail and return
-     * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+     * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
      * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
      * 
* @@ -887,7 +887,7 @@ public com.google.protobuf.ByteString getSsmlBytes() { *
      * The SSML document to be synthesized. The SSML document must be valid
      * and well-formed. Otherwise the RPC will fail and return
-     * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+     * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
      * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
      * 
* @@ -911,7 +911,7 @@ public Builder setSsml(java.lang.String value) { *
      * The SSML document to be synthesized. The SSML document must be valid
      * and well-formed. Otherwise the RPC will fail and return
-     * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+     * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
      * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
      * 
* @@ -933,7 +933,7 @@ public Builder clearSsml() { *
      * The SSML document to be synthesized. The SSML document must be valid
      * and well-formed. Otherwise the RPC will fail and return
-     * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+     * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
      * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
      * 
* diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesisInputOrBuilder.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesisInputOrBuilder.java index b8c202e56132..675bf5680e8b 100644 --- a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesisInputOrBuilder.java +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesisInputOrBuilder.java @@ -66,7 +66,7 @@ public interface SynthesisInputOrBuilder *
    * The SSML document to be synthesized. The SSML document must be valid
    * and well-formed. Otherwise the RPC will fail and return
-   * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+   * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
    * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
    * 
* @@ -81,7 +81,7 @@ public interface SynthesisInputOrBuilder *
    * The SSML document to be synthesized. The SSML document must be valid
    * and well-formed. Otherwise the RPC will fail and return
-   * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+   * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
    * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
    * 
* @@ -96,7 +96,7 @@ public interface SynthesisInputOrBuilder *
    * The SSML document to be synthesized. The SSML document must be valid
    * and well-formed. Otherwise the RPC will fail and return
-   * [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see
+   * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see
    * [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
    * 
* diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioMetadata.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioMetadata.java new file mode 100644 index 000000000000..bb140660e681 --- /dev/null +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioMetadata.java @@ -0,0 +1,1066 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto + +package com.google.cloud.texttospeech.v1beta1; + +/** + * + * + *
+ * Metadata for response returned by the `SynthesizeLongAudio` method.
+ * 
+ * + * Protobuf type {@code google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata} + */ +public final class SynthesizeLongAudioMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata) + SynthesizeLongAudioMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use SynthesizeLongAudioMetadata.newBuilder() to construct. + private SynthesizeLongAudioMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SynthesizeLongAudioMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SynthesizeLongAudioMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata.class, + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata.Builder.class); + } + + public static final int START_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + @java.lang.Override + public boolean hasStartTime() { + return startTime_ != null; + } + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return getStartTime(); + } + + public static final int LAST_UPDATE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp lastUpdateTime_; + /** + * + * + *
+   * Time of the most recent processing update.
+   * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + * + * @return Whether the lastUpdateTime field is set. + */ + @java.lang.Override + public boolean hasLastUpdateTime() { + return lastUpdateTime_ != null; + } + /** + * + * + *
+   * Time of the most recent processing update.
+   * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + * + * @return The lastUpdateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getLastUpdateTime() { + return lastUpdateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastUpdateTime_; + } + /** + * + * + *
+   * Time of the most recent processing update.
+   * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getLastUpdateTimeOrBuilder() { + return getLastUpdateTime(); + } + + public static final int PROGRESS_PERCENTAGE_FIELD_NUMBER = 3; + private double progressPercentage_; + /** + * + * + *
+   * The progress of the most recent processing update in percentage, ie. 70.0%.
+   * 
+ * + * double progress_percentage = 3; + * + * @return The progressPercentage. + */ + @java.lang.Override + public double getProgressPercentage() { + return progressPercentage_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (startTime_ != null) { + output.writeMessage(1, getStartTime()); + } + if (lastUpdateTime_ != null) { + output.writeMessage(2, getLastUpdateTime()); + } + if (java.lang.Double.doubleToRawLongBits(progressPercentage_) != 0) { + output.writeDouble(3, progressPercentage_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (startTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getStartTime()); + } + if (lastUpdateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getLastUpdateTime()); + } + if (java.lang.Double.doubleToRawLongBits(progressPercentage_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(3, progressPercentage_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata)) { + return super.equals(obj); + } + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata other = + (com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata) obj; + + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (hasLastUpdateTime() != other.hasLastUpdateTime()) return false; + if (hasLastUpdateTime()) { + if (!getLastUpdateTime().equals(other.getLastUpdateTime())) return false; + } + if (java.lang.Double.doubleToLongBits(getProgressPercentage()) + != java.lang.Double.doubleToLongBits(other.getProgressPercentage())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + if (hasLastUpdateTime()) { + hash = (37 * hash) + LAST_UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getLastUpdateTime().hashCode(); + } + hash = (37 * hash) + PROGRESS_PERCENTAGE_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getProgressPercentage())); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Metadata for response returned by the `SynthesizeLongAudio` method.
+   * 
+ * + * Protobuf type {@code google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata) + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata.class, + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata.Builder.class); + } + + // Construct using + // com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (startTimeBuilder_ == null) { + startTime_ = null; + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + if (lastUpdateTimeBuilder_ == null) { + lastUpdateTime_ = null; + } else { + lastUpdateTime_ = null; + lastUpdateTimeBuilder_ = null; + } + progressPercentage_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata + getDefaultInstanceForType() { + return com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata build() { + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata buildPartial() { + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata result = + new com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata(this); + if (startTimeBuilder_ == null) { + result.startTime_ = startTime_; + } else { + result.startTime_ = startTimeBuilder_.build(); + } + if (lastUpdateTimeBuilder_ == null) { + result.lastUpdateTime_ = lastUpdateTime_; + } else { + result.lastUpdateTime_ = lastUpdateTimeBuilder_.build(); + } + result.progressPercentage_ = progressPercentage_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata) { + return mergeFrom((com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata other) { + if (other + == com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata.getDefaultInstance()) + return this; + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + if (other.hasLastUpdateTime()) { + mergeLastUpdateTime(other.getLastUpdateTime()); + } + if (other.getProgressPercentage() != 0D) { + setProgressPercentage(other.getProgressPercentage()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getStartTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 10 + case 18: + { + input.readMessage(getLastUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + case 25: + { + progressPercentage_ = input.readDouble(); + + break; + } // case 25 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return startTimeBuilder_ != null || startTime_ != null; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + onChanged(); + } else { + startTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + onChanged(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (startTime_ != null) { + startTime_ = + com.google.protobuf.Timestamp.newBuilder(startTime_).mergeFrom(value).buildPartial(); + } else { + startTime_ = value; + } + onChanged(); + } else { + startTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder clearStartTime() { + if (startTimeBuilder_ == null) { + startTime_ = null; + onChanged(); + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + private com.google.protobuf.Timestamp lastUpdateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + lastUpdateTimeBuilder_; + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + * + * @return Whether the lastUpdateTime field is set. + */ + public boolean hasLastUpdateTime() { + return lastUpdateTimeBuilder_ != null || lastUpdateTime_ != null; + } + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + * + * @return The lastUpdateTime. + */ + public com.google.protobuf.Timestamp getLastUpdateTime() { + if (lastUpdateTimeBuilder_ == null) { + return lastUpdateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastUpdateTime_; + } else { + return lastUpdateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + public Builder setLastUpdateTime(com.google.protobuf.Timestamp value) { + if (lastUpdateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + lastUpdateTime_ = value; + onChanged(); + } else { + lastUpdateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + public Builder setLastUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (lastUpdateTimeBuilder_ == null) { + lastUpdateTime_ = builderForValue.build(); + onChanged(); + } else { + lastUpdateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + public Builder mergeLastUpdateTime(com.google.protobuf.Timestamp value) { + if (lastUpdateTimeBuilder_ == null) { + if (lastUpdateTime_ != null) { + lastUpdateTime_ = + com.google.protobuf.Timestamp.newBuilder(lastUpdateTime_) + .mergeFrom(value) + .buildPartial(); + } else { + lastUpdateTime_ = value; + } + onChanged(); + } else { + lastUpdateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + public Builder clearLastUpdateTime() { + if (lastUpdateTimeBuilder_ == null) { + lastUpdateTime_ = null; + onChanged(); + } else { + lastUpdateTime_ = null; + lastUpdateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getLastUpdateTimeBuilder() { + + onChanged(); + return getLastUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getLastUpdateTimeOrBuilder() { + if (lastUpdateTimeBuilder_ != null) { + return lastUpdateTimeBuilder_.getMessageOrBuilder(); + } else { + return lastUpdateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : lastUpdateTime_; + } + } + /** + * + * + *
+     * Time of the most recent processing update.
+     * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getLastUpdateTimeFieldBuilder() { + if (lastUpdateTimeBuilder_ == null) { + lastUpdateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getLastUpdateTime(), getParentForChildren(), isClean()); + lastUpdateTime_ = null; + } + return lastUpdateTimeBuilder_; + } + + private double progressPercentage_; + /** + * + * + *
+     * The progress of the most recent processing update in percentage, ie. 70.0%.
+     * 
+ * + * double progress_percentage = 3; + * + * @return The progressPercentage. + */ + @java.lang.Override + public double getProgressPercentage() { + return progressPercentage_; + } + /** + * + * + *
+     * The progress of the most recent processing update in percentage, ie. 70.0%.
+     * 
+ * + * double progress_percentage = 3; + * + * @param value The progressPercentage to set. + * @return This builder for chaining. + */ + public Builder setProgressPercentage(double value) { + + progressPercentage_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The progress of the most recent processing update in percentage, ie. 70.0%.
+     * 
+ * + * double progress_percentage = 3; + * + * @return This builder for chaining. + */ + public Builder clearProgressPercentage() { + + progressPercentage_ = 0D; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata) + private static final com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata(); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SynthesizeLongAudioMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioMetadataOrBuilder.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioMetadataOrBuilder.java new file mode 100644 index 000000000000..ef976b6e7069 --- /dev/null +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioMetadataOrBuilder.java @@ -0,0 +1,108 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto + +package com.google.cloud.texttospeech.v1beta1; + +public interface SynthesizeLongAudioMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); + + /** + * + * + *
+   * Time of the most recent processing update.
+   * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + * + * @return Whether the lastUpdateTime field is set. + */ + boolean hasLastUpdateTime(); + /** + * + * + *
+   * Time of the most recent processing update.
+   * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + * + * @return The lastUpdateTime. + */ + com.google.protobuf.Timestamp getLastUpdateTime(); + /** + * + * + *
+   * Time of the most recent processing update.
+   * 
+ * + * .google.protobuf.Timestamp last_update_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getLastUpdateTimeOrBuilder(); + + /** + * + * + *
+   * The progress of the most recent processing update in percentage, ie. 70.0%.
+   * 
+ * + * double progress_percentage = 3; + * + * @return The progressPercentage. + */ + double getProgressPercentage(); +} diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioRequest.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioRequest.java new file mode 100644 index 000000000000..3a49c0d32317 --- /dev/null +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioRequest.java @@ -0,0 +1,1675 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto + +package com.google.cloud.texttospeech.v1beta1; + +/** + * + * + *
+ * The top-level message sent by the client for the
+ * `SynthesizeLongAudio` method.
+ * 
+ * + * Protobuf type {@code google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest} + */ +public final class SynthesizeLongAudioRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) + SynthesizeLongAudioRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SynthesizeLongAudioRequest.newBuilder() to construct. + private SynthesizeLongAudioRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SynthesizeLongAudioRequest() { + parent_ = ""; + outputGcsUri_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SynthesizeLongAudioRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest.class, + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * The resource states of the request in the form of
+   * projects/*/locations/*/voices/*.
+   * 
+ * + * string parent = 1; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * The resource states of the request in the form of
+   * projects/*/locations/*/voices/*.
+   * 
+ * + * string parent = 1; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUT_FIELD_NUMBER = 2; + private com.google.cloud.texttospeech.v1beta1.SynthesisInput input_; + /** + * + * + *
+   * Required. The Synthesizer requires either plain text or SSML as input.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the input field is set. + */ + @java.lang.Override + public boolean hasInput() { + return input_ != null; + } + /** + * + * + *
+   * Required. The Synthesizer requires either plain text or SSML as input.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The input. + */ + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesisInput getInput() { + return input_ == null + ? com.google.cloud.texttospeech.v1beta1.SynthesisInput.getDefaultInstance() + : input_; + } + /** + * + * + *
+   * Required. The Synthesizer requires either plain text or SSML as input.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesisInputOrBuilder getInputOrBuilder() { + return getInput(); + } + + public static final int AUDIO_CONFIG_FIELD_NUMBER = 3; + private com.google.cloud.texttospeech.v1beta1.AudioConfig audioConfig_; + /** + * + * + *
+   * Required. The configuration of the synthesized audio.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the audioConfig field is set. + */ + @java.lang.Override + public boolean hasAudioConfig() { + return audioConfig_ != null; + } + /** + * + * + *
+   * Required. The configuration of the synthesized audio.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The audioConfig. + */ + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.AudioConfig getAudioConfig() { + return audioConfig_ == null + ? com.google.cloud.texttospeech.v1beta1.AudioConfig.getDefaultInstance() + : audioConfig_; + } + /** + * + * + *
+   * Required. The configuration of the synthesized audio.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.AudioConfigOrBuilder getAudioConfigOrBuilder() { + return getAudioConfig(); + } + + public static final int OUTPUT_GCS_URI_FIELD_NUMBER = 4; + private volatile java.lang.Object outputGcsUri_; + /** + * + * + *
+   * Specifies a Cloud Storage URI for the synthesis results. Must be
+   * specified in the format: `gs://bucket_name/object_name`, and the bucket
+   * must already exist.
+   * 
+ * + * string output_gcs_uri = 4; + * + * @return The outputGcsUri. + */ + @java.lang.Override + public java.lang.String getOutputGcsUri() { + java.lang.Object ref = outputGcsUri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + outputGcsUri_ = s; + return s; + } + } + /** + * + * + *
+   * Specifies a Cloud Storage URI for the synthesis results. Must be
+   * specified in the format: `gs://bucket_name/object_name`, and the bucket
+   * must already exist.
+   * 
+ * + * string output_gcs_uri = 4; + * + * @return The bytes for outputGcsUri. + */ + @java.lang.Override + public com.google.protobuf.ByteString getOutputGcsUriBytes() { + java.lang.Object ref = outputGcsUri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + outputGcsUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VOICE_FIELD_NUMBER = 5; + private com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice_; + /** + * + * + *
+   * The desired voice of the synthesized audio.
+   * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + * + * @return Whether the voice field is set. + */ + @java.lang.Override + public boolean hasVoice() { + return voice_ != null; + } + /** + * + * + *
+   * The desired voice of the synthesized audio.
+   * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + * + * @return The voice. + */ + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams getVoice() { + return voice_ == null + ? com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.getDefaultInstance() + : voice_; + } + /** + * + * + *
+   * The desired voice of the synthesized audio.
+   * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.VoiceSelectionParamsOrBuilder getVoiceOrBuilder() { + return getVoice(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (input_ != null) { + output.writeMessage(2, getInput()); + } + if (audioConfig_ != null) { + output.writeMessage(3, getAudioConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(outputGcsUri_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, outputGcsUri_); + } + if (voice_ != null) { + output.writeMessage(5, getVoice()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (input_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getInput()); + } + if (audioConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getAudioConfig()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(outputGcsUri_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, outputGcsUri_); + } + if (voice_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getVoice()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest)) { + return super.equals(obj); + } + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest other = + (com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasInput() != other.hasInput()) return false; + if (hasInput()) { + if (!getInput().equals(other.getInput())) return false; + } + if (hasAudioConfig() != other.hasAudioConfig()) return false; + if (hasAudioConfig()) { + if (!getAudioConfig().equals(other.getAudioConfig())) return false; + } + if (!getOutputGcsUri().equals(other.getOutputGcsUri())) return false; + if (hasVoice() != other.hasVoice()) return false; + if (hasVoice()) { + if (!getVoice().equals(other.getVoice())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasInput()) { + hash = (37 * hash) + INPUT_FIELD_NUMBER; + hash = (53 * hash) + getInput().hashCode(); + } + if (hasAudioConfig()) { + hash = (37 * hash) + AUDIO_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getAudioConfig().hashCode(); + } + hash = (37 * hash) + OUTPUT_GCS_URI_FIELD_NUMBER; + hash = (53 * hash) + getOutputGcsUri().hashCode(); + if (hasVoice()) { + hash = (37 * hash) + VOICE_FIELD_NUMBER; + hash = (53 * hash) + getVoice().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The top-level message sent by the client for the
+   * `SynthesizeLongAudio` method.
+   * 
+ * + * Protobuf type {@code google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest.class, + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest.Builder.class); + } + + // Construct using com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (inputBuilder_ == null) { + input_ = null; + } else { + input_ = null; + inputBuilder_ = null; + } + if (audioConfigBuilder_ == null) { + audioConfig_ = null; + } else { + audioConfig_ = null; + audioConfigBuilder_ = null; + } + outputGcsUri_ = ""; + + if (voiceBuilder_ == null) { + voice_ = null; + } else { + voice_ = null; + voiceBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest + getDefaultInstanceForType() { + return com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest build() { + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest buildPartial() { + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest result = + new com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest(this); + result.parent_ = parent_; + if (inputBuilder_ == null) { + result.input_ = input_; + } else { + result.input_ = inputBuilder_.build(); + } + if (audioConfigBuilder_ == null) { + result.audioConfig_ = audioConfig_; + } else { + result.audioConfig_ = audioConfigBuilder_.build(); + } + result.outputGcsUri_ = outputGcsUri_; + if (voiceBuilder_ == null) { + result.voice_ = voice_; + } else { + result.voice_ = voiceBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) { + return mergeFrom((com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest other) { + if (other + == com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasInput()) { + mergeInput(other.getInput()); + } + if (other.hasAudioConfig()) { + mergeAudioConfig(other.getAudioConfig()); + } + if (!other.getOutputGcsUri().isEmpty()) { + outputGcsUri_ = other.outputGcsUri_; + onChanged(); + } + if (other.hasVoice()) { + mergeVoice(other.getVoice()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + input.readMessage(getInputFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + case 26: + { + input.readMessage(getAudioConfigFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 26 + case 34: + { + outputGcsUri_ = input.readStringRequireUtf8(); + + break; + } // case 34 + case 42: + { + input.readMessage(getVoiceFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * The resource states of the request in the form of
+     * projects/*/locations/*/voices/*.
+     * 
+ * + * string parent = 1; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource states of the request in the form of
+     * projects/*/locations/*/voices/*.
+     * 
+ * + * string parent = 1; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource states of the request in the form of
+     * projects/*/locations/*/voices/*.
+     * 
+ * + * string parent = 1; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource states of the request in the form of
+     * projects/*/locations/*/voices/*.
+     * 
+ * + * string parent = 1; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource states of the request in the form of
+     * projects/*/locations/*/voices/*.
+     * 
+ * + * string parent = 1; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.texttospeech.v1beta1.SynthesisInput input_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.SynthesisInput, + com.google.cloud.texttospeech.v1beta1.SynthesisInput.Builder, + com.google.cloud.texttospeech.v1beta1.SynthesisInputOrBuilder> + inputBuilder_; + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the input field is set. + */ + public boolean hasInput() { + return inputBuilder_ != null || input_ != null; + } + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The input. + */ + public com.google.cloud.texttospeech.v1beta1.SynthesisInput getInput() { + if (inputBuilder_ == null) { + return input_ == null + ? com.google.cloud.texttospeech.v1beta1.SynthesisInput.getDefaultInstance() + : input_; + } else { + return inputBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInput(com.google.cloud.texttospeech.v1beta1.SynthesisInput value) { + if (inputBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + input_ = value; + onChanged(); + } else { + inputBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInput( + com.google.cloud.texttospeech.v1beta1.SynthesisInput.Builder builderForValue) { + if (inputBuilder_ == null) { + input_ = builderForValue.build(); + onChanged(); + } else { + inputBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeInput(com.google.cloud.texttospeech.v1beta1.SynthesisInput value) { + if (inputBuilder_ == null) { + if (input_ != null) { + input_ = + com.google.cloud.texttospeech.v1beta1.SynthesisInput.newBuilder(input_) + .mergeFrom(value) + .buildPartial(); + } else { + input_ = value; + } + onChanged(); + } else { + inputBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearInput() { + if (inputBuilder_ == null) { + input_ = null; + onChanged(); + } else { + input_ = null; + inputBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.texttospeech.v1beta1.SynthesisInput.Builder getInputBuilder() { + + onChanged(); + return getInputFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.texttospeech.v1beta1.SynthesisInputOrBuilder getInputOrBuilder() { + if (inputBuilder_ != null) { + return inputBuilder_.getMessageOrBuilder(); + } else { + return input_ == null + ? com.google.cloud.texttospeech.v1beta1.SynthesisInput.getDefaultInstance() + : input_; + } + } + /** + * + * + *
+     * Required. The Synthesizer requires either plain text or SSML as input.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.SynthesisInput, + com.google.cloud.texttospeech.v1beta1.SynthesisInput.Builder, + com.google.cloud.texttospeech.v1beta1.SynthesisInputOrBuilder> + getInputFieldBuilder() { + if (inputBuilder_ == null) { + inputBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.SynthesisInput, + com.google.cloud.texttospeech.v1beta1.SynthesisInput.Builder, + com.google.cloud.texttospeech.v1beta1.SynthesisInputOrBuilder>( + getInput(), getParentForChildren(), isClean()); + input_ = null; + } + return inputBuilder_; + } + + private com.google.cloud.texttospeech.v1beta1.AudioConfig audioConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.AudioConfig, + com.google.cloud.texttospeech.v1beta1.AudioConfig.Builder, + com.google.cloud.texttospeech.v1beta1.AudioConfigOrBuilder> + audioConfigBuilder_; + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the audioConfig field is set. + */ + public boolean hasAudioConfig() { + return audioConfigBuilder_ != null || audioConfig_ != null; + } + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The audioConfig. + */ + public com.google.cloud.texttospeech.v1beta1.AudioConfig getAudioConfig() { + if (audioConfigBuilder_ == null) { + return audioConfig_ == null + ? com.google.cloud.texttospeech.v1beta1.AudioConfig.getDefaultInstance() + : audioConfig_; + } else { + return audioConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAudioConfig(com.google.cloud.texttospeech.v1beta1.AudioConfig value) { + if (audioConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + audioConfig_ = value; + onChanged(); + } else { + audioConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAudioConfig( + com.google.cloud.texttospeech.v1beta1.AudioConfig.Builder builderForValue) { + if (audioConfigBuilder_ == null) { + audioConfig_ = builderForValue.build(); + onChanged(); + } else { + audioConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeAudioConfig(com.google.cloud.texttospeech.v1beta1.AudioConfig value) { + if (audioConfigBuilder_ == null) { + if (audioConfig_ != null) { + audioConfig_ = + com.google.cloud.texttospeech.v1beta1.AudioConfig.newBuilder(audioConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + audioConfig_ = value; + } + onChanged(); + } else { + audioConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearAudioConfig() { + if (audioConfigBuilder_ == null) { + audioConfig_ = null; + onChanged(); + } else { + audioConfig_ = null; + audioConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.texttospeech.v1beta1.AudioConfig.Builder getAudioConfigBuilder() { + + onChanged(); + return getAudioConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.texttospeech.v1beta1.AudioConfigOrBuilder getAudioConfigOrBuilder() { + if (audioConfigBuilder_ != null) { + return audioConfigBuilder_.getMessageOrBuilder(); + } else { + return audioConfig_ == null + ? com.google.cloud.texttospeech.v1beta1.AudioConfig.getDefaultInstance() + : audioConfig_; + } + } + /** + * + * + *
+     * Required. The configuration of the synthesized audio.
+     * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.AudioConfig, + com.google.cloud.texttospeech.v1beta1.AudioConfig.Builder, + com.google.cloud.texttospeech.v1beta1.AudioConfigOrBuilder> + getAudioConfigFieldBuilder() { + if (audioConfigBuilder_ == null) { + audioConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.AudioConfig, + com.google.cloud.texttospeech.v1beta1.AudioConfig.Builder, + com.google.cloud.texttospeech.v1beta1.AudioConfigOrBuilder>( + getAudioConfig(), getParentForChildren(), isClean()); + audioConfig_ = null; + } + return audioConfigBuilder_; + } + + private java.lang.Object outputGcsUri_ = ""; + /** + * + * + *
+     * Specifies a Cloud Storage URI for the synthesis results. Must be
+     * specified in the format: `gs://bucket_name/object_name`, and the bucket
+     * must already exist.
+     * 
+ * + * string output_gcs_uri = 4; + * + * @return The outputGcsUri. + */ + public java.lang.String getOutputGcsUri() { + java.lang.Object ref = outputGcsUri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + outputGcsUri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Specifies a Cloud Storage URI for the synthesis results. Must be
+     * specified in the format: `gs://bucket_name/object_name`, and the bucket
+     * must already exist.
+     * 
+ * + * string output_gcs_uri = 4; + * + * @return The bytes for outputGcsUri. + */ + public com.google.protobuf.ByteString getOutputGcsUriBytes() { + java.lang.Object ref = outputGcsUri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + outputGcsUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Specifies a Cloud Storage URI for the synthesis results. Must be
+     * specified in the format: `gs://bucket_name/object_name`, and the bucket
+     * must already exist.
+     * 
+ * + * string output_gcs_uri = 4; + * + * @param value The outputGcsUri to set. + * @return This builder for chaining. + */ + public Builder setOutputGcsUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + outputGcsUri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies a Cloud Storage URI for the synthesis results. Must be
+     * specified in the format: `gs://bucket_name/object_name`, and the bucket
+     * must already exist.
+     * 
+ * + * string output_gcs_uri = 4; + * + * @return This builder for chaining. + */ + public Builder clearOutputGcsUri() { + + outputGcsUri_ = getDefaultInstance().getOutputGcsUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies a Cloud Storage URI for the synthesis results. Must be
+     * specified in the format: `gs://bucket_name/object_name`, and the bucket
+     * must already exist.
+     * 
+ * + * string output_gcs_uri = 4; + * + * @param value The bytes for outputGcsUri to set. + * @return This builder for chaining. + */ + public Builder setOutputGcsUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + outputGcsUri_ = value; + onChanged(); + return this; + } + + private com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams, + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.Builder, + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParamsOrBuilder> + voiceBuilder_; + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + * + * @return Whether the voice field is set. + */ + public boolean hasVoice() { + return voiceBuilder_ != null || voice_ != null; + } + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + * + * @return The voice. + */ + public com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams getVoice() { + if (voiceBuilder_ == null) { + return voice_ == null + ? com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.getDefaultInstance() + : voice_; + } else { + return voiceBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + public Builder setVoice(com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams value) { + if (voiceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + voice_ = value; + onChanged(); + } else { + voiceBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + public Builder setVoice( + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.Builder builderForValue) { + if (voiceBuilder_ == null) { + voice_ = builderForValue.build(); + onChanged(); + } else { + voiceBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + public Builder mergeVoice(com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams value) { + if (voiceBuilder_ == null) { + if (voice_ != null) { + voice_ = + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.newBuilder(voice_) + .mergeFrom(value) + .buildPartial(); + } else { + voice_ = value; + } + onChanged(); + } else { + voiceBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + public Builder clearVoice() { + if (voiceBuilder_ == null) { + voice_ = null; + onChanged(); + } else { + voice_ = null; + voiceBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + public com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.Builder getVoiceBuilder() { + + onChanged(); + return getVoiceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + public com.google.cloud.texttospeech.v1beta1.VoiceSelectionParamsOrBuilder getVoiceOrBuilder() { + if (voiceBuilder_ != null) { + return voiceBuilder_.getMessageOrBuilder(); + } else { + return voice_ == null + ? com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.getDefaultInstance() + : voice_; + } + } + /** + * + * + *
+     * The desired voice of the synthesized audio.
+     * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams, + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.Builder, + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParamsOrBuilder> + getVoiceFieldBuilder() { + if (voiceBuilder_ == null) { + voiceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams, + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams.Builder, + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParamsOrBuilder>( + getVoice(), getParentForChildren(), isClean()); + voice_ = null; + } + return voiceBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) + private static final com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest(); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SynthesizeLongAudioRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioRequestOrBuilder.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioRequestOrBuilder.java new file mode 100644 index 000000000000..d86a0a0be53d --- /dev/null +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioRequestOrBuilder.java @@ -0,0 +1,198 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto + +package com.google.cloud.texttospeech.v1beta1; + +public interface SynthesizeLongAudioRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The resource states of the request in the form of
+   * projects/*/locations/*/voices/*.
+   * 
+ * + * string parent = 1; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * The resource states of the request in the form of
+   * projects/*/locations/*/voices/*.
+   * 
+ * + * string parent = 1; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The Synthesizer requires either plain text or SSML as input.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the input field is set. + */ + boolean hasInput(); + /** + * + * + *
+   * Required. The Synthesizer requires either plain text or SSML as input.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The input. + */ + com.google.cloud.texttospeech.v1beta1.SynthesisInput getInput(); + /** + * + * + *
+   * Required. The Synthesizer requires either plain text or SSML as input.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.texttospeech.v1beta1.SynthesisInputOrBuilder getInputOrBuilder(); + + /** + * + * + *
+   * Required. The configuration of the synthesized audio.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the audioConfig field is set. + */ + boolean hasAudioConfig(); + /** + * + * + *
+   * Required. The configuration of the synthesized audio.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The audioConfig. + */ + com.google.cloud.texttospeech.v1beta1.AudioConfig getAudioConfig(); + /** + * + * + *
+   * Required. The configuration of the synthesized audio.
+   * 
+ * + * + * .google.cloud.texttospeech.v1beta1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.texttospeech.v1beta1.AudioConfigOrBuilder getAudioConfigOrBuilder(); + + /** + * + * + *
+   * Specifies a Cloud Storage URI for the synthesis results. Must be
+   * specified in the format: `gs://bucket_name/object_name`, and the bucket
+   * must already exist.
+   * 
+ * + * string output_gcs_uri = 4; + * + * @return The outputGcsUri. + */ + java.lang.String getOutputGcsUri(); + /** + * + * + *
+   * Specifies a Cloud Storage URI for the synthesis results. Must be
+   * specified in the format: `gs://bucket_name/object_name`, and the bucket
+   * must already exist.
+   * 
+ * + * string output_gcs_uri = 4; + * + * @return The bytes for outputGcsUri. + */ + com.google.protobuf.ByteString getOutputGcsUriBytes(); + + /** + * + * + *
+   * The desired voice of the synthesized audio.
+   * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + * + * @return Whether the voice field is set. + */ + boolean hasVoice(); + /** + * + * + *
+   * The desired voice of the synthesized audio.
+   * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + * + * @return The voice. + */ + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams getVoice(); + /** + * + * + *
+   * The desired voice of the synthesized audio.
+   * 
+ * + * .google.cloud.texttospeech.v1beta1.VoiceSelectionParams voice = 5; + */ + com.google.cloud.texttospeech.v1beta1.VoiceSelectionParamsOrBuilder getVoiceOrBuilder(); +} diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioResponse.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioResponse.java new file mode 100644 index 000000000000..c9c24a9105b7 --- /dev/null +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioResponse.java @@ -0,0 +1,445 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto + +package com.google.cloud.texttospeech.v1beta1; + +/** + * + * + *
+ * The message returned to the client by the `SynthesizeLongAudio` method.
+ * 
+ * + * Protobuf type {@code google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse} + */ +public final class SynthesizeLongAudioResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse) + SynthesizeLongAudioResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use SynthesizeLongAudioResponse.newBuilder() to construct. + private SynthesizeLongAudioResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SynthesizeLongAudioResponse() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SynthesizeLongAudioResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse.class, + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse)) { + return super.equals(obj); + } + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse other = + (com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The message returned to the client by the `SynthesizeLongAudio` method.
+   * 
+ * + * Protobuf type {@code google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse) + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse.class, + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse.Builder.class); + } + + // Construct using + // com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesisProto + .internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse + getDefaultInstanceForType() { + return com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse build() { + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse buildPartial() { + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse result = + new com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse) { + return mergeFrom((com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse other) { + if (other + == com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse) + private static final com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse(); + } + + public static com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SynthesizeLongAudioResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioResponseOrBuilder.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioResponseOrBuilder.java new file mode 100644 index 000000000000..12d5eb1ad162 --- /dev/null +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/SynthesizeLongAudioResponseOrBuilder.java @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto + +package com.google.cloud.texttospeech.v1beta1; + +public interface SynthesizeLongAudioResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse) + com.google.protobuf.MessageOrBuilder {} diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesisProto.java b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesisProto.java new file mode 100644 index 000000000000..1262cb3f2c52 --- /dev/null +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/java/com/google/cloud/texttospeech/v1beta1/TextToSpeechLongAudioSynthesisProto.java @@ -0,0 +1,140 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto + +package com.google.cloud.texttospeech.v1beta1; + +public final class TextToSpeechLongAudioSynthesisProto { + private TextToSpeechLongAudioSynthesisProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n5google/cloud/texttospeech/v1beta1/clou" + + "d_tts_lrs.proto\022!google.cloud.texttospee" + + "ch.v1beta1\032\034google/api/annotations.proto" + + "\032\027google/api/client.proto\032\037google/api/fi" + + "eld_behavior.proto\0321google/cloud/texttos" + + "peech/v1beta1/cloud_tts.proto\032#google/lo" + + "ngrunning/operations.proto\032\037google/proto" + + "buf/timestamp.proto\"\236\002\n\032SynthesizeLongAu" + + "dioRequest\022\016\n\006parent\030\001 \001(\t\022E\n\005input\030\002 \001(" + + "\01321.google.cloud.texttospeech.v1beta1.Sy" + + "nthesisInputB\003\340A\002\022I\n\014audio_config\030\003 \001(\0132" + + "..google.cloud.texttospeech.v1beta1.Audi" + + "oConfigB\003\340A\002\022\026\n\016output_gcs_uri\030\004 \001(\t\022F\n\005" + + "voice\030\005 \001(\01327.google.cloud.texttospeech." + + "v1beta1.VoiceSelectionParams\"\035\n\033Synthesi" + + "zeLongAudioResponse\"\240\001\n\033SynthesizeLongAu" + + "dioMetadata\022.\n\nstart_time\030\001 \001(\0132\032.google" + + ".protobuf.Timestamp\0224\n\020last_update_time\030" + + "\002 \001(\0132\032.google.protobuf.Timestamp\022\033\n\023pro" + + "gress_percentage\030\003 \001(\0012\370\002\n\037TextToSpeechL" + + "ongAudioSynthesize\022\203\002\n\023SynthesizeLongAud" + + "io\022=.google.cloud.texttospeech.v1beta1.S" + + "ynthesizeLongAudioRequest\032\035.google.longr" + + "unning.Operation\"\215\001\202\323\344\223\002J\"E/v1beta1/{par" + + "ent=projects/*/locations/*/voices/*}:Syn" + + "thesizeLongAudio:\001*\312A:\n\033SynthesizeLongAu" + + "dioResponse\022\033SynthesizeLongAudioMetadata" + + "\032O\312A\033texttospeech.googleapis.com\322A.https" + + "://www.googleapis.com/auth/cloud-platfor" + + "mB\217\002\n%com.google.cloud.texttospeech.v1be" + + "ta1B#TextToSpeechLongAudioSynthesisProto" + + "P\001ZMgoogle.golang.org/genproto/googleapi" + + "s/cloud/texttospeech/v1beta1;texttospeec" + + "h\370\001\001\252\002!Google.Cloud.TextToSpeech.V1Beta1" + + "\312\002!Google\\Cloud\\TextToSpeech\\V1beta1\352\002$G" + + "oogle::Cloud::TextToSpeech::V1beta1b\006pro" + + "to3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.cloud.texttospeech.v1beta1.TextToSpeechProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioRequest_descriptor, + new java.lang.String[] { + "Parent", "Input", "AudioConfig", "OutputGcsUri", "Voice", + }); + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioResponse_descriptor, + new java.lang.String[] {}); + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_texttospeech_v1beta1_SynthesizeLongAudioMetadata_descriptor, + new java.lang.String[] { + "StartTime", "LastUpdateTime", "ProgressPercentage", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.cloud.texttospeech.v1beta1.TextToSpeechProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/proto/google/cloud/texttospeech/v1beta1/cloud_tts.proto b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/proto/google/cloud/texttospeech/v1beta1/cloud_tts.proto index 4fdd68b206f3..63e5361dc0ab 100644 --- a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/proto/google/cloud/texttospeech/v1beta1/cloud_tts.proto +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/proto/google/cloud/texttospeech/v1beta1/cloud_tts.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -58,19 +58,6 @@ service TextToSpeech { } } -// The top-level message sent by the client for the `ListVoices` method. -message ListVoicesRequest { - // Optional. Recommended. - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - // If not specified, the API will return all supported voices. - // If specified, the ListVoices call will only return voices that can be used - // to synthesize this language_code. For example, if you specify `"en-NZ"`, - // all `"en-NZ"` voices will be returned. If you specify `"no"`, both - // `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be - // returned. - string language_code = 1 [(google.api.field_behavior) = OPTIONAL]; -} - // Gender of the voice as described in // [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). enum SsmlVoiceGender { @@ -94,7 +81,7 @@ enum SsmlVoiceGender { // Configuration to set up audio encoder. The encoding determines the output // audio format that we'd like. enum AudioEncoding { - // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][]. + // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. AUDIO_ENCODING_UNSPECIFIED = 0; // Uncompressed 16-bit signed little-endian samples (Linear PCM). @@ -122,6 +109,19 @@ enum AudioEncoding { ALAW = 6; } +// The top-level message sent by the client for the `ListVoices` method. +message ListVoicesRequest { + // Optional. Recommended. + // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + // If not specified, the API will return all supported voices. + // If specified, the ListVoices call will only return voices that can be used + // to synthesize this language_code. For example, if you specify `"en-NZ"`, + // all `"en-NZ"` voices will be returned. If you specify `"no"`, both + // `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + // returned. + string language_code = 1 [(google.api.field_behavior) = OPTIONAL]; +} + // The message returned to the client by the `ListVoices` method. message ListVoicesResponse { // The list of voices. @@ -171,8 +171,8 @@ message SynthesizeSpeechRequest { // Contains text input to be synthesized. Either `text` or `ssml` must be // supplied. Supplying both or neither returns -// [google.rpc.Code.INVALID_ARGUMENT][]. The input size is limited to 5000 -// characters. +// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. The input size is limited to 5000 +// bytes. message SynthesisInput { // The input source, which is either plain text or SSML. oneof input_source { @@ -181,7 +181,7 @@ message SynthesisInput { // The SSML document to be synthesized. The SSML document must be valid // and well-formed. Otherwise the RPC will fail and return - // [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For more information, see // [SSML](https://cloud.google.com/text-to-speech/docs/ssml). string ssml = 2; } @@ -260,7 +260,7 @@ message AudioConfig { // converting to the desired sample rate (which might result in worse audio // quality), unless the specified sample rate is not supported for the // encoding chosen, in which case it will fail the request and return - // [google.rpc.Code.INVALID_ARGUMENT][]. + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. int32 sample_rate_hertz = 5 [(google.api.field_behavior) = OPTIONAL]; // Optional. Input only. An identifier which selects 'audio effects' profiles diff --git a/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/proto/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/proto/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto new file mode 100644 index 000000000000..9adcd6ae6005 --- /dev/null +++ b/java-texttospeech/proto-google-cloud-texttospeech-v1beta1/src/main/proto/google/cloud/texttospeech/v1beta1/cloud_tts_lrs.proto @@ -0,0 +1,90 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.texttospeech.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/texttospeech/v1beta1/cloud_tts.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.TextToSpeech.V1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1;texttospeech"; +option java_multiple_files = true; +option java_outer_classname = "TextToSpeechLongAudioSynthesisProto"; +option java_package = "com.google.cloud.texttospeech.v1beta1"; +option php_namespace = "Google\\Cloud\\TextToSpeech\\V1beta1"; +option ruby_package = "Google::Cloud::TextToSpeech::V1beta1"; + +// Service that implements Google Cloud Text-to-Speech API. +service TextToSpeechLongAudioSynthesize { + option (google.api.default_host) = "texttospeech.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Synthesizes long form text asynchronously. + rpc SynthesizeLongAudio(SynthesizeLongAudioRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta1/{parent=projects/*/locations/*/voices/*}:SynthesizeLongAudio" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "SynthesizeLongAudioResponse" + metadata_type: "SynthesizeLongAudioMetadata" + }; + } +} + +// The top-level message sent by the client for the +// `SynthesizeLongAudio` method. +message SynthesizeLongAudioRequest { + // The resource states of the request in the form of + // projects/*/locations/*/voices/*. + string parent = 1; + + // Required. The Synthesizer requires either plain text or SSML as input. + SynthesisInput input = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The configuration of the synthesized audio. + AudioConfig audio_config = 3 [(google.api.field_behavior) = REQUIRED]; + + // Specifies a Cloud Storage URI for the synthesis results. Must be + // specified in the format: `gs://bucket_name/object_name`, and the bucket + // must already exist. + string output_gcs_uri = 4; + + // The desired voice of the synthesized audio. + VoiceSelectionParams voice = 5; +} + +// The message returned to the client by the `SynthesizeLongAudio` method. +message SynthesizeLongAudioResponse {} + +// Metadata for response returned by the `SynthesizeLongAudio` method. +message SynthesizeLongAudioMetadata { + // Time when the request was received. + google.protobuf.Timestamp start_time = 1; + + // Time of the most recent processing update. + google.protobuf.Timestamp last_update_time = 2; + + // The progress of the most recent processing update in percentage, ie. 70.0%. + double progress_percentage = 3; +} diff --git a/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/stub/texttospeechlongaudiosynthesizestubsettings/synthesizelongaudio/SyncSynthesizeLongAudio.java b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/stub/texttospeechlongaudiosynthesizestubsettings/synthesizelongaudio/SyncSynthesizeLongAudio.java new file mode 100644 index 000000000000..4e3147c9fd9c --- /dev/null +++ b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/stub/texttospeechlongaudiosynthesizestubsettings/synthesizelongaudio/SyncSynthesizeLongAudio.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.stub.samples; + +// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesizeStubSettings_SynthesizeLongAudio_sync] +import com.google.cloud.texttospeech.v1beta1.stub.TextToSpeechLongAudioSynthesizeStubSettings; +import java.time.Duration; + +public class SyncSynthesizeLongAudio { + + public static void main(String[] args) throws Exception { + syncSynthesizeLongAudio(); + } + + public static void syncSynthesizeLongAudio() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TextToSpeechLongAudioSynthesizeStubSettings.Builder + textToSpeechLongAudioSynthesizeSettingsBuilder = + TextToSpeechLongAudioSynthesizeStubSettings.newBuilder(); + textToSpeechLongAudioSynthesizeSettingsBuilder + .synthesizeLongAudioSettings() + .setRetrySettings( + textToSpeechLongAudioSynthesizeSettingsBuilder + .synthesizeLongAudioSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TextToSpeechLongAudioSynthesizeStubSettings textToSpeechLongAudioSynthesizeSettings = + textToSpeechLongAudioSynthesizeSettingsBuilder.build(); + } +} +// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesizeStubSettings_SynthesizeLongAudio_sync] diff --git a/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetCredentialsProvider.java b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..3cca937e4768 --- /dev/null +++ b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.samples; + +// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeClient; +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeSettings; +import com.google.cloud.texttospeech.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings = + TextToSpeechLongAudioSynthesizeSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = + TextToSpeechLongAudioSynthesizeClient.create(textToSpeechLongAudioSynthesizeSettings); + } +} +// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_Create_SetCredentialsProvider_sync] diff --git a/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetCredentialsProvider1.java b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..72459051f971 --- /dev/null +++ b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.samples; + +// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_Create_SetCredentialsProvider1_sync] +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeClient; +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings = + TextToSpeechLongAudioSynthesizeSettings.newHttpJsonBuilder().build(); + TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = + TextToSpeechLongAudioSynthesizeClient.create(textToSpeechLongAudioSynthesizeSettings); + } +} +// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_Create_SetCredentialsProvider1_sync] diff --git a/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetEndpoint.java b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..55e7b73876b0 --- /dev/null +++ b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/create/SyncCreateSetEndpoint.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.samples; + +// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_Create_SetEndpoint_sync] +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeClient; +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeSettings; +import com.google.cloud.texttospeech.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings = + TextToSpeechLongAudioSynthesizeSettings.newBuilder().setEndpoint(myEndpoint).build(); + TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = + TextToSpeechLongAudioSynthesizeClient.create(textToSpeechLongAudioSynthesizeSettings); + } +} +// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_Create_SetEndpoint_sync] diff --git a/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/AsyncSynthesizeLongAudio.java b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/AsyncSynthesizeLongAudio.java new file mode 100644 index 000000000000..fe43575ca8fb --- /dev/null +++ b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/AsyncSynthesizeLongAudio.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.samples; + +// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.texttospeech.v1beta1.AudioConfig; +import com.google.cloud.texttospeech.v1beta1.SynthesisInput; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest; +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeClient; +import com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams; +import com.google.longrunning.Operation; + +public class AsyncSynthesizeLongAudio { + + public static void main(String[] args) throws Exception { + asyncSynthesizeLongAudio(); + } + + public static void asyncSynthesizeLongAudio() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = + TextToSpeechLongAudioSynthesizeClient.create()) { + SynthesizeLongAudioRequest request = + SynthesizeLongAudioRequest.newBuilder() + .setParent("parent-995424086") + .setInput(SynthesisInput.newBuilder().build()) + .setAudioConfig(AudioConfig.newBuilder().build()) + .setOutputGcsUri("outputGcsUri-489598154") + .setVoice(VoiceSelectionParams.newBuilder().build()) + .build(); + ApiFuture future = + textToSpeechLongAudioSynthesizeClient.synthesizeLongAudioCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_async] diff --git a/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/AsyncSynthesizeLongAudioLRO.java b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/AsyncSynthesizeLongAudioLRO.java new file mode 100644 index 000000000000..cd2f7a3f1257 --- /dev/null +++ b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/AsyncSynthesizeLongAudioLRO.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.samples; + +// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.texttospeech.v1beta1.AudioConfig; +import com.google.cloud.texttospeech.v1beta1.SynthesisInput; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioMetadata; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse; +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeClient; +import com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams; + +public class AsyncSynthesizeLongAudioLRO { + + public static void main(String[] args) throws Exception { + asyncSynthesizeLongAudioLRO(); + } + + public static void asyncSynthesizeLongAudioLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = + TextToSpeechLongAudioSynthesizeClient.create()) { + SynthesizeLongAudioRequest request = + SynthesizeLongAudioRequest.newBuilder() + .setParent("parent-995424086") + .setInput(SynthesisInput.newBuilder().build()) + .setAudioConfig(AudioConfig.newBuilder().build()) + .setOutputGcsUri("outputGcsUri-489598154") + .setVoice(VoiceSelectionParams.newBuilder().build()) + .build(); + OperationFuture future = + textToSpeechLongAudioSynthesizeClient + .synthesizeLongAudioOperationCallable() + .futureCall(request); + // Do something. + SynthesizeLongAudioResponse response = future.get(); + } + } +} +// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_LRO_async] diff --git a/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/SyncSynthesizeLongAudio.java b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/SyncSynthesizeLongAudio.java new file mode 100644 index 000000000000..5717f32a2bab --- /dev/null +++ b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesize/synthesizelongaudio/SyncSynthesizeLongAudio.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.samples; + +// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync] +import com.google.cloud.texttospeech.v1beta1.AudioConfig; +import com.google.cloud.texttospeech.v1beta1.SynthesisInput; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioRequest; +import com.google.cloud.texttospeech.v1beta1.SynthesizeLongAudioResponse; +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeClient; +import com.google.cloud.texttospeech.v1beta1.VoiceSelectionParams; + +public class SyncSynthesizeLongAudio { + + public static void main(String[] args) throws Exception { + syncSynthesizeLongAudio(); + } + + public static void syncSynthesizeLongAudio() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TextToSpeechLongAudioSynthesizeClient textToSpeechLongAudioSynthesizeClient = + TextToSpeechLongAudioSynthesizeClient.create()) { + SynthesizeLongAudioRequest request = + SynthesizeLongAudioRequest.newBuilder() + .setParent("parent-995424086") + .setInput(SynthesisInput.newBuilder().build()) + .setAudioConfig(AudioConfig.newBuilder().build()) + .setOutputGcsUri("outputGcsUri-489598154") + .setVoice(VoiceSelectionParams.newBuilder().build()) + .build(); + SynthesizeLongAudioResponse response = + textToSpeechLongAudioSynthesizeClient.synthesizeLongAudioAsync(request).get(); + } + } +} +// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync] diff --git a/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesizesettings/synthesizelongaudio/SyncSynthesizeLongAudio.java b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesizesettings/synthesizelongaudio/SyncSynthesizeLongAudio.java new file mode 100644 index 000000000000..03f1874d68a0 --- /dev/null +++ b/java-texttospeech/samples/snippets/generated/com/google/cloud/texttospeech/v1beta1/texttospeechlongaudiosynthesizesettings/synthesizelongaudio/SyncSynthesizeLongAudio.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.texttospeech.v1beta1.samples; + +// [START texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesizeSettings_SynthesizeLongAudio_sync] +import com.google.cloud.texttospeech.v1beta1.TextToSpeechLongAudioSynthesizeSettings; +import java.time.Duration; + +public class SyncSynthesizeLongAudio { + + public static void main(String[] args) throws Exception { + syncSynthesizeLongAudio(); + } + + public static void syncSynthesizeLongAudio() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TextToSpeechLongAudioSynthesizeSettings.Builder textToSpeechLongAudioSynthesizeSettingsBuilder = + TextToSpeechLongAudioSynthesizeSettings.newBuilder(); + textToSpeechLongAudioSynthesizeSettingsBuilder + .synthesizeLongAudioSettings() + .setRetrySettings( + textToSpeechLongAudioSynthesizeSettingsBuilder + .synthesizeLongAudioSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TextToSpeechLongAudioSynthesizeSettings textToSpeechLongAudioSynthesizeSettings = + textToSpeechLongAudioSynthesizeSettingsBuilder.build(); + } +} +// [END texttospeech_v1beta1_generated_TextToSpeechLongAudioSynthesizeSettings_SynthesizeLongAudio_sync]