in retail/interactive-tutorial/RetailProducts.Samples/ImportProductsInlineSourceSample.cs [33:122]
public static List<Product> GetProducts()
{
var products = new List<Product>();
// First product data generation:
var priceInfo1 = new PriceInfo
{
Price = 16.0f,
OriginalPrice = 45.0f,
Cost = 12.0f,
CurrencyCode = "USD"
};
var colorInfo1 = new ColorInfo
{
ColorFamilies = { "Blue" },
Colors = { "Light blue", "Blue", "Dark blue" }
};
var fulfillmentInfo1 = new FulfillmentInfo
{
Type = "pickup-in-store",
PlaceIds = { "store1", "store2" },
};
var fieldMask1 = new FieldMask
{
Paths = { "title", "categories", "price_info", "color_info" }
};
// To check error handling comment out the product title here:
var product1 = new Product
{
Title = "#IamRemarkable Pen",
Id = Guid.NewGuid().ToString("N").Substring(0, 14),
Uri = "https://shop.googlemerchandisestore.com/Google+Redesign/Office/IamRemarkable+Pen",
PriceInfo = priceInfo1,
ColorInfo = colorInfo1,
RetrievableFields = fieldMask1,
Categories = { "Office" },
Brands = { "#IamRemarkable" },
FulfillmentInfo = { fulfillmentInfo1 }
};
// Second product data generation:
var priceInfo2 = new PriceInfo
{
Price = 35.0f,
OriginalPrice = 45.0f,
Cost = 12.0f,
CurrencyCode = "USD"
};
var colorInfo2 = new ColorInfo
{
ColorFamilies = { "Blue" },
Colors = { "Sky blue" }
};
var fulfillmentInfo2 = new FulfillmentInfo
{
Type = "pickup-in-store",
PlaceIds = { "store2", "store3" }
};
var fieldMask2 = new FieldMask
{
Paths = { "title", "categories", "price_info", "color_info" }
};
// To check error handling comment out the product title here:
var product2 = new Product
{
Title = "Android Embroidered Crewneck Sweater",
Id = Guid.NewGuid().ToString("N").Substring(0, 14),
Uri = "https://shop.googlemerchandisestore.com/Google+Redesign/Apparel/Android+Embroidered+Crewneck+Sweater",
PriceInfo = priceInfo2,
ColorInfo = colorInfo2,
RetrievableFields = fieldMask2,
Categories = { "Apparel" },
Brands= { "Android" },
FulfillmentInfo = { fulfillmentInfo2 }
};
products.Add(product1);
products.Add(product2);
return products;
}