@Generated(value="by gapic-generator") @BetaApi public class AgentsClient extends Object implements BackgroundResource
After you create an agent, you can add [Intents][google.cloud.dialogflow.v2beta1.Intents], [Contexts][google.cloud.dialogflow.v2beta1.Contexts], [Entity Types][google.cloud.dialogflow.v2beta1.EntityTypes], [Webhooks][google.cloud.dialogflow.v2beta1.WebhookRequest], and so on to manage the flow of a conversation and match user input to predefined intents and actions.
You can create an agent using both Dialogflow Standard Edition and Dialogflow Enterprise Edition. For details, see [Dialogflow Editions](https://cloud.google.com/dialogflow-enterprise/docs/editions).
You can save your agent for backup or versioning by exporting the agent by using the [ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent] method. You can import a saved agent by using the [ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent] method.
Dialogflow provides several [prebuilt agents](https://cloud.google.com/dialogflow-enterprise/docs/agents-prebuilt) for common conversation scenarios such as determining a date and time, converting currency, and so on.
For more information about agents, see the [Dialogflow documentation](https://cloud.google.com/dialogflow-enterprise/docs/agents-overview).
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Agent response = agentsClient.getAgent(parent);
}
Note: close() needs to be called on the agentsClient 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 AgentsSettings to create(). For example:
To customize credentials:
AgentsSettings agentsSettings =
AgentsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AgentsClient agentsClient =
AgentsClient.create(agentsSettings);
To customize the endpoint:
AgentsSettings agentsSettings =
AgentsSettings.newBuilder().setEndpoint(myEndpoint).build();
AgentsClient agentsClient =
AgentsClient.create(agentsSettings);
Modifier and Type | Class and Description |
---|---|
static class |
AgentsClient.SearchAgentsFixedSizeCollection |
static class |
AgentsClient.SearchAgentsPage |
static class |
AgentsClient.SearchAgentsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
AgentsClient(AgentsSettings settings)
Constructs an instance of AgentsClient, using the given settings.
|
protected |
AgentsClient(AgentsStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static AgentsClient |
create()
Constructs an instance of AgentsClient with default settings.
|
static AgentsClient |
create(AgentsSettings settings)
Constructs an instance of AgentsClient, using the given settings.
|
static AgentsClient |
create(AgentsStub stub)
Constructs an instance of AgentsClient, using the given stub for making calls.
|
OperationFuture<com.google.cloud.dialogflow.v2beta1.ExportAgentResponse,Struct> |
exportAgentAsync(com.google.cloud.dialogflow.v2beta1.ExportAgentRequest request)
Exports the specified agent to a ZIP file.
|
OperationFuture<com.google.cloud.dialogflow.v2beta1.ExportAgentResponse,Struct> |
exportAgentAsync(com.google.cloud.dialogflow.v2beta1.ProjectName parent)
Exports the specified agent to a ZIP file.
|
OperationFuture<com.google.cloud.dialogflow.v2beta1.ExportAgentResponse,Struct> |
exportAgentAsync(String parent)
Exports the specified agent to a ZIP file.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.ExportAgentRequest,Operation> |
exportAgentCallable()
Exports the specified agent to a ZIP file.
|
OperationCallable<com.google.cloud.dialogflow.v2beta1.ExportAgentRequest,com.google.cloud.dialogflow.v2beta1.ExportAgentResponse,Struct> |
exportAgentOperationCallable()
Exports the specified agent to a ZIP file.
|
com.google.cloud.dialogflow.v2beta1.Agent |
getAgent(com.google.cloud.dialogflow.v2beta1.GetAgentRequest request)
Retrieves the specified agent.
|
com.google.cloud.dialogflow.v2beta1.Agent |
getAgent(com.google.cloud.dialogflow.v2beta1.ProjectName parent)
Retrieves the specified agent.
|
com.google.cloud.dialogflow.v2beta1.Agent |
getAgent(String parent)
Retrieves the specified agent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.GetAgentRequest,com.google.cloud.dialogflow.v2beta1.Agent> |
getAgentCallable()
Retrieves the specified agent.
|
OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
AgentsSettings |
getSettings() |
AgentsStub |
getStub() |
OperationFuture<Empty,Struct> |
importAgentAsync(com.google.cloud.dialogflow.v2beta1.ImportAgentRequest request)
Imports the specified agent from a ZIP file.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.ImportAgentRequest,Operation> |
importAgentCallable()
Imports the specified agent from a ZIP file.
|
OperationCallable<com.google.cloud.dialogflow.v2beta1.ImportAgentRequest,Empty,Struct> |
importAgentOperationCallable()
Imports the specified agent from a ZIP file.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
OperationFuture<Empty,Struct> |
restoreAgentAsync(com.google.cloud.dialogflow.v2beta1.RestoreAgentRequest request)
Restores the specified agent from a ZIP file.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.RestoreAgentRequest,Operation> |
restoreAgentCallable()
Restores the specified agent from a ZIP file.
|
OperationCallable<com.google.cloud.dialogflow.v2beta1.RestoreAgentRequest,Empty,Struct> |
restoreAgentOperationCallable()
Restores the specified agent from a ZIP file.
|
AgentsClient.SearchAgentsPagedResponse |
searchAgents(com.google.cloud.dialogflow.v2beta1.ProjectName parent)
Returns the list of agents.
|
AgentsClient.SearchAgentsPagedResponse |
searchAgents(com.google.cloud.dialogflow.v2beta1.SearchAgentsRequest request)
Returns the list of agents.
|
AgentsClient.SearchAgentsPagedResponse |
searchAgents(String parent)
Returns the list of agents.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.SearchAgentsRequest,com.google.cloud.dialogflow.v2beta1.SearchAgentsResponse> |
searchAgentsCallable()
Returns the list of agents.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.SearchAgentsRequest,AgentsClient.SearchAgentsPagedResponse> |
searchAgentsPagedCallable()
Returns the list of agents.
|
void |
shutdown() |
void |
shutdownNow() |
OperationFuture<Empty,Struct> |
trainAgentAsync(com.google.cloud.dialogflow.v2beta1.ProjectName parent)
Trains the specified agent.
|
OperationFuture<Empty,Struct> |
trainAgentAsync(String parent)
Trains the specified agent.
|
OperationFuture<Empty,Struct> |
trainAgentAsync(com.google.cloud.dialogflow.v2beta1.TrainAgentRequest request)
Trains the specified agent.
|
UnaryCallable<com.google.cloud.dialogflow.v2beta1.TrainAgentRequest,Operation> |
trainAgentCallable()
Trains the specified agent.
|
OperationCallable<com.google.cloud.dialogflow.v2beta1.TrainAgentRequest,Empty,Struct> |
trainAgentOperationCallable()
Trains the specified agent.
|
protected AgentsClient(AgentsSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected AgentsClient(AgentsStub stub)
public static final AgentsClient create() throws IOException
IOException
public static final AgentsClient create(AgentsSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final AgentsClient create(AgentsStub stub)
public final AgentsSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public AgentsStub getStub()
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient()
public final com.google.cloud.dialogflow.v2beta1.Agent getAgent(com.google.cloud.dialogflow.v2beta1.ProjectName parent)
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Agent response = agentsClient.getAgent(parent);
}
parent
- Required. The project that the agent to fetch is associated with. Format:
`projects/<Project ID>`.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Agent getAgent(String parent)
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Agent response = agentsClient.getAgent(parent.toString());
}
parent
- Required. The project that the agent to fetch is associated with. Format:
`projects/<Project ID>`.ApiException
- if the remote call failspublic final com.google.cloud.dialogflow.v2beta1.Agent getAgent(com.google.cloud.dialogflow.v2beta1.GetAgentRequest request)
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
GetAgentRequest request = GetAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
Agent response = agentsClient.getAgent(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dialogflow.v2beta1.GetAgentRequest,com.google.cloud.dialogflow.v2beta1.Agent> getAgentCallable()
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
GetAgentRequest request = GetAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<Agent> future = agentsClient.getAgentCallable().futureCall(request);
// Do something
Agent response = future.get();
}
public final AgentsClient.SearchAgentsPagedResponse searchAgents(com.google.cloud.dialogflow.v2beta1.ProjectName parent)
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
for (Agent element : agentsClient.searchAgents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The project to list agents from. Format: `projects/<Project ID or
'-'>`.ApiException
- if the remote call failspublic final AgentsClient.SearchAgentsPagedResponse searchAgents(String parent)
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
for (Agent element : agentsClient.searchAgents(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The project to list agents from. Format: `projects/<Project ID or
'-'>`.ApiException
- if the remote call failspublic final AgentsClient.SearchAgentsPagedResponse searchAgents(com.google.cloud.dialogflow.v2beta1.SearchAgentsRequest request)
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchAgentsRequest request = SearchAgentsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Agent element : agentsClient.searchAgents(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.dialogflow.v2beta1.SearchAgentsRequest,AgentsClient.SearchAgentsPagedResponse> searchAgentsPagedCallable()
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchAgentsRequest request = SearchAgentsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<SearchAgentsPagedResponse> future = agentsClient.searchAgentsPagedCallable().futureCall(request);
// Do something
for (Agent element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.dialogflow.v2beta1.SearchAgentsRequest,com.google.cloud.dialogflow.v2beta1.SearchAgentsResponse> searchAgentsCallable()
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchAgentsRequest request = SearchAgentsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
SearchAgentsResponse response = agentsClient.searchAgentsCallable().call(request);
for (Agent element : response.getAgentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Struct> trainAgentAsync(com.google.cloud.dialogflow.v2beta1.ProjectName parent)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
agentsClient.trainAgentAsync(parent).get();
}
parent
- Required. The project that the agent to train is associated with. Format:
`projects/<Project ID>`.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Struct> trainAgentAsync(String parent)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
agentsClient.trainAgentAsync(parent.toString()).get();
}
parent
- Required. The project that the agent to train is associated with. Format:
`projects/<Project ID>`.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Struct> trainAgentAsync(com.google.cloud.dialogflow.v2beta1.TrainAgentRequest request)
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
TrainAgentRequest request = TrainAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
agentsClient.trainAgentAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.dialogflow.v2beta1.TrainAgentRequest,Empty,Struct> trainAgentOperationCallable()
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
TrainAgentRequest request = TrainAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
OperationFuture<Empty, Struct> future = agentsClient.trainAgentOperationCallable().futureCall(request);
// Do something
future.get();
}
public final UnaryCallable<com.google.cloud.dialogflow.v2beta1.TrainAgentRequest,Operation> trainAgentCallable()
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
TrainAgentRequest request = TrainAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<Operation> future = agentsClient.trainAgentCallable().futureCall(request);
// Do something
future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<com.google.cloud.dialogflow.v2beta1.ExportAgentResponse,Struct> exportAgentAsync(com.google.cloud.dialogflow.v2beta1.ProjectName parent)
Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ExportAgentResponse response = agentsClient.exportAgentAsync(parent).get();
}
parent
- Required. The project that the agent to export is associated with. Format:
`projects/<Project ID>`.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<com.google.cloud.dialogflow.v2beta1.ExportAgentResponse,Struct> exportAgentAsync(String parent)
Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ExportAgentResponse response = agentsClient.exportAgentAsync(parent.toString()).get();
}
parent
- Required. The project that the agent to export is associated with. Format:
`projects/<Project ID>`.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<com.google.cloud.dialogflow.v2beta1.ExportAgentResponse,Struct> exportAgentAsync(com.google.cloud.dialogflow.v2beta1.ExportAgentRequest request)
Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ExportAgentRequest request = ExportAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
ExportAgentResponse response = agentsClient.exportAgentAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.dialogflow.v2beta1.ExportAgentRequest,com.google.cloud.dialogflow.v2beta1.ExportAgentResponse,Struct> exportAgentOperationCallable()
Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ExportAgentRequest request = ExportAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
OperationFuture<ExportAgentResponse, Struct> future = agentsClient.exportAgentOperationCallable().futureCall(request);
// Do something
ExportAgentResponse response = future.get();
}
public final UnaryCallable<com.google.cloud.dialogflow.v2beta1.ExportAgentRequest,Operation> exportAgentCallable()
Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ExportAgentRequest request = ExportAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<Operation> future = agentsClient.exportAgentCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Struct> importAgentAsync(com.google.cloud.dialogflow.v2beta1.ImportAgentRequest request)
Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from ImportAgentRequest.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ImportAgentRequest request = ImportAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
agentsClient.importAgentAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.dialogflow.v2beta1.ImportAgentRequest,Empty,Struct> importAgentOperationCallable()
Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from ImportAgentRequest.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ImportAgentRequest request = ImportAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
OperationFuture<Empty, Struct> future = agentsClient.importAgentOperationCallable().futureCall(request);
// Do something
future.get();
}
public final UnaryCallable<com.google.cloud.dialogflow.v2beta1.ImportAgentRequest,Operation> importAgentCallable()
Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from ImportAgentRequest.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ImportAgentRequest request = ImportAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<Operation> future = agentsClient.importAgentCallable().futureCall(request);
// Do something
future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Struct> restoreAgentAsync(com.google.cloud.dialogflow.v2beta1.RestoreAgentRequest request)
Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
agentsClient.restoreAgentAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.dialogflow.v2beta1.RestoreAgentRequest,Empty,Struct> restoreAgentOperationCallable()
Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
OperationFuture<Empty, Struct> future = agentsClient.restoreAgentOperationCallable().futureCall(request);
// Do something
future.get();
}
public final UnaryCallable<com.google.cloud.dialogflow.v2beta1.RestoreAgentRequest,Operation> restoreAgentCallable()
Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Sample code:
try (AgentsClient agentsClient = AgentsClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
RestoreAgentRequest request = RestoreAgentRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<Operation> future = agentsClient.restoreAgentCallable().futureCall(request);
// Do something
future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.