@BetaApi @Generated(value="by gapic-generator-java") public class IntentsClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIntent |
Retrieves the specified intent. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateIntent |
Creates an intent in the specified agent. Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateIntent |
Updates the specified intent. Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteIntent |
Deletes the specified intent. Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ImportIntents |
Imports the specified intents into the agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`: [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ImportIntentsResponse] |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExportIntents |
Exports the selected intents. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`: [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ExportIntentsResponse] |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of IntentsSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
IntentsSettings intentsSettings =
IntentsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
IntentsClient intentsClient = IntentsClient.create(intentsSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
IntentsSettings intentsSettings = IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
IntentsClient intentsClient = IntentsClient.create(intentsSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
IntentsSettings intentsSettings = IntentsSettings.newHttpJsonBuilder().build();
IntentsClient intentsClient = IntentsClient.create(intentsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
IntentsClient.ListIntentsFixedSizeCollection |
static class |
IntentsClient.ListIntentsPage |
static class |
IntentsClient.ListIntentsPagedResponse |
static class |
IntentsClient.ListLocationsFixedSizeCollection |
static class |
IntentsClient.ListLocationsPage |
static class |
IntentsClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
IntentsClient(IntentsSettings settings)
Constructs an instance of IntentsClient, using the given settings.
|
protected |
IntentsClient(IntentsStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static IntentsClient |
create()
Constructs an instance of IntentsClient with default settings.
|
static IntentsClient |
create(IntentsSettings settings)
Constructs an instance of IntentsClient, using the given settings.
|
static IntentsClient |
create(IntentsStub stub)
Constructs an instance of IntentsClient, using the given stub for making calls.
|
Intent |
createIntent(AgentName parent,
Intent intent)
Creates an intent in the specified agent.
|
Intent |
createIntent(CreateIntentRequest request)
Creates an intent in the specified agent.
|
Intent |
createIntent(String parent,
Intent intent)
Creates an intent in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<CreateIntentRequest,Intent> |
createIntentCallable()
Creates an intent in the specified agent.
|
void |
deleteIntent(DeleteIntentRequest request)
Deletes the specified intent.
|
void |
deleteIntent(IntentName name)
Deletes the specified intent.
|
void |
deleteIntent(String name)
Deletes the specified intent.
|
com.google.api.gax.rpc.UnaryCallable<DeleteIntentRequest,com.google.protobuf.Empty> |
deleteIntentCallable()
Deletes the specified intent.
|
com.google.api.gax.longrunning.OperationFuture<ExportIntentsResponse,ExportIntentsMetadata> |
exportIntentsAsync(ExportIntentsRequest request)
Exports the selected intents.
|
com.google.api.gax.rpc.UnaryCallable<ExportIntentsRequest,com.google.longrunning.Operation> |
exportIntentsCallable()
Exports the selected intents.
|
com.google.api.gax.rpc.OperationCallable<ExportIntentsRequest,ExportIntentsResponse,ExportIntentsMetadata> |
exportIntentsOperationCallable()
Exports the selected intents.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
Intent |
getIntent(GetIntentRequest request)
Retrieves the specified intent.
|
Intent |
getIntent(IntentName name)
Retrieves the specified intent.
|
Intent |
getIntent(String name)
Retrieves the specified intent.
|
com.google.api.gax.rpc.UnaryCallable<GetIntentRequest,Intent> |
getIntentCallable()
Retrieves the specified intent.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
IntentsSettings |
getSettings() |
IntentsStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<ImportIntentsResponse,ImportIntentsMetadata> |
importIntentsAsync(ImportIntentsRequest request)
Imports the specified intents into the agent.
|
com.google.api.gax.rpc.UnaryCallable<ImportIntentsRequest,com.google.longrunning.Operation> |
importIntentsCallable()
Imports the specified intents into the agent.
|
com.google.api.gax.rpc.OperationCallable<ImportIntentsRequest,ImportIntentsResponse,ImportIntentsMetadata> |
importIntentsOperationCallable()
Imports the specified intents into the agent.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
IntentsClient.ListIntentsPagedResponse |
listIntents(AgentName parent)
Returns the list of all intents in the specified agent.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(ListIntentsRequest request)
Returns the list of all intents in the specified agent.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(String parent)
Returns the list of all intents in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<ListIntentsRequest,ListIntentsResponse> |
listIntentsCallable()
Returns the list of all intents in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<ListIntentsRequest,IntentsClient.ListIntentsPagedResponse> |
listIntentsPagedCallable()
Returns the list of all intents in the specified agent.
|
IntentsClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,IntentsClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
void |
shutdown() |
void |
shutdownNow() |
Intent |
updateIntent(Intent intent,
com.google.protobuf.FieldMask updateMask)
Updates the specified intent.
|
Intent |
updateIntent(UpdateIntentRequest request)
Updates the specified intent.
|
com.google.api.gax.rpc.UnaryCallable<UpdateIntentRequest,Intent> |
updateIntentCallable()
Updates the specified intent.
|
protected IntentsClient(IntentsSettings settings) throws IOException
IOExceptionprotected IntentsClient(IntentsStub stub)
public static final IntentsClient create() throws IOException
IOExceptionpublic static final IntentsClient create(IntentsSettings settings) throws IOException
IOExceptionpublic static final IntentsClient create(IntentsStub stub)
public final IntentsSettings getSettings()
public IntentsStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final IntentsClient.ListIntentsPagedResponse listIntents(AgentName parent)
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);
}
}
parent - Required. The agent to list all intents for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(String parent)
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);
}
}
parent - Required. The agent to list all intents for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(ListIntentsRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListIntentsRequest,IntentsClient.ListIntentsPagedResponse> listIntentsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListIntentsRequest,ListIntentsResponse> listIntentsCallable()
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;
}
}
}
public final Intent getIntent(IntentName name)
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);
}
name - Required. The name of the intent. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/intents/<IntentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Intent getIntent(String name)
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);
}
name - Required. The name of the intent. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/intents/<IntentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Intent getIntent(GetIntentRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetIntentRequest,Intent> getIntentCallable()
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();
}
public final Intent createIntent(AgentName parent, Intent intent)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
Intent intent = Intent.newBuilder().build();
Intent response = intentsClient.createIntent(parent, intent);
}
parent - Required. The agent to create an intent for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.intent - Required. The intent to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Intent createIntent(String parent, Intent intent)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
Intent intent = Intent.newBuilder().build();
Intent response = intentsClient.createIntent(parent, intent);
}
parent - Required. The agent to create an intent for. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`.intent - Required. The intent to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Intent createIntent(CreateIntentRequest request)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
CreateIntentRequest request =
CreateIntentRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setIntent(Intent.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
Intent response = intentsClient.createIntent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateIntentRequest,Intent> createIntentCallable()
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
CreateIntentRequest request =
CreateIntentRequest.newBuilder()
.setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
.setIntent(Intent.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.build();
ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
// Do something.
Intent response = future.get();
}
public final Intent updateIntent(Intent intent, com.google.protobuf.FieldMask updateMask)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
Intent intent = Intent.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Intent response = intentsClient.updateIntent(intent, updateMask);
}
intent - Required. The intent to update.updateMask - The mask to control which fields get updated. If the mask is not present, all
fields will be updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Intent updateIntent(UpdateIntentRequest request)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
UpdateIntentRequest request =
UpdateIntentRequest.newBuilder()
.setIntent(Intent.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Intent response = intentsClient.updateIntent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateIntentRequest,Intent> updateIntentCallable()
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
UpdateIntentRequest request =
UpdateIntentRequest.newBuilder()
.setIntent(Intent.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Intent> future = intentsClient.updateIntentCallable().futureCall(request);
// Do something.
Intent response = future.get();
}
public final void deleteIntent(IntentName name)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]");
intentsClient.deleteIntent(name);
}
name - Required. The name of the intent to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/intents/<IntentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteIntent(String name)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
String name = IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString();
intentsClient.deleteIntent(name);
}
name - Required. The name of the intent to delete. Format:
`projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/intents/<IntentID>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteIntent(DeleteIntentRequest request)
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
DeleteIntentRequest request =
DeleteIntentRequest.newBuilder()
.setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
.build();
intentsClient.deleteIntent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteIntentRequest,com.google.protobuf.Empty> deleteIntentCallable()
Note: You should always train a flow prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (IntentsClient intentsClient = IntentsClient.create()) {
DeleteIntentRequest request =
DeleteIntentRequest.newBuilder()
.setName(IntentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]").toString())
.build();
ApiFuture<Empty> future = intentsClient.deleteIntentCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<ImportIntentsResponse,ImportIntentsMetadata> importIntentsAsync(ImportIntentsRequest request)
This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`: [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ImportIntentsRequest,ImportIntentsResponse,ImportIntentsMetadata> importIntentsOperationCallable()
This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`: [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.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();
}
public final com.google.api.gax.rpc.UnaryCallable<ImportIntentsRequest,com.google.longrunning.Operation> importIntentsCallable()
This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`: [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.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();
}
public final com.google.api.gax.longrunning.OperationFuture<ExportIntentsResponse,ExportIntentsMetadata> exportIntentsAsync(ExportIntentsRequest request)
This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`: [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ExportIntentsRequest,ExportIntentsResponse,ExportIntentsMetadata> exportIntentsOperationCallable()
This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`: [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.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();
}
public final com.google.api.gax.rpc.UnaryCallable<ExportIntentsRequest,com.google.longrunning.Operation> exportIntentsCallable()
This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:
- `metadata`: [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`: [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.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();
}
public final IntentsClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,IntentsClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2025 Google LLC. All rights reserved.