Class SpeechClient (4.6.0)

public class SpeechClient implements BackgroundResource

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

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

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

See the individual methods for example code.

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

This class can be customized by passing in a custom instance of 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

Implements

BackgroundResource

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>())
           .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. Resource name of the recognizer to be used for ASR.

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.

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. Resource name of the recognizer to be used for ASR.

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.

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>())
           .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>())
           .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]", "[CUSTOM_CLASS]").toString())
           .build();
   CustomClass response = speechClient.getCustomClass(request);
 }
 
Parameter
NameDescription
requestGetCustomClassRequest

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

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

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
OperationsClient

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

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

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

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

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

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

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

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

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

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

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

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

Returns
TypeDescription
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
TypeDescription
UnaryCallable<GetRecognizerRequest,Recognizer>

getSettings()

public final SpeechSettings getSettings()
Returns
TypeDescription
SpeechSettings

getStub()

public SpeechStub getStub()
Returns
TypeDescription
SpeechStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
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
NameDescription
requestListCustomClassesRequest

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

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

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

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

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
UnaryCallable<ListCustomClassesRequest,ListCustomClassesPagedResponse>

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
NameDescription
requestListPhraseSetsRequest

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{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 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.

contentByteString

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

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{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 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.

uriString

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

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{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 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.

contentByteString

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

Required. The name of the Recognizer to use during recognition. The expected format is projects/{project}/locations/{location}/recognizers/{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 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.

uriString

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

updateMaskFieldMask

The list of fields to be updated.

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

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

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

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}.

updateMaskFieldMask

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

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

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

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

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}.

updateMaskFieldMask

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

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

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

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}.

updateMaskFieldMask

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

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
OperationCallable<UpdateRecognizerRequest,Recognizer,OperationMetadata>