Class IntentsClient (4.3.1)

public class IntentsClient implements BackgroundResource

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:


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

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

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

See the individual methods for example code.

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

This class can be customized by passing in a custom instance of IntentsSettings to create(). For example:

To customize credentials:


 IntentsSettings intentsSettings =
     IntentsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 IntentsClient intentsClient = IntentsClient.create(intentsSettings);
 

To customize the endpoint:


 IntentsSettings intentsSettings = IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
 IntentsClient intentsClient = IntentsClient.create(intentsSettings);
 

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

Inheritance

java.lang.Object > IntentsClient

Implements

BackgroundResource

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

IntentsClient(IntentsStub stub)

protected IntentsClient(IntentsStub stub)
Parameter
NameDescription
stubIntentsStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
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:

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    AgentName parent = AgentName.ofProjectName("[PROJECT]");
    List
Parameters
NameDescription
parentAgentName

Required. The name of the agent to delete all entities types for. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentsList<Intent>

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

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

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    BatchDeleteIntentsRequest request =
        BatchDeleteIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .addAllIntents(new ArrayList
Parameter
NameDescription
requestBatchDeleteIntentsRequest

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

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

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    String parent = AgentName.ofProjectName("[PROJECT]").toString();
    List
Parameters
NameDescription
parentString

Required. The name of the agent to delete all entities types for. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentsList<Intent>

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

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

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    BatchDeleteIntentsRequest request =
        BatchDeleteIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .addAllIntents(new ArrayList
Returns
TypeDescription
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:

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    BatchDeleteIntentsRequest request =
        BatchDeleteIntentsRequest.newBuilder()
            .setParent(AgentName.ofProjectName("[PROJECT]").toString())
            .addAllIntents(new ArrayList
Returns
TypeDescription
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:

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    AgentName parent = AgentName.ofProjectName("[PROJECT]");
    IntentBatch intentBatchInline = IntentBatch.newBuilder().build();
    BatchUpdateIntentsResponse response =
        intentsClient.batchUpdateIntentsAsync(parent, intentBatchInline).get();
    }
    
Parameters
NameDescription
parentAgentName

Required. The name of the agent to update or create intents in. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentBatchInlineIntentBatch

The collection of intents to update or create.

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

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    AgentName parent = AgentName.ofProjectName("[PROJECT]");
    String intentBatchUri = "intentBatchUri544125582";
    BatchUpdateIntentsResponse response =
        intentsClient.batchUpdateIntentsAsync(parent, intentBatchUri).get();
    }
    
Parameters
NameDescription
parentAgentName

Required. The name of the agent to update or create intents in. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentBatchUriString

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
TypeDescription
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:

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

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

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

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    String parent = AgentName.ofProjectName("[PROJECT]").toString();
    IntentBatch intentBatchInline = IntentBatch.newBuilder().build();
    BatchUpdateIntentsResponse response =
        intentsClient.batchUpdateIntentsAsync(parent, intentBatchInline).get();
    }
    
Parameters
NameDescription
parentString

Required. The name of the agent to update or create intents in. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentBatchInlineIntentBatch

The collection of intents to update or create.

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

    
    try (IntentsClient intentsClient = IntentsClient.create()) {
    String parent = AgentName.ofProjectName("[PROJECT]").toString();
    String intentBatchUri = "intentBatchUri544125582";
    BatchUpdateIntentsResponse response =
        intentsClient.batchUpdateIntentsAsync(parent, intentBatchUri).get();
    }
    
Parameters
NameDescription
parentString

Required. The name of the agent to update or create intents in. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentBatchUriString

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
TypeDescription
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:

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

    
    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
Returns
TypeDescription
OperationCallable<BatchUpdateIntentsRequest,BatchUpdateIntentsResponse,Struct>

close()

public final void close()

create()

public static final IntentsClient create()

Constructs an instance of IntentsClient with default settings.

