diff --git a/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/SpeechClient.java b/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/SpeechClient.java index 64b7be25c..bca8ce282 100644 --- a/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/SpeechClient.java +++ b/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/SpeechClient.java @@ -37,6 +37,14 @@ *
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 + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognitionConfig config = RecognitionConfig.newBuilder().build(); + * RecognitionAudio audio = RecognitionAudio.newBuilder().build(); + * RecognizeResponse response = speechClient.recognize(config, audio); + * } + * }+ * *
Note: close() needs to be called on the SpeechClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -149,6 +157,16 @@ public final OperationsClient getOperationsClient() { * Performs synchronous speech recognition: receive results after all audio has been sent and * processed. * + *
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognitionConfig config = RecognitionConfig.newBuilder().build(); + * RecognitionAudio audio = RecognitionAudio.newBuilder().build(); + * RecognizeResponse response = speechClient.recognize(config, audio); + * } + * }+ * * @param config Required. Provides information to the recognizer that specifies how to process * the request. * @param audio Required. The audio data to be recognized. @@ -165,6 +183,19 @@ public final RecognizeResponse recognize(RecognitionConfig config, RecognitionAu * Performs synchronous speech recognition: receive results after all audio has been sent and * processed. * + *
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognizeRequest request = + * RecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * RecognizeResponse response = speechClient.recognize(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -178,6 +209,19 @@ public final RecognizeResponse recognize(RecognizeRequest request) { * processed. * *
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognizeRequest request = + * RecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = speechClient.recognizeCallable().futureCall(request); + * // Do something. + * RecognizeResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognitionConfig config = RecognitionConfig.newBuilder().build(); + * RecognitionAudio audio = RecognitionAudio.newBuilder().build(); + * LongRunningRecognizeResponse response = + * speechClient.longRunningRecognizeAsync(config, audio).get(); + * } + * }+ * * @param config Required. Provides information to the recognizer that specifies how to process * the request. * @param audio Required. The audio data to be recognized. @@ -209,6 +264,19 @@ public final UnaryCallable
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * LongRunningRecognizeRequest request = + * LongRunningRecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * LongRunningRecognizeResponse response = speechClient.longRunningRecognizeAsync(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 */ @@ -225,6 +293,20 @@ public final UnaryCallable
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * LongRunningRecognizeRequest request = + * LongRunningRecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * OperationFuture*/ public final OperationCallable< LongRunningRecognizeRequest, LongRunningRecognizeResponse, LongRunningRecognizeMetadata> @@ -240,6 +322,19 @@ public final UnaryCallablefuture = + * speechClient.longRunningRecognizeOperationCallable().futureCall(request); + * // Do something. + * LongRunningRecognizeResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * LongRunningRecognizeRequest request = + * LongRunningRecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = speechClient.longRunningRecognizeCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * BidiStream*/ public final BidiStreamingCallablebidiStream = + * speechClient.streamingRecognizeCallable().call(); + * StreamingRecognizeRequest request = StreamingRecognizeRequest.newBuilder().build(); + * bidiStream.send(request); + * for (StreamingRecognizeResponse response : bidiStream) { + * // Do something when a response is received. + * } + * } + * }
Service Description: Service that implements Google Cloud Speech API. * *
Sample for SpeechClient: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognitionConfig config = RecognitionConfig.newBuilder().build(); + * RecognitionAudio audio = RecognitionAudio.newBuilder().build(); + * RecognizeResponse response = speechClient.recognize(config, audio); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.speech.v1; diff --git a/google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechClient.java b/google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechClient.java index 64bf21ffd..7a950c180 100644 --- a/google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechClient.java +++ b/google-cloud-speech/src/main/java/com/google/cloud/speech/v1p1beta1/SpeechClient.java @@ -37,6 +37,14 @@ *
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 + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognitionConfig config = RecognitionConfig.newBuilder().build(); + * RecognitionAudio audio = RecognitionAudio.newBuilder().build(); + * RecognizeResponse response = speechClient.recognize(config, audio); + * } + * }+ * *
Note: close() needs to be called on the SpeechClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -150,6 +158,16 @@ public final OperationsClient getOperationsClient() { * Performs synchronous speech recognition: receive results after all audio has been sent and * processed. * + *
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognitionConfig config = RecognitionConfig.newBuilder().build(); + * RecognitionAudio audio = RecognitionAudio.newBuilder().build(); + * RecognizeResponse response = speechClient.recognize(config, audio); + * } + * }+ * * @param config Required. Provides information to the recognizer that specifies how to process * the request. * @param audio Required. The audio data to be recognized. @@ -166,6 +184,19 @@ public final RecognizeResponse recognize(RecognitionConfig config, RecognitionAu * Performs synchronous speech recognition: receive results after all audio has been sent and * processed. * + *
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognizeRequest request = + * RecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * RecognizeResponse response = speechClient.recognize(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -179,6 +210,19 @@ public final RecognizeResponse recognize(RecognizeRequest request) { * processed. * *
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognizeRequest request = + * RecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = speechClient.recognizeCallable().futureCall(request); + * // Do something. + * RecognizeResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognitionConfig config = RecognitionConfig.newBuilder().build(); + * RecognitionAudio audio = RecognitionAudio.newBuilder().build(); + * LongRunningRecognizeResponse response = + * speechClient.longRunningRecognizeAsync(config, audio).get(); + * } + * }+ * * @param config Required. Provides information to the recognizer that specifies how to process * the request. * @param audio Required. The audio data to be recognized. @@ -210,6 +265,19 @@ public final UnaryCallable
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * LongRunningRecognizeRequest request = + * LongRunningRecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * LongRunningRecognizeResponse response = speechClient.longRunningRecognizeAsync(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 */ @@ -226,6 +294,20 @@ public final UnaryCallable
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * LongRunningRecognizeRequest request = + * LongRunningRecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * OperationFuture*/ public final OperationCallable< LongRunningRecognizeRequest, LongRunningRecognizeResponse, LongRunningRecognizeMetadata> @@ -241,6 +323,19 @@ public final UnaryCallablefuture = + * speechClient.longRunningRecognizeOperationCallable().futureCall(request); + * // Do something. + * LongRunningRecognizeResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * LongRunningRecognizeRequest request = + * LongRunningRecognizeRequest.newBuilder() + * .setConfig(RecognitionConfig.newBuilder().build()) + * .setAudio(RecognitionAudio.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = speechClient.longRunningRecognizeCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * BidiStream*/ public final BidiStreamingCallablebidiStream = + * speechClient.streamingRecognizeCallable().call(); + * StreamingRecognizeRequest request = StreamingRecognizeRequest.newBuilder().build(); + * bidiStream.send(request); + * for (StreamingRecognizeResponse response : bidiStream) { + * // Do something when a response is received. + * } + * } + * }
Service Description: Service that implements Google Cloud Speech API. * *
Sample for SpeechClient: + * + *
{@code + * try (SpeechClient speechClient = SpeechClient.create()) { + * RecognitionConfig config = RecognitionConfig.newBuilder().build(); + * RecognitionAudio audio = RecognitionAudio.newBuilder().build(); + * RecognizeResponse response = speechClient.recognize(config, audio); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.speech.v1p1beta1; diff --git a/synth.metadata b/synth.metadata index b05eb7894..05887fa01 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,23 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-speech.git", - "sha": "11e873e9ff047bb02881be8633c047e091fb27ce" + "sha": "c99e52c7e034fd061f5ce5f16991a9aaa6e46bd6" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {