Class IntentsClient (4.55.0)

GitHub RepositoryProduct Reference

Service Description: Service for managing Intents.

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.ofProjectIntentName("[PROJECT]", "[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().

Methods
Method Description Method Variants

ListIntents

Returns the list of all intents in the specified agent.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listIntents(ListIntentsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listIntents(AgentName parent)

  • listIntents(String parent)

  • listIntents(AgentName parent, String languageCode)

  • listIntents(String parent, String languageCode)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listIntentsPagedCallable()

  • listIntentsCallable()

GetIntent

Retrieves the specified intent.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getIntent(GetIntentRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getIntent(IntentName name)

  • getIntent(String name)

  • getIntent(IntentName name, String languageCode)

  • getIntent(String name, String languageCode)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getIntentCallable()

CreateIntent

Creates an intent in the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createIntent(CreateIntentRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createIntent(AgentName parent, Intent intent)

  • createIntent(String parent, Intent intent)

  • createIntent(AgentName parent, Intent intent, String languageCode)

  • createIntent(String parent, Intent intent, String languageCode)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createIntentCallable()

UpdateIntent

Updates the specified intent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateIntent(UpdateIntentRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateIntent(Intent intent, String languageCode)

  • updateIntent(Intent intent, String languageCode, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateIntentCallable()

DeleteIntent

Deletes the specified intent and its direct or indirect followup intents.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteIntent(DeleteIntentRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteIntent(IntentName name)

  • deleteIntent(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteIntentCallable()

BatchUpdateIntents

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message - response: BatchUpdateIntentsResponse

Note: You should always train an agent prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchUpdateIntentsAsync(BatchUpdateIntentsRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • batchUpdateIntentsAsync(AgentName parent, IntentBatch intentBatchInline)

  • batchUpdateIntentsAsync(AgentName parent, String intentBatchUri)

  • batchUpdateIntentsAsync(String parent, IntentBatch intentBatchInline)

  • batchUpdateIntentsAsync(String parent, String intentBatchUri)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchUpdateIntentsOperationCallable()

  • batchUpdateIntentsCallable()

BatchDeleteIntents

Deletes intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message - response: An Empty message

Note: You should always train an agent prior to sending it queries. See the training documentation.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchDeleteIntentsAsync(BatchDeleteIntentsRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • batchDeleteIntentsAsync(AgentName parent, List<Intent> intents)

  • batchDeleteIntentsAsync(String parent, List<Intent> intents)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchDeleteIntentsOperationCallable()

  • batchDeleteIntentsCallable()

ListLocations

Lists information about the supported locations for this service.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listLocations(ListLocationsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getLocation(GetLocationRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getLocationCallable()

See the individual methods for example code.

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

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

Inheritance

java.lang.Object > IntentsClient

Static Methods

create()

public static final IntentsClient create()

Constructs an instance of IntentsClient with default settings.

Returns
Type Description
IntentsClient
Exceptions
Type Description
IOException

create(IntentsSettings settings)

public static final IntentsClient create(IntentsSettings settings)

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.

Parameter
Name Description
settings IntentsSettings
Returns
Type Description
IntentsClient
Exceptions
Type Description
IOException

create(IntentsStub stub)

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

Parameter
Name Description
stub IntentsStub
Returns
Type Description
IntentsClient

Constructors

IntentsClient(IntentsSettings settings)

protected IntentsClient(IntentsSettings settings)

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.

Parameter
Name Description
settings IntentsSettings

IntentsClient(IntentsStub stub)

protected IntentsClient(IntentsStub stub)
Parameter
Name Description
stub IntentsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

batchDeleteIntentsAsync(AgentName parent, List<Intent> intents)

public final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(AgentName parent, List<Intent> intents)

Deletes intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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.ofProjectName("[PROJECT]");
    List<Intent> intents = new ArrayList<>();
    intentsClient.batchDeleteIntentsAsync(parent, intents).get();
    }
    
Parameters
Name Description
parent AgentName

Required. The name of the agent to delete all entities types for. Format: projects/<Project ID>/agent.

intents List<Intent>

Required. The collection of intents to delete. Only intent name must be filled in.

Returns
Type Description
OperationFuture<Empty,Struct>

batchDeleteIntentsAsync(BatchDeleteIntentsRequest request)

public final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(BatchDeleteIntentsRequest request)

Deletes intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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()) {
    BatchDeleteIntentsRequest request =
        BatchDeleteIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .addAllIntents(new ArrayList<Intent>())
            .build();
    intentsClient.batchDeleteIntentsAsync(request).get();
    }
    
Parameter
Name Description
request BatchDeleteIntentsRequest

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

Returns
Type Description
OperationFuture<Empty,Struct>

batchDeleteIntentsAsync(String parent, List<Intent> intents)

public final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(String parent, List<Intent> intents)

Deletes intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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.ofProjectName("[PROJECT]").toString();
    List<Intent> intents = new ArrayList<>();
    intentsClient.batchDeleteIntentsAsync(parent, intents).get();
    }
    
Parameters
Name Description
parent String

Required. The name of the agent to delete all entities types for. Format: projects/<Project ID>/agent.

intents List<Intent>

Required. The collection of intents to delete. Only intent name must be filled in.

Returns
Type Description
OperationFuture<Empty,Struct>

batchDeleteIntentsCallable()

public final UnaryCallable<BatchDeleteIntentsRequest,Operation> batchDeleteIntentsCallable()

Deletes intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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()) {
    BatchDeleteIntentsRequest request =
        BatchDeleteIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .addAllIntents(new ArrayList<Intent>())
            .build();
    ApiFuture<Operation> future = intentsClient.batchDeleteIntentsCallable().futureCall(request);
    // Do something.
    future.get();
    }
    
Returns
Type Description
UnaryCallable<BatchDeleteIntentsRequest,Operation>

batchDeleteIntentsOperationCallable()

public final OperationCallable<BatchDeleteIntentsRequest,Empty,Struct> batchDeleteIntentsOperationCallable()

Deletes intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: An Empty message

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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()) {
    BatchDeleteIntentsRequest request =
        BatchDeleteIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .addAllIntents(new ArrayList<Intent>())
            .build();
    OperationFuture<Empty, Struct> future =
        intentsClient.batchDeleteIntentsOperationCallable().futureCall(request);
    // Do something.
    future.get();
    }
    
Returns
Type Description
OperationCallable<BatchDeleteIntentsRequest,Empty,Struct>

batchUpdateIntentsAsync(AgentName parent, IntentBatch intentBatchInline)

public final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(AgentName parent, IntentBatch intentBatchInline)

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: BatchUpdateIntentsResponse

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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.ofProjectName("[PROJECT]");
    IntentBatch intentBatchInline = IntentBatch.newBuilder().build();
    BatchUpdateIntentsResponse response =
        intentsClient.batchUpdateIntentsAsync(parent, intentBatchInline).get();
    }
    
Parameters
Name Description
parent AgentName

Required. The name of the agent to update or create intents in. Format: projects/<Project ID>/agent.

intentBatchInline IntentBatch

The collection of intents to update or create.

Returns
Type Description
OperationFuture<BatchUpdateIntentsResponse,Struct>

batchUpdateIntentsAsync(AgentName parent, String intentBatchUri)

public final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(AgentName parent, String intentBatchUri)

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: BatchUpdateIntentsResponse

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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.ofProjectName("[PROJECT]");
    String intentBatchUri = "intentBatchUri544125582";
    BatchUpdateIntentsResponse response =
        intentsClient.batchUpdateIntentsAsync(parent, intentBatchUri).get();
    }
    
Parameters
Name Description
parent AgentName

Required. The name of the agent to update or create intents in. Format: projects/<Project ID>/agent.

intentBatchUri String

The URI to a Google Cloud Storage file containing intents to update or create. The file format can either be a serialized proto (of IntentBatch type) or JSON object. Note: The URI must start with "gs://".

Returns
Type Description
OperationFuture<BatchUpdateIntentsResponse,Struct>

batchUpdateIntentsAsync(BatchUpdateIntentsRequest request)

public final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(BatchUpdateIntentsRequest request)

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: BatchUpdateIntentsResponse

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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()) {
    BatchUpdateIntentsRequest request =
        BatchUpdateIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .setLanguageCode("languageCode-2092349083")
            .setUpdateMask(FieldMask.newBuilder().build())
            .setIntentView(IntentView.forNumber(0))
            .build();
    BatchUpdateIntentsResponse response = intentsClient.batchUpdateIntentsAsync(request).get();
    }
    
Parameter
Name Description
request BatchUpdateIntentsRequest

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

Returns
Type Description
OperationFuture<BatchUpdateIntentsResponse,Struct>

batchUpdateIntentsAsync(String parent, IntentBatch intentBatchInline)

public final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(String parent, IntentBatch intentBatchInline)

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: BatchUpdateIntentsResponse

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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.ofProjectName("[PROJECT]").toString();
    IntentBatch intentBatchInline = IntentBatch.newBuilder().build();
    BatchUpdateIntentsResponse response =
        intentsClient.batchUpdateIntentsAsync(parent, intentBatchInline).get();
    }
    
Parameters
Name Description
parent String

Required. The name of the agent to update or create intents in. Format: projects/<Project ID>/agent.

intentBatchInline IntentBatch

The collection of intents to update or create.

Returns
Type Description
OperationFuture<BatchUpdateIntentsResponse,Struct>

batchUpdateIntentsAsync(String parent, String intentBatchUri)

public final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(String parent, String intentBatchUri)

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: BatchUpdateIntentsResponse

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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.ofProjectName("[PROJECT]").toString();
    String intentBatchUri = "intentBatchUri544125582";
    BatchUpdateIntentsResponse response =
        intentsClient.batchUpdateIntentsAsync(parent, intentBatchUri).get();
    }
    
Parameters
Name Description
parent String

Required. The name of the agent to update or create intents in. Format: projects/<Project ID>/agent.

intentBatchUri String

The URI to a Google Cloud Storage file containing intents to update or create. The file format can either be a serialized proto (of IntentBatch type) or JSON object. Note: The URI must start with "gs://".

Returns
Type Description
OperationFuture<BatchUpdateIntentsResponse,Struct>

batchUpdateIntentsCallable()

public final UnaryCallable<BatchUpdateIntentsRequest,Operation> batchUpdateIntentsCallable()

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: BatchUpdateIntentsResponse

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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()) {
    BatchUpdateIntentsRequest request =
        BatchUpdateIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .setLanguageCode("languageCode-2092349083")
            .setUpdateMask(FieldMask.newBuilder().build())
            .setIntentView(IntentView.forNumber(0))
            .build();
    ApiFuture<Operation> future = intentsClient.batchUpdateIntentsCallable().futureCall(request);
    // Do something.
    Operation response = future.get();
    }
    
Returns
Type Description
UnaryCallable<BatchUpdateIntentsRequest,Operation>

batchUpdateIntentsOperationCallable()

public final OperationCallable<BatchUpdateIntentsRequest,BatchUpdateIntentsResponse,Struct> batchUpdateIntentsOperationCallable()

Updates/Creates multiple intents in the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: An empty Struct message

  • response: BatchUpdateIntentsResponse

    Note: You should always train an agent prior to sending it queries. See the training documentation.

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying 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()) {
    BatchUpdateIntentsRequest request =
        BatchUpdateIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .setLanguageCode("languageCode-2092349083")
            .setUpdateMask(FieldMask.newBuilder().build())
            .setIntentView(IntentView.forNumber(0))
            .build();
    OperationFuture<BatchUpdateIntentsResponse, Struct> future =
        intentsClient.batchUpdateIntentsOperationCallable().futureCall(request);
    // Do something.
    BatchUpdateIntentsResponse response = future.get();
    }
    