Returns
TypeDescription
IntentsClient
Exceptions
TypeDescription
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
NameDescription
settingsIntentsSettings
Returns
TypeDescription
IntentsClient
Exceptions
TypeDescription
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
NameDescription
stubIntentsStub
Returns
TypeDescription
IntentsClient

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:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   AgentName parent = AgentName.ofProjectName("[PROJECT]");
   Intent intent = Intent.newBuilder().build();
   Intent response = intentsClient.createIntent(parent, intent);
 }
 
Parameters
NameDescription
parentAgentName

Required. The agent to create a intent for. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentIntent

Required. The intent to create.

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


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

Required. The agent to create a intent for. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentIntent

Required. The intent to create.

languageCodeString

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
TypeDescription
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:


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

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

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


 try (IntentsClient intentsClient = IntentsClient.create()) {
   String parent = AgentName.ofProjectName("[PROJECT]").toString();
   Intent intent = Intent.newBuilder().build();
   Intent response = intentsClient.createIntent(parent, intent);
 }
 
Parameters
NameDescription
parentString

Required. The agent to create a intent for. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentIntent

Required. The intent to create.

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


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

Required. The agent to create a intent for. Supported formats:

- projects/<Project ID>/agent - projects/<Project ID>/locations/<Location ID>/agent

intentIntent

Required. The intent to create.

languageCodeString

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
TypeDescription
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:


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


 try (IntentsClient intentsClient = IntentsClient.create()) {
   DeleteIntentRequest request =
       DeleteIntentRequest.newBuilder()
           .setName(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
           .build();
   intentsClient.deleteIntent(request);
 }
 
Parameter
NameDescription
requestDeleteIntentRequest

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:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   IntentName name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]");
   intentsClient.deleteIntent(name);
 }
 
Parameter
NameDescription
nameIntentName

Required. The name of the intent to delete. If this intent has direct or indirect followup intents, we also delete them.

Supported formats:

- projects/<Project ID>/agent/intents/<Intent ID> - projects/<Project ID>/locations/<Location 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:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   String name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
   intentsClient.deleteIntent(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the intent to delete. If this intent has direct or indirect followup intents, we also delete them.

Supported formats:

- projects/<Project ID>/agent/intents/<Intent ID> - projects/<Project ID>/locations/<Location 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:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   DeleteIntentRequest request =
       DeleteIntentRequest.newBuilder()
           .setName(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<DeleteIntentRequest,Empty>

getIntent(GetIntentRequest request)

public final Intent getIntent(GetIntentRequest request)

Retrieves the specified intent.

Sample code:


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

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

Returns
TypeDescription
Intent

getIntent(IntentName name)

public final Intent getIntent(IntentName name)

Retrieves the specified intent.

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   IntentName name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]");
   Intent response = intentsClient.getIntent(name);
 }
 
Parameter
NameDescription
nameIntentName

Required. The name of the intent. Supported formats:

- projects/<Project ID>/agent/intents/<Intent ID> - projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>

Returns
TypeDescription
Intent

getIntent(IntentName name, String languageCode)

public final Intent getIntent(IntentName name, String languageCode)

Retrieves the specified intent.

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   IntentName name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]");
   String languageCode = "languageCode-2092349083";
   Intent response = intentsClient.getIntent(name, languageCode);
 }
 
Parameters
NameDescription
nameIntentName

Required. The name of the intent. Supported formats:

- projects/<Project ID>/agent/intents/<Intent ID> - projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>

languageCodeString

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
TypeDescription
Intent

getIntent(String name)

public final Intent getIntent(String name)

Retrieves the specified intent.

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   String name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
   Intent response = intentsClient.getIntent(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the intent. Supported formats:

- projects/<Project ID>/agent/intents/<Intent ID> - projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>

Returns
TypeDescription
Intent

getIntent(String name, String languageCode)

public final Intent getIntent(String name, String languageCode)

Retrieves the specified intent.

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   String name = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
   String languageCode = "languageCode-2092349083";
   Intent response = intentsClient.getIntent(name, languageCode);
 }
 
