use of com.google.cloud.retail.v2.PurgeMetadata in project java-retail by googleapis.
the class SetupCleanup method purgeUserEvent.
public static void purgeUserEvent(String visitorId) throws IOException, ExecutionException, InterruptedException {
// the "close" method on the client to safely clean up any remaining background resources.
try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
PurgeUserEventsRequest purgeUserEventsRequest = PurgeUserEventsRequest.newBuilder().setFilter(String.format("visitorId=\"%s\"", visitorId)).setParent(DEFAULT_CATALOG).setForce(true).build();
OperationFuture<PurgeUserEventsResponse, PurgeMetadata> purgeOperation = userEventServiceClient.purgeUserEventsAsync(purgeUserEventsRequest);
System.out.printf("The purge operation was started: %s%n", purgeOperation.getName());
}
}
use of com.google.cloud.retail.v2.PurgeMetadata in project java-retail by googleapis.
the class PurgeUserEvent method callPurgeUserEvents.
public static void callPurgeUserEvents(String defaultCatalog, String visitorId) throws IOException, ExecutionException, InterruptedException {
writeUserEvent(visitorId);
// the "close" method on the client to safely clean up any remaining background resources.
try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
PurgeUserEventsRequest purgeUserEventsRequest = PurgeUserEventsRequest.newBuilder().setFilter(String.format("visitorId=\"%s\"", visitorId)).setParent(defaultCatalog).setForce(true).build();
System.out.printf("Purge user events request: %s%n", purgeUserEventsRequest);
OperationFuture<PurgeUserEventsResponse, PurgeMetadata> purgeOperation = userEventServiceClient.purgeUserEventsAsync(purgeUserEventsRequest);
System.out.printf("The purge operation was started: %s%n", purgeOperation.getName());
}
}
Aggregations