Returns
Type Description
OperationCallable<BatchUpdateIntentsRequest,BatchUpdateIntentsResponse,Struct>

close()

public final void close()

createIntent(AgentName parent, Intent intent)

public final Intent createIntent(AgentName parent, Intent intent)

Creates an intent in the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectName("[PROJECT]");
   Intent intent = Intent.newBuilder().build();
   Intent response = intentsClient.createIntent(parent, intent);
 }
 
Parameters
Name Description
parent AgentName

Required. The agent to create a intent for. Format: projects/<Project ID>/agent.

intent Intent

Required. The intent to create.

Returns
Type Description
Intent

createIntent(AgentName parent, Intent intent, String languageCode)

public final Intent createIntent(AgentName parent, Intent intent, String languageCode)

Creates an intent in the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectName("[PROJECT]");
   Intent intent = Intent.newBuilder().build();
   String languageCode = "languageCode-2092349083";
   Intent response = intentsClient.createIntent(parent, intent, languageCode);
 }
 
Parameters
Name Description
parent AgentName

Required. The agent to create a intent for. Format: projects/<Project ID>/agent.

intent Intent

Required. The intent to create.

languageCode String

Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.

Returns
Type Description
Intent

createIntent(CreateIntentRequest request)

public final Intent createIntent(CreateIntentRequest request)

