Class AgentsClient

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

    @BetaApi
    @Generated("by gapic-generator-java")
    public class AgentsClient
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Service for managing [Agents][google.cloud.dialogflow.v2beta1.Agent].

    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 (AgentsClient agentsClient = AgentsClient.create()) {
       LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
       Agent response = agentsClient.getAgent(parent);
     }
     

    Note: close() needs to be called on the AgentsClient 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 AgentsSettings 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
     AgentsSettings agentsSettings =
         AgentsSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     AgentsClient agentsClient = AgentsClient.create(agentsSettings);
     

    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
     AgentsSettings agentsSettings = AgentsSettings.newBuilder().setEndpoint(myEndpoint).build();
     AgentsClient agentsClient = AgentsClient.create(agentsSettings);
     

    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
     AgentsSettings agentsSettings = AgentsSettings.newHttpJsonBuilder().build();
     AgentsClient agentsClient = AgentsClient.create(agentsSettings);
     

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

    • Constructor Detail

      • AgentsClient

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

        protected AgentsClient​(AgentsStub stub)
    • Method Detail

      • create

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

        public final Agent getAgent​(LocationName parent)
        Retrieves 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 (AgentsClient agentsClient = AgentsClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           Agent response = agentsClient.getAgent(parent);
         }
         
        Parameters:
        parent - Required. The project that the agent to fetch is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAgent

        public final Agent getAgent​(ProjectName parent)
        Retrieves 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 (AgentsClient agentsClient = AgentsClient.create()) {
           ProjectName parent = ProjectName.of("[PROJECT]");
           Agent response = agentsClient.getAgent(parent);
         }
         
        Parameters:
        parent - Required. The project that the agent to fetch is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAgent

        public final Agent getAgent​(String parent)
        Retrieves 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 (AgentsClient agentsClient = AgentsClient.create()) {
           String parent = ProjectName.of("[PROJECT]").toString();
           Agent response = agentsClient.getAgent(parent);
         }
         
        Parameters:
        parent - Required. The project that the agent to fetch is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAgent

        public final Agent getAgent​(GetAgentRequest request)
        Retrieves 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 (AgentsClient agentsClient = AgentsClient.create()) {
           GetAgentRequest request =
               GetAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           Agent response = agentsClient.getAgent(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
      • getAgentCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetAgentRequest,​Agent> getAgentCallable()
        Retrieves 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 (AgentsClient agentsClient = AgentsClient.create()) {
           GetAgentRequest request =
               GetAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           ApiFuture<Agent> future = agentsClient.getAgentCallable().futureCall(request);
           // Do something.
           Agent response = future.get();
         }
         
      • setAgent

        public final Agent setAgent​(Agent agent)
        Creates/updates the specified agent.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           Agent agent = Agent.newBuilder().build();
           Agent response = agentsClient.setAgent(agent);
         }
         
        Parameters:
        agent - Required. The agent to update.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setAgent

        public final Agent setAgent​(SetAgentRequest request)
        Creates/updates the specified agent.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           SetAgentRequest request =
               SetAgentRequest.newBuilder()
                   .setAgent(Agent.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           Agent response = agentsClient.setAgent(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
      • setAgentCallable

        public final com.google.api.gax.rpc.UnaryCallable<SetAgentRequest,​Agent> setAgentCallable()
        Creates/updates the specified agent.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           SetAgentRequest request =
               SetAgentRequest.newBuilder()
                   .setAgent(Agent.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Agent> future = agentsClient.setAgentCallable().futureCall(request);
           // Do something.
           Agent response = future.get();
         }
         
      • deleteAgent

        public final void deleteAgent​(LocationName parent)
        Deletes 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 (AgentsClient agentsClient = AgentsClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           agentsClient.deleteAgent(parent);
         }
         
        Parameters:
        parent - Required. The project that the agent to delete is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAgent

        public final void deleteAgent​(ProjectName parent)
        Deletes 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 (AgentsClient agentsClient = AgentsClient.create()) {
           ProjectName parent = ProjectName.of("[PROJECT]");
           agentsClient.deleteAgent(parent);
         }
         
        Parameters:
        parent - Required. The project that the agent to delete is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAgent

        public final void deleteAgent​(String parent)
        Deletes 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 (AgentsClient agentsClient = AgentsClient.create()) {
           String parent = ProjectName.of("[PROJECT]").toString();
           agentsClient.deleteAgent(parent);
         }
         
        Parameters:
        parent - Required. The project that the agent to delete is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAgent

        public final void deleteAgent​(DeleteAgentRequest request)
        Deletes 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 (AgentsClient agentsClient = AgentsClient.create()) {
           DeleteAgentRequest request =
               DeleteAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           agentsClient.deleteAgent(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
      • deleteAgentCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteAgentRequest,​com.google.protobuf.Empty> deleteAgentCallable()
        Deletes 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 (AgentsClient agentsClient = AgentsClient.create()) {
           DeleteAgentRequest request =
               DeleteAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           ApiFuture<Empty> future = agentsClient.deleteAgentCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • searchAgents

        public final AgentsClient.SearchAgentsPagedResponse searchAgents​(LocationName parent)
        Returns the list of agents. Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).

        Sample code:

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

        public final AgentsClient.SearchAgentsPagedResponse searchAgents​(ProjectName parent)
        Returns the list of agents. Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).

        Sample code:

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

        public final AgentsClient.SearchAgentsPagedResponse searchAgents​(String parent)
        Returns the list of agents. Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).

        Sample code:

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

        public final AgentsClient.SearchAgentsPagedResponse searchAgents​(SearchAgentsRequest request)
        Returns the list of agents. Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           SearchAgentsRequest request =
               SearchAgentsRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Agent element : agentsClient.searchAgents(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
      • searchAgentsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<SearchAgentsRequest,​AgentsClient.SearchAgentsPagedResponse> searchAgentsPagedCallable()
        Returns the list of agents. Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           SearchAgentsRequest request =
               SearchAgentsRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Agent> future = agentsClient.searchAgentsPagedCallable().futureCall(request);
           // Do something.
           for (Agent element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • searchAgentsCallable

        public final com.google.api.gax.rpc.UnaryCallable<SearchAgentsRequest,​SearchAgentsResponse> searchAgentsCallable()
        Returns the list of agents. Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           SearchAgentsRequest request =
               SearchAgentsRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             SearchAgentsResponse response = agentsClient.searchAgentsCallable().call(request);
             for (Agent element : response.getAgentsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • trainAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​com.google.protobuf.Struct> trainAgentAsync​(LocationName parent)
        Trains the specified agent.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           agentsClient.trainAgentAsync(parent).get();
         }
         
        Parameters:
        parent - Required. The project that the agent to train is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • trainAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​com.google.protobuf.Struct> trainAgentAsync​(ProjectName parent)
        Trains the specified agent.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           ProjectName parent = ProjectName.of("[PROJECT]");
           agentsClient.trainAgentAsync(parent).get();
         }
         
        Parameters:
        parent - Required. The project that the agent to train is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • trainAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​com.google.protobuf.Struct> trainAgentAsync​(String parent)
        Trains the specified agent.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           String parent = ProjectName.of("[PROJECT]").toString();
           agentsClient.trainAgentAsync(parent).get();
         }
         
        Parameters:
        parent - Required. The project that the agent to train is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • trainAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​com.google.protobuf.Struct> trainAgentAsync​(TrainAgentRequest request)
        Trains the specified agent.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           TrainAgentRequest request =
               TrainAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           agentsClient.trainAgentAsync(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
      • trainAgentOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<TrainAgentRequest,​com.google.protobuf.Empty,​com.google.protobuf.Struct> trainAgentOperationCallable()
        Trains the specified agent.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           TrainAgentRequest request =
               TrainAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           OperationFuture<Empty, Struct> future =
               agentsClient.trainAgentOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • trainAgentCallable

        public final com.google.api.gax.rpc.UnaryCallable<TrainAgentRequest,​com.google.longrunning.Operation> trainAgentCallable()
        Trains the specified agent.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           TrainAgentRequest request =
               TrainAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           ApiFuture<Operation> future = agentsClient.trainAgentCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • exportAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<ExportAgentResponse,​com.google.protobuf.Struct> exportAgentAsync​(LocationName parent)
        Exports the specified agent to a ZIP file.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           ExportAgentResponse response = agentsClient.exportAgentAsync(parent).get();
         }
         
        Parameters:
        parent - Required. The project that the agent to export is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • exportAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<ExportAgentResponse,​com.google.protobuf.Struct> exportAgentAsync​(ProjectName parent)
        Exports the specified agent to a ZIP file.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           ProjectName parent = ProjectName.of("[PROJECT]");
           ExportAgentResponse response = agentsClient.exportAgentAsync(parent).get();
         }
         
        Parameters:
        parent - Required. The project that the agent to export is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • exportAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<ExportAgentResponse,​com.google.protobuf.Struct> exportAgentAsync​(String parent)
        Exports the specified agent to a ZIP file.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           String parent = ProjectName.of("[PROJECT]").toString();
           ExportAgentResponse response = agentsClient.exportAgentAsync(parent).get();
         }
         
        Parameters:
        parent - Required. The project that the agent to export is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • exportAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<ExportAgentResponse,​com.google.protobuf.Struct> exportAgentAsync​(ExportAgentRequest request)
        Exports the specified agent to a ZIP file.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           ExportAgentRequest request =
               ExportAgentRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .setAgentUri("agentUri1469149223")
                   .build();
           ExportAgentResponse response = agentsClient.exportAgentAsync(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
      • exportAgentOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<ExportAgentRequest,​ExportAgentResponse,​com.google.protobuf.Struct> exportAgentOperationCallable()
        Exports the specified agent to a ZIP file.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           ExportAgentRequest request =
               ExportAgentRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .setAgentUri("agentUri1469149223")
                   .build();
           OperationFuture<ExportAgentResponse, Struct> future =
               agentsClient.exportAgentOperationCallable().futureCall(request);
           // Do something.
           ExportAgentResponse response = future.get();
         }
         
      • exportAgentCallable

        public final com.google.api.gax.rpc.UnaryCallable<ExportAgentRequest,​com.google.longrunning.Operation> exportAgentCallable()
        Exports the specified agent to a ZIP file.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (AgentsClient agentsClient = AgentsClient.create()) {
           ExportAgentRequest request =
               ExportAgentRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .setAgentUri("agentUri1469149223")
                   .build();
           ApiFuture<Operation> future = agentsClient.exportAgentCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • importAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​com.google.protobuf.Struct> importAgentAsync​(ImportAgentRequest request)
        Imports the specified agent from a ZIP file.

        Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        The operation only tracks when importing is complete, not when it is done training.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           ImportAgentRequest request =
               ImportAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           agentsClient.importAgentAsync(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
      • importAgentOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<ImportAgentRequest,​com.google.protobuf.Empty,​com.google.protobuf.Struct> importAgentOperationCallable()
        Imports the specified agent from a ZIP file.

        Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        The operation only tracks when importing is complete, not when it is done training.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           ImportAgentRequest request =
               ImportAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           OperationFuture<Empty, Struct> future =
               agentsClient.importAgentOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • importAgentCallable

        public final com.google.api.gax.rpc.UnaryCallable<ImportAgentRequest,​com.google.longrunning.Operation> importAgentCallable()
        Imports the specified agent from a ZIP file.

        Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        The operation only tracks when importing is complete, not when it is done training.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           ImportAgentRequest request =
               ImportAgentRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).build();
           ApiFuture<Operation> future = agentsClient.importAgentCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • restoreAgentAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​com.google.protobuf.Struct> restoreAgentAsync​(RestoreAgentRequest request)
        Restores the specified agent from a ZIP file.

        Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        The operation only tracks when restoring is complete, not when it is done training.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           RestoreAgentRequest request =
               RestoreAgentRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .build();
           agentsClient.restoreAgentAsync(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
      • restoreAgentOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<RestoreAgentRequest,​com.google.protobuf.Empty,​com.google.protobuf.Struct> restoreAgentOperationCallable()
        Restores the specified agent from a ZIP file.

        Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        The operation only tracks when restoring is complete, not when it is done training.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           RestoreAgentRequest request =
               RestoreAgentRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .build();
           OperationFuture<Empty, Struct> future =
               agentsClient.restoreAgentOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • restoreAgentCallable

        public final com.google.api.gax.rpc.UnaryCallable<RestoreAgentRequest,​com.google.longrunning.Operation> restoreAgentCallable()
        Restores the specified agent from a ZIP file.

        Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.

        This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

        - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

        The operation only tracks when restoring is complete, not when it is done training.

        Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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 (AgentsClient agentsClient = AgentsClient.create()) {
           RestoreAgentRequest request =
               RestoreAgentRequest.newBuilder()
                   .setParent(ProjectName.of("[PROJECT]").toString())
                   .build();
           ApiFuture<Operation> future = agentsClient.restoreAgentCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • getValidationResult

        public final ValidationResult getValidationResult​(GetValidationResultRequest request)
        Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.

        Sample code:

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

        public final com.google.api.gax.rpc.UnaryCallable<GetValidationResultRequest,​ValidationResult> getValidationResultCallable()
        Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.

        Sample code:

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

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