Class SpeechClient (4.37.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

Service Description: Enables speech transcription and resource management.

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:


 // 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
   Recognizer response = speechClient.getRecognizer(name);
 }
 

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().

Methods
Method Description Method Variants

CreateRecognizer

Creates a Recognizer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createRecognizerAsync(CreateRecognizerRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createRecognizerAsync(LocationName parent, Recognizer recognizer, String recognizerId)

  • createRecognizerAsync(String parent, Recognizer recognizer, String recognizerId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createRecognizerOperationCallable()

  • createRecognizerCallable()

ListRecognizers

Lists Recognizers.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listRecognizers(ListRecognizersRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listRecognizers(LocationName parent)

  • listRecognizers(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listRecognizersPagedCallable()

  • listRecognizersCallable()

GetRecognizer

Returns the requested Recognizer. Fails with NOT_FOUND if the requested Recognizer doesn't exist.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getRecognizer(GetRecognizerRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getRecognizer(RecognizerName name)

  • getRecognizer(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getRecognizerCallable()

UpdateRecognizer

Updates the Recognizer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateRecognizerAsync(UpdateRecognizerRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updateRecognizerAsync(Recognizer recognizer, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateRecognizerOperationCallable()

  • updateRecognizerCallable()

DeleteRecognizer

Deletes the Recognizer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteRecognizerAsync(DeleteRecognizerRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteRecognizerAsync(RecognizerName name)

  • deleteRecognizerAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteRecognizerOperationCallable()

  • deleteRecognizerCallable()

UndeleteRecognizer

Undeletes the Recognizer.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • undeleteRecognizerAsync(UndeleteRecognizerRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • undeleteRecognizerAsync(RecognizerName name)

  • undeleteRecognizerAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • undeleteRecognizerOperationCallable()

  • undeleteRecognizerCallable()

Recognize

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • recognize(RecognizeRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • recognize(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, ByteString content)

  • recognize(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, String uri)

  • recognize(String recognizer, RecognitionConfig config, FieldMask configMask, ByteString content)

  • recognize(String recognizer, RecognitionConfig config, FieldMask configMask, String uri)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • recognizeCallable()

StreamingRecognize

Performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST).

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • streamingRecognizeCallable()

BatchRecognize

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchRecognizeAsync(BatchRecognizeRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • batchRecognizeAsync(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, List<BatchRecognizeFileMetadata> files)

  • batchRecognizeAsync(String recognizer, RecognitionConfig config, FieldMask configMask, List<BatchRecognizeFileMetadata> files)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchRecognizeOperationCallable()

  • batchRecognizeCallable()

GetConfig

Returns the requested Config.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getConfig(GetConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getConfig(ConfigName name)

  • getConfig(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getConfigCallable()

UpdateConfig

Updates the Config.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateConfig(UpdateConfigRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateConfig(Config config, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateConfigCallable()

CreateCustomClass

Creates a CustomClass.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createCustomClassAsync(CreateCustomClassRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createCustomClassAsync(LocationName parent, CustomClass customClass, String customClassId)

  • createCustomClassAsync(String parent, CustomClass customClass, String customClassId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createCustomClassOperationCallable()

  • createCustomClassCallable()

ListCustomClasses

Lists CustomClasses.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listCustomClasses(ListCustomClassesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listCustomClasses(LocationName parent)

  • listCustomClasses(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listCustomClassesPagedCallable()

  • listCustomClassesCallable()

GetCustomClass

Returns the requested CustomClass.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getCustomClass(GetCustomClassRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getCustomClass(CustomClassName name)

  • getCustomClass(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCustomClassCallable()

UpdateCustomClass

Updates the CustomClass.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateCustomClassAsync(UpdateCustomClassRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updateCustomClassAsync(CustomClass customClass, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateCustomClassOperationCallable()

  • updateCustomClassCallable()

DeleteCustomClass

Deletes the CustomClass.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteCustomClassAsync(DeleteCustomClassRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteCustomClassAsync(CustomClassName name)

  • deleteCustomClassAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteCustomClassOperationCallable()

  • deleteCustomClassCallable()

UndeleteCustomClass

Undeletes the CustomClass.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • undeleteCustomClassAsync(UndeleteCustomClassRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • undeleteCustomClassAsync(CustomClassName name)

  • undeleteCustomClassAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • undeleteCustomClassOperationCallable()

  • undeleteCustomClassCallable()

CreatePhraseSet

Creates a PhraseSet.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createPhraseSetAsync(CreatePhraseSetRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createPhraseSetAsync(LocationName parent, PhraseSet phraseSet, String phraseSetId)

  • createPhraseSetAsync(String parent, PhraseSet phraseSet, String phraseSetId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createPhraseSetOperationCallable()

  • createPhraseSetCallable()

ListPhraseSets

Lists PhraseSets.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listPhraseSets(ListPhraseSetsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listPhraseSets(LocationName parent)

  • listPhraseSets(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPhraseSetsPagedCallable()

  • listPhraseSetsCallable()

GetPhraseSet

Returns the requested PhraseSet.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getPhraseSet(GetPhraseSetRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getPhraseSet(PhraseSetName name)

  • getPhraseSet(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getPhraseSetCallable()

UpdatePhraseSet

Updates the PhraseSet.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updatePhraseSetAsync(UpdatePhraseSetRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • updatePhraseSetAsync(PhraseSet phraseSet, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updatePhraseSetOperationCallable()

  • updatePhraseSetCallable()

DeletePhraseSet

Deletes the PhraseSet.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deletePhraseSetAsync(DeletePhraseSetRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deletePhraseSetAsync(PhraseSetName name)

  • deletePhraseSetAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deletePhraseSetOperationCallable()

  • deletePhraseSetCallable()

UndeletePhraseSet

Undeletes the PhraseSet.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • undeletePhraseSetAsync(UndeletePhraseSetRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • undeletePhraseSetAsync(PhraseSetName name)

  • undeletePhraseSetAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • undeletePhraseSetOperationCallable()

  • undeletePhraseSetCallable()

ListLocations

Lists information about the supported locations for this service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

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 SpeechSettings to create(). For example:

To customize credentials:


 // 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
 SpeechSettings speechSettings =
     SpeechSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 SpeechClient speechClient = SpeechClient.create(speechSettings);
 

To customize the endpoint:


 // 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
 SpeechSettings speechSettings = SpeechSettings.newBuilder().setEndpoint(myEndpoint).build();
 SpeechClient speechClient = SpeechClient.create(speechSettings);
 

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


 // 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
 SpeechSettings speechSettings = SpeechSettings.newHttpJsonBuilder().build();
 SpeechClient speechClient = SpeechClient.create(speechSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > SpeechClient

Static Methods

create()

public static final SpeechClient create()

Constructs an instance of SpeechClient with default settings.

Returns
Type Description
SpeechClient
Exceptions
Type Description
IOException

create(SpeechSettings settings)

public static final SpeechClient create(SpeechSettings settings)

Constructs an instance of SpeechClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings SpeechSettings
Returns
Type Description
SpeechClient
Exceptions
Type Description
IOException

create(SpeechStub stub)

public static final SpeechClient create(SpeechStub stub)

Constructs an instance of SpeechClient, using the given stub for making calls. This is for advanced usage - prefer using create(SpeechSettings).

Parameter
Name Description
stub SpeechStub
Returns
Type Description
SpeechClient

Constructors

SpeechClient(SpeechSettings settings)

protected SpeechClient(SpeechSettings settings)

Constructs an instance of SpeechClient, 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.

Parameter
Name Description
settings SpeechSettings

SpeechClient(SpeechStub stub)

protected SpeechClient(SpeechStub stub)
Parameter
Name Description
stub SpeechStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

batchRecognizeAsync(BatchRecognizeRequest request)

public final OperationFuture<BatchRecognizeResponse,OperationMetadata> batchRecognizeAsync(BatchRecognizeRequest request)

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   BatchRecognizeRequest request =
       BatchRecognizeRequest.newBuilder()
           .setRecognizer(
               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setConfig(RecognitionConfig.newBuilder().build())
           .setConfigMask(FieldMask.newBuilder().build())
           .addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
           .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
           .build();
   BatchRecognizeResponse response = speechClient.batchRecognizeAsync(request).get();
 }
 
Parameter
Name Description
request BatchRecognizeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<BatchRecognizeResponse,OperationMetadata>

batchRecognizeAsync(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, List<BatchRecognizeFileMetadata> files)

public final OperationFuture<BatchRecognizeResponse,OperationMetadata> batchRecognizeAsync(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, List<BatchRecognizeFileMetadata> files)

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
   RecognitionConfig config = RecognitionConfig.newBuilder().build();
   FieldMask configMask = FieldMask.newBuilder().build();
   List<BatchRecognizeFileMetadata> files = new ArrayList<>();
   BatchRecognizeResponse response =
       speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get();
 }
 
Parameters
Name Description
recognizer RecognizerName

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}. The {recognizer} segment may be set to _ to use an empty implicit Recognizer.

config RecognitionConfig

Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.

configMask FieldMask

The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all given fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.

files List<BatchRecognizeFileMetadata>

Audio files with file metadata for ASR. The maximum number of files allowed to be specified is 5.

Returns
Type Description
OperationFuture<BatchRecognizeResponse,OperationMetadata>

batchRecognizeAsync(String recognizer, RecognitionConfig config, FieldMask configMask, List<BatchRecognizeFileMetadata> files)

public final OperationFuture<BatchRecognizeResponse,OperationMetadata> batchRecognizeAsync(String recognizer, RecognitionConfig config, FieldMask configMask, List<BatchRecognizeFileMetadata> files)

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
   RecognitionConfig config = RecognitionConfig.newBuilder().build();
   FieldMask configMask = FieldMask.newBuilder().build();
   List<BatchRecognizeFileMetadata> files = new ArrayList<>();
   BatchRecognizeResponse response =
       speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get();
 }
 
Parameters
Name Description
recognizer String

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}. The {recognizer} segment may be set to _ to use an empty implicit Recognizer.

config RecognitionConfig

Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.

configMask FieldMask

The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all given fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.

files List<BatchRecognizeFileMetadata>

Audio files with file metadata for ASR. The maximum number of files allowed to be specified is 5.

Returns
Type Description
OperationFuture<BatchRecognizeResponse,OperationMetadata>

batchRecognizeCallable()

public final UnaryCallable<BatchRecognizeRequest,Operation> batchRecognizeCallable()

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   BatchRecognizeRequest request =
       BatchRecognizeRequest.newBuilder()
           .setRecognizer(
               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setConfig(RecognitionConfig.newBuilder().build())
           .setConfigMask(FieldMask.newBuilder().build())
           .addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
           .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
           .build();
   ApiFuture<Operation> future = speechClient.batchRecognizeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchRecognizeRequest,Operation>

batchRecognizeOperationCallable()

public final OperationCallable<BatchRecognizeRequest,BatchRecognizeResponse,OperationMetadata> batchRecognizeOperationCallable()

Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   BatchRecognizeRequest request =
       BatchRecognizeRequest.newBuilder()
           .setRecognizer(
               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setConfig(RecognitionConfig.newBuilder().build())
           .setConfigMask(FieldMask.newBuilder().build())
           .addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
           .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
           .build();
   OperationFuture<BatchRecognizeResponse, OperationMetadata> future =
       speechClient.batchRecognizeOperationCallable().futureCall(request);
   // Do something.
   BatchRecognizeResponse response = future.get();
 }
 
Returns
Type Description
OperationCallable<BatchRecognizeRequest,BatchRecognizeResponse,OperationMetadata>

close()

public final void close()

createCustomClassAsync(CreateCustomClassRequest request)

public final OperationFuture<CustomClass,OperationMetadata> createCustomClassAsync(CreateCustomClassRequest request)

Creates a CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreateCustomClassRequest request =
       CreateCustomClassRequest.newBuilder()
           .setCustomClass(CustomClass.newBuilder().build())
           .setValidateOnly(true)
           .setCustomClassId("customClassId1871032322")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   CustomClass response = speechClient.createCustomClassAsync(request).get();
 }
 
Parameter
Name Description
request CreateCustomClassRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

createCustomClassAsync(LocationName parent, CustomClass customClass, String customClassId)

public final OperationFuture<CustomClass,OperationMetadata> createCustomClassAsync(LocationName parent, CustomClass customClass, String customClassId)

Creates a CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   CustomClass customClass = CustomClass.newBuilder().build();
   String customClassId = "customClassId1871032322";
   CustomClass response =
       speechClient.createCustomClassAsync(parent, customClass, customClassId).get();
 }
 
Parameters
Name Description
parent LocationName

Required. The project and location where this CustomClass will be created. The expected format is projects/{project}/locations/{location}.

customClass CustomClass

Required. The CustomClass to create.

customClassId String

The ID to use for the CustomClass, which will become the final component of the CustomClass's resource name.

This value should be 4-63 characters, and valid characters are /a-z-/.

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

createCustomClassAsync(String parent, CustomClass customClass, String customClassId)

public final OperationFuture<CustomClass,OperationMetadata> createCustomClassAsync(String parent, CustomClass customClass, String customClassId)

Creates a CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   CustomClass customClass = CustomClass.newBuilder().build();
   String customClassId = "customClassId1871032322";
   CustomClass response =
       speechClient.createCustomClassAsync(parent, customClass, customClassId).get();
 }
 
Parameters
Name Description
parent String

Required. The project and location where this CustomClass will be created. The expected format is projects/{project}/locations/{location}.

customClass CustomClass

Required. The CustomClass to create.

customClassId String

The ID to use for the CustomClass, which will become the final component of the CustomClass's resource name.

This value should be 4-63 characters, and valid characters are /a-z-/.

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

createCustomClassCallable()

public final UnaryCallable<CreateCustomClassRequest,Operation> createCustomClassCallable()

Creates a CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreateCustomClassRequest request =
       CreateCustomClassRequest.newBuilder()
           .setCustomClass(CustomClass.newBuilder().build())
           .setValidateOnly(true)
           .setCustomClassId("customClassId1871032322")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   ApiFuture<Operation> future = speechClient.createCustomClassCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateCustomClassRequest,Operation>

createCustomClassOperationCallable()

public final OperationCallable<CreateCustomClassRequest,CustomClass,OperationMetadata> createCustomClassOperationCallable()

Creates a CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreateCustomClassRequest request =
       CreateCustomClassRequest.newBuilder()
           .setCustomClass(CustomClass.newBuilder().build())
           .setValidateOnly(true)
           .setCustomClassId("customClassId1871032322")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   OperationFuture<CustomClass, OperationMetadata> future =
       speechClient.createCustomClassOperationCallable().futureCall(request);
   // Do something.
   CustomClass response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateCustomClassRequest,CustomClass,OperationMetadata>

createPhraseSetAsync(CreatePhraseSetRequest request)

public final OperationFuture<PhraseSet,OperationMetadata> createPhraseSetAsync(CreatePhraseSetRequest request)

Creates a PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreatePhraseSetRequest request =
       CreatePhraseSetRequest.newBuilder()
           .setPhraseSet(PhraseSet.newBuilder().build())
           .setValidateOnly(true)
           .setPhraseSetId("phraseSetId959902180")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   PhraseSet response = speechClient.createPhraseSetAsync(request).get();
 }
 
Parameter
Name Description
request CreatePhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

createPhraseSetAsync(LocationName parent, PhraseSet phraseSet, String phraseSetId)

public final OperationFuture<PhraseSet,OperationMetadata> createPhraseSetAsync(LocationName parent, PhraseSet phraseSet, String phraseSetId)

Creates a PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   PhraseSet phraseSet = PhraseSet.newBuilder().build();
   String phraseSetId = "phraseSetId959902180";
   PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get();
 }
 
Parameters
Name Description
parent LocationName

Required. The project and location where this PhraseSet will be created. The expected format is projects/{project}/locations/{location}.

phraseSet PhraseSet

Required. The PhraseSet to create.

phraseSetId String

The ID to use for the PhraseSet, which will become the final component of the PhraseSet's resource name.

This value should be 4-63 characters, and valid characters are /a-z-/.

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

createPhraseSetAsync(String parent, PhraseSet phraseSet, String phraseSetId)

public final OperationFuture<PhraseSet,OperationMetadata> createPhraseSetAsync(String parent, PhraseSet phraseSet, String phraseSetId)

Creates a PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   PhraseSet phraseSet = PhraseSet.newBuilder().build();
   String phraseSetId = "phraseSetId959902180";
   PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get();
 }
 
Parameters
Name Description
parent String

Required. The project and location where this PhraseSet will be created. The expected format is projects/{project}/locations/{location}.

phraseSet PhraseSet

Required. The PhraseSet to create.

phraseSetId String

The ID to use for the PhraseSet, which will become the final component of the PhraseSet's resource name.

This value should be 4-63 characters, and valid characters are /a-z-/.

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

createPhraseSetCallable()

public final UnaryCallable<CreatePhraseSetRequest,Operation> createPhraseSetCallable()

Creates a PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreatePhraseSetRequest request =
       CreatePhraseSetRequest.newBuilder()
           .setPhraseSet(PhraseSet.newBuilder().build())
           .setValidateOnly(true)
           .setPhraseSetId("phraseSetId959902180")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   ApiFuture<Operation> future = speechClient.createPhraseSetCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreatePhraseSetRequest,Operation>

createPhraseSetOperationCallable()

public final OperationCallable<CreatePhraseSetRequest,PhraseSet,OperationMetadata> createPhraseSetOperationCallable()

Creates a PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreatePhraseSetRequest request =
       CreatePhraseSetRequest.newBuilder()
           .setPhraseSet(PhraseSet.newBuilder().build())
           .setValidateOnly(true)
           .setPhraseSetId("phraseSetId959902180")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   OperationFuture<PhraseSet, OperationMetadata> future =
       speechClient.createPhraseSetOperationCallable().futureCall(request);
   // Do something.
   PhraseSet response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreatePhraseSetRequest,PhraseSet,OperationMetadata>

createRecognizerAsync(CreateRecognizerRequest request)

public final OperationFuture<Recognizer,OperationMetadata> createRecognizerAsync(CreateRecognizerRequest request)

Creates a Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreateRecognizerRequest request =
       CreateRecognizerRequest.newBuilder()
           .setRecognizer(Recognizer.newBuilder().build())
           .setValidateOnly(true)
           .setRecognizerId("recognizerId771963359")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   Recognizer response = speechClient.createRecognizerAsync(request).get();
 }
 
Parameter
Name Description
request CreateRecognizerRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

createRecognizerAsync(LocationName parent, Recognizer recognizer, String recognizerId)

public final OperationFuture<Recognizer,OperationMetadata> createRecognizerAsync(LocationName parent, Recognizer recognizer, String recognizerId)

Creates a Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Recognizer recognizer = Recognizer.newBuilder().build();
   String recognizerId = "recognizerId771963359";
   Recognizer response =
       speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get();
 }
 
Parameters
Name Description
parent LocationName

Required. The project and location where this Recognizer will be created. The expected format is projects/{project}/locations/{location}.

recognizer Recognizer

Required. The Recognizer to create.

recognizerId String

The ID to use for the Recognizer, which will become the final component of the Recognizer's resource name.

This value should be 4-63 characters, and valid characters are /a-z-/.

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

createRecognizerAsync(String parent, Recognizer recognizer, String recognizerId)

public final OperationFuture<Recognizer,OperationMetadata> createRecognizerAsync(String parent, Recognizer recognizer, String recognizerId)

Creates a Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Recognizer recognizer = Recognizer.newBuilder().build();
   String recognizerId = "recognizerId771963359";
   Recognizer response =
       speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get();
 }
 
Parameters
Name Description
parent String

Required. The project and location where this Recognizer will be created. The expected format is projects/{project}/locations/{location}.

recognizer Recognizer

Required. The Recognizer to create.

recognizerId String

The ID to use for the Recognizer, which will become the final component of the Recognizer's resource name.

This value should be 4-63 characters, and valid characters are /a-z-/.

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

createRecognizerCallable()

public final UnaryCallable<CreateRecognizerRequest,Operation> createRecognizerCallable()

Creates a Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreateRecognizerRequest request =
       CreateRecognizerRequest.newBuilder()
           .setRecognizer(Recognizer.newBuilder().build())
           .setValidateOnly(true)
           .setRecognizerId("recognizerId771963359")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   ApiFuture<Operation> future = speechClient.createRecognizerCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateRecognizerRequest,Operation>

createRecognizerOperationCallable()

public final OperationCallable<CreateRecognizerRequest,Recognizer,OperationMetadata> createRecognizerOperationCallable()

Creates a Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CreateRecognizerRequest request =
       CreateRecognizerRequest.newBuilder()
           .setRecognizer(Recognizer.newBuilder().build())
           .setValidateOnly(true)
           .setRecognizerId("recognizerId771963359")
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   OperationFuture<Recognizer, OperationMetadata> future =
       speechClient.createRecognizerOperationCallable().futureCall(request);
   // Do something.
   Recognizer response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateRecognizerRequest,Recognizer,OperationMetadata>

deleteCustomClassAsync(CustomClassName name)

public final OperationFuture<CustomClass,OperationMetadata> deleteCustomClassAsync(CustomClassName name)

Deletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
   CustomClass response = speechClient.deleteCustomClassAsync(name).get();
 }
 
Parameter
Name Description
name CustomClassName

Required. The name of the CustomClass to delete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

deleteCustomClassAsync(DeleteCustomClassRequest request)

public final OperationFuture<CustomClass,OperationMetadata> deleteCustomClassAsync(DeleteCustomClassRequest request)

Deletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeleteCustomClassRequest request =
       DeleteCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   CustomClass response = speechClient.deleteCustomClassAsync(request).get();
 }
 
Parameter
Name Description
request DeleteCustomClassRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

deleteCustomClassAsync(String name)

public final OperationFuture<CustomClass,OperationMetadata> deleteCustomClassAsync(String name)

Deletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
   CustomClass response = speechClient.deleteCustomClassAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The name of the CustomClass to delete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

deleteCustomClassCallable()

public final UnaryCallable<DeleteCustomClassRequest,Operation> deleteCustomClassCallable()

Deletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeleteCustomClassRequest request =
       DeleteCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   ApiFuture<Operation> future = speechClient.deleteCustomClassCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteCustomClassRequest,Operation>

deleteCustomClassOperationCallable()

public final OperationCallable<DeleteCustomClassRequest,CustomClass,OperationMetadata> deleteCustomClassOperationCallable()

Deletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeleteCustomClassRequest request =
       DeleteCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   OperationFuture<CustomClass, OperationMetadata> future =
       speechClient.deleteCustomClassOperationCallable().futureCall(request);
   // Do something.
   CustomClass response = future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteCustomClassRequest,CustomClass,OperationMetadata>

deletePhraseSetAsync(DeletePhraseSetRequest request)

public final OperationFuture<PhraseSet,OperationMetadata> deletePhraseSetAsync(DeletePhraseSetRequest request)

Deletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeletePhraseSetRequest request =
       DeletePhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   PhraseSet response = speechClient.deletePhraseSetAsync(request).get();
 }
 
Parameter
Name Description
request DeletePhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

deletePhraseSetAsync(PhraseSetName name)

public final OperationFuture<PhraseSet,OperationMetadata> deletePhraseSetAsync(PhraseSetName name)

Deletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
   PhraseSet response = speechClient.deletePhraseSetAsync(name).get();
 }
 
Parameter
Name Description
name PhraseSetName

Required. The name of the PhraseSet to delete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

deletePhraseSetAsync(String name)

public final OperationFuture<PhraseSet,OperationMetadata> deletePhraseSetAsync(String name)

Deletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
   PhraseSet response = speechClient.deletePhraseSetAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The name of the PhraseSet to delete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

deletePhraseSetCallable()

public final UnaryCallable<DeletePhraseSetRequest,Operation> deletePhraseSetCallable()

Deletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeletePhraseSetRequest request =
       DeletePhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   ApiFuture<Operation> future = speechClient.deletePhraseSetCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<DeletePhraseSetRequest,Operation>

deletePhraseSetOperationCallable()

public final OperationCallable<DeletePhraseSetRequest,PhraseSet,OperationMetadata> deletePhraseSetOperationCallable()

Deletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeletePhraseSetRequest request =
       DeletePhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   OperationFuture<PhraseSet, OperationMetadata> future =
       speechClient.deletePhraseSetOperationCallable().futureCall(request);
   // Do something.
   PhraseSet response = future.get();
 }
 
Returns
Type Description
OperationCallable<DeletePhraseSetRequest,PhraseSet,OperationMetadata>

deleteRecognizerAsync(DeleteRecognizerRequest request)

public final OperationFuture<Recognizer,OperationMetadata> deleteRecognizerAsync(DeleteRecognizerRequest request)

Deletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeleteRecognizerRequest request =
       DeleteRecognizerRequest.newBuilder()
           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   Recognizer response = speechClient.deleteRecognizerAsync(request).get();
 }
 
Parameter
Name Description
request DeleteRecognizerRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

deleteRecognizerAsync(RecognizerName name)

public final OperationFuture<Recognizer,OperationMetadata> deleteRecognizerAsync(RecognizerName name)

Deletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
   Recognizer response = speechClient.deleteRecognizerAsync(name).get();
 }
 
Parameter
Name Description
name RecognizerName

Required. The name of the Recognizer to delete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

deleteRecognizerAsync(String name)

public final OperationFuture<Recognizer,OperationMetadata> deleteRecognizerAsync(String name)

Deletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
   Recognizer response = speechClient.deleteRecognizerAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The name of the Recognizer to delete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

deleteRecognizerCallable()

public final UnaryCallable<DeleteRecognizerRequest,Operation> deleteRecognizerCallable()

Deletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeleteRecognizerRequest request =
       DeleteRecognizerRequest.newBuilder()
           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   ApiFuture<Operation> future = speechClient.deleteRecognizerCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteRecognizerRequest,Operation>

deleteRecognizerOperationCallable()

public final OperationCallable<DeleteRecognizerRequest,Recognizer,OperationMetadata> deleteRecognizerOperationCallable()

Deletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   DeleteRecognizerRequest request =
       DeleteRecognizerRequest.newBuilder()
           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setValidateOnly(true)
           .setAllowMissing(true)
           .setEtag("etag3123477")
           .build();
   OperationFuture<Recognizer, OperationMetadata> future =
       speechClient.deleteRecognizerOperationCallable().futureCall(request);
   // Do something.
   Recognizer response = future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteRecognizerRequest,Recognizer,OperationMetadata>

getConfig(ConfigName name)

public final Config getConfig(ConfigName name)

Returns the requested Config.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]");
   Config response = speechClient.getConfig(name);
 }
 
Parameter
Name Description
name ConfigName

Required. The name of the config to retrieve. There is exactly one config resource per project per location. The expected format is projects/{project}/locations/{location}/config.

Returns
Type Description
Config

getConfig(GetConfigRequest request)

public final Config getConfig(GetConfigRequest request)

Returns the requested Config.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetConfigRequest request =
       GetConfigRequest.newBuilder()
           .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   Config response = speechClient.getConfig(request);
 }
 
Parameter
Name Description
request GetConfigRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Config

getConfig(String name)

public final Config getConfig(String name)

Returns the requested Config.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = ConfigName.of("[PROJECT]", "[LOCATION]").toString();
   Config response = speechClient.getConfig(name);
 }
 
Parameter
Name Description
name String

Required. The name of the config to retrieve. There is exactly one config resource per project per location. The expected format is projects/{project}/locations/{location}/config.

Returns
Type Description
Config

getConfigCallable()

public final UnaryCallable<GetConfigRequest,Config> getConfigCallable()

Returns the requested Config.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetConfigRequest request =
       GetConfigRequest.newBuilder()
           .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   ApiFuture<Config> future = speechClient.getConfigCallable().futureCall(request);
   // Do something.
   Config response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetConfigRequest,Config>

getCustomClass(CustomClassName name)

public final CustomClass getCustomClass(CustomClassName name)

Returns the requested CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
   CustomClass response = speechClient.getCustomClass(name);
 }
 
Parameter
Name Description
name CustomClassName

Required. The name of the CustomClass to retrieve. The expected format is projects/{project}/locations/{location}/customClasses/{custom_class}.

Returns
Type Description
CustomClass

getCustomClass(GetCustomClassRequest request)

public final CustomClass getCustomClass(GetCustomClassRequest request)

Returns the requested CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetCustomClassRequest request =
       GetCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .build();
   CustomClass response = speechClient.getCustomClass(request);
 }
 
Parameter
Name Description
request GetCustomClassRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
CustomClass

getCustomClass(String name)

public final CustomClass getCustomClass(String name)

Returns the requested CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
   CustomClass response = speechClient.getCustomClass(name);
 }
 
Parameter
Name Description
name String

Required. The name of the CustomClass to retrieve. The expected format is projects/{project}/locations/{location}/customClasses/{custom_class}.

Returns
Type Description
CustomClass

getCustomClassCallable()

public final UnaryCallable<GetCustomClassRequest,CustomClass> getCustomClassCallable()

Returns the requested CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetCustomClassRequest request =
       GetCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .build();
   ApiFuture<CustomClass> future = speechClient.getCustomClassCallable().futureCall(request);
   // Do something.
   CustomClass response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetCustomClassRequest,CustomClass>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = speechClient.getLocation(request);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a location.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = speechClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getPhraseSet(GetPhraseSetRequest request)

public final PhraseSet getPhraseSet(GetPhraseSetRequest request)

Returns the requested PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetPhraseSetRequest request =
       GetPhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .build();
   PhraseSet response = speechClient.getPhraseSet(request);
 }
 
Parameter
Name Description
request GetPhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
PhraseSet

getPhraseSet(PhraseSetName name)

public final PhraseSet getPhraseSet(PhraseSetName name)

Returns the requested PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
   PhraseSet response = speechClient.getPhraseSet(name);
 }
 
Parameter
Name Description
name PhraseSetName

Required. The name of the PhraseSet to retrieve. The expected format is projects/{project}/locations/{location}/phraseSets/{phrase_set}.

Returns
Type Description
PhraseSet

getPhraseSet(String name)

public final PhraseSet getPhraseSet(String name)

Returns the requested PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
   PhraseSet response = speechClient.getPhraseSet(name);
 }
 
Parameter
Name Description
name String

Required. The name of the PhraseSet to retrieve. The expected format is projects/{project}/locations/{location}/phraseSets/{phrase_set}.

Returns
Type Description
PhraseSet

getPhraseSetCallable()

public final UnaryCallable<GetPhraseSetRequest,PhraseSet> getPhraseSetCallable()

Returns the requested PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetPhraseSetRequest request =
       GetPhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .build();
   ApiFuture<PhraseSet> future = speechClient.getPhraseSetCallable().futureCall(request);
   // Do something.
   PhraseSet response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetPhraseSetRequest,PhraseSet>

getRecognizer(GetRecognizerRequest request)

public final Recognizer getRecognizer(GetRecognizerRequest request)

Returns the requested Recognizer. Fails with NOT_FOUND if the requested Recognizer doesn't exist.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetRecognizerRequest request =
       GetRecognizerRequest.newBuilder()
           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .build();
   Recognizer response = speechClient.getRecognizer(request);
 }
 
Parameter
Name Description
request GetRecognizerRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Recognizer

getRecognizer(RecognizerName name)

public final Recognizer getRecognizer(RecognizerName name)

Returns the requested Recognizer. Fails with NOT_FOUND if the requested Recognizer doesn't exist.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
   Recognizer response = speechClient.getRecognizer(name);
 }
 
Parameter
Name Description
name RecognizerName

Required. The name of the Recognizer to retrieve. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}.

Returns
Type Description
Recognizer

getRecognizer(String name)

public final Recognizer getRecognizer(String name)

Returns the requested Recognizer. Fails with NOT_FOUND if the requested Recognizer doesn't exist.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
   Recognizer response = speechClient.getRecognizer(name);
 }
 
Parameter
Name Description
name String

Required. The name of the Recognizer to retrieve. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}.

Returns
Type Description
Recognizer

getRecognizerCallable()

public final UnaryCallable<GetRecognizerRequest,Recognizer> getRecognizerCallable()

Returns the requested Recognizer. Fails with NOT_FOUND if the requested Recognizer doesn't exist.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   GetRecognizerRequest request =
       GetRecognizerRequest.newBuilder()
           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .build();
   ApiFuture<Recognizer> future = speechClient.getRecognizerCallable().futureCall(request);
   // Do something.
   Recognizer response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetRecognizerRequest,Recognizer>

getSettings()

public final SpeechSettings getSettings()
Returns
Type Description
SpeechSettings

getStub()

public SpeechStub getStub()
Returns
Type Description
SpeechStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listCustomClasses(ListCustomClassesRequest request)

public final SpeechClient.ListCustomClassesPagedResponse listCustomClasses(ListCustomClassesRequest request)

Lists CustomClasses.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListCustomClassesRequest request =
       ListCustomClassesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   for (CustomClass element : speechClient.listCustomClasses(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListCustomClassesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SpeechClient.ListCustomClassesPagedResponse

listCustomClasses(LocationName parent)

public final SpeechClient.ListCustomClassesPagedResponse listCustomClasses(LocationName parent)

Lists CustomClasses.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The project and location of CustomClass resources to list. The expected format is projects/{project}/locations/{location}.

Returns
Type Description
SpeechClient.ListCustomClassesPagedResponse

listCustomClasses(String parent)

public final SpeechClient.ListCustomClassesPagedResponse listCustomClasses(String parent)

Lists CustomClasses.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The project and location of CustomClass resources to list. The expected format is projects/{project}/locations/{location}.

Returns
Type Description
SpeechClient.ListCustomClassesPagedResponse

listCustomClassesCallable()

public final UnaryCallable<ListCustomClassesRequest,ListCustomClassesResponse> listCustomClassesCallable()

Lists CustomClasses.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListCustomClassesRequest request =
       ListCustomClassesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   while (true) {
     ListCustomClassesResponse response = speechClient.listCustomClassesCallable().call(request);
     for (CustomClass element : response.getCustomClassesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListCustomClassesRequest,ListCustomClassesResponse>

listCustomClassesPagedCallable()

public final UnaryCallable<ListCustomClassesRequest,SpeechClient.ListCustomClassesPagedResponse> listCustomClassesPagedCallable()

Lists CustomClasses.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListCustomClassesRequest request =
       ListCustomClassesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   ApiFuture<CustomClass> future =
       speechClient.listCustomClassesPagedCallable().futureCall(request);
   // Do something.
   for (CustomClass element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListCustomClassesRequest,ListCustomClassesPagedResponse>

listLocations(ListLocationsRequest request)

public final SpeechClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : speechClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SpeechClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = speechClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,SpeechClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future = speechClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

listPhraseSets(ListPhraseSetsRequest request)

public final SpeechClient.ListPhraseSetsPagedResponse listPhraseSets(ListPhraseSetsRequest request)

Lists PhraseSets.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListPhraseSetsRequest request =
       ListPhraseSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   for (PhraseSet element : speechClient.listPhraseSets(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListPhraseSetsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SpeechClient.ListPhraseSetsPagedResponse

listPhraseSets(LocationName parent)

public final SpeechClient.ListPhraseSetsPagedResponse listPhraseSets(LocationName parent)

Lists PhraseSets.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The project and location of PhraseSet resources to list. The expected format is projects/{project}/locations/{location}.

Returns
Type Description
SpeechClient.ListPhraseSetsPagedResponse

listPhraseSets(String parent)

public final SpeechClient.ListPhraseSetsPagedResponse listPhraseSets(String parent)

Lists PhraseSets.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The project and location of PhraseSet resources to list. The expected format is projects/{project}/locations/{location}.

Returns
Type Description
SpeechClient.ListPhraseSetsPagedResponse

listPhraseSetsCallable()

public final UnaryCallable<ListPhraseSetsRequest,ListPhraseSetsResponse> listPhraseSetsCallable()

Lists PhraseSets.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListPhraseSetsRequest request =
       ListPhraseSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   while (true) {
     ListPhraseSetsResponse response = speechClient.listPhraseSetsCallable().call(request);
     for (PhraseSet element : response.getPhraseSetsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListPhraseSetsRequest,ListPhraseSetsResponse>

listPhraseSetsPagedCallable()

public final UnaryCallable<ListPhraseSetsRequest,SpeechClient.ListPhraseSetsPagedResponse> listPhraseSetsPagedCallable()

Lists PhraseSets.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListPhraseSetsRequest request =
       ListPhraseSetsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   ApiFuture<PhraseSet> future = speechClient.listPhraseSetsPagedCallable().futureCall(request);
   // Do something.
   for (PhraseSet element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListPhraseSetsRequest,ListPhraseSetsPagedResponse>

listRecognizers(ListRecognizersRequest request)

public final SpeechClient.ListRecognizersPagedResponse listRecognizers(ListRecognizersRequest request)

Lists Recognizers.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListRecognizersRequest request =
       ListRecognizersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   for (Recognizer element : speechClient.listRecognizers(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListRecognizersRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SpeechClient.ListRecognizersPagedResponse

listRecognizers(LocationName parent)

public final SpeechClient.ListRecognizersPagedResponse listRecognizers(LocationName parent)

Lists Recognizers.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The project and location of Recognizers to list. The expected format is projects/{project}/locations/{location}.

Returns
Type Description
SpeechClient.ListRecognizersPagedResponse

listRecognizers(String parent)

public final SpeechClient.ListRecognizersPagedResponse listRecognizers(String parent)

Lists Recognizers.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The project and location of Recognizers to list. The expected format is projects/{project}/locations/{location}.

Returns
Type Description
SpeechClient.ListRecognizersPagedResponse

listRecognizersCallable()

public final UnaryCallable<ListRecognizersRequest,ListRecognizersResponse> listRecognizersCallable()

Lists Recognizers.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListRecognizersRequest request =
       ListRecognizersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   while (true) {
     ListRecognizersResponse response = speechClient.listRecognizersCallable().call(request);
     for (Recognizer element : response.getRecognizersList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListRecognizersRequest,ListRecognizersResponse>

listRecognizersPagedCallable()

public final UnaryCallable<ListRecognizersRequest,SpeechClient.ListRecognizersPagedResponse> listRecognizersPagedCallable()

Lists Recognizers.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   ListRecognizersRequest request =
       ListRecognizersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setShowDeleted(true)
           .build();
   ApiFuture<Recognizer> future =
       speechClient.listRecognizersPagedCallable().futureCall(request);
   // Do something.
   for (Recognizer element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListRecognizersRequest,ListRecognizersPagedResponse>

recognize(RecognizeRequest request)

public final RecognizeResponse recognize(RecognizeRequest request)

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizeRequest request =
       RecognizeRequest.newBuilder()
           .setRecognizer(
               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setConfig(RecognitionConfig.newBuilder().build())
           .setConfigMask(FieldMask.newBuilder().build())
           .build();
   RecognizeResponse response = speechClient.recognize(request);
 }
 
Parameter
Name Description
request RecognizeRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
RecognizeResponse

recognize(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, ByteString content)

public final RecognizeResponse recognize(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, ByteString content)

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
   RecognitionConfig config = RecognitionConfig.newBuilder().build();
   FieldMask configMask = FieldMask.newBuilder().build();
   ByteString content = ByteString.EMPTY;
   RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content);
 }
 
Parameters
Name Description
recognizer RecognizerName

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}. The {recognizer} segment may be set to _ to use an empty implicit Recognizer.

config RecognitionConfig

Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.

configMask FieldMask

The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.

content ByteString

The audio data bytes encoded as specified in RecognitionConfig. As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64.

Returns
Type Description
RecognizeResponse

recognize(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, String uri)

public final RecognizeResponse recognize(RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, String uri)

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
   RecognitionConfig config = RecognitionConfig.newBuilder().build();
   FieldMask configMask = FieldMask.newBuilder().build();
   String uri = "uri116076";
   RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri);
 }
 
Parameters
Name Description
recognizer RecognizerName

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}. The {recognizer} segment may be set to _ to use an empty implicit Recognizer.

config RecognitionConfig

Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.

configMask FieldMask

The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.

uri String

URI that points to a file that contains audio data bytes as specified in RecognitionConfig. The file must not be compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: gs://bucket_name/object_name (other URI formats return INVALID_ARGUMENT). For more information, see Request URIs.

Returns
Type Description
RecognizeResponse

recognize(String recognizer, RecognitionConfig config, FieldMask configMask, ByteString content)

public final RecognizeResponse recognize(String recognizer, RecognitionConfig config, FieldMask configMask, ByteString content)

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
   RecognitionConfig config = RecognitionConfig.newBuilder().build();
   FieldMask configMask = FieldMask.newBuilder().build();
   ByteString content = ByteString.EMPTY;
   RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content);
 }
 
Parameters
Name Description
recognizer String

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}. The {recognizer} segment may be set to _ to use an empty implicit Recognizer.

config RecognitionConfig

Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.

configMask FieldMask

The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.

content ByteString

The audio data bytes encoded as specified in RecognitionConfig. As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64.

Returns
Type Description
RecognizeResponse

recognize(String recognizer, RecognitionConfig config, FieldMask configMask, String uri)

public final RecognizeResponse recognize(String recognizer, RecognitionConfig config, FieldMask configMask, String uri)

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
   RecognitionConfig config = RecognitionConfig.newBuilder().build();
   FieldMask configMask = FieldMask.newBuilder().build();
   String uri = "uri116076";
   RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri);
 }
 
Parameters
Name Description
recognizer String

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{recognizer}. The {recognizer} segment may be set to _ to use an empty implicit Recognizer.

config RecognitionConfig

Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the config_mask field can be used to override parts of the default_recognition_config of the Recognizer resource.

configMask FieldMask

The list of fields in config that override the values in the default_recognition_config of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in config override the values in the recognizer for this recognition request. If a mask is provided, only the fields listed in the mask override the config in the recognizer for this recognition request. If a wildcard (*) is provided, config completely overrides and replaces the config in the recognizer for this recognition request.

uri String

URI that points to a file that contains audio data bytes as specified in RecognitionConfig. The file must not be compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: gs://bucket_name/object_name (other URI formats return INVALID_ARGUMENT). For more information, see Request URIs.

Returns
Type Description
RecognizeResponse

recognizeCallable()

public final UnaryCallable<RecognizeRequest,RecognizeResponse> recognizeCallable()

Performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizeRequest request =
       RecognizeRequest.newBuilder()
           .setRecognizer(
               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setConfig(RecognitionConfig.newBuilder().build())
           .setConfigMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<RecognizeResponse> future = speechClient.recognizeCallable().futureCall(request);
   // Do something.
   RecognizeResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<RecognizeRequest,RecognizeResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

streamingRecognizeCallable()

public final BidiStreamingCallable<StreamingRecognizeRequest,StreamingRecognizeResponse> streamingRecognizeCallable()

Performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST).

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   BidiStream<StreamingRecognizeRequest, StreamingRecognizeResponse> bidiStream =
       speechClient.streamingRecognizeCallable().call();
   StreamingRecognizeRequest request =
       StreamingRecognizeRequest.newBuilder()
           .setRecognizer(
               RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .build();
   bidiStream.send(request);
   for (StreamingRecognizeResponse response : bidiStream) {
     // Do something when a response is received.
   }
 }
 
Returns
Type Description
BidiStreamingCallable<StreamingRecognizeRequest,StreamingRecognizeResponse>

undeleteCustomClassAsync(CustomClassName name)

public final OperationFuture<CustomClass,OperationMetadata> undeleteCustomClassAsync(CustomClassName name)

Undeletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
   CustomClass response = speechClient.undeleteCustomClassAsync(name).get();
 }
 
Parameter
Name Description
name CustomClassName

Required. The name of the CustomClass to undelete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

undeleteCustomClassAsync(UndeleteCustomClassRequest request)

public final OperationFuture<CustomClass,OperationMetadata> undeleteCustomClassAsync(UndeleteCustomClassRequest request)

Undeletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeleteCustomClassRequest request =
       UndeleteCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   CustomClass response = speechClient.undeleteCustomClassAsync(request).get();
 }
 
Parameter
Name Description
request UndeleteCustomClassRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

undeleteCustomClassAsync(String name)

public final OperationFuture<CustomClass,OperationMetadata> undeleteCustomClassAsync(String name)

Undeletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
   CustomClass response = speechClient.undeleteCustomClassAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The name of the CustomClass to undelete. Format: projects/{project}/locations/{location}/customClasses/{custom_class}

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

undeleteCustomClassCallable()

public final UnaryCallable<UndeleteCustomClassRequest,Operation> undeleteCustomClassCallable()

Undeletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeleteCustomClassRequest request =
       UndeleteCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   ApiFuture<Operation> future = speechClient.undeleteCustomClassCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UndeleteCustomClassRequest,Operation>

undeleteCustomClassOperationCallable()

public final OperationCallable<UndeleteCustomClassRequest,CustomClass,OperationMetadata> undeleteCustomClassOperationCallable()

Undeletes the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeleteCustomClassRequest request =
       UndeleteCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   OperationFuture<CustomClass, OperationMetadata> future =
       speechClient.undeleteCustomClassOperationCallable().futureCall(request);
   // Do something.
   CustomClass response = future.get();
 }
 
Returns
Type Description
OperationCallable<UndeleteCustomClassRequest,CustomClass,OperationMetadata>

undeletePhraseSetAsync(PhraseSetName name)

public final OperationFuture<PhraseSet,OperationMetadata> undeletePhraseSetAsync(PhraseSetName name)

Undeletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
   PhraseSet response = speechClient.undeletePhraseSetAsync(name).get();
 }
 
Parameter
Name Description
name PhraseSetName

Required. The name of the PhraseSet to undelete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

undeletePhraseSetAsync(UndeletePhraseSetRequest request)

public final OperationFuture<PhraseSet,OperationMetadata> undeletePhraseSetAsync(UndeletePhraseSetRequest request)

Undeletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeletePhraseSetRequest request =
       UndeletePhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   PhraseSet response = speechClient.undeletePhraseSetAsync(request).get();
 }
 
Parameter
Name Description
request UndeletePhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

undeletePhraseSetAsync(String name)

public final OperationFuture<PhraseSet,OperationMetadata> undeletePhraseSetAsync(String name)

Undeletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
   PhraseSet response = speechClient.undeletePhraseSetAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The name of the PhraseSet to undelete. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

undeletePhraseSetCallable()

public final UnaryCallable<UndeletePhraseSetRequest,Operation> undeletePhraseSetCallable()

Undeletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeletePhraseSetRequest request =
       UndeletePhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   ApiFuture<Operation> future = speechClient.undeletePhraseSetCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UndeletePhraseSetRequest,Operation>

undeletePhraseSetOperationCallable()

public final OperationCallable<UndeletePhraseSetRequest,PhraseSet,OperationMetadata> undeletePhraseSetOperationCallable()

Undeletes the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeletePhraseSetRequest request =
       UndeletePhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   OperationFuture<PhraseSet, OperationMetadata> future =
       speechClient.undeletePhraseSetOperationCallable().futureCall(request);
   // Do something.
   PhraseSet response = future.get();
 }
 
Returns
Type Description
OperationCallable<UndeletePhraseSetRequest,PhraseSet,OperationMetadata>

undeleteRecognizerAsync(RecognizerName name)

public final OperationFuture<Recognizer,OperationMetadata> undeleteRecognizerAsync(RecognizerName name)

Undeletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
   Recognizer response = speechClient.undeleteRecognizerAsync(name).get();
 }
 
Parameter
Name Description
name RecognizerName

Required. The name of the Recognizer to undelete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

undeleteRecognizerAsync(UndeleteRecognizerRequest request)

public final OperationFuture<Recognizer,OperationMetadata> undeleteRecognizerAsync(UndeleteRecognizerRequest request)

Undeletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeleteRecognizerRequest request =
       UndeleteRecognizerRequest.newBuilder()
           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   Recognizer response = speechClient.undeleteRecognizerAsync(request).get();
 }
 
Parameter
Name Description
request UndeleteRecognizerRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

undeleteRecognizerAsync(String name)

public final OperationFuture<Recognizer,OperationMetadata> undeleteRecognizerAsync(String name)

Undeletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
   Recognizer response = speechClient.undeleteRecognizerAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The name of the Recognizer to undelete. Format: projects/{project}/locations/{location}/recognizers/{recognizer}

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

undeleteRecognizerCallable()

public final UnaryCallable<UndeleteRecognizerRequest,Operation> undeleteRecognizerCallable()

Undeletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeleteRecognizerRequest request =
       UndeleteRecognizerRequest.newBuilder()
           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   ApiFuture<Operation> future = speechClient.undeleteRecognizerCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UndeleteRecognizerRequest,Operation>

