@Generated(value="by gapic-generator") @BetaApi public class IntentsClient extends Object implements BackgroundResource
You can provide additional information for the Dialogflow API to use to match user input to an intent by adding the following to your intent.
* **Contexts** - provide additional context for intent analysis. For example, if an intent is related to an object in your application that plays music, you can provide a context to determine when to match the intent if the user input is "turn it off". You can include a context that matches the intent when there is previous user input of "play music", and not when there is previous user input of "turn on the light".
* **Events** - allow for matching an intent by using an event name instead of user input. Your application can provide an event name and related parameters to the Dialogflow API to match an intent. For example, when your application starts, you can send a welcome event with a user name parameter to the Dialogflow API to match an intent with a personalized welcome message for the user.
* **Training phrases** - provide examples of user input to train the Dialogflow API agent to better match intents.
For more information about intents, see the [Dialogflow documentation](https://cloud.google.com/dialogflow-enterprise/docs/intents-overview).
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
Intent response = intentsClient.getIntent(name);
}
Note: close() needs to be called on the intentsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of IntentsSettings to create(). For example:
To customize credentials:
IntentsSettings intentsSettings =
IntentsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
IntentsClient intentsClient =
IntentsClient.create(intentsSettings);
To customize the endpoint:
IntentsSettings intentsSettings =
IntentsSettings.newBuilder().setEndpoint(myEndpoint).build();
IntentsClient intentsClient =
IntentsClient.create(intentsSettings);
Modifier and Type | Class and Description |
---|---|
static class |
IntentsClient.ListIntentsFixedSizeCollection |
static class |
IntentsClient.ListIntentsPage |
static class |
IntentsClient.ListIntentsPagedResponse |
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) |
OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(com.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest request)
Deletes intents in the specified agent.
|
OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent,
List<com.google.cloud.dialogflow.v2beta1.Intent> intents)
Deletes intents in the specified agent.
|
OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(String parent,
List<com.google.cloud.dialogflow.v2beta1.Intent> intents)
Deletes intents in the specified agent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest,Operation> |
batchDeleteIntentsCallable()
Deletes intents in the specified agent.
|
OperationCallable<com.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest,Empty,Struct> |
batchDeleteIntentsOperationCallable()
Deletes intents in the specified agent.
|
OperationFuture<com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse,Struct> |
batchUpdateIntentsAsync(com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest request)
Updates/Creates multiple intents in the specified agent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest,Operation> |
batchUpdateIntentsCallable()
Updates/Creates multiple intents in the specified agent.
|
OperationCallable<com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest,com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse,Struct> |
batchUpdateIntentsOperationCallable()
Updates/Creates multiple intents in the specified agent.
|
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.
|
com.google.cloud.dialogflow.v2beta1.Intent |
createIntent(com.google.cloud.dialogflow.v2beta1.CreateIntentRequest request)
Creates an intent in the specified agent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
createIntent(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent,
com.google.cloud.dialogflow.v2beta1.Intent intent)
Creates an intent in the specified agent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
createIntent(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent,
com.google.cloud.dialogflow.v2beta1.Intent intent,
String languageCode)
Creates an intent in the specified agent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
createIntent(String parent,
com.google.cloud.dialogflow.v2beta1.Intent intent)
Creates an intent in the specified agent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
createIntent(String parent,
com.google.cloud.dialogflow.v2beta1.Intent intent,
String languageCode)
Creates an intent in the specified agent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.CreateIntentRequest,com.google.cloud.dialogflow.v2beta1.Intent> |
createIntentCallable()
Creates an intent in the specified agent.
|
void |
deleteIntent(com.google.cloud.dialogflow.v2beta1.DeleteIntentRequest request)
Deletes the specified intent and its direct or indirect followup intents.
|
void |
deleteIntent(com.google.cloud.dialogflow.v2beta1.IntentName name)
Deletes the specified intent and its direct or indirect followup intents.
|
void |
deleteIntent(String name)
Deletes the specified intent and its direct or indirect followup intents.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.DeleteIntentRequest,Empty> |
deleteIntentCallable()
Deletes the specified intent and its direct or indirect followup intents.
|
com.google.cloud.dialogflow.v2beta1.Intent |
getIntent(com.google.cloud.dialogflow.v2beta1.GetIntentRequest request)
Retrieves the specified intent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
getIntent(com.google.cloud.dialogflow.v2beta1.IntentName name)
Retrieves the specified intent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
getIntent(com.google.cloud.dialogflow.v2beta1.IntentName name,
String languageCode)
Retrieves the specified intent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
getIntent(String name)
Retrieves the specified intent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
getIntent(String name,
String languageCode)
Retrieves the specified intent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.GetIntentRequest,com.google.cloud.dialogflow.v2beta1.Intent> |
getIntentCallable()
Retrieves the specified intent.
|
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() |
boolean |
isShutdown() |
boolean |
isTerminated() |
IntentsClient.ListIntentsPagedResponse |
listIntents(com.google.cloud.dialogflow.v2beta1.ListIntentsRequest request)
Returns the list of all intents in the specified agent.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent)
Returns the list of all intents in the specified agent.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent,
String languageCode)
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.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(String parent,
String languageCode)
Returns the list of all intents in the specified agent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.ListIntentsRequest,com.google.cloud.dialogflow.v2beta1.ListIntentsResponse> |
listIntentsCallable()
Returns the list of all intents in the specified agent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.ListIntentsRequest,IntentsClient.ListIntentsPagedResponse> |
listIntentsPagedCallable()
Returns the list of all intents in the specified agent.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.cloud.dialogflow.v2beta1.Intent |
updateIntent(com.google.cloud.dialogflow.v2beta1.Intent intent,
String languageCode)
Updates the specified intent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
updateIntent(com.google.cloud.dialogflow.v2beta1.Intent intent,
String languageCode,
FieldMask updateMask)
Updates the specified intent.
|
com.google.cloud.dialogflow.v2beta1.Intent |
updateIntent(com.google.cloud.dialogflow.v2beta1.UpdateIntentRequest request)
Updates the specified intent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.UpdateIntentRequest,com.google.cloud.dialogflow.v2beta1.Intent> |
updateIntentCallable()
Updates the specified intent.
|
protected IntentsClient(IntentsSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected IntentsClient(IntentsStub stub)
public static final IntentsClient create() throws IOException
IOException
public static final IntentsClient create(IntentsSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final IntentsClient create(IntentsStub stub)
public final IntentsSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public IntentsStub getStub()
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient()
public final IntentsClient.ListIntentsPagedResponse listIntents(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent`.ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(String parent)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
for (Intent element : intentsClient.listIntents(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent`.ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent, String languageCode)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
String languageCode = "";
for (Intent element : intentsClient.listIntents(parent, languageCode).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent`.languageCode
- Optional. The language to list training phrases, parameters and rich
messages for. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(String parent, String languageCode)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
String languageCode = "";
for (Intent element : intentsClient.listIntents(parent.toString(), languageCode).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent`.languageCode
- Optional. The language to list training phrases, parameters and rich
messages for. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(com.google.cloud.dialogflow.v2beta1.ListIntentsRequest request)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
ListIntentsRequest request = ListIntentsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Intent element : intentsClient.listIntents(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dialogflow.v2beta1.ListIntentsRequest,IntentsClient.ListIntentsPagedResponse> listIntentsPagedCallable()
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
ListIntentsRequest request = ListIntentsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListIntentsPagedResponse> future = intentsClient.listIntentsPagedCallable().futureCall(request);
// Do something
for (Intent element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.dialogflow.v2beta1.ListIntentsRequest,com.google.cloud.dialogflow.v2beta1.ListIntentsResponse> listIntentsCallable()
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
ListIntentsRequest request = ListIntentsRequest.newBuilder()
.setParent(parent.toString())
.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 com.google.cloud.dialogflow.v2beta1.Intent getIntent(com.google.cloud.dialogflow.v2beta1.IntentName name)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
Intent response = intentsClient.getIntent(name);
}
name
- Required. The name of the intent. Format: `projects/<Project
ID>/agent/intents/<Intent ID>`.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent getIntent(String name)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
Intent response = intentsClient.getIntent(name.toString());
}
name
- Required. The name of the intent. Format: `projects/<Project
ID>/agent/intents/<Intent ID>`.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent getIntent(com.google.cloud.dialogflow.v2beta1.IntentName name, String languageCode)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
String languageCode = "";
Intent response = intentsClient.getIntent(name, languageCode);
}
name
- Required. The name of the intent. Format: `projects/<Project
ID>/agent/intents/<Intent ID>`.languageCode
- Optional. The language to retrieve training phrases, parameters and rich
messages for. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent getIntent(String name, String languageCode)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
String languageCode = "";
Intent response = intentsClient.getIntent(name.toString(), languageCode);
}
name
- Required. The name of the intent. Format: `projects/<Project
ID>/agent/intents/<Intent ID>`.languageCode
- Optional. The language to retrieve training phrases, parameters and rich
messages for. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent getIntent(com.google.cloud.dialogflow.v2beta1.GetIntentRequest request)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
GetIntentRequest request = GetIntentRequest.newBuilder()
.setName(name.toString())
.build();
Intent response = intentsClient.getIntent(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dialogflow.v2beta1.GetIntentRequest,com.google.cloud.dialogflow.v2beta1.Intent> getIntentCallable()
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
GetIntentRequest request = GetIntentRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Intent> future = intentsClient.getIntentCallable().futureCall(request);
// Do something
Intent response = future.get();
}
public final com.google.cloud.dialogflow.v2beta1.Intent createIntent(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent, com.google.cloud.dialogflow.v2beta1.Intent intent)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
Intent intent = Intent.newBuilder().build();
Intent response = intentsClient.createIntent(parent, intent);
}
parent
- Required. The agent to create a intent for. Format: `projects/<Project
ID>/agent`.intent
- Required. The intent to create.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent createIntent(String parent, com.google.cloud.dialogflow.v2beta1.Intent intent)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
Intent intent = Intent.newBuilder().build();
Intent response = intentsClient.createIntent(parent.toString(), intent);
}
parent
- Required. The agent to create a intent for. Format: `projects/<Project
ID>/agent`.intent
- Required. The intent to create.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent createIntent(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent, com.google.cloud.dialogflow.v2beta1.Intent intent, String languageCode)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
Intent intent = Intent.newBuilder().build();
String languageCode = "";
Intent response = intentsClient.createIntent(parent, intent, languageCode);
}
parent
- Required. The agent to create a intent for. Format: `projects/<Project
ID>/agent`.intent
- Required. The intent to create.languageCode
- Optional. The language of training phrases, parameters and rich messages
defined in `intent`. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent createIntent(String parent, com.google.cloud.dialogflow.v2beta1.Intent intent, String languageCode)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
Intent intent = Intent.newBuilder().build();
String languageCode = "";
Intent response = intentsClient.createIntent(parent.toString(), intent, languageCode);
}
parent
- Required. The agent to create a intent for. Format: `projects/<Project
ID>/agent`.intent
- Required. The intent to create.languageCode
- Optional. The language of training phrases, parameters and rich messages
defined in `intent`. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent createIntent(com.google.cloud.dialogflow.v2beta1.CreateIntentRequest request)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
Intent intent = Intent.newBuilder().build();
CreateIntentRequest request = CreateIntentRequest.newBuilder()
.setParent(parent.toString())
.setIntent(intent)
.build();
Intent response = intentsClient.createIntent(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dialogflow.v2beta1.CreateIntentRequest,com.google.cloud.dialogflow.v2beta1.Intent> createIntentCallable()
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
Intent intent = Intent.newBuilder().build();
CreateIntentRequest request = CreateIntentRequest.newBuilder()
.setParent(parent.toString())
.setIntent(intent)
.build();
ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
// Do something
Intent response = future.get();
}
public final com.google.cloud.dialogflow.v2beta1.Intent updateIntent(com.google.cloud.dialogflow.v2beta1.Intent intent, String languageCode)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
Intent intent = Intent.newBuilder().build();
String languageCode = "";
Intent response = intentsClient.updateIntent(intent, languageCode);
}
intent
- Required. The intent to update.languageCode
- Optional. The language of training phrases, parameters and rich messages
defined in `intent`. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent updateIntent(com.google.cloud.dialogflow.v2beta1.Intent intent, String languageCode, FieldMask updateMask)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
Intent intent = Intent.newBuilder().build();
String languageCode = "";
FieldMask updateMask = FieldMask.newBuilder().build();
Intent response = intentsClient.updateIntent(intent, languageCode, updateMask);
}
intent
- Required. The intent to update.languageCode
- Optional. The language of training phrases, parameters and rich messages
defined in `intent`. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.updateMask
- Optional. The mask to control which fields get updated.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Intent updateIntent(com.google.cloud.dialogflow.v2beta1.UpdateIntentRequest request)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
Intent intent = Intent.newBuilder().build();
String languageCode = "";
UpdateIntentRequest request = UpdateIntentRequest.newBuilder()
.setIntent(intent)
.setLanguageCode(languageCode)
.build();
Intent response = intentsClient.updateIntent(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dialogflow.v2beta1.UpdateIntentRequest,com.google.cloud.dialogflow.v2beta1.Intent> updateIntentCallable()
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
Intent intent = Intent.newBuilder().build();
String languageCode = "";
UpdateIntentRequest request = UpdateIntentRequest.newBuilder()
.setIntent(intent)
.setLanguageCode(languageCode)
.build();
ApiFuture<Intent> future = intentsClient.updateIntentCallable().futureCall(request);
// Do something
Intent response = future.get();
}
public final void deleteIntent(com.google.cloud.dialogflow.v2beta1.IntentName name)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
intentsClient.deleteIntent(name);
}
name
- Required. The name of the intent to delete. If this intent has direct or indirect
followup intents, we also delete them.
Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
ApiException
- if the remote call failspublic final void deleteIntent(String name)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
intentsClient.deleteIntent(name.toString());
}
name
- Required. The name of the intent to delete. If this intent has direct or indirect
followup intents, we also delete them.
Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
ApiException
- if the remote call failspublic final void deleteIntent(com.google.cloud.dialogflow.v2beta1.DeleteIntentRequest request)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
DeleteIntentRequest request = DeleteIntentRequest.newBuilder()
.setName(name.toString())
.build();
intentsClient.deleteIntent(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dialogflow.v2beta1.DeleteIntentRequest,Empty> deleteIntentCallable()
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
IntentName name = IntentName.of("[PROJECT]", "[INTENT]");
DeleteIntentRequest request = DeleteIntentRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = intentsClient.deleteIntentCallable().futureCall(request);
// Do something
future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest request)
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
String languageCode = "";
BatchUpdateIntentsRequest request = BatchUpdateIntentsRequest.newBuilder()
.setParent(parent.toString())
.setLanguageCode(languageCode)
.build();
BatchUpdateIntentsResponse response = intentsClient.batchUpdateIntentsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest,com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse,Struct> batchUpdateIntentsOperationCallable()
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
String languageCode = "";
BatchUpdateIntentsRequest request = BatchUpdateIntentsRequest.newBuilder()
.setParent(parent.toString())
.setLanguageCode(languageCode)
.build();
OperationFuture<BatchUpdateIntentsResponse, Struct> future = intentsClient.batchUpdateIntentsOperationCallable().futureCall(request);
// Do something
BatchUpdateIntentsResponse response = future.get();
}
public final UnaryCallable<com.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest,Operation> batchUpdateIntentsCallable()
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
String languageCode = "";
BatchUpdateIntentsRequest request = BatchUpdateIntentsRequest.newBuilder()
.setParent(parent.toString())
.setLanguageCode(languageCode)
.build();
ApiFuture<Operation> future = intentsClient.batchUpdateIntentsCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(com.google.cloud.dialogflow.v2beta1.ProjectAgentName parent, List<com.google.cloud.dialogflow.v2beta1.Intent> intents)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
List<Intent> intents = new ArrayList<>();
intentsClient.batchDeleteIntentsAsync(parent, intents).get();
}
parent
- Required. The name of the agent to delete all entities types for. Format:
`projects/<Project ID>/agent`.intents
- Required. The collection of intents to delete. Only intent `name` must be filled
in.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(String parent, List<com.google.cloud.dialogflow.v2beta1.Intent> intents)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
List<Intent> intents = new ArrayList<>();
intentsClient.batchDeleteIntentsAsync(parent.toString(), intents).get();
}
parent
- Required. The name of the agent to delete all entities types for. Format:
`projects/<Project ID>/agent`.intents
- Required. The collection of intents to delete. Only intent `name` must be filled
in.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(com.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest request)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
List<Intent> intents = new ArrayList<>();
BatchDeleteIntentsRequest request = BatchDeleteIntentsRequest.newBuilder()
.setParent(parent.toString())
.addAllIntents(intents)
.build();
intentsClient.batchDeleteIntentsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest,Empty,Struct> batchDeleteIntentsOperationCallable()
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
List<Intent> intents = new ArrayList<>();
BatchDeleteIntentsRequest request = BatchDeleteIntentsRequest.newBuilder()
.setParent(parent.toString())
.addAllIntents(intents)
.build();
OperationFuture<Empty, Struct> future = intentsClient.batchDeleteIntentsOperationCallable().futureCall(request);
// Do something
future.get();
}
public final UnaryCallable<com.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest,Operation> batchDeleteIntentsCallable()
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
List<Intent> intents = new ArrayList<>();
BatchDeleteIntentsRequest request = BatchDeleteIntentsRequest.newBuilder()
.setParent(parent.toString())
.addAllIntents(intents)
.build();
ApiFuture<Operation> future = intentsClient.batchDeleteIntentsCallable().futureCall(request);
// Do something
future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.