@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:
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:
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);
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 |
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.
|
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.
|
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.
|
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
@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()
public final OperationsClient getOperationsClient()
public final IntentsClient.ListIntentsPagedResponse listIntents(AgentName parent)
Sample code:
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`.ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(String parent)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
String parent = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString();
for (Intent element : intentsClient.listIntents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent`.ApiException
- if the remote call failspublic final IntentsClient.ListIntentsPagedResponse listIntents(AgentName parent, String languageCode)
Sample code:
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`.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:
try (IntentsClient intentsClient = IntentsClient.create()) {
String parent = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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`.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:
try (IntentsClient intentsClient = IntentsClient.create()) {
ListIntentsRequest request =
ListIntentsRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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:
try (IntentsClient intentsClient = IntentsClient.create()) {
ListIntentsRequest request =
ListIntentsRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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:
try (IntentsClient intentsClient = IntentsClient.create()) {
while (true) {
ListIntentsResponse response = intentsClient.listIntentsCallable().call(request);
for (Intent element : response.getResponsesList()) {
// 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.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:
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:
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:
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:
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:
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)
Sample code:
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)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
String parent = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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)
Sample code:
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)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
String parent = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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)
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
CreateIntentRequest request =
CreateIntentRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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()
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
CreateIntentRequest request =
CreateIntentRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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)
Sample code:
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)
Sample code:
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)
Sample code:
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)
Sample code:
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)
Sample code:
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()
Sample code:
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)
Sample code:
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)
Sample code:
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)
Sample code:
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()
Sample code:
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)
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
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)
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
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)
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
String parent = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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)
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
String parent = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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)
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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()
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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()
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
BatchUpdateIntentsRequest request =
BatchUpdateIntentsRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
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)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
String parent = IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
BatchDeleteIntentsRequest request =
BatchDeleteIntentsRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").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()
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
BatchDeleteIntentsRequest request =
BatchDeleteIntentsRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
.addAllIntents(new ArrayList<Intent>())
.build();
OperationFuture<Empty, Struct> future =
intentsClient.batchDeleteIntentsOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final UnaryCallable<BatchDeleteIntentsRequest,Operation> batchDeleteIntentsCallable()
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (IntentsClient intentsClient = IntentsClient.create()) {
BatchDeleteIntentsRequest request =
BatchDeleteIntentsRequest.newBuilder()
.setParent(IntentName.ofProjectIntentName("[PROJECT]", "[INTENT]").toString())
.addAllIntents(new ArrayList<Intent>())
.build();
ApiFuture<Operation> future = intentsClient.batchDeleteIntentsCallable().futureCall(request);
// Do something.
future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2021 Google LLC. All rights reserved.