public sealed class Product : IMessage<Product>, IEquatable<Product>, IDeepCloneable<Product>, IBufferMessage, IMessage
Product captures all metadata information of items to be recommended or searched.
Implements
IMessage<Product>, IEquatable<Product>, IDeepCloneable<Product>, IBufferMessage, IMessageNamespace
Google.Cloud.Retail.V2Assembly
Google.Cloud.Retail.V2.dll
Constructors
Product()
public Product()
Product(Product)
public Product(Product other)
Parameter | |
---|---|
Name | Description |
other | Product |
Properties
Attributes
public MapField<string, CustomAttribute> Attributes { get; }
Highly encouraged. Extra product attributes to be included. For example, for products, this could include the store name, vendor, style, color, etc. These are very strong signals for recommendation model, thus we highly recommend providing the attributes here.
Features that can take on one of a limited number of possible values. Two types of features can be set are:
Textual features. some examples would be the brand/maker of a product, or country of a customer. Numerical features. Some examples would be the height/weight of a product, or age of a customer.
For example: { "vendor": {"text": ["vendor123", "vendor456"]},
"lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
}
.
This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT error is returned:
- Max entries count: 200.
- The key must be a UTF-8 encoded string with a length limit of 128 characters.
- For indexable attribute, the key must match the pattern: [a-zA-Z0-9][a-zA-Z0-9_]*. For example, key0LikeThis or KEY_1_LIKE_THIS.
Property Value | |
---|---|
Type | Description |
MapField<String, CustomAttribute> |
Audience
public Audience Audience { get; set; }
The target group associated with a given audience (e.g. male, veterans, car owners, musicians, etc.) of the product.
Property Value | |
---|---|
Type | Description |
Audience |
Availability
public Product.Types.Availability Availability { get; set; }
The online availability of the [Product][google.cloud.retail.v2.Product]. Default to [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
Google Merchant Center Property availability. Schema.org Property Offer.availability.
Property Value | |
---|---|
Type | Description |
Product.Types.Availability |
AvailableQuantity
public int? AvailableQuantity { get; set; }
The available quantity of the item.
Property Value | |
---|---|
Type | Description |
Nullable<Int32> |
AvailableTime
public Timestamp AvailableTime { get; set; }
The timestamp when this [Product][google.cloud.retail.v2.Product] becomes available for [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
Property Value | |
---|---|
Type | Description |
Timestamp |
Brands
public RepeatedField<string> Brands { get; }
The brands of the product.
A maximum of 30 brands are allowed. Each brand must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property brand. Schema.org property Product.brand.
Property Value | |
---|---|
Type | Description |
RepeatedField<String> |
Categories
public RepeatedField<string> Categories { get; }
Product categories. This field is repeated for supporting one product belonging to several parallel categories. Strongly recommended using the full path for better search / recommendation quality.
To represent full path of category, use '>' sign to separate different hierarchies. If '>' is part of the category name, please replace it with other character(s).
For example, if a shoes product belongs to both ["Shoes & Accessories" -> "Shoes"] and ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be represented as:
"categories": [ "Shoes & Accessories > Shoes", "Sports & Fitness > Athletic Clothing > Shoes" ]
Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT error is returned.
At most 250 values are allowed per [Product][google.cloud.retail.v2.Product]. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property [google_product_category][mc_google_product_category]. Schema.org property Product.category.
[mc_google_product_category]: https://support.google.com/merchants/answer/6324436
Property Value | |
---|---|
Type | Description |
RepeatedField<String> |
CollectionMemberIds
public RepeatedField<string> CollectionMemberIds { get; }
The [id][google.cloud.retail.v2.Product.id] of the collection members when [type][google.cloud.retail.v2.Product.type] is [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION].
Should not set it for other types. A maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is return.
Property Value | |
---|---|
Type | Description |
RepeatedField<String> |
ColorInfo
public ColorInfo ColorInfo { get; set; }
The color of the product.
Google Merchant Center property color. Schema.org property Product.color.
Property Value | |
---|---|
Type | Description |
ColorInfo |
Conditions
public RepeatedField<string> Conditions { get; }
The condition of the product. Strongly encouraged to use the standard values: "new", "refurbished", "used".
A maximum of 5 values are allowed per [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property condition. Schema.org property Offer.itemCondition.
Property Value | |
---|---|
Type | Description |
RepeatedField<String> |
Description
public string Description { get; set; }
Product description.
This field must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property description. schema.org property Product.description.
Property Value | |
---|---|
Type | Description |
String |
ExpirationCase
public Product.ExpirationOneofCase ExpirationCase { get; }
Property Value | |
---|---|
Type | Description |
Product.ExpirationOneofCase |
ExpireTime
public Timestamp ExpireTime { get; set; }
The timestamp when this product becomes unavailable for [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
If it is set, the [Product][google.cloud.retail.v2.Product] is not available for [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after [expire_time][google.cloud.retail.v2.Product.expire_time]. However, the product can still be retrieved by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] and [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
[expire_time][google.cloud.retail.v2.Product.expire_time] must be later than [available_time][google.cloud.retail.v2.Product.available_time] and [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an INVALID_ARGUMENT error is thrown.
Google Merchant Center property expiration_date.
Property Value | |
---|---|
Type | Description |
Timestamp |
FulfillmentInfo
public RepeatedField<FulfillmentInfo> FulfillmentInfo { get; }
Fulfillment information, such as the store IDs for in-store pickup or region IDs for different shipping methods.
All the elements must have distinct [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]. Otherwise, an INVALID_ARGUMENT error is returned.
Property Value | |
---|---|
Type | Description |
RepeatedField<FulfillmentInfo> |
Gtin
public string Gtin { get; set; }
The Global Trade Item Number (GTIN) of the product.
This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property gtin. Schema.org property Product.isbn or Product.gtin8 or Product.gtin12 or Product.gtin13 or Product.gtin14.
If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.
Property Value | |
---|---|
Type | Description |
String |
Id
public string Id { get; set; }
Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
the final component of [name][google.cloud.retail.v2.Product.name]. For
example, this field is "id_1", if
[name][google.cloud.retail.v2.Product.name] is
projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1
.
This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property id. Schema.org Property Product.sku.
Property Value | |
---|---|
Type | Description |
String |
Images
public RepeatedField<Image> Images { get; }
Product images for the product.Highly recommended to put the main image to the first.
A maximum of 300 images are allowed.
Google Merchant Center property image_link. Schema.org property Product.image.
Property Value | |
---|---|
Type | Description |
RepeatedField<Image> |
LanguageCode
public string LanguageCode { get; set; }
Language of the title/description and other string attributes. Use language tags defined by [BCP 47][https://www.rfc-editor.org/rfc/bcp/bcp47.txt].
For product prediction, this field is ignored and the model automatically detects the text language. The [Product][google.cloud.retail.v2.Product] can include text in different languages, but duplicating [Product][google.cloud.retail.v2.Product]s to provide text in multiple languages can result in degraded model performance.
For product search this field is in use. It defaults to "en-US" if unset.
Property Value | |
---|---|
Type | Description |
String |
Materials
public RepeatedField<string> Materials { get; }
The material of the product. For example, "leather", "wooden".
A maximum of 20 values are allowed. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property material. Schema.org property Product.material.
Property Value | |
---|---|
Type | Description |
RepeatedField<String> |
Name
public string Name { get; set; }
Immutable. Full resource name of the product, such as
projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id
.
Property Value | |
---|---|
Type | Description |
String |
Patterns
public RepeatedField<string> Patterns { get; }
The pattern or graphic print of the product. For example, "striped", "polka dot", "paisley".
A maximum of 20 values are allowed per [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property pattern. Schema.org property Product.pattern.
Property Value | |
---|---|
Type | Description |
RepeatedField<String> |
PriceInfo
public PriceInfo PriceInfo { get; set; }
Product price and cost information.
Google Merchant Center property price.
Property Value | |
---|---|
Type | Description |
PriceInfo |
PrimaryProductId
public string PrimaryProductId { get; set; }
Variant group identifier. Must be an [id][google.cloud.retail.v2.Product.id], with the same parent branch with this product. Otherwise, an error is thrown.
For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] [Product][google.cloud.retail.v2.Product]s, this field can only be empty or set to the same value as [id][google.cloud.retail.v2.Product.id].
For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot be empty. A maximum of 2,000 products are allowed to share the same [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center Property item_group_id. Schema.org Property Product.inProductGroupWithID.
This field must be enabled before it can be used. Learn more.
Property Value | |
---|---|
Type | Description |
String |
ProductName
public ProductName ProductName { get; set; }
ProductName-typed view over the Name resource name property.
Property Value | |
---|---|
Type | Description |
ProductName |
Promotions
public RepeatedField<Promotion> Promotions { get; }
The promotions applied to the product. A maximum of 10 values are allowed per [Product][google.cloud.retail.v2.Product].
Property Value | |
---|---|
Type | Description |
RepeatedField<Promotion> |
PublishTime
public Timestamp PublishTime { get; set; }
The timestamp when the product is published by the retailer for the first time, which indicates the freshness of the products. Note that this field is different from [available_time][google.cloud.retail.v2.Product.available_time], given it purely describes product freshness regardless of when it is available on search and recommendation.
Property Value | |
---|---|
Type | Description |
Timestamp |
Rating
public Rating Rating { get; set; }
The rating of this product.
Property Value | |
---|---|
Type | Description |
Rating |
RetrievableFields
public FieldMask RetrievableFields { get; set; }
Indicates which fields in the [Product][google.cloud.retail.v2.Product]s are returned in [SearchResponse][google.cloud.retail.v2.SearchResponse].
Supported fields for all [type][google.cloud.retail.v2.Product.type]s:
- [audience][google.cloud.retail.v2.Product.audience]
- [availability][google.cloud.retail.v2.Product.availability]
- [brands][google.cloud.retail.v2.Product.brands]
- [color_info][google.cloud.retail.v2.Product.color_info]
- [conditions][google.cloud.retail.v2.Product.conditions]
- [gtin][google.cloud.retail.v2.Product.gtin]
- [materials][google.cloud.retail.v2.Product.materials]
- [name][google.cloud.retail.v2.Product.name]
- [patterns][google.cloud.retail.v2.Product.patterns]
- [price_info][google.cloud.retail.v2.Product.price_info]
- [rating][google.cloud.retail.v2.Product.rating]
- [sizes][google.cloud.retail.v2.Product.sizes]
- [title][google.cloud.retail.v2.Product.title]
- [uri][google.cloud.retail.v2.Product.uri]
Supported fields only for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]:
- [categories][google.cloud.retail.v2.Product.categories]
- [description][google.cloud.retail.v2.Product.description]
- [images][google.cloud.retail.v2.Product.images]
Supported fields only for [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]:
- Only the first image in [images][google.cloud.retail.v2.Product.images]
To mark [attributes][google.cloud.retail.v2.Product.attributes] as retrievable, include paths of the form "attributes.key" where "key" is the key of a custom attribute, as specified in [attributes][google.cloud.retail.v2.Product.attributes].
For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], the following fields are always returned in [SearchResponse][google.cloud.retail.v2.SearchResponse] by default:
- [name][google.cloud.retail.v2.Product.name]
For [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT], the following fields are always returned in by default:
- [name][google.cloud.retail.v2.Product.name]
- [color_info][google.cloud.retail.v2.Product.color_info]
Maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is returned.
Note: Returning more fields in [SearchResponse][google.cloud.retail.v2.SearchResponse] may increase response payload size and serving latency.
Property Value | |
---|---|
Type | Description |
FieldMask |
Sizes
public RepeatedField<string> Sizes { get; }
The size of the product. To represent different size systems or size types, consider using this format: [[[size_system:]size_type:]size_value].
For example, in "US:MENS:M", "US" represents size system; "MENS" represents size type; "M" represents size value. In "GIRLS:27", size system is empty; "GIRLS" represents size type; "27" represents size value. In "32 inches", both size system and size type are empty, while size value is "32 inches".
A maximum of 20 values are allowed per [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property size, size_type and size_system. Schema.org property Product.size.
Property Value | |
---|---|
Type | Description |
RepeatedField<String> |
Tags
public RepeatedField<string> Tags { get; }
Custom tags associated with the product.
At most 250 values are allowed per [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.
This tag can be used for filtering recommendation results by passing the tag as part of the [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
Google Merchant Center property custom_label_0–4.
Property Value | |
---|---|
Type | Description |
RepeatedField<String> |
Title
public string Title { get; set; }
Required. Product title.
This field must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property title. Schema.org property Product.name.
Property Value | |
---|---|
Type | Description |
String |
Ttl
public Duration Ttl { get; set; }
Input only. The TTL (time to live) of the product.
If it is set, it must be a non-negative value, and [expire_time][google.cloud.retail.v2.Product.expire_time] is set as current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. The derived [expire_time][google.cloud.retail.v2.Product.expire_time] is returned in the output and [ttl][google.cloud.retail.v2.Product.ttl] is left blank when retrieving the [Product][google.cloud.retail.v2.Product].
If it is set, the product is not available for [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. However, the product can still be retrieved by [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] and [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
Property Value | |
---|---|
Type | Description |
Duration |
Type
public Product.Types.Type Type { get; set; }
Immutable. The type of the product. Default to [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type] if unset.
Property Value | |
---|---|
Type | Description |
Product.Types.Type |
Uri
public string Uri { get; set; }
Canonical URL directly linking to the product detail page.
It is strongly recommended to provide a valid uri for the product, otherwise the service performance could be significantly degraded.
This field must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.
Google Merchant Center property link. Schema.org property Offer.url.
Property Value | |
---|---|
Type | Description |
String |
Variants
public RepeatedField<Product> Variants { get; }
Output only. Product variants grouped together on primary product which share similar product attributes. It's automatically grouped by [primary_product_id][google.cloud.retail.v2.Product.primary_product_id] for all the product variants. Only populated for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] [Product][google.cloud.retail.v2.Product]s.
Note: This field is OUTPUT_ONLY for [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]. Do not set this field in API requests.
Property Value | |
---|---|
Type | Description |
RepeatedField<Product> |