@BetaApi @Generated(value="by gapic-generator-java") public class IntentsClient extends Object implements 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.ofProjectIntentName("[PROJECT]", "[INTENT]");
Intent response = intentsClient.getIntent(name);
}
Note: close() needs to be called on the IntentsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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.newBuilder()
.setTransportChannelProvider(
IntentsSettings.defaultHttpJsonTransportProviderBuilder().build())
.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) |
OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(AgentName parent,
List<Intent> intents)
Deletes intents in the specified agent.
|
OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(BatchDeleteIntentsRequest request)
Deletes intents in the specified agent.
|
OperationFuture<Empty,Struct> |
batchDeleteIntentsAsync(String parent,
List<Intent> intents)
Deletes intents in the specified agent.
|
UnaryCallable<BatchDeleteIntentsRequest,Operation> |
batchDeleteIntentsCallable()
Deletes intents in the specified agent.
|
OperationCallable<BatchDeleteIntentsRequest,Empty,Struct> |
batchDeleteIntentsOperationCallable()
Deletes intents in the specified agent.
|
OperationFuture<BatchUpdateIntentsResponse,Struct> |
batchUpdateIntentsAsync(AgentName parent,
IntentBatch intentBatchInline)
Updates/Creates multiple intents in the specified agent.
|
OperationFuture<BatchUpdateIntentsResponse,Struct> |
batchUpdateIntentsAsync(AgentName parent,
String intentBatchUri)
Updates/Creates multiple intents in the specified agent.
|
OperationFuture<BatchUpdateIntentsResponse,Struct> |
batchUpdateIntentsAsync(BatchUpdateIntentsRequest request)
Updates/Creates multiple intents in the specified agent.
|
OperationFuture<BatchUpdateIntentsResponse,Struct> |
batchUpdateIntentsAsync(String parent,
IntentBatch intentBatchInline)
Updates/Creates multiple intents in the specified agent.
|
OperationFuture<BatchUpdateIntentsResponse,Struct> |
batchUpdateIntentsAsync(String parent,
String intentBatchUri)
Updates/Creates multiple intents in the specified agent.
|
UnaryCallable<BatchUpdateIntentsRequest,Operation> |
batchUpdateIntentsCallable()
Updates/Creates multiple intents in the specified agent.
|
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(AgentName parent,
Intent intent)
Creates an intent in the specified agent.
|
Intent |
createIntent(AgentName parent,
Intent intent,
String languageCode)
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.
|
Intent |
createIntent(String parent,
Intent intent,
String languageCode)
Creates an intent in the specified agent.
|
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.
|
UnaryCallable<DeleteIntentRequest,Empty> |
deleteIntentCallable()
Deletes the specified intent and its direct or indirect followup intents.
|
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(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.
|
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.
|
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
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(AgentName parent)
Returns the list of all intents in the specified agent.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(AgentName parent,
String languageCode)
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.
|
IntentsClient.ListIntentsPagedResponse |
listIntents(String parent,
String languageCode)
Returns the list of all intents in the specified agent.
|
UnaryCallable<ListIntentsRequest,ListIntentsResponse> |
listIntentsCallable()
Returns the list of all intents in the specified agent.
|
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.
|
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
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)
Updates the specified intent.
|
Intent |
updateIntent(Intent intent,
FieldMask updateMask)
Updates the specified intent.
|
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.
|
UnaryCallable<UpdateIntentRequest,Intent> |
updateIntentCallable()
Updates the specified intent.
|
protected IntentsClient(IntentsSettings settings) throws IOException
IOException
protected IntentsClient(IntentsStub stub)
public static final IntentsClient create() throws IOException
IOException
public static final IntentsClient create(IntentsSettings settings) throws IOException
IOException
public static final IntentsClient create(IntentsStub stub)
public final IntentsSettings getSettings()
public IntentsStub getStub()
public final OperationsClient getOperationsClient()
@BetaApi public final 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.ofProjectName("[PROJECT]");
for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent` or `projects/<Project ID>/locations/<Location ID>/agent`.
Alternatively, you can specify the environment to list intents for. Format: `projects/<Project ID>/agent/environments/<Environment ID>` or `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>`. Note: training phrases of the intents will not be returned for non-draft environment.
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.ofProjectName("[PROJECT]").toString();
for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent` or `projects/<Project ID>/locations/<Location ID>/agent`.
Alternatively, you can specify the environment to list intents for. Format: `projects/<Project ID>/agent/environments/<Environment ID>` or `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>`. Note: training phrases of the intents will not be returned for non-draft environment.
ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(AgentName parent, String languageCode)
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.ofProjectName("[PROJECT]");
String languageCode = "languageCode-2092349083";
for (Intent element : intentsClient.listIntents(parent, languageCode).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent` or `projects/<Project ID>/locations/<Location ID>/agent`.
Alternatively, you can specify the environment to list intents for. Format: `projects/<Project ID>/agent/environments/<Environment ID>` or `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>`. Note: training phrases of the intents will not be returned for non-draft environment.
languageCode
- Optional. The language used to access language-specific data. If not
specified, the agent's default language is used. For more information, see [Multilingual
intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(String parent, String languageCode)
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.ofProjectName("[PROJECT]").toString();
String languageCode = "languageCode-2092349083";
for (Intent element : intentsClient.listIntents(parent, languageCode).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent` or `projects/<Project ID>/locations/<Location ID>/agent`.
Alternatively, you can specify the environment to list intents for. Format: `projects/<Project ID>/agent/environments/<Environment ID>` or `projects/<Project ID>/locations/<Location ID>/agent/environments/<Environment ID>`. Note: training phrases of the intents will not be returned for non-draft environment.
languageCode
- Optional. The language used to access language-specific data. If not
specified, the agent's default language is used. For more information, see [Multilingual
intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).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.ofProjectName("[PROJECT]").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.ApiException
- if the remote call failspublic final 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.ofProjectName("[PROJECT]").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 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.ofProjectName("[PROJECT]").toString())
.setLanguageCode("languageCode-2092349083")
.setIntentView(IntentView.forNumber(0))
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
for (Intent element : response.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.ofProjectIntentName("[PROJECT]", "[INTENT]");
Intent response = intentsClient.getIntent(name);
}
name
- Required. The name of the intent. Supported formats:
- `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>`
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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
Intent response = intentsClient.getIntent(name);
}
name
- Required. The name of the intent. Supported formats:
- `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>`
ApiException
- if the remote call failspublic final Intent getIntent(IntentName name, String languageCode)
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.ofProjectIntentName("[PROJECT]", "[INTENT]");
String languageCode = "languageCode-2092349083";
Intent response = intentsClient.getIntent(name, languageCode);
}
name
- Required. The name of the intent. Supported formats:
- `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>`
languageCode
- Optional. The language used to access language-specific data. If not
specified, the agent's default language is used. For more information, see [Multilingual
intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).ApiException
- if the remote call failspublic final Intent getIntent(String name, String languageCode)
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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
String languageCode = "languageCode-2092349083";
Intent response = intentsClient.getIntent(name, languageCode);
}
name
- Required. The name of the intent. Supported formats:
- `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>`
languageCode
- Optional. The language used to access language-specific data. If not
specified, the agent's default language is used. For more information, see [Multilingual
intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
.setLanguageCode("languageCode-2092349083")
.setIntentView(IntentView.forNumber(0))
.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<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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
.setLanguageCode("languageCode-2092349083")
.setIntentView(IntentView.forNumber(0))
.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 an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]");
Intent intent = Intent.newBuilder().build();
Intent response = intentsClient.createIntent(parent, intent);
}
parent
- Required. The agent to create a intent for. Supported formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intent
- Required. The intent to create.ApiException
- if the remote call failspublic final Intent createIntent(String parent, Intent intent)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]").toString();
Intent intent = Intent.newBuilder().build();
Intent response = intentsClient.createIntent(parent, intent);
}
parent
- Required. The agent to create a intent for. Supported formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intent
- Required. The intent to create.ApiException
- if the remote call failspublic final Intent createIntent(AgentName parent, Intent intent, String languageCode)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]");
Intent intent = Intent.newBuilder().build();
String languageCode = "languageCode-2092349083";
Intent response = intentsClient.createIntent(parent, intent, languageCode);
}
parent
- Required. The agent to create a intent for. Supported formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intent
- Required. The intent to create.languageCode
- Optional. The language used to access language-specific data. If not
specified, the agent's default language is used. For more information, see [Multilingual
intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).ApiException
- if the remote call failspublic final Intent createIntent(String parent, Intent intent, String languageCode)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]").toString();
Intent intent = Intent.newBuilder().build();
String languageCode = "languageCode-2092349083";
Intent response = intentsClient.createIntent(parent, intent, languageCode);
}
parent
- Required. The agent to create a intent for. Supported formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intent
- Required. The intent to create.languageCode
- Optional. The language used to access language-specific data. If not
specified, the agent's default language is used. For more information, see [Multilingual
intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).ApiException
- if the remote call failspublic final Intent createIntent(CreateIntentRequest request)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]").toString())
.setIntent(Intent.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setIntentView(IntentView.forNumber(0))
.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<CreateIntentRequest,Intent> createIntentCallable()
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]").toString())
.setIntent(Intent.newBuilder().build())
.setLanguageCode("languageCode-2092349083")
.setIntentView(IntentView.forNumber(0))
.build();
ApiFuture<Intent> future = intentsClient.createIntentCallable().futureCall(request);
// Do something.
Intent response = future.get();
}
public final Intent updateIntent(Intent intent)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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();
Intent response = intentsClient.updateIntent(intent);
}
intent
- Required. The intent to update.ApiException
- if the remote call failspublic final Intent updateIntent(Intent intent, FieldMask updateMask)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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
- Optional. The mask to control which fields get updated.ApiException
- if the remote call failspublic final Intent updateIntent(Intent intent, String languageCode)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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();
String languageCode = "languageCode-2092349083";
Intent response = intentsClient.updateIntent(intent, languageCode);
}
intent
- Required. The intent to update.languageCode
- Optional. The language used to access language-specific data. If not
specified, the agent's default language is used. For more information, see [Multilingual
intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).ApiException
- if the remote call failspublic final Intent updateIntent(Intent intent, String languageCode, FieldMask updateMask)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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();
String languageCode = "languageCode-2092349083";
FieldMask updateMask = FieldMask.newBuilder().build();
Intent response = intentsClient.updateIntent(intent, languageCode, updateMask);
}
intent
- Required. The intent to update.languageCode
- Optional. The language used to access language-specific data. If not
specified, the agent's default language is used. For more information, see [Multilingual
intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).updateMask
- Optional. The mask to control which fields get updated.ApiException
- if the remote call failspublic final Intent updateIntent(UpdateIntentRequest request)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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())
.setIntentView(IntentView.forNumber(0))
.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<UpdateIntentRequest,Intent> updateIntentCallable()
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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())
.setIntentView(IntentView.forNumber(0))
.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 an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectIntentName("[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.
Supported formats:
- `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>`
ApiException
- if the remote call failspublic final void deleteIntent(String name)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
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.
Supported formats:
- `projects/<Project ID>/agent/intents/<Intent ID>` - `projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>`
ApiException
- if the remote call failspublic final void deleteIntent(DeleteIntentRequest request)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectIntentName("[PROJECT]", "[INTENT]").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<DeleteIntentRequest,Empty> deleteIntentCallable()
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
.build();
ApiFuture<Empty> future = intentsClient.deleteIntentCallable().futureCall(request);
// Do something.
future.get();
}
public final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(AgentName parent, IntentBatch intentBatchInline)
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]");
IntentBatch intentBatchInline = IntentBatch.newBuilder().build();
BatchUpdateIntentsResponse response =
intentsClient.batchUpdateIntentsAsync(parent, intentBatchInline).get();
}
parent
- Required. The name of the agent to update or create intents in. Supported
formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intentBatchInline
- The collection of intents to update or create.ApiException
- if the remote call failspublic final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(AgentName parent, String intentBatchUri)
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]");
String intentBatchUri = "intentBatchUri544125582";
BatchUpdateIntentsResponse response =
intentsClient.batchUpdateIntentsAsync(parent, intentBatchUri).get();
}
parent
- Required. The name of the agent to update or create intents in. Supported
formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intentBatchUri
- The URI to a Google Cloud Storage file containing intents to update or
create. The file format can either be a serialized proto (of IntentBatch type) or JSON
object. Note: The URI must start with "gs://".ApiException
- if the remote call failspublic final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(String parent, IntentBatch intentBatchInline)
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]").toString();
IntentBatch intentBatchInline = IntentBatch.newBuilder().build();
BatchUpdateIntentsResponse response =
intentsClient.batchUpdateIntentsAsync(parent, intentBatchInline).get();
}
parent
- Required. The name of the agent to update or create intents in. Supported
formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intentBatchInline
- The collection of intents to update or create.ApiException
- if the remote call failspublic final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(String parent, String intentBatchUri)
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]").toString();
String intentBatchUri = "intentBatchUri544125582";
BatchUpdateIntentsResponse response =
intentsClient.batchUpdateIntentsAsync(parent, intentBatchUri).get();
}
parent
- Required. The name of the agent to update or create intents in. Supported
formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intentBatchUri
- The URI to a Google Cloud Storage file containing intents to update or
create. The file format can either be a serialized proto (of IntentBatch type) or JSON
object. Note: The URI must start with "gs://".ApiException
- if the remote call failspublic final OperationFuture<BatchUpdateIntentsResponse,Struct> batchUpdateIntentsAsync(BatchUpdateIntentsRequest request)
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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()) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.setIntentView(IntentView.forNumber(0))
.build();
BatchUpdateIntentsResponse response = intentsClient.batchUpdateIntentsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<BatchUpdateIntentsRequest,BatchUpdateIntentsResponse,Struct> batchUpdateIntentsOperationCallable()
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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()) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.setIntentView(IntentView.forNumber(0))
.build();
OperationFuture<BatchUpdateIntentsResponse, Struct> future =
intentsClient.batchUpdateIntentsOperationCallable().futureCall(request);
// Do something.
BatchUpdateIntentsResponse response = future.get();
}
public final UnaryCallable<BatchUpdateIntentsRequest,Operation> batchUpdateIntentsCallable()
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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()) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.setLanguageCode("languageCode-2092349083")
.setUpdateMask(FieldMask.newBuilder().build())
.setIntentView(IntentView.forNumber(0))
.build();
ApiFuture<Operation> future = intentsClient.batchUpdateIntentsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(AgentName parent, List<Intent> intents)
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]");
List<Intent> intents = new ArrayList<>();
intentsClient.batchDeleteIntentsAsync(parent, intents).get();
}
parent
- Required. The name of the agent to delete all entities types for. Supported
formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intents
- Required. The collection of intents to delete. Only intent `name` must be filled
in.ApiException
- if the remote call failspublic final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(String parent, List<Intent> intents)
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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.ofProjectName("[PROJECT]").toString();
List<Intent> intents = new ArrayList<>();
intentsClient.batchDeleteIntentsAsync(parent, intents).get();
}
parent
- Required. The name of the agent to delete all entities types for. Supported
formats:
- `projects/<Project ID>/agent` - `projects/<Project ID>/locations/<Location ID>/agent`
intents
- Required. The collection of intents to delete. Only intent `name` must be filled
in.ApiException
- if the remote call failspublic final OperationFuture<Empty,Struct> batchDeleteIntentsAsync(BatchDeleteIntentsRequest request)
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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()) {
BatchDeleteIntentsRequest request =
BatchDeleteIntentsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.addAllIntents(new ArrayList<Intent>())
.build();
intentsClient.batchDeleteIntentsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<BatchDeleteIntentsRequest,Empty,Struct> batchDeleteIntentsOperationCallable()
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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()) {
BatchDeleteIntentsRequest request =
BatchDeleteIntentsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.addAllIntents(new ArrayList<Intent>())
.build();
OperationFuture<Empty, Struct> future =
intentsClient.batchDeleteIntentsOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final UnaryCallable<BatchDeleteIntentsRequest,Operation> batchDeleteIntentsCallable()
This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:
- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/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()) {
BatchDeleteIntentsRequest request =
BatchDeleteIntentsRequest.newBuilder()
.setParent(AgentName.ofProjectName("[PROJECT]").toString())
.addAllIntents(new ArrayList<Intent>())
.build();
ApiFuture<Operation> future = intentsClient.batchDeleteIntentsCallable().futureCall(request);
// Do something.
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.ApiException
- if the remote call failspublic final 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 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.ApiException
- if the remote call failspublic final 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 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 © 2022 Google LLC. All rights reserved.