use of com.google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse in project java-dialogflow-cx by googleapis.
the class ITSystemTest method exportAgentTest.
@Test
public void exportAgentTest() throws ExecutionException, InterruptedException {
ExportAgentRequest request = ExportAgentRequest.newBuilder().setName(agentName).build();
ExportAgentResponse exportAgentResponse = agentsClient.exportAgentAsync(request).get();
assertNotNull(exportAgentResponse.getAgentContent());
assertTrue(exportAgentResponse.getAgentContent().toStringUtf8().contains(agentName));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse in project java-dialogflow-cx by googleapis.
the class ExportAgent method exportAgent.
public static void exportAgent(String projectId, String agentId, String location) throws IOException, InterruptedException, ExecutionException {
// Sets the api endpoint to specified location
String apiEndpoint = String.format("%s-dialogflow.googleapis.com:443", location);
AgentsSettings agentsSettings = AgentsSettings.newBuilder().setEndpoint(apiEndpoint).build();
try (AgentsClient agentsClient = AgentsClient.create(agentsSettings)) {
ExportAgentRequest request = ExportAgentRequest.newBuilder().setName(AgentName.of(projectId, location, agentId).toString()).build();
// Returns a future of the operation
OperationFuture<ExportAgentResponse, Struct> future = agentsClient.exportAgentOperationCallable().futureCall(request);
// get the export agent response after the operation is completed
ExportAgentResponse response = future.get();
System.out.println(response);
}
}
Aggregations