Class IntentsClient (0.48.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

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

Note: close() needs to be called on the IntentsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
MethodDescriptionMethod 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)

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)

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 a flow 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)

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 a flow 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, 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.

Note: You should always train a flow 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()

ImportIntents

Imports the specified intents into the agent.

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

- metadata: ImportIntentsMetadata - response: ImportIntentsResponse

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

  • importIntentsAsync(ImportIntentsRequest request)

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

  • importIntentsOperationCallable()

  • importIntentsCallable()

ExportIntents

Exports the selected intents.

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

- metadata: ExportIntentsMetadata - response: ExportIntentsResponse

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

  • exportIntentsAsync(ExportIntentsRequest request)

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

  • exportIntentsOperationCallable()

  • exportIntentsCallable()

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

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

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 a flow 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.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   Intent intent = Intent.newBuilder().build();
   Intent response = intentsClient.createIntent(parent, intent);
 }
 
Parameters
NameDescription
parentAgentName

Required. The agent to create an intent for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

intentIntent

Required. The intent to create.

Returns
TypeDescription
Intent

createIntent(CreateIntentRequest request)

public final Intent createIntent(CreateIntentRequest request)

Creates an intent in the specified agent.

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

Sample code:


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

Required. The agent to create an intent for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

intentIntent

Required. The intent to create.

Returns
TypeDescription
Intent

createIntentCallable()

public final UnaryCallable<CreateIntentRequest,Intent> createIntentCallable()

Creates an intent in the specified agent.

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

Sample code:


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

deleteIntent(DeleteIntentRequest request)

public final void deleteIntent(DeleteIntentRequest request)

Deletes the specified intent.

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

Sample code:


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

Note: You should always train a flow 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.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
   intentsClient.deleteIntent(name);
 }
 
Parameter
NameDescription
nameIntentName

Required. The name of the intent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>.

deleteIntent(String name)

public final void deleteIntent(String name)

Deletes the specified intent.

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

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (IntentsClient intentsClient = IntentsClient.create()) {
   String name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString();
   intentsClient.deleteIntent(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the intent to delete. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>.

deleteIntentCallable()

public final UnaryCallable<DeleteIntentRequest,Empty> deleteIntentCallable()

Deletes the specified intent.

Note: You should always train a flow 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.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
           .build();
   ApiFuture<Empty> future = intentsClient.deleteIntentCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteIntentRequest,Empty>

exportIntentsAsync(ExportIntentsRequest request)

public final OperationFuture<ExportIntentsResponse,ExportIntentsMetadata> exportIntentsAsync(ExportIntentsRequest request)

Exports the selected intents.

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

- metadata: ExportIntentsMetadata - response: ExportIntentsResponse

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()) {
   ExportIntentsRequest request =
       ExportIntentsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .addAllIntents(new ArrayList<String>())
           .build();
   ExportIntentsResponse response = intentsClient.exportIntentsAsync(request).get();
 }
 
Parameter
NameDescription
requestExportIntentsRequest

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

Returns
TypeDescription
OperationFuture<ExportIntentsResponse,ExportIntentsMetadata>

exportIntentsCallable()

public final UnaryCallable<ExportIntentsRequest,Operation> exportIntentsCallable()

Exports the selected intents.

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

- metadata: ExportIntentsMetadata - response: ExportIntentsResponse

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()) {
   ExportIntentsRequest request =
       ExportIntentsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .addAllIntents(new ArrayList<String>())
           .build();
   ApiFuture<Operation> future = intentsClient.exportIntentsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ExportIntentsRequest,Operation>

exportIntentsOperationCallable()

public final OperationCallable<ExportIntentsRequest,ExportIntentsResponse,ExportIntentsMetadata> exportIntentsOperationCallable()

Exports the selected intents.

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

- metadata: ExportIntentsMetadata - response: ExportIntentsResponse

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()) {
   ExportIntentsRequest request =
       ExportIntentsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .addAllIntents(new ArrayList<String>())
           .build();
   OperationFuture<ExportIntentsResponse, ExportIntentsMetadata> future =
       intentsClient.exportIntentsOperationCallable().futureCall(request);
   // Do something.
   ExportIntentsResponse response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ExportIntentsRequest,ExportIntentsResponse,ExportIntentsMetadata>

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
TypeDescription
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.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
           .setLanguageCode("languageCode-2092349083")
           .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:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (IntentsClient intentsClient = IntentsClient.create()) {
   IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
   Intent response = intentsClient.getIntent(name);
 }
 
Parameter
NameDescription
nameIntentName

Required. The name of the intent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>.

Returns
TypeDescription
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.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString();
   Intent response = intentsClient.getIntent(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the intent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/intents/<Intent ID>.

Returns
TypeDescription
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.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
           .setLanguageCode("languageCode-2092349083")
           .build();
   ApiFuture<Intent> future = intentsClient.getIntentCallable().futureCall(request);
   // Do something.
   Intent response = future.get();
 }
 
Returns
TypeDescription
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
NameDescription
requestcom.google.cloud.location.GetLocationRequest

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

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

getSettings()

public final IntentsSettings getSettings()
Returns
TypeDescription
IntentsSettings

getStub()

public IntentsStub getStub()
Returns
TypeDescription
IntentsStub

importIntentsAsync(ImportIntentsRequest request)

public final OperationFuture<ImportIntentsResponse,ImportIntentsMetadata> importIntentsAsync(ImportIntentsRequest request)

Imports the specified intents into the agent.

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

- metadata: ImportIntentsMetadata - response: ImportIntentsResponse

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()) {
   ImportIntentsRequest request =
       ImportIntentsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   ImportIntentsResponse response = intentsClient.importIntentsAsync(request).get();
 }
 
