Class SpeechClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @Generated("by gapic-generator-java")
    public class SpeechClient
    extends Object
    implements com.google.api.gax.core.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.

    • Constructor Detail

      • SpeechClient

        protected SpeechClient​(SpeechSettings settings)
                        throws IOException
        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.
        Throws:
        IOException
      • SpeechClient

        protected SpeechClient​(SpeechStub stub)
    • Method Detail

      • create

        public static final SpeechClient create​(SpeechSettings settings)
                                         throws IOException
        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.
        Throws:
        IOException
      • create

        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).
      • getOperationsClient

        public final com.google.longrunning.OperationsClient getOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • getHttpJsonOperationsClient

        @BetaApi
        public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • createRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> createRecognizerAsync​(LocationName parent,
                                                                                                                              Recognizer recognizer,
                                                                                                                              String recognizerId)
        Creates a [Recognizer][google.cloud.speech.v2.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:
        parent - Required. The project and location where this Recognizer will be created. The expected format is `projects/{project}/locations/{location}`.
        recognizer - Required. The Recognizer to create.
        recognizerId - 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][0-9]-/.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> createRecognizerAsync​(String parent,
                                                                                                                              Recognizer recognizer,
                                                                                                                              String recognizerId)
        Creates a [Recognizer][google.cloud.speech.v2.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:
        parent - Required. The project and location where this Recognizer will be created. The expected format is `projects/{project}/locations/{location}`.
        recognizer - Required. The Recognizer to create.
        recognizerId - 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][0-9]-/.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> createRecognizerAsync​(CreateRecognizerRequest request)
        Creates a [Recognizer][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createRecognizerOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CreateRecognizerRequest,​Recognizer,​OperationMetadata> createRecognizerOperationCallable()
        Creates a [Recognizer][google.cloud.speech.v2.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();
         }
         
      • createRecognizerCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateRecognizerRequest,​com.google.longrunning.Operation> createRecognizerCallable()
        Creates a [Recognizer][google.cloud.speech.v2.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();
         }
         
      • listRecognizers

        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);
           }
         }
         
        Parameters:
        parent - Required. The project and location of Recognizers to list. The expected format is `projects/{project}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listRecognizers

        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);
           }
         }
         
        Parameters:
        parent - Required. The project and location of Recognizers to list. The expected format is `projects/{project}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listRecognizers

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listRecognizersPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • listRecognizersCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • getRecognizer

        public final Recognizer getRecognizer​(RecognizerName name)
        Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with [NOT_FOUND][google.rpc.Code.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);
         }
         
        Parameters:
        name - Required. The name of the Recognizer to retrieve. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getRecognizer

        public final Recognizer getRecognizer​(String name)
        Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with [NOT_FOUND][google.rpc.Code.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);
         }
         
        Parameters:
        name - Required. The name of the Recognizer to retrieve. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getRecognizer

        public final Recognizer getRecognizer​(GetRecognizerRequest request)
        Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with [NOT_FOUND][google.rpc.Code.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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getRecognizerCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetRecognizerRequest,​Recognizer> getRecognizerCallable()
        Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with [NOT_FOUND][google.rpc.Code.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();
         }
         
      • updateRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> updateRecognizerAsync​(Recognizer recognizer,
                                                                                                                              com.google.protobuf.FieldMask updateMask)
        Updates the [Recognizer][google.cloud.speech.v2.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:
        recognizer - Required. The Recognizer to update.

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

        updateMask - The list of fields to update. If empty, all non-default valued fields are considered for update. Use `*` to update the entire Recognizer resource.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> updateRecognizerAsync​(UpdateRecognizerRequest request)
        Updates the [Recognizer][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateRecognizerOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UpdateRecognizerRequest,​Recognizer,​OperationMetadata> updateRecognizerOperationCallable()
        Updates the [Recognizer][google.cloud.speech.v2.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();
         }
         
      • updateRecognizerCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateRecognizerRequest,​com.google.longrunning.Operation> updateRecognizerCallable()
        Updates the [Recognizer][google.cloud.speech.v2.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();
         }
         
      • deleteRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> deleteRecognizerAsync​(RecognizerName name)
        Deletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the Recognizer to delete. Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> deleteRecognizerAsync​(String name)
        Deletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the Recognizer to delete. Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> deleteRecognizerAsync​(DeleteRecognizerRequest request)
        Deletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteRecognizerOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<DeleteRecognizerRequest,​Recognizer,​OperationMetadata> deleteRecognizerOperationCallable()
        Deletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
      • deleteRecognizerCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteRecognizerRequest,​com.google.longrunning.Operation> deleteRecognizerCallable()
        Deletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
      • undeleteRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> undeleteRecognizerAsync​(RecognizerName name)
        Undeletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the Recognizer to undelete. Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> undeleteRecognizerAsync​(String name)
        Undeletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the Recognizer to undelete. Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteRecognizerAsync

        public final com.google.api.gax.longrunning.OperationFuture<Recognizer,​OperationMetadata> undeleteRecognizerAsync​(UndeleteRecognizerRequest request)
        Undeletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteRecognizerOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UndeleteRecognizerRequest,​Recognizer,​OperationMetadata> undeleteRecognizerOperationCallable()
        Undeletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
      • undeleteRecognizerCallable

        public final com.google.api.gax.rpc.UnaryCallable<UndeleteRecognizerRequest,​com.google.longrunning.Operation> undeleteRecognizerCallable()
        Undeletes the [Recognizer][google.cloud.speech.v2.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();
         }
         
      • recognize

        public final RecognizeResponse recognize​(RecognizerName recognizer,
                                                 RecognitionConfig config,
                                                 com.google.protobuf.FieldMask configMask,
                                                 com.google.protobuf.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:
        recognizer - Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
        config - Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to override parts of the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the Recognizer resource.
        configMask - The list of fields in [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in [config][google.cloud.speech.v2.RecognizeRequest.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][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces the config in the recognizer for this recognition request.
        content - The audio data bytes encoded as specified in [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • recognize

        public final RecognizeResponse recognize​(RecognizerName recognizer,
                                                 RecognitionConfig config,
                                                 com.google.protobuf.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:
        recognizer - Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
        config - Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to override parts of the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the Recognizer resource.
        configMask - The list of fields in [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in [config][google.cloud.speech.v2.RecognizeRequest.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][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces the config in the recognizer for this recognition request.
        uri - URI that points to a file that contains audio data bytes as specified in [RecognitionConfig][google.cloud.speech.v2.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][google.rpc.Code.INVALID_ARGUMENT]). For more information, see [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • recognize

        public final RecognizeResponse recognize​(String recognizer,
                                                 RecognitionConfig config,
                                                 com.google.protobuf.FieldMask configMask,
                                                 com.google.protobuf.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:
        recognizer - Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
        config - Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to override parts of the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the Recognizer resource.
        configMask - The list of fields in [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in [config][google.cloud.speech.v2.RecognizeRequest.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][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces the config in the recognizer for this recognition request.
        content - The audio data bytes encoded as specified in [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As with all bytes fields, proto buffers use a pure binary representation, whereas JSON representations use base64.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • recognize

        public final RecognizeResponse recognize​(String recognizer,
                                                 RecognitionConfig config,
                                                 com.google.protobuf.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:
        recognizer - Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
        config - Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to override parts of the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the Recognizer resource.
        configMask - The list of fields in [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the recognizer during this recognition request. If no mask is provided, all non-default valued fields in [config][google.cloud.speech.v2.RecognizeRequest.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][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces the config in the recognizer for this recognition request.
        uri - URI that points to a file that contains audio data bytes as specified in [RecognitionConfig][google.cloud.speech.v2.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][google.rpc.Code.INVALID_ARGUMENT]). For more information, see [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • recognize

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • recognizeCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • streamingRecognizeCallable

        public final com.google.api.gax.rpc.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.
           }
         }
         
      • batchRecognizeAsync

        public final com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,​OperationMetadata> batchRecognizeAsync​(RecognizerName recognizer,
                                                                                                                                        RecognitionConfig config,
                                                                                                                                        com.google.protobuf.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:
        recognizer - Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
        config - Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] field can be used to override parts of the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the Recognizer resource.
        configMask - The list of fields in [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override the values in the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the recognizer during this recognition request. If no mask is provided, all given fields in [config][google.cloud.speech.v2.BatchRecognizeRequest.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][google.cloud.speech.v2.BatchRecognizeRequest.config] completely overrides and replaces the config in the recognizer for this recognition request.
        files - Audio files with file metadata for ASR. The maximum number of files allowed to be specified is 5.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchRecognizeAsync

        public final com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,​OperationMetadata> batchRecognizeAsync​(String recognizer,
                                                                                                                                        RecognitionConfig config,
                                                                                                                                        com.google.protobuf.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:
        recognizer - Required. The name of the Recognizer to use during recognition. The expected format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
        config - Features and audio metadata to use for the Automatic Speech Recognition. This field in combination with the [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] field can be used to override parts of the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the Recognizer resource.
        configMask - The list of fields in [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override the values in the [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config] of the recognizer during this recognition request. If no mask is provided, all given fields in [config][google.cloud.speech.v2.BatchRecognizeRequest.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][google.cloud.speech.v2.BatchRecognizeRequest.config] completely overrides and replaces the config in the recognizer for this recognition request.
        files - Audio files with file metadata for ASR. The maximum number of files allowed to be specified is 5.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchRecognizeAsync

        public final com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,​OperationMetadata> batchRecognizeAsync​(BatchRecognizeRequest request)
        Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (SpeechClient speechClient = SpeechClient.create()) {
           BatchRecognizeRequest request =
               BatchRecognizeRequest.newBuilder()
                   .setRecognizer(
                       RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
                   .setConfig(RecognitionConfig.newBuilder().build())
                   .setConfigMask(FieldMask.newBuilder().build())
                   .addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
                   .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
                   .build();
           BatchRecognizeResponse response = speechClient.batchRecognizeAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • batchRecognizeOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<BatchRecognizeRequest,​BatchRecognizeResponse,​OperationMetadata> batchRecognizeOperationCallable()
        Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (SpeechClient speechClient = SpeechClient.create()) {
           BatchRecognizeRequest request =
               BatchRecognizeRequest.newBuilder()
                   .setRecognizer(
                       RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
                   .setConfig(RecognitionConfig.newBuilder().build())
                   .setConfigMask(FieldMask.newBuilder().build())
                   .addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
                   .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
                   .build();
           OperationFuture<BatchRecognizeResponse, OperationMetadata> future =
               speechClient.batchRecognizeOperationCallable().futureCall(request);
           // Do something.
           BatchRecognizeResponse response = future.get();
         }
         
      • batchRecognizeCallable

        public final com.google.api.gax.rpc.UnaryCallable<BatchRecognizeRequest,​com.google.longrunning.Operation> batchRecognizeCallable()
        Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (SpeechClient speechClient = SpeechClient.create()) {
           BatchRecognizeRequest request =
               BatchRecognizeRequest.newBuilder()
                   .setRecognizer(
                       RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
                   .setConfig(RecognitionConfig.newBuilder().build())
                   .setConfigMask(FieldMask.newBuilder().build())
                   .addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
                   .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
                   .build();
           ApiFuture<Operation> future = speechClient.batchRecognizeCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • getConfig

        public final Config getConfig​(ConfigName name)
        Returns the requested [Config][google.cloud.speech.v2.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);
         }
         
        Parameters:
        name - 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`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getConfig

        public final Config getConfig​(String name)
        Returns the requested [Config][google.cloud.speech.v2.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);
         }
         
        Parameters:
        name - 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`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getConfig

        public final Config getConfig​(GetConfigRequest request)
        Returns the requested [Config][google.cloud.speech.v2.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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getConfigCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetConfigRequest,​Config> getConfigCallable()
        Returns the requested [Config][google.cloud.speech.v2.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();
         }
         
      • updateConfig

        public final Config updateConfig​(Config config,
                                         com.google.protobuf.FieldMask updateMask)
        Updates the [Config][google.cloud.speech.v2.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:
        config - Required. The config to update.

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

        updateMask - The list of fields to be updated.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateConfig

        public final Config updateConfig​(UpdateConfigRequest request)
        Updates the [Config][google.cloud.speech.v2.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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateConfigCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateConfigRequest,​Config> updateConfigCallable()
        Updates the [Config][google.cloud.speech.v2.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();
         }
         
      • createCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> createCustomClassAsync​(LocationName parent,
                                                                                                                                CustomClass customClass,
                                                                                                                                String customClassId)
        Creates a [CustomClass][google.cloud.speech.v2.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:
        parent - Required. The project and location where this CustomClass will be created. The expected format is `projects/{project}/locations/{location}`.
        customClass - Required. The CustomClass to create.
        customClassId - 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][0-9]-/.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> createCustomClassAsync​(String parent,
                                                                                                                                CustomClass customClass,
                                                                                                                                String customClassId)
        Creates a [CustomClass][google.cloud.speech.v2.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:
        parent - Required. The project and location where this CustomClass will be created. The expected format is `projects/{project}/locations/{location}`.
        customClass - Required. The CustomClass to create.
        customClassId - 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][0-9]-/.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> createCustomClassAsync​(CreateCustomClassRequest request)
        Creates a [CustomClass][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createCustomClassOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CreateCustomClassRequest,​CustomClass,​OperationMetadata> createCustomClassOperationCallable()
        Creates a [CustomClass][google.cloud.speech.v2.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();
         }
         
      • createCustomClassCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateCustomClassRequest,​com.google.longrunning.Operation> createCustomClassCallable()
        Creates a [CustomClass][google.cloud.speech.v2.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();
         }
         
      • listCustomClasses

        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);
           }
         }
         
        Parameters:
        parent - Required. The project and location of CustomClass resources to list. The expected format is `projects/{project}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listCustomClasses

        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);
           }
         }
         
        Parameters:
        parent - Required. The project and location of CustomClass resources to list. The expected format is `projects/{project}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listCustomClasses

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listCustomClassesPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • listCustomClassesCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • getCustomClass

        public final CustomClass getCustomClass​(CustomClassName name)
        Returns the requested [CustomClass][google.cloud.speech.v2.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);
         }
         
        Parameters:
        name - Required. The name of the CustomClass to retrieve. The expected format is `projects/{project}/locations/{location}/customClasses/{custom_class}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getCustomClass

        public final CustomClass getCustomClass​(String name)
        Returns the requested [CustomClass][google.cloud.speech.v2.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);
         }
         
        Parameters:
        name - Required. The name of the CustomClass to retrieve. The expected format is `projects/{project}/locations/{location}/customClasses/{custom_class}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getCustomClass

        public final CustomClass getCustomClass​(GetCustomClassRequest request)
        Returns the requested [CustomClass][google.cloud.speech.v2.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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getCustomClassCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetCustomClassRequest,​CustomClass> getCustomClassCallable()
        Returns the requested [CustomClass][google.cloud.speech.v2.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();
         }
         
      • updateCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> updateCustomClassAsync​(CustomClass customClass,
                                                                                                                                com.google.protobuf.FieldMask updateMask)
        Updates the [CustomClass][google.cloud.speech.v2.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:
        customClass - Required. The CustomClass to update.

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

        updateMask - The list of fields to be updated. If empty, all fields are considered for update.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> updateCustomClassAsync​(UpdateCustomClassRequest request)
        Updates the [CustomClass][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateCustomClassOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UpdateCustomClassRequest,​CustomClass,​OperationMetadata> updateCustomClassOperationCallable()
        Updates the [CustomClass][google.cloud.speech.v2.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();
         }
         
      • updateCustomClassCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateCustomClassRequest,​com.google.longrunning.Operation> updateCustomClassCallable()
        Updates the [CustomClass][google.cloud.speech.v2.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();
         }
         
      • deleteCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> deleteCustomClassAsync​(CustomClassName name)
        Deletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the CustomClass to delete. Format: `projects/{project}/locations/{location}/customClasses/{custom_class}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> deleteCustomClassAsync​(String name)
        Deletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the CustomClass to delete. Format: `projects/{project}/locations/{location}/customClasses/{custom_class}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> deleteCustomClassAsync​(DeleteCustomClassRequest request)
        Deletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteCustomClassOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<DeleteCustomClassRequest,​CustomClass,​OperationMetadata> deleteCustomClassOperationCallable()
        Deletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
      • deleteCustomClassCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteCustomClassRequest,​com.google.longrunning.Operation> deleteCustomClassCallable()
        Deletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
      • undeleteCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> undeleteCustomClassAsync​(CustomClassName name)
        Undeletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the CustomClass to undelete. Format: `projects/{project}/locations/{location}/customClasses/{custom_class}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> undeleteCustomClassAsync​(String name)
        Undeletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the CustomClass to undelete. Format: `projects/{project}/locations/{location}/customClasses/{custom_class}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteCustomClassAsync

        public final com.google.api.gax.longrunning.OperationFuture<CustomClass,​OperationMetadata> undeleteCustomClassAsync​(UndeleteCustomClassRequest request)
        Undeletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeleteCustomClassOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UndeleteCustomClassRequest,​CustomClass,​OperationMetadata> undeleteCustomClassOperationCallable()
        Undeletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
      • undeleteCustomClassCallable

        public final com.google.api.gax.rpc.UnaryCallable<UndeleteCustomClassRequest,​com.google.longrunning.Operation> undeleteCustomClassCallable()
        Undeletes the [CustomClass][google.cloud.speech.v2.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();
         }
         
      • createPhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> createPhraseSetAsync​(LocationName parent,
                                                                                                                            PhraseSet phraseSet,
                                                                                                                            String phraseSetId)
        Creates a [PhraseSet][google.cloud.speech.v2.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:
        parent - Required. The project and location where this PhraseSet will be created. The expected format is `projects/{project}/locations/{location}`.
        phraseSet - Required. The PhraseSet to create.
        phraseSetId - 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][0-9]-/.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createPhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> createPhraseSetAsync​(String parent,
                                                                                                                            PhraseSet phraseSet,
                                                                                                                            String phraseSetId)
        Creates a [PhraseSet][google.cloud.speech.v2.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:
        parent - Required. The project and location where this PhraseSet will be created. The expected format is `projects/{project}/locations/{location}`.
        phraseSet - Required. The PhraseSet to create.
        phraseSetId - 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][0-9]-/.

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createPhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> createPhraseSetAsync​(CreatePhraseSetRequest request)
        Creates a [PhraseSet][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createPhraseSetOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CreatePhraseSetRequest,​PhraseSet,​OperationMetadata> createPhraseSetOperationCallable()
        Creates a [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • createPhraseSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreatePhraseSetRequest,​com.google.longrunning.Operation> createPhraseSetCallable()
        Creates a [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • listPhraseSets

        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);
           }
         }
         
        Parameters:
        parent - Required. The project and location of PhraseSet resources to list. The expected format is `projects/{project}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listPhraseSets

        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);
           }
         }
         
        Parameters:
        parent - Required. The project and location of PhraseSet resources to list. The expected format is `projects/{project}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listPhraseSets

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listPhraseSetsPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • listPhraseSetsCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • getPhraseSet

        public final PhraseSet getPhraseSet​(PhraseSetName name)
        Returns the requested [PhraseSet][google.cloud.speech.v2.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);
         }
         
        Parameters:
        name - Required. The name of the PhraseSet to retrieve. The expected format is `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getPhraseSet

        public final PhraseSet getPhraseSet​(String name)
        Returns the requested [PhraseSet][google.cloud.speech.v2.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);
         }
         
        Parameters:
        name - Required. The name of the PhraseSet to retrieve. The expected format is `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getPhraseSet

        public final PhraseSet getPhraseSet​(GetPhraseSetRequest request)
        Returns the requested [PhraseSet][google.cloud.speech.v2.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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getPhraseSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetPhraseSetRequest,​PhraseSet> getPhraseSetCallable()
        Returns the requested [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • updatePhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> updatePhraseSetAsync​(PhraseSet phraseSet,
                                                                                                                            com.google.protobuf.FieldMask updateMask)
        Updates the [PhraseSet][google.cloud.speech.v2.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:
        phraseSet - Required. The PhraseSet to update.

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

        updateMask - The list of fields to update. If empty, all non-default valued fields are considered for update. Use `*` to update the entire PhraseSet resource.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updatePhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> updatePhraseSetAsync​(UpdatePhraseSetRequest request)
        Updates the [PhraseSet][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updatePhraseSetOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UpdatePhraseSetRequest,​PhraseSet,​OperationMetadata> updatePhraseSetOperationCallable()
        Updates the [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • updatePhraseSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdatePhraseSetRequest,​com.google.longrunning.Operation> updatePhraseSetCallable()
        Updates the [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • deletePhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> deletePhraseSetAsync​(PhraseSetName name)
        Deletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the PhraseSet to delete. Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deletePhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> deletePhraseSetAsync​(String name)
        Deletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the PhraseSet to delete. Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deletePhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> deletePhraseSetAsync​(DeletePhraseSetRequest request)
        Deletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deletePhraseSetOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<DeletePhraseSetRequest,​PhraseSet,​OperationMetadata> deletePhraseSetOperationCallable()
        Deletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • deletePhraseSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeletePhraseSetRequest,​com.google.longrunning.Operation> deletePhraseSetCallable()
        Deletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • undeletePhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> undeletePhraseSetAsync​(PhraseSetName name)
        Undeletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the PhraseSet to undelete. Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeletePhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> undeletePhraseSetAsync​(String name)
        Undeletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
        Parameters:
        name - Required. The name of the PhraseSet to undelete. Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeletePhraseSetAsync

        public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,​OperationMetadata> undeletePhraseSetAsync​(UndeletePhraseSetRequest request)
        Undeletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • undeletePhraseSetOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UndeletePhraseSetRequest,​PhraseSet,​OperationMetadata> undeletePhraseSetOperationCallable()
        Undeletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • undeletePhraseSetCallable

        public final com.google.api.gax.rpc.UnaryCallable<UndeletePhraseSetRequest,​com.google.longrunning.Operation> undeletePhraseSetCallable()
        Undeletes the [PhraseSet][google.cloud.speech.v2.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();
         }
         
      • listLocations

        public final SpeechClient.ListLocationsPagedResponse listLocations​(com.google.cloud.location.ListLocationsRequest request)
        Lists information about the supported locations for this service.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (SpeechClient speechClient = SpeechClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Location element : speechClient.listLocations(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listLocationsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,​SpeechClient.ListLocationsPagedResponse> listLocationsPagedCallable()
        Lists information about the supported locations for this service.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (SpeechClient speechClient = SpeechClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Location> future = speechClient.listLocationsPagedCallable().futureCall(request);
           // Do something.
           for (Location element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listLocationsCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,​com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
        Lists information about the supported locations for this service.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (SpeechClient speechClient = SpeechClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListLocationsResponse response = speechClient.listLocationsCallable().call(request);
             for (Location element : response.getLocationsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getLocation

        public final com.google.cloud.location.Location getLocation​(com.google.cloud.location.GetLocationRequest request)
        Gets information about a location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (SpeechClient speechClient = SpeechClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           Location response = speechClient.getLocation(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getLocationCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,​com.google.cloud.location.Location> getLocationCallable()
        Gets information about a location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (SpeechClient speechClient = SpeechClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           ApiFuture<Location> future = speechClient.getLocationCallable().futureCall(request);
           // Do something.
           Location response = future.get();
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource