use of com.google.cloud.retail.v2.ProductDetail in project java-retail by googleapis.
the class SetupCleanup method getUserEvent.
public static UserEvent getUserEvent(String visitorId) {
int value = 3;
Timestamp timestamp = Timestamp.newBuilder().setSeconds(Instant.now().getEpochSecond()).build();
Product product = Product.newBuilder().setId(UUID.randomUUID().toString()).build();
ProductDetail productDetail = ProductDetail.newBuilder().setProduct(product).setQuantity(Int32Value.newBuilder().setValue(value).build()).build();
UserEvent userEvent = UserEvent.newBuilder().setEventType("detail-page-view").setVisitorId(visitorId).setEventTime(timestamp).addAllProductDetails(Collections.singletonList(productDetail)).build();
System.out.println(userEvent);
return userEvent;
}
Aggregations