Struct google_api_proto::google::cloud::retail::v2::Product

source ·
pub struct Product {
Show 33 fields pub name: String, pub id: String, pub type: i32, pub primary_product_id: String, pub collection_member_ids: Vec<String>, pub gtin: String, pub categories: Vec<String>, pub title: String, pub brands: Vec<String>, pub description: String, pub language_code: String, pub attributes: BTreeMap<String, CustomAttribute>, pub tags: Vec<String>, pub price_info: Option<PriceInfo>, pub rating: Option<Rating>, pub available_time: Option<Timestamp>, pub availability: i32, pub available_quantity: Option<i32>, pub fulfillment_info: Vec<FulfillmentInfo>, pub uri: String, pub images: Vec<Image>, pub audience: Option<Audience>, pub color_info: Option<ColorInfo>, pub sizes: Vec<String>, pub materials: Vec<String>, pub patterns: Vec<String>, pub conditions: Vec<String>, pub promotions: Vec<Promotion>, pub publish_time: Option<Timestamp>, pub retrievable_fields: Option<FieldMask>, pub variants: Vec<Product>, pub local_inventories: Vec<LocalInventory>, pub expiration: Option<Expiration>,
}
Expand description

Product captures all metadata information of items to be recommended or searched.

Fields§

§name: String

Immutable. Full resource name of the product, such as projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id.

§id: String

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.

Corresponding properties: Google Merchant Center property id. Schema.org property Product.sku.

§type: i32

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.

§primary_product_id: String

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.

Corresponding properties: Google Merchant Center property item_group_id. Schema.org property Product.inProductGroupWithID.

§collection_member_ids: Vec<String>

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].

Non-existent product ids are allowed. The [type][google.cloud.retail.v2.Product.type] of the members must be either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an INVALID_ARGUMENT error is thrown. Should not set it for other types. A maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is return.

§gtin: String

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.

Corresponding properties: Google Merchant Center property gtin. Schema.org property Product.isbn, Product.gtin8, Product.gtin12, Product.gtin13, or Product.gtin14.

If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.

§categories: Vec<String>

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, 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] unless overridden through the Google Cloud console. 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.

Corresponding properties: Google Merchant Center property [google_product_category][mc_google_product_category]. Schema.org property [Product.category] (https://schema.org/category).

[mc_google_product_category]: https://support.google.com/merchants/answer/6324436

§title: String

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.

Corresponding properties: Google Merchant Center property title. Schema.org property Product.name.

§brands: Vec<String>

The brands of the product.

A maximum of 30 brands are allowed unless overridden through the Google Cloud console. Each brand must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property brand. Schema.org property Product.brand.

§description: String

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.

Corresponding properties: Google Merchant Center property description. Schema.org property Product.description.

§language_code: String

Language of the title/description and other string attributes. Use language tags defined by BCP 47.

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.

§attributes: BTreeMap<String, CustomAttribute>

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.
  • For text attributes, at most 400 values are allowed. Empty values are not allowed. Each value must be a non-empty UTF-8 encoded string with a length limit of 256 characters.
  • For number attributes, at most 400 values are allowed.
§tags: Vec<String>

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].

Corresponding properties: Google Merchant Center property custom_label_0–4.

§price_info: Option<PriceInfo>

Product price and cost information.

Corresponding properties: Google Merchant Center property price.

§rating: Option<Rating>

The rating of this product.

§available_time: Option<Timestamp>

The timestamp when this [Product][google.cloud.retail.v2.Product] becomes available for [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. Note that this is only applicable to [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], and ignored for [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT].

§availability: i32

The online availability of the [Product][google.cloud.retail.v2.Product]. Default to [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].

Corresponding properties: Google Merchant Center property availability. Schema.org property Offer.availability.

§available_quantity: Option<i32>

The available quantity of the item.

§fulfillment_info: Vec<FulfillmentInfo>

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.

§uri: String

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.

Corresponding properties: Google Merchant Center property link. Schema.org property Offer.url.

§images: Vec<Image>

Product images for the product. We highly recommend putting the main image first.

A maximum of 300 images are allowed.

Corresponding properties: Google Merchant Center property image_link. Schema.org property Product.image.

§audience: Option<Audience>

The target group associated with a given audience (e.g. male, veterans, car owners, musicians, etc.) of the product.

§color_info: Option<ColorInfo>

The color of the product.

Corresponding properties: Google Merchant Center property color. Schema.org property Product.color.

§sizes: Vec<String>

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.

Corresponding properties: Google Merchant Center property size, size_type, and size_system. Schema.org property Product.size.

§materials: Vec<String>

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 200 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Corresponding properties: Google Merchant Center property material. Schema.org property Product.material.

§patterns: Vec<String>

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.

Corresponding properties: Google Merchant Center property pattern. Schema.org property Product.pattern.

§conditions: Vec<String>

The condition of the product. Strongly encouraged to use the standard values: “new”, “refurbished”, “used”.

A maximum of 1 value is 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.

Corresponding properties: Google Merchant Center property condition. Schema.org property Offer.itemCondition.

§promotions: Vec<Promotion>

The promotions applied to the product. A maximum of 10 values are allowed per [Product][google.cloud.retail.v2.Product]. Only [Promotion.promotion_id][google.cloud.retail.v2.Promotion.promotion_id] will be used, other fields will be ignored if set.

§publish_time: Option<Timestamp>

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.

§retrievable_fields: Option<FieldMask>
👎Deprecated

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]

The maximum number of paths is 30. Otherwise, an INVALID_ARGUMENT error is returned.

Note: Returning more fields in [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase response payload size and serving latency.

This field is deprecated. Use the retrievable site-wide control instead.

§variants: Vec<Product>

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.

§local_inventories: Vec<LocalInventory>

Output only. A list of local inventories specific to different places.

This field can be managed by [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] and [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] APIs if fine-grained, high-volume updates are necessary.

§expiration: Option<Expiration>

Implementations§

source§

impl Product

source

pub fn type(&self) -> Type

Returns the enum value of type, or the default if the field is set to an invalid enum value.

source

pub fn set_type(&mut self, value: Type)

Sets type to the provided enum value.

source

pub fn availability(&self) -> Availability

Returns the enum value of availability, or the default if the field is set to an invalid enum value.

source

pub fn set_availability(&mut self, value: Availability)

Sets availability to the provided enum value.

Trait Implementations§

source§

impl Clone for Product

source§

fn clone(&self) -> Product

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Product

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Product

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Message for Product

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for Product

source§

fn eq(&self, other: &Product) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Product

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more