undeleteRecognizerOperationCallable()

public final OperationCallable<UndeleteRecognizerRequest,Recognizer,OperationMetadata> undeleteRecognizerOperationCallable()

Undeletes the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UndeleteRecognizerRequest request =
       UndeleteRecognizerRequest.newBuilder()
           .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
           .setValidateOnly(true)
           .setEtag("etag3123477")
           .build();
   OperationFuture<Recognizer, OperationMetadata> future =
       speechClient.undeleteRecognizerOperationCallable().futureCall(request);
   // Do something.
   Recognizer response = future.get();
 }
 
Returns
Type Description
OperationCallable<UndeleteRecognizerRequest,Recognizer,OperationMetadata>

updateConfig(Config config, FieldMask updateMask)

public final Config updateConfig(Config config, FieldMask updateMask)

Updates the Config.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   Config config = Config.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Config response = speechClient.updateConfig(config, updateMask);
 }
 
Parameters
Name Description
config Config

Required. The config to update.

The config's name field is used to identify the config to be updated. The expected format is projects/{project}/locations/{location}/config.

updateMask FieldMask

The list of fields to be updated.

Returns
Type Description
Config

updateConfig(UpdateConfigRequest request)

public final Config updateConfig(UpdateConfigRequest request)

Updates the Config.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdateConfigRequest request =
       UpdateConfigRequest.newBuilder()
           .setConfig(Config.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Config response = speechClient.updateConfig(request);
 }
 