Creates an intent in the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectName("[PROJECT]").toString())
           .setIntent(Intent.newBuilder().build())
           .setLanguageCode("languageCode-2092349083")
           .setIntentView(IntentView.forNumber(0))
           .build();
   Intent response = intentsClient.createIntent(request);
 }
 
Parameter
Name Description
request CreateIntentRequest

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

Returns
Type Description
Intent

createIntent(String parent, Intent intent)

public final Intent createIntent(String parent, Intent intent)

Creates an intent in the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectName("[PROJECT]").toString();
   Intent intent = Intent.newBuilder().build();
   Intent response = intentsClient.createIntent(parent, intent);
 }
 
Parameters
Name Description
parent String

Required. The agent to create a intent for. Format: projects/<Project ID>/agent.

intent Intent

Required. The intent to create.

Returns
Type Description
Intent

createIntent(String parent, Intent intent, String languageCode)

public final Intent createIntent(String parent, Intent intent, String languageCode)

Creates an intent in the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectName("[PROJECT]").toString();
   Intent intent = Intent.newBuilder().build();
   String languageCode = "languageCode-2092349083";
   Intent response = intentsClient.createIntent(parent, intent, languageCode);
 }
 
Parameters
Name Description
parent String

Required. The agent to create a intent for. Format: projects/<Project ID>/agent.

