use of com.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest in project java-retail by googleapis.
the class RemoveFulfillmentPlaces method removeFulfillmentPlaces.
// remove fulfillment places to product
public static void removeFulfillmentPlaces(String productName, Timestamp timestamp, String storeId) throws IOException, InterruptedException {
RemoveFulfillmentPlacesRequest removeFulfillmentRequest = getRemoveFulfillmentRequest(productName, timestamp, storeId);
try (ProductServiceClient serviceClient = ProductServiceClient.create()) {
serviceClient.removeFulfillmentPlacesAsync(removeFulfillmentRequest);
/*
This is a long-running operation and its result is not immediately
present with get operations,thus we simulate wait with sleep method.
*/
System.out.println("Remove fulfillment places, wait 30 seconds.");
Thread.sleep(30_000);
}
}
use of com.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest in project java-retail by googleapis.
the class RemoveFulfillmentPlaces method getRemoveFulfillmentRequest.
// remove fulfillment request
public static RemoveFulfillmentPlacesRequest getRemoveFulfillmentRequest(String productName, Timestamp timestamp, String storeId) {
RemoveFulfillmentPlacesRequest removeFulfillmentRequest = RemoveFulfillmentPlacesRequest.newBuilder().setProduct(productName).setType("pickup-in-store").addPlaceIds(storeId).setRemoveTime(timestamp).setAllowMissing(true).build();
System.out.println("Remove fulfillment request " + removeFulfillmentRequest);
return removeFulfillmentRequest;
}
Aggregations