Parameter
Name Description
request UpdateConfigRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Config

updateConfigCallable()

public final UnaryCallable<UpdateConfigRequest,Config> updateConfigCallable()

Updates the Config.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdateConfigRequest request =
       UpdateConfigRequest.newBuilder()
           .setConfig(Config.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Config> future = speechClient.updateConfigCallable().futureCall(request);
   // Do something.
   Config response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateConfigRequest,Config>

updateCustomClassAsync(CustomClass customClass, FieldMask updateMask)

public final OperationFuture<CustomClass,OperationMetadata> updateCustomClassAsync(CustomClass customClass, FieldMask updateMask)

Updates the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   CustomClass customClass = CustomClass.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   CustomClass response = speechClient.updateCustomClassAsync(customClass, updateMask).get();
 }
 
Parameters
Name Description
customClass CustomClass

Required. The CustomClass to update.

The CustomClass's name field is used to identify the CustomClass to update. Format: projects/{project}/locations/{location}/customClasses/{custom_class}.

updateMask FieldMask

The list of fields to be updated. If empty, all fields are considered for update.

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

updateCustomClassAsync(UpdateCustomClassRequest request)

public final OperationFuture<CustomClass,OperationMetadata> updateCustomClassAsync(UpdateCustomClassRequest request)