intent Intent

Required. The intent to create.

languageCode String

Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.

Returns
Type Description
Intent

createIntentCallable()

public final UnaryCallable<CreateIntentRequest,Intent> createIntentCallable()

Creates an intent in the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectName("[PROJECT]").toString())
           .setIntent(Intent.newBuilder().build())
           .setLanguageCode("languageCode-2092349083")
           .setIntentView(IntentView.forNumber(0))
           .build();
   ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
   // Do something.
   Intent response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateIntentRequest,Intent>

deleteIntent(DeleteIntentRequest request)

public final void deleteIntent(DeleteIntentRequest request)

Deletes the specified intent and its direct or indirect followup intents.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
           .build();
   intentsClient.deleteIntent(request);
 }
 
Parameter
Name Description
request DeleteIntentRequest

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

deleteIntent(IntentName name)

public final void deleteIntent(IntentName name)

Deletes the specified intent and its direct or indirect followup intents.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectIntentName("[PROJECT]", "[INTENT]");
   intentsClient.deleteIntent(name);
 }
 
Parameter
Name Description
name IntentName

Required. The name of the intent to delete. If this intent has direct or indirect followup intents, we also delete them. Format: projects/<Project ID>/agent/intents/<Intent ID>.

deleteIntent(String name)

public final void deleteIntent(String name)

Deletes the specified intent and its direct or indirect followup intents.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
   intentsClient.deleteIntent(name);
 }
 
Parameter
Name Description
name String

