Class IntentsClient

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

    @Generated("by gapic-generator-java")
    public class IntentsClient
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent].

    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 (IntentsClient intentsClient = IntentsClient.create()) {
       IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
       Intent response = intentsClient.getIntent(name);
     }
     

    Note: close() needs to be called on the IntentsClient 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 IntentsSettings 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
     IntentsSettings intentsSettings =
         IntentsSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     IntentsClient intentsClient = IntentsClient.create(intentsSettings);
     

    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
     IntentsSettings intentsSettings = IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
     IntentsClient intentsClient = IntentsClient.create(intentsSettings);
     

    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
     IntentsSettings intentsSettings = IntentsSettings.newHttpJsonBuilder().build();
     IntentsClient intentsClient = IntentsClient.create(intentsSettings);
     

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

    • Constructor Detail

      • IntentsClient

        protected IntentsClient​(IntentsSettings settings)
                         throws IOException
        Constructs an instance of IntentsClient, 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
      • IntentsClient

        protected IntentsClient​(IntentsStub stub)
    • Method Detail

      • create

        public static final IntentsClient create​(IntentsSettings settings)
                                          throws IOException
        Constructs an instance of IntentsClient, 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 IntentsClient create​(IntentsStub stub)
        Constructs an instance of IntentsClient, using the given stub for making calls. This is for advanced usage - prefer using create(IntentsSettings).
      • listIntents

        public final IntentsClient.ListIntentsPagedResponse listIntents​(AgentName parent)
        Returns the list of all intents in the specified agent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
           for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The agent to list all intents for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listIntents

        public final IntentsClient.ListIntentsPagedResponse listIntents​(String parent)
        Returns the list of all intents in the specified agent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
           for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The agent to list all intents for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listIntents

        public final IntentsClient.ListIntentsPagedResponse listIntents​(ListIntentsRequest request)
        Returns the list of all intents in the specified agent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           ListIntentsRequest request =
               ListIntentsRequest.newBuilder()
                   .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
                   .setLanguageCode("languageCode-2092349083")
                   .setIntentView(IntentView.forNumber(0))
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Intent element : intentsClient.listIntents(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
      • listIntentsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListIntentsRequest,​IntentsClient.ListIntentsPagedResponse> listIntentsPagedCallable()
        Returns the list of all intents in the specified agent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           ListIntentsRequest request =
               ListIntentsRequest.newBuilder()
                   .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
                   .setLanguageCode("languageCode-2092349083")
                   .setIntentView(IntentView.forNumber(0))
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Intent> future = intentsClient.listIntentsPagedCallable().futureCall(request);
           // Do something.
           for (Intent element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listIntentsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListIntentsRequest,​ListIntentsResponse> listIntentsCallable()
        Returns the list of all intents in the specified agent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           ListIntentsRequest request =
               ListIntentsRequest.newBuilder()
                   .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
                   .setLanguageCode("languageCode-2092349083")
                   .setIntentView(IntentView.forNumber(0))
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
             for (Intent element : response.getIntentsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getIntent

        public final Intent getIntent​(IntentName name)
        Retrieves the specified intent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
           Intent response = intentsClient.getIntent(name);
         }
         
        Parameters:
        name - Required. The name of the intent. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIntent

        public final Intent getIntent​(String name)
        Retrieves the specified intent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           String name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString();
           Intent response = intentsClient.getIntent(name);
         }
         
        Parameters:
        name - Required. The name of the intent. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIntent

        public final Intent getIntent​(GetIntentRequest request)
        Retrieves the specified intent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           GetIntentRequest request =
               GetIntentRequest.newBuilder()
                   .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
                   .setLanguageCode("languageCode-2092349083")
                   .build();
           Intent response = intentsClient.getIntent(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
      • getIntentCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetIntentRequest,​Intent> getIntentCallable()
        Retrieves the specified intent.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           GetIntentRequest request =
               GetIntentRequest.newBuilder()
                   .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
                   .setLanguageCode("languageCode-2092349083")
                   .build();
           ApiFuture<Intent> future = intentsClient.getIntentCallable().futureCall(request);
           // Do something.
           Intent response = future.get();
         }
         
      • createIntent

        public final Intent createIntent​(AgentName parent,
                                         Intent intent)
        Creates an intent in the specified agent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
           Intent intent = Intent.newBuilder().build();
           Intent response = intentsClient.createIntent(parent, intent);
         }
         
        Parameters:
        parent - Required. The agent to create an intent for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
        intent - Required. The intent to create.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createIntent

        public final Intent createIntent​(String parent,
                                         Intent intent)
        Creates an intent in the specified agent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
           Intent intent = Intent.newBuilder().build();
           Intent response = intentsClient.createIntent(parent, intent);
         }
         
        Parameters:
        parent - Required. The agent to create an intent for. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
        intent - Required. The intent to create.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createIntent

        public final Intent createIntent​(CreateIntentRequest request)
        Creates an intent in the specified agent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           CreateIntentRequest request =
               CreateIntentRequest.newBuilder()
                   .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
                   .setIntent(Intent.newBuilder().build())
                   .setLanguageCode("languageCode-2092349083")
                   .build();
           Intent response = intentsClient.createIntent(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
      • createIntentCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateIntentRequest,​Intent> createIntentCallable()
        Creates an intent in the specified agent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           CreateIntentRequest request =
               CreateIntentRequest.newBuilder()
                   .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
                   .setIntent(Intent.newBuilder().build())
                   .setLanguageCode("languageCode-2092349083")
                   .build();
           ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
           // Do something.
           Intent response = future.get();
         }
         
      • updateIntent

        public final Intent updateIntent​(Intent intent,
                                         com.google.protobuf.FieldMask updateMask)
        Updates the specified intent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           Intent intent = Intent.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           Intent response = intentsClient.updateIntent(intent, updateMask);
         }
         
        Parameters:
        intent - Required. The intent to update.
        updateMask - The mask to control which fields get updated. If the mask is not present, all fields will be updated.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateIntent

        public final Intent updateIntent​(UpdateIntentRequest request)
        Updates the specified intent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           UpdateIntentRequest request =
               UpdateIntentRequest.newBuilder()
                   .setIntent(Intent.newBuilder().build())
                   .setLanguageCode("languageCode-2092349083")
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           Intent response = intentsClient.updateIntent(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
      • updateIntentCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateIntentRequest,​Intent> updateIntentCallable()
        Updates the specified intent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           UpdateIntentRequest request =
               UpdateIntentRequest.newBuilder()
                   .setIntent(Intent.newBuilder().build())
                   .setLanguageCode("languageCode-2092349083")
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Intent> future = intentsClient.updateIntentCallable().futureCall(request);
           // Do something.
           Intent response = future.get();
         }
         
      • deleteIntent

        public final void deleteIntent​(IntentName name)
        Deletes the specified intent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
           intentsClient.deleteIntent(name);
         }
         
        Parameters:
        name - Required. The name of the intent to delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteIntent

        public final void deleteIntent​(String name)
        Deletes the specified intent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           String name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString();
           intentsClient.deleteIntent(name);
         }
         
        Parameters:
        name - Required. The name of the intent to delete. Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteIntent

        public final void deleteIntent​(DeleteIntentRequest request)
        Deletes the specified intent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           DeleteIntentRequest request =
               DeleteIntentRequest.newBuilder()
                   .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
                   .build();
           intentsClient.deleteIntent(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
      • deleteIntentCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteIntentRequest,​com.google.protobuf.Empty> deleteIntentCallable()
        Deletes the specified intent.

        Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (IntentsClient intentsClient = IntentsClient.create()) {
           DeleteIntentRequest request =
               DeleteIntentRequest.newBuilder()
                   .setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
                   .build();
           ApiFuture<Empty> future = intentsClient.deleteIntentCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • listLocations

        public final IntentsClient.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 (IntentsClient intentsClient = IntentsClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Location element : intentsClient.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,​IntentsClient.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 (IntentsClient intentsClient = IntentsClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Location> future = intentsClient.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 (IntentsClient intentsClient = IntentsClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListLocationsResponse response = intentsClient.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 (IntentsClient intentsClient = IntentsClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           Location response = intentsClient.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 (IntentsClient intentsClient = IntentsClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           ApiFuture<Location> future = intentsClient.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