Parameters
NameDescription
nameString

Required. The name of the intent. Supported formats:

- projects/<Project ID>/agent/intents/<Intent ID> - projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>

languageCodeString

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
TypeDescription
Intent

getIntentCallable()

public final UnaryCallable<GetIntentRequest,Intent> getIntentCallable()

Retrieves the specified intent.

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   GetIntentRequest request =
       GetIntentRequest.newBuilder()
           .setName(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
           .setLanguageCode("languageCode-2092349083")
           .setIntentView(IntentView.forNumber(0))
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<GetIntentRequest,Intent>

getOperationsClient()

public final OperationsClient getOperationsClient()

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

Returns
TypeDescription
OperationsClient

getSettings()

public final IntentsSettings getSettings()
Returns
TypeDescription
IntentsSettings

getStub()

public IntentsStub getStub()
Returns
TypeDescription
IntentsStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listIntents(AgentName parent)

public final IntentsClient.ListIntentsPagedResponse listIntents(AgentName parent)

Returns the list of all intents in the specified agent.

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   AgentName parent = AgentName.ofProjectName("[PROJECT]");
   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentAgentName

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
TypeDescription
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:


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

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.

languageCodeString

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
TypeDescription
IntentsClient.ListIntentsPagedResponse

listIntents(ListIntentsRequest request)

public final IntentsClient.ListIntentsPagedResponse listIntents(ListIntentsRequest request)

Returns the list of all intents in the specified agent.

Sample code:


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

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

Returns
TypeDescription
IntentsClient.ListIntentsPagedResponse

listIntents(String parent)

public final IntentsClient.ListIntentsPagedResponse listIntents(String parent)

Returns the list of all intents in the specified agent.

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   String parent = AgentName.ofProjectName("[PROJECT]").toString();
   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

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
TypeDescription
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:


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

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.

languageCodeString

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
TypeDescription
IntentsClient.ListIntentsPagedResponse

listIntentsCallable()

public final UnaryCallable<ListIntentsRequest,ListIntentsResponse> listIntentsCallable()

Returns the list of all intents in the specified agent.

Sample code:


 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.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListIntentsRequest,ListIntentsResponse>

listIntentsPagedCallable()

public final UnaryCallable<ListIntentsRequest,IntentsClient.ListIntentsPagedResponse> listIntentsPagedCallable()

Returns the list of all intents in the specified agent.

Sample code:


 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
Returns
TypeDescription
UnaryCallable<ListIntentsRequest,ListIntentsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateIntent(Intent intent)

public final Intent updateIntent(Intent intent)

Updates the specified intent.

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

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   Intent intent = Intent.newBuilder().build();
   Intent response = intentsClient.updateIntent(intent);
 }
 
Parameter
NameDescription
intentIntent

Required. The intent to update.

Returns
TypeDescription
Intent

updateIntent(Intent intent, FieldMask updateMask)

public final Intent updateIntent(Intent intent, FieldMask updateMask)

Updates the specified intent.

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

Sample code:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   Intent intent = Intent.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Intent response = intentsClient.updateIntent(intent, updateMask);
 }
 
Parameters
NameDescription
intentIntent

Required. The intent to update.

updateMaskFieldMask

Optional. The mask to control which fields get updated.

Returns
TypeDescription
Intent

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:


 try (IntentsClient intentsClient = IntentsClient.create()) {
   Intent intent = Intent.newBuilder().build();
   String languageCode = "languageCode-2092349083";
   Intent response = intentsClient.updateIntent(intent, languageCode);
 }
 
Parameters
NameDescription
intentIntent

Required. The intent to update.

languageCodeString

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
TypeDescription
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:


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

Required. The intent to update.

languageCodeString

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.

updateMaskFieldMask

Optional. The mask to control which fields get updated.

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


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

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

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


 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
Returns
TypeDescription
UnaryCallable<UpdateIntentRequest,Intent>