Required. The name of the intent to delete. If this intent has direct or indirect followup intents, we also delete them. Format: projects/<Project ID>/agent/intents/<Intent ID>.

deleteIntentCallable()

public final UnaryCallable<DeleteIntentRequest,Empty> deleteIntentCallable()

Deletes the specified intent and its direct or indirect followup intents.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
           .build();
   ApiFuture<Empty> future = intentsClient.deleteIntentCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteIntentRequest,Empty>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getIntent(GetIntentRequest request)

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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
           .setLanguageCode("languageCode-2092349083")
           .setIntentView(IntentView.forNumber(0))
           .build();
   Intent response = intentsClient.getIntent(request);
 }
 
Parameter
Name Description
request GetIntentRequest

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

Returns
Type Description
Intent

getIntent(IntentName name)

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.ofProjectIntentName("[PROJECT]", "[INTENT]");
   Intent response = intentsClient.getIntent(name);
 }
 
Parameter
Name Description
name IntentName

Required. The name of the intent. Format: projects/<Project ID>/agent/intents/<Intent ID>.

Returns
Type Description
Intent

getIntent(IntentName name, String languageCode)

public final Intent getIntent(IntentName name, String languageCode)

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.ofProjectIntentName("[PROJECT]", "[INTENT]");
   String languageCode = "languageCode-2092349083";
   Intent response = intentsClient.getIntent(name, languageCode);
 }
 
Parameters
Name Description
name IntentName

Required. The name of the intent. Format: projects/<Project ID>/agent/intents/<Intent ID>.

languageCode String

Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.

Returns
Type Description
Intent

getIntent(String name)

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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
   Intent response = intentsClient.getIntent(name);
 }
 
Parameter
Name Description
name String

Required. The name of the intent. Format: projects/<Project ID>/agent/intents/<Intent ID>.

Returns
Type Description
Intent

getIntent(String name, String languageCode)

public final Intent getIntent(String name, String languageCode)

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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
   String languageCode = "languageCode-2092349083";
   Intent response = intentsClient.getIntent(name, languageCode);
 }
 
Parameters
Name Description
name String

Required. The name of the intent. Format: projects/<Project ID>/agent/intents/<Intent ID>.

languageCode String

Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.

Returns
Type Description
Intent

getIntentCallable()

public final 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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
           .setLanguageCode("languageCode-2092349083")
           .setIntentView(IntentView.forNumber(0))
           .build();
   ApiFuture<Intent> future = intentsClient.getIntentCallable().futureCall(request);
   // Do something.
   Intent response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetIntentRequest,Intent>

getLocation(GetLocationRequest request)

public final Location getLocation(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);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

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

Returns
Type Description
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,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();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getSettings()

public final IntentsSettings getSettings()
Returns
Type Description
IntentsSettings

getStub()

public IntentsStub getStub()
Returns
Type Description
IntentsStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listIntents(AgentName parent)

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.ofProjectName("[PROJECT]");
   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent AgentName

Required. The agent to list all intents from. Format: projects/<Project ID>/agent or projects/<Project ID>/locations/<Location ID>/agent.

Alternatively, you can specify the environment to list intents for. Format: projects/<Project ID>/agent/environments/<Environment ID> or projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>. Note: training phrases of the intents will not be returned for non-draft environment.

Returns
Type Description
IntentsClient.ListIntentsPagedResponse

listIntents(AgentName parent, String languageCode)

