@Generated(value="by gapic-generator") @BetaApi public class IntentsClient extends Object implements com.google.api.gax.core.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/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) |
com.google.api.gax.longrunning.OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(BatchDeleteIntentsRequest request)
Deletes intents in the specified agent.
|
com.google.api.gax.longrunning.OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(ProjectAgentName parent,
List<Intent> intents)
Deletes intents in the specified agent.
|
com.google.api.gax.longrunning.OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(String parent,
List<Intent> intents)
Deletes intents in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<BatchDeleteIntentsRequest,com.google.longrunning.Operation> |
batchDeleteIntentsCallable()
Deletes intents in the specified agent.
|
com.google.api.gax.rpc.OperationCallable<BatchDeleteIntentsRequest,Empty,Struct> |
batchDeleteIntentsOperationCallable()
Deletes intents in the specified agent.
|
com.google.api.gax.longrunning.OperationFuture<BatchUpdateIntentsResponse,Struct> |
batchUpdateIntentsAsync(BatchUpdateIntentsRequest request)
Updates/Creates multiple intents in the specified agent.
|
com.google.api.gax.rpc.UnaryCallable<BatchUpdateIntentsRequest,com.google.longrunning.Operation> |
batchUpdateIntentsCallable()
Updates/Creates multiple intents in the specified agent.
|
com.google.api.gax.rpc.OperationCallable<BatchUpdateIntentsRequest,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.
|
Intent |
createIntent(CreateIntentRequest request)
Creates an intent in the specified agent.
|
Intent |
createIntent(ProjectAgentName parent,
Intent intent)
Creates an intent in the specified agent.
|
Intent |
createIntent(ProjectAgentName parent,
Intent intent,
String languageCode)
Creates an intent in the specified agent.
|
Intent |
createIntent(String parent,
Intent intent)
Creates an intent in the specified agent.
|
Intent |
createIntent(String parent,
Intent intent,
String languageCode)
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 and its direct or indirect followup intents.
|
void |
deleteIntent(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.
|
com.google.api.gax.rpc.UnaryCallable<DeleteIntentRequest,Empty> |
deleteIntentCallable()
Deletes the specified intent and its direct or indirect followup intents.
|
Intent |
getIntent(GetIntentRequest request)
Retrieves the specified intent.
|
Intent |
getIntent(IntentName name)
Retrieves the specified intent.
|
Intent |
getIntent(IntentName name,
String languageCode)
Retrieves the specified intent.
|
Intent |
getIntent(String name)
Retrieves the specified intent.
|
Intent |
getIntent(String name,
String languageCode)
Retrieves the specified intent.
|
com.google.api.gax.rpc.UnaryCallable<GetIntentRequest,Intent> |
getIntentCallable()
Retrieves the specified intent.
|
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() |
boolean |
isShutdown() |
boolean |
isTerminated() |
IntentsClient.ListIntentsPagedResponse |
listIntents(ListIntentsRequest request)
Returns the list of all intents in the specified agent.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(ProjectAgentName parent)
Returns the list of all intents in the specified agent.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(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.
|
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.
|
void |
shutdown() |
void |
shutdownNow() |
Intent |
updateIntent(Intent intent,
String languageCode)
Updates the specified intent.
|
Intent |
updateIntent(Intent intent,
String languageCode,
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
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 com.google.longrunning.OperationsClient getOperationsClient()
public final IntentsClient.ListIntentsPagedResponse listIntents(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`.com.google.api.gax.rpc.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`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(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/docs/reference/language) are supported.
Note: languages must be enabled in the agent before they can be used.com.google.api.gax.rpc.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/docs/reference/language) are supported.
Note: languages must be enabled in the agent before they can be used.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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 com.google.api.gax.rpc.UnaryCallable<ListIntentsRequest,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 Intent getIntent(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>`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final 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>`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Intent getIntent(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/docs/reference/language) are supported.
Note: languages must be enabled in the agent before they can be used.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final 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/docs/reference/language) are supported.
Note: languages must be enabled in the agent before they can be used.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Intent getIntent(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetIntentRequest,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 Intent createIntent(ProjectAgentName parent, 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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Intent createIntent(String parent, 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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Intent createIntent(ProjectAgentName parent, 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/docs/reference/language) are supported.
Note: languages must be enabled in the agent before they can be used.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Intent createIntent(String parent, 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/docs/reference/language) are supported.
Note: languages must be enabled in the agent before they can be used.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Intent createIntent(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateIntentRequest,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 Intent updateIntent(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/docs/reference/language) are supported.
Note: languages must be enabled in the agent before they can be used.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Intent updateIntent(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/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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Intent updateIntent(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateIntentRequest,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(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>`.com.google.api.gax.rpc.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>`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteIntent(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.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<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 com.google.api.gax.longrunning.OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(BatchUpdateIntentsRequest request)
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.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.com.google.api.gax.rpc.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 com.google.api.gax.rpc.OperationCallable<BatchUpdateIntentsRequest,BatchUpdateIntentsResponse,Struct> batchUpdateIntentsOperationCallable()
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.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 com.google.api.gax.rpc.UnaryCallable<BatchUpdateIntentsRequest,com.google.longrunning.Operation> batchUpdateIntentsCallable()
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.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 com.google.api.gax.longrunning.OperationFuture<Empty,Struct> batchDeleteIntentsAsync(ProjectAgentName parent, List<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.com.google.api.gax.rpc.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 com.google.api.gax.longrunning.OperationFuture<Empty,Struct> batchDeleteIntentsAsync(String parent, List<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.com.google.api.gax.rpc.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 com.google.api.gax.longrunning.OperationFuture<Empty,Struct> batchDeleteIntentsAsync(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.com.google.api.gax.rpc.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 com.google.api.gax.rpc.OperationCallable<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 com.google.api.gax.rpc.UnaryCallable<BatchDeleteIntentsRequest,com.google.longrunning.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 com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.