Class SpeechClient (4.31.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
MethodDescriptionMethod 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
TypeDescription
SpeechClient
Exceptions
TypeDescription
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
NameDescription
settingsSpeechSettings
Returns
TypeDescription
SpeechClient
Exceptions
TypeDescription
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
NameDescription
stubSpeechStub
Returns
TypeDescription
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
NameDescription
settingsSpeechSettings

SpeechClient(SpeechStub stub)

protected SpeechClient(SpeechStub stub)
Parameter
NameDescription
stubSpeechStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
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
NameDescription
requestBatchRecognizeRequest

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

Returns
TypeDescription
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
NameDescription
recognizerRecognizerName

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.

configRecognitionConfig

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.

configMaskFieldMask

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.

filesList<BatchRecognizeFileMetadata>

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

Returns
TypeDescription
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
NameDescription
recognizerString

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.

configRecognitionConfig

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.

configMaskFieldMask

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.

filesList<BatchRecognizeFileMetadata>

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestCreateCustomClassRequest

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

Returns
TypeDescription
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
NameDescription
parentLocationName

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

customClassCustomClass

Required. The CustomClass to create.

customClassIdString

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
TypeDescription
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
NameDescription
parentString

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

customClassCustomClass

Required. The CustomClass to create.

customClassIdString

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
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestCreatePhraseSetRequest

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

Returns
TypeDescription
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
NameDescription
parentLocationName

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

phraseSetPhraseSet

Required. The PhraseSet to create.

phraseSetIdString

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
TypeDescription
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
NameDescription
parentString

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

phraseSetPhraseSet

Required. The PhraseSet to create.

phraseSetIdString

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
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestCreateRecognizerRequest

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

Returns
TypeDescription
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
NameDescription
parentLocationName

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

recognizerRecognizer

Required. The Recognizer to create.

recognizerIdString

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
TypeDescription
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
NameDescription
parentString

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

recognizerRecognizer

Required. The Recognizer to create.

recognizerIdString

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
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
nameCustomClassName

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

Returns
TypeDescription
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
NameDescription
requestDeleteCustomClassRequest

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

Returns
TypeDescription
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
NameDescription
nameString

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestDeletePhraseSetRequest

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

Returns
TypeDescription
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
NameDescription
namePhraseSetName

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

Returns
TypeDescription
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
NameDescription
nameString

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestDeleteRecognizerRequest

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

Returns
TypeDescription
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
NameDescription
nameRecognizerName

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

Returns
TypeDescription
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
NameDescription
nameString

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
nameConfigName

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
TypeDescription
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
NameDescription
requestGetConfigRequest

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

Returns
TypeDescription
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
NameDescription
nameString

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
TypeDescription
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
TypeDescription
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
NameDescription
nameCustomClassName

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

Returns
TypeDescription
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]",<