Search in sources :

Example 1 with FulfillmentInfo

use of com.google.cloud.retail.v2.FulfillmentInfo in project java-retail by googleapis.

the class ImportProductsInlineSource method getProducts.

public static List<Product> getProducts() {
    List<Product> products = new ArrayList<>();
    Product product1;
    Product product2;
    float price1 = 16f;
    float originalPrice1 = 45.0f;
    float cost1 = 12.0f;
    PriceInfo priceInfo1 = PriceInfo.newBuilder().setPrice(price1).setOriginalPrice(originalPrice1).setCost(cost1).setCurrencyCode("USD").build();
    ColorInfo colorInfo1 = ColorInfo.newBuilder().addColorFamilies("Blue").addAllColors(Arrays.asList("Light blue", "Blue", "Dark blue")).build();
    FulfillmentInfo fulfillmentInfo1 = FulfillmentInfo.newBuilder().setType("pickup-in-store").addAllPlaceIds(Arrays.asList("store1", "store2")).build();
    FieldMask fieldMask1 = FieldMask.newBuilder().addAllPaths(Arrays.asList("title", "categories", "price_info", "color_info")).build();
    // TO CHECK ERROR HANDLING COMMENT OUT THE PRODUCT TITLE HERE:
    product1 = Product.newBuilder().setTitle("#IamRemarkable Pen").setId(UUID.randomUUID().toString()).addAllCategories(Collections.singletonList("Office")).setUri("https://shop.googlemerchandisestore.com/Google+Redesign/" + "Office/IamRemarkable+Pen").addBrands("#IamRemarkable").setPriceInfo(priceInfo1).setColorInfo(colorInfo1).addFulfillmentInfo(fulfillmentInfo1).setRetrievableFields(fieldMask1).build();
    float price2 = 35f;
    float originalPrice2 = 45.0f;
    float cost2 = 12.0f;
    PriceInfo priceInfo2 = PriceInfo.newBuilder().setPrice(price2).setOriginalPrice(originalPrice2).setCost(cost2).setCurrencyCode("USD").build();
    ColorInfo colorInfo2 = ColorInfo.newBuilder().addColorFamilies("Blue").addAllColors(Collections.singletonList("Sky blue")).build();
    FulfillmentInfo fulfillmentInfo2 = FulfillmentInfo.newBuilder().setType("pickup-in-store").addAllPlaceIds(Arrays.asList("store2", "store3")).build();
    FieldMask fieldMask2 = FieldMask.newBuilder().addAllPaths(Arrays.asList("title", "categories", "price_info", "color_info")).build();
    product2 = Product.newBuilder().setTitle("Android Embroidered Crewneck Sweater").setId(UUID.randomUUID().toString()).addCategories("Apparel").setUri("https://shop.googlemerchandisestore.com/Google+Redesign/" + "Apparel/Android+Embroidered+Crewneck+Sweater").addBrands("Android").setPriceInfo(priceInfo2).setColorInfo(colorInfo2).addFulfillmentInfo(fulfillmentInfo2).setRetrievableFields(fieldMask2).build();
    products.add(product1);
    products.add(product2);
    return products;
}
Also used : ArrayList(java.util.ArrayList) Product(com.google.cloud.retail.v2.Product) ColorInfo(com.google.cloud.retail.v2.ColorInfo) FulfillmentInfo(com.google.cloud.retail.v2.FulfillmentInfo) FieldMask(com.google.protobuf.FieldMask) PriceInfo(com.google.cloud.retail.v2.PriceInfo)

Example 2 with FulfillmentInfo

use of com.google.cloud.retail.v2.FulfillmentInfo in project java-retail by googleapis.

the class SetInventory method getProductWithInventoryInfo.

public static Product getProductWithInventoryInfo(String productName) {
    float price = 15.0f;
    float originalPrice = 20.0f;
    float cost = 8.0f;
    PriceInfo priceInfo = PriceInfo.newBuilder().setPrice(price).setOriginalPrice(originalPrice).setCost(cost).setCurrencyCode("USD").build();
    FulfillmentInfo fulfillmentInfo = FulfillmentInfo.newBuilder().setType("pickup-in-store").addAllPlaceIds(Arrays.asList("store1", "store2")).build();
    return Product.newBuilder().setName(productName).setPriceInfo(priceInfo).addFulfillmentInfo(fulfillmentInfo).setAvailability(Availability.IN_STOCK).setAvailableQuantity(Int32Value.newBuilder().setValue(5).build()).build();
}
Also used : FulfillmentInfo(com.google.cloud.retail.v2.FulfillmentInfo) PriceInfo(com.google.cloud.retail.v2.PriceInfo)

Example 3 with FulfillmentInfo

use of com.google.cloud.retail.v2.FulfillmentInfo in project java-retail by googleapis.

the class SetupCleanup method generateProduct.

public static Product generateProduct() {
    float price = 30.0f;
    float originalPrice = 35.5f;
    PriceInfo priceInfo = PriceInfo.newBuilder().setPrice(price).setOriginalPrice(originalPrice).setCurrencyCode("USD").build();
    FulfillmentInfo fulfillmentInfo = FulfillmentInfo.newBuilder().setType("pickup-in-store").addAllPlaceIds(Arrays.asList("store0", "store1")).build();
    return Product.newBuilder().setTitle("Nest Mini").setType(Type.PRIMARY).addCategories("Speakers and displays").addBrands("Google").setPriceInfo(priceInfo).setAvailability(Availability.IN_STOCK).addFulfillmentInfo(fulfillmentInfo).build();
}
Also used : FulfillmentInfo(com.google.cloud.retail.v2.FulfillmentInfo) PriceInfo(com.google.cloud.retail.v2.PriceInfo)

Aggregations

FulfillmentInfo (com.google.cloud.retail.v2.FulfillmentInfo)3 PriceInfo (com.google.cloud.retail.v2.PriceInfo)3 ColorInfo (com.google.cloud.retail.v2.ColorInfo)1 Product (com.google.cloud.retail.v2.Product)1 FieldMask (com.google.protobuf.FieldMask)1 ArrayList (java.util.ArrayList)1