Updates the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdateCustomClassRequest request =
       UpdateCustomClassRequest.newBuilder()
           .setCustomClass(CustomClass.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   CustomClass response = speechClient.updateCustomClassAsync(request).get();
 }
 
Parameter
Name Description
request UpdateCustomClassRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<CustomClass,OperationMetadata>

updateCustomClassCallable()

public final UnaryCallable<UpdateCustomClassRequest,Operation> updateCustomClassCallable()

Updates the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdateCustomClassRequest request =
       UpdateCustomClassRequest.newBuilder()
           .setCustomClass(CustomClass.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   ApiFuture<Operation> future = speechClient.updateCustomClassCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateCustomClassRequest,Operation>

updateCustomClassOperationCallable()

public final OperationCallable<UpdateCustomClassRequest,CustomClass,OperationMetadata> updateCustomClassOperationCallable()

Updates the CustomClass.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdateCustomClassRequest request =
       UpdateCustomClassRequest.newBuilder()
           .setCustomClass(CustomClass.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   OperationFuture<CustomClass, OperationMetadata> future =
       speechClient.updateCustomClassOperationCallable().futureCall(request);
   // Do something.
   CustomClass response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateCustomClassRequest,CustomClass,OperationMetadata>

updatePhraseSetAsync(PhraseSet phraseSet, FieldMask updateMask)

public final OperationFuture<PhraseSet,OperationMetadata> updatePhraseSetAsync(PhraseSet phraseSet, FieldMask updateMask)

Updates the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   PhraseSet phraseSet = PhraseSet.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   PhraseSet response = speechClient.updatePhraseSetAsync(phraseSet, updateMask).get();
 }
 
Parameters
Name Description
phraseSet PhraseSet

Required. The PhraseSet to update.

The PhraseSet's name field is used to identify the PhraseSet to update. Format: projects/{project}/locations/{location}/phraseSets/{phrase_set}.

updateMask FieldMask

The list of fields to update. If empty, all non-default valued fields are considered for update. Use * to update the entire PhraseSet resource.

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

updatePhraseSetAsync(UpdatePhraseSetRequest request)

public final OperationFuture<PhraseSet,OperationMetadata> updatePhraseSetAsync(UpdatePhraseSetRequest request)

Updates the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdatePhraseSetRequest request =
       UpdatePhraseSetRequest.newBuilder()
           .setPhraseSet(PhraseSet.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   PhraseSet response = speechClient.updatePhraseSetAsync(request).get();
 }
 
Parameter
Name Description
request UpdatePhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<PhraseSet,OperationMetadata>

updatePhraseSetCallable()

public final UnaryCallable<UpdatePhraseSetRequest,Operation> updatePhraseSetCallable()

Updates the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdatePhraseSetRequest request =
       UpdatePhraseSetRequest.newBuilder()
           .setPhraseSet(PhraseSet.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   ApiFuture<Operation> future = speechClient.updatePhraseSetCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdatePhraseSetRequest,Operation>

updatePhraseSetOperationCallable()

public final OperationCallable<UpdatePhraseSetRequest,PhraseSet,OperationMetadata> updatePhraseSetOperationCallable()

Updates the PhraseSet.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdatePhraseSetRequest request =
       UpdatePhraseSetRequest.newBuilder()
           .setPhraseSet(PhraseSet.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   OperationFuture<PhraseSet, OperationMetadata> future =
       speechClient.updatePhraseSetOperationCallable().futureCall(request);
   // Do something.
   PhraseSet response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdatePhraseSetRequest,PhraseSet,OperationMetadata>

updateRecognizerAsync(Recognizer recognizer, FieldMask updateMask)

public final OperationFuture<Recognizer,OperationMetadata> updateRecognizerAsync(Recognizer recognizer, FieldMask updateMask)

Updates the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   Recognizer recognizer = Recognizer.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Recognizer response = speechClient.updateRecognizerAsync(recognizer, updateMask).get();
 }
 
Parameters
Name Description
recognizer Recognizer

Required. The Recognizer to update.

The Recognizer's name field is used to identify the Recognizer to update. Format: projects/{project}/locations/{location}/recognizers/{recognizer}.

updateMask FieldMask

The list of fields to update. If empty, all non-default valued fields are considered for update. Use * to update the entire Recognizer resource.

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

updateRecognizerAsync(UpdateRecognizerRequest request)

public final OperationFuture<Recognizer,OperationMetadata> updateRecognizerAsync(UpdateRecognizerRequest request)

Updates the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdateRecognizerRequest request =
       UpdateRecognizerRequest.newBuilder()
           .setRecognizer(Recognizer.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   Recognizer response = speechClient.updateRecognizerAsync(request).get();
 }
 
Parameter
Name Description
request UpdateRecognizerRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Recognizer,OperationMetadata>

updateRecognizerCallable()

public final UnaryCallable<UpdateRecognizerRequest,Operation> updateRecognizerCallable()

Updates the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdateRecognizerRequest request =
       UpdateRecognizerRequest.newBuilder()
           .setRecognizer(Recognizer.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   ApiFuture<Operation> future = speechClient.updateRecognizerCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateRecognizerRequest,Operation>

updateRecognizerOperationCallable()

public final OperationCallable<UpdateRecognizerRequest,Recognizer,OperationMetadata> updateRecognizerOperationCallable()

Updates the Recognizer.

Sample 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 (SpeechClient speechClient = SpeechClient.create()) {
   UpdateRecognizerRequest request =
       UpdateRecognizerRequest.newBuilder()
           .setRecognizer(Recognizer.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setValidateOnly(true)
           .build();
   OperationFuture<Recognizer, OperationMetadata> future =
       speechClient.updateRecognizerOperationCallable().futureCall(request);
   // Do something.
   Recognizer response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateRecognizerRequest,Recognizer,OperationMetadata>