Parameter
NameDescription
requestImportIntentsRequest

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

Returns
TypeDescription
OperationFuture<ImportIntentsResponse,ImportIntentsMetadata>

importIntentsCallable()

public final UnaryCallable<ImportIntentsRequest,Operation> importIntentsCallable()

Imports the specified intents into the agent.

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

- metadata: ImportIntentsMetadata - response: ImportIntentsResponse

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()) {
   ImportIntentsRequest request =
       ImportIntentsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   ApiFuture<Operation> future = intentsClient.importIntentsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ImportIntentsRequest,Operation>

importIntentsOperationCallable()

public final OperationCallable<ImportIntentsRequest,ImportIntentsResponse,ImportIntentsMetadata> importIntentsOperationCallable()

Imports the specified intents into the agent.

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

- metadata: ImportIntentsMetadata - response: ImportIntentsResponse

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()) {
   ImportIntentsRequest request =
       ImportIntentsRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   OperationFuture<ImportIntentsResponse, ImportIntentsMetadata> future =
       intentsClient.importIntentsOperationCallable().futureCall(request);
   // Do something.
   ImportIntentsResponse response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ImportIntentsRequest,ImportIntentsResponse,ImportIntentsMetadata>

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:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (IntentsClient intentsClient = IntentsClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentAgentName

Required. The agent to list all intents for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

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:


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


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (IntentsClient intentsClient = IntentsClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The agent to list all intents for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Returns
TypeDescription
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.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setLanguageCode("languageCode-2092349083")
           .setIntentView(IntentView.forNumber(0))
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
     for (Intent element : response.getIntentsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
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:


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

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateIntent(Intent intent, FieldMask updateMask)

public final Intent updateIntent(Intent intent, FieldMask updateMask)

Updates the specified intent.

Note: You should always train a flow 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();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Intent response = intentsClient.updateIntent(intent, updateMask);
 }
 
Parameters
NameDescription
intentIntent

Required. The intent to update.

updateMaskFieldMask

The mask to control which fields get updated. If the mask is not present, all fields will be updated.

Returns
TypeDescription
Intent

updateIntent(UpdateIntentRequest request)

public final Intent updateIntent(UpdateIntentRequest request)

Updates the specified intent.

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

Sample code:


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