public final IntentsClient.ListIntentsPagedResponse listIntents(AgentName parent, String languageCode)

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.ofProjectName("[PROJECT]");
   String languageCode = "languageCode-2092349083";
   for (Intent element : intentsClient.listIntents(parent, languageCode).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
Name Description
parent AgentName

Required. The agent to list all intents from. Format: projects/<Project ID>/agent or projects/<Project ID>/locations/<Location ID>/agent.

Alternatively, you can specify the environment to list intents for. Format: projects/<Project ID>/agent/environments/<Environment ID> or projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>. Note: training phrases of the intents will not be returned for non-draft environment.

languageCode String

Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.

Returns
Type Description
IntentsClient.ListIntentsPagedResponse

listIntents(ListIntentsRequest request)

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.ofProjectName("[PROJECT]").toString())
           .setLanguageCode("languageCode-2092349083")
           .setIntentView(IntentView.forNumber(0))
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Intent element : intentsClient.listIntents(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListIntentsRequest

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

Returns
Type Description
IntentsClient.ListIntentsPagedResponse

listIntents(String parent)

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.ofProjectName("[PROJECT]").toString();
   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The agent to list all intents from. Format: projects/<Project ID>/agent or projects/<Project ID>/locations/<Location ID>/agent.

Alternatively, you can specify the environment to list intents for. Format: projects/<Project ID>/agent/environments/<Environment ID> or projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>. Note: training phrases of the intents will not be returned for non-draft environment.

Returns
Type Description
IntentsClient.ListIntentsPagedResponse

listIntents(String parent, String languageCode)

public final IntentsClient.ListIntentsPagedResponse listIntents(String parent, String languageCode)

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.ofProjectName("[PROJECT]").toString();
   String languageCode = "languageCode-2092349083";
   for (Intent element : intentsClient.listIntents(parent, languageCode).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
Name Description
parent String

Required. The agent to list all intents from. Format: projects/<Project ID>/agent or projects/<Project ID>/locations/<Location ID>/agent.

Alternatively, you can specify the environment to list intents for. Format: projects/<Project ID>/agent/environments/<Environment ID> or projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>. Note: training phrases of the intents will not be returned for non-draft environment.

languageCode String

Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.

Returns
Type Description
IntentsClient.ListIntentsPagedResponse

listIntentsCallable()

public final 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.ofProjectName("[PROJECT]").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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListIntentsRequest,ListIntentsResponse>

listIntentsPagedCallable()

public final 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.ofProjectName("[PROJECT]").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);
   }
 }
 
Returns
Type Description
UnaryCallable<ListIntentsRequest,ListIntentsPagedResponse>

listLocations(ListLocationsRequest request)

public final IntentsClient.ListLocationsPagedResponse listLocations(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);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

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

Returns
Type Description
IntentsClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<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);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateIntent(Intent intent, String languageCode)

public final Intent updateIntent(Intent intent, String languageCode)

Updates the specified intent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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();
   String languageCode = "languageCode-2092349083";
   Intent response = intentsClient.updateIntent(intent, languageCode);
 }
 
Parameters
Name Description
intent Intent

Required. The intent to update.

languageCode String

Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.

Returns
Type Description
Intent

updateIntent(Intent intent, String languageCode, FieldMask updateMask)

public final Intent updateIntent(Intent intent, String languageCode, FieldMask updateMask)

Updates the specified intent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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();
   String languageCode = "languageCode-2092349083";
   FieldMask updateMask = FieldMask.newBuilder().build();
   Intent response = intentsClient.updateIntent(intent, languageCode, updateMask);
 }
 
Parameters
Name Description
intent Intent

Required. The intent to update.

languageCode String

Optional. The language used to access language-specific data. If not specified, the agent's default language is used. For more information, see Multilingual intent and entity data.

updateMask FieldMask

Optional. The mask to control which fields get updated.

Returns
Type Description
Intent

updateIntent(UpdateIntentRequest request)

public final Intent updateIntent(UpdateIntentRequest request)

Updates the specified intent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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())
           .setIntentView(IntentView.forNumber(0))
           .build();
   Intent response = intentsClient.updateIntent(request);
 }
 
Parameter
Name Description
request UpdateIntentRequest

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

Returns
Type Description
Intent

updateIntentCallable()

public final UnaryCallable<UpdateIntentRequest,Intent> updateIntentCallable()

Updates the specified intent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying 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())
           .setIntentView(IntentView.forNumber(0))
           .build();
   ApiFuture<Intent> future = intentsClient.updateIntentCallable().futureCall(request);
   // Do something.
   Intent response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateIntentRequest,Intent>