common.proto 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.retail.v2;
  16. import "google/api/annotations.proto";
  17. import "google/api/field_behavior.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option csharp_namespace = "Google.Cloud.Retail.V2";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "CommonProto";
  23. option java_package = "com.google.cloud.retail.v2";
  24. option objc_class_prefix = "RETAIL";
  25. option php_namespace = "Google\\Cloud\\Retail\\V2";
  26. option ruby_package = "Google::Cloud::Retail::V2";
  27. // An intended audience of the [Product][google.cloud.retail.v2.Product] for
  28. // whom it's sold.
  29. message Audience {
  30. // The genders of the audience. Strongly encouraged to use the standard
  31. // values: "male", "female", "unisex".
  32. //
  33. // At most 5 values are allowed. Each value must be a UTF-8 encoded string
  34. // with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
  35. // is returned.
  36. //
  37. // Google Merchant Center property
  38. // [gender](https://support.google.com/merchants/answer/6324479). Schema.org
  39. // property
  40. // [Product.audience.suggestedGender](https://schema.org/suggestedGender).
  41. repeated string genders = 1;
  42. // The age groups of the audience. Strongly encouraged to use the standard
  43. // values: "newborn" (up to 3 months old), "infant" (3–12 months old),
  44. // "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically
  45. // teens or older).
  46. //
  47. // At most 5 values are allowed. Each value must be a UTF-8 encoded string
  48. // with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
  49. // is returned.
  50. //
  51. // Google Merchant Center property
  52. // [age_group](https://support.google.com/merchants/answer/6324463).
  53. // Schema.org property
  54. // [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and
  55. // [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge).
  56. repeated string age_groups = 2;
  57. }
  58. // The color information of a [Product][google.cloud.retail.v2.Product].
  59. message ColorInfo {
  60. // The standard color families. Strongly recommended to use the following
  61. // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
  62. // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and
  63. // "Mixed". Normally it is expected to have only 1 color family. May consider
  64. // using single "Mixed" instead of multiple values.
  65. //
  66. // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
  67. // string with a length limit of 128 characters. Otherwise, an
  68. // INVALID_ARGUMENT error is returned.
  69. //
  70. // Google Merchant Center property
  71. // [color](https://support.google.com/merchants/answer/6324487). Schema.org
  72. // property [Product.color](https://schema.org/color).
  73. repeated string color_families = 1;
  74. // The color display names, which may be different from standard color family
  75. // names, such as the color aliases used in the website frontend. Normally
  76. // it is expected to have only 1 color. May consider using single "Mixed"
  77. // instead of multiple values.
  78. //
  79. // A maximum of 5 colors are allowed. Each value must be a UTF-8 encoded
  80. // string with a length limit of 128 characters. Otherwise, an
  81. // INVALID_ARGUMENT error is returned.
  82. //
  83. // Google Merchant Center property
  84. // [color](https://support.google.com/merchants/answer/6324487). Schema.org
  85. // property [Product.color](https://schema.org/color).
  86. repeated string colors = 2;
  87. }
  88. // A custom attribute that is not explicitly modeled in
  89. // [Product][google.cloud.retail.v2.Product].
  90. message CustomAttribute {
  91. // The textual values of this custom attribute. For example, `["yellow",
  92. // "green"]` when the key is "color".
  93. //
  94. // At most 400 values are allowed. Empty values are not allowed. Each value
  95. // must be a UTF-8 encoded string with a length limit of 256 characters.
  96. // Otherwise, an INVALID_ARGUMENT error is returned.
  97. //
  98. // Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
  99. // [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
  100. // Otherwise, an INVALID_ARGUMENT error is returned.
  101. repeated string text = 1;
  102. // The numerical values of this custom attribute. For example, `[2.3, 15.4]`
  103. // when the key is "lengths_cm".
  104. //
  105. // At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is
  106. // returned.
  107. //
  108. // Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
  109. // [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
  110. // Otherwise, an INVALID_ARGUMENT error is returned.
  111. repeated double numbers = 2;
  112. // If true, custom attribute values are searchable by text queries in
  113. // [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
  114. //
  115. // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
  116. //
  117. // Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is
  118. // set. Otherwise, a INVALID_ARGUMENT error is returned.
  119. optional bool searchable = 3;
  120. // If true, custom attribute values are indexed, so that it can be filtered,
  121. // faceted or boosted in
  122. // [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
  123. //
  124. // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
  125. //
  126. // See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],
  127. // [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
  128. // and
  129. // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
  130. // for more details.
  131. optional bool indexable = 4;
  132. }
  133. // Fulfillment information, such as the store IDs for in-store pickup or region
  134. // IDs for different shipping methods.
  135. message FulfillmentInfo {
  136. // The fulfillment type, including commonly used types (such as pickup in
  137. // store and same day delivery), and custom types. Customers have to map
  138. // custom types to their display names before rendering UI.
  139. //
  140. // Supported values:
  141. //
  142. // * "pickup-in-store"
  143. // * "ship-to-store"
  144. // * "same-day-delivery"
  145. // * "next-day-delivery"
  146. // * "custom-type-1"
  147. // * "custom-type-2"
  148. // * "custom-type-3"
  149. // * "custom-type-4"
  150. // * "custom-type-5"
  151. //
  152. // If this field is set to an invalid value other than these, an
  153. // INVALID_ARGUMENT error is returned.
  154. string type = 1;
  155. // The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such
  156. // as the store IDs for
  157. // [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type]
  158. // or the region IDs for
  159. // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
  160. //
  161. // A maximum of 2000 values are allowed. Each value must be a string with a
  162. // length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as
  163. // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned.
  164. repeated string place_ids = 2;
  165. }
  166. // [Product][google.cloud.retail.v2.Product] thumbnail/detail image.
  167. message Image {
  168. // Required. URI of the image.
  169. //
  170. // This field must be a valid UTF-8 encoded URI with a length limit of 5,000
  171. // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  172. //
  173. // Google Merchant Center property
  174. // [image_link](https://support.google.com/merchants/answer/6324350).
  175. // Schema.org property [Product.image](https://schema.org/image).
  176. string uri = 1 [(google.api.field_behavior) = REQUIRED];
  177. // Height of the image in number of pixels.
  178. //
  179. // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
  180. // returned.
  181. int32 height = 2;
  182. // Width of the image in number of pixels.
  183. //
  184. // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
  185. // returned.
  186. int32 width = 3;
  187. }
  188. // A floating point interval.
  189. message Interval {
  190. // The lower bound of the interval. If neither of the min fields are set, then
  191. // the lower bound is negative infinity.
  192. //
  193. // This field must be not larger than
  194. // [max][google.cloud.retail.v2.Interval.max]. Otherwise, an INVALID_ARGUMENT
  195. // error is returned.
  196. oneof min {
  197. // Inclusive lower bound.
  198. double minimum = 1;
  199. // Exclusive lower bound.
  200. double exclusive_minimum = 2;
  201. }
  202. // The upper bound of the interval. If neither of the max fields are set, then
  203. // the upper bound is positive infinity.
  204. //
  205. // This field must be not smaller than
  206. // [min][google.cloud.retail.v2.Interval.min]. Otherwise, an INVALID_ARGUMENT
  207. // error is returned.
  208. oneof max {
  209. // Inclusive upper bound.
  210. double maximum = 3;
  211. // Exclusive upper bound.
  212. double exclusive_maximum = 4;
  213. }
  214. }
  215. // The price information of a [Product][google.cloud.retail.v2.Product].
  216. message PriceInfo {
  217. // The price range of all
  218. // [variant][google.cloud.retail.v2.Product.Type.VARIANT]
  219. // [Product][google.cloud.retail.v2.Product] having the same
  220. // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
  221. message PriceRange {
  222. // The inclusive
  223. // [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price]
  224. // interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
  225. // [Product][google.cloud.retail.v2.Product] having the same
  226. // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
  227. Interval price = 1;
  228. // The inclusive
  229. // [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price]
  230. // internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
  231. // [Product][google.cloud.retail.v2.Product] having the same
  232. // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
  233. Interval original_price = 2;
  234. }
  235. // The 3-letter currency code defined in [ISO
  236. // 4217](https://www.iso.org/iso-4217-currency-codes.html).
  237. //
  238. // If this field is an unrecognizable currency code, an INVALID_ARGUMENT
  239. // error is returned.
  240. //
  241. // The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
  242. // [Product][google.cloud.retail.v2.Product]s with the same
  243. // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
  244. // must share the same
  245. // [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise,
  246. // a FAILED_PRECONDITION error is returned.
  247. string currency_code = 1;
  248. // Price of the product.
  249. //
  250. // Google Merchant Center property
  251. // [price](https://support.google.com/merchants/answer/6324371). Schema.org
  252. // property [Offer.priceSpecification](https://schema.org/priceSpecification).
  253. float price = 2;
  254. // Price of the product without any discount. If zero, by default set to be
  255. // the [price][google.cloud.retail.v2.PriceInfo.price].
  256. float original_price = 3;
  257. // The costs associated with the sale of a particular product. Used for gross
  258. // profit reporting.
  259. //
  260. // * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
  261. // [cost][google.cloud.retail.v2.PriceInfo.cost]
  262. //
  263. // Google Merchant Center property
  264. // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
  265. float cost = 4;
  266. // The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
  267. // starts to be effective. This can be set as a future timestamp, and the
  268. // [price][google.cloud.retail.v2.PriceInfo.price] is only used for search
  269. // after
  270. // [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
  271. // If so, the
  272. // [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
  273. // set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
  274. // is used before
  275. // [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
  276. //
  277. // Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
  278. // effective because it will cause additional latency during search.
  279. google.protobuf.Timestamp price_effective_time = 5;
  280. // The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
  281. // stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price]
  282. // is used for search before
  283. // [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If
  284. // this field is set, the
  285. // [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
  286. // set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
  287. // is used after
  288. // [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time].
  289. //
  290. // Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
  291. // effective because it will cause additional latency during search.
  292. google.protobuf.Timestamp price_expire_time = 6;
  293. // Output only. The price range of all the child
  294. // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
  295. // [Product][google.cloud.retail.v2.Product]s grouped together on the
  296. // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
  297. // [Product][google.cloud.retail.v2.Product]. Only populated for
  298. // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
  299. // [Product][google.cloud.retail.v2.Product]s.
  300. //
  301. // Note: This field is OUTPUT_ONLY for
  302. // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
  303. // Do not set this field in API requests.
  304. PriceRange price_range = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  305. }
  306. // The rating of a [Product][google.cloud.retail.v2.Product].
  307. message Rating {
  308. // The total number of ratings. This value is independent of the value of
  309. // [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram].
  310. //
  311. // This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
  312. // returned.
  313. int32 rating_count = 1;
  314. // The average rating of the [Product][google.cloud.retail.v2.Product].
  315. //
  316. // The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
  317. // returned.
  318. float average_rating = 2;
  319. // List of rating counts per rating value (index = rating - 1). The list is
  320. // empty if there is no rating. If the list is non-empty, its size is
  321. // always 5. Otherwise, an INVALID_ARGUMENT error is returned.
  322. //
  323. // For example, [41, 14, 13, 47, 303]. It means that the
  324. // [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14
  325. // ratings with 2 star, and so on.
  326. repeated int32 rating_histogram = 3;
  327. }
  328. // Information of an end user.
  329. message UserInfo {
  330. // Highly recommended for logged-in users. Unique identifier for logged-in
  331. // user, such as a user name.
  332. //
  333. // The field must be a UTF-8 encoded string with a length limit of 128
  334. // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  335. string user_id = 1;
  336. // The end user's IP address. Required for getting
  337. // [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
  338. // This field is used to extract location information for personalization.
  339. //
  340. // This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
  341. // address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
  342. // INVALID_ARGUMENT error is returned.
  343. //
  344. // This should not be set when using the JavaScript tag in
  345. // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
  346. // or if
  347. // [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
  348. // is set.
  349. string ip_address = 2;
  350. // User agent as included in the HTTP header. Required for getting
  351. // [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
  352. //
  353. // The field must be a UTF-8 encoded string with a length limit of 1,000
  354. // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  355. //
  356. // This should not be set when using the client side event reporting with
  357. // GTM or JavaScript tag in
  358. // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
  359. // or if
  360. // [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
  361. // is set.
  362. string user_agent = 3;
  363. // True if the request is made directly from the end user, in which case the
  364. // [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
  365. // [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
  366. // from the HTTP request. This flag should be set only if the API request is
  367. // made directly from the end user such as a mobile app (and not if a gateway
  368. // or a server is processing and pushing the user events).
  369. //
  370. // This should not be set when using the JavaScript tag in
  371. // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
  372. bool direct_user_request = 4;
  373. }
  374. // Promotion information.
  375. message Promotion {
  376. // ID of the promotion. For example, "free gift".
  377. //
  378. // The value value must be a UTF-8 encoded string with a length limit of 128
  379. // characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example,
  380. // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is
  381. // returned.
  382. //
  383. // Google Merchant Center property
  384. // [promotion](https://support.google.com/merchants/answer/7050148).
  385. string promotion_id = 1;
  386. }