common.proto 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. // Copyright 2021 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.v2beta;
  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.V2Beta";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2beta;retail";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "CommonProto";
  23. option java_package = "com.google.cloud.retail.v2beta";
  24. option objc_class_prefix = "RETAIL";
  25. option php_namespace = "Google\\Cloud\\Retail\\V2beta";
  26. option ruby_package = "Google::Cloud::Retail::V2beta";
  27. // An intended audience of the [Product][google.cloud.retail.v2beta.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.v2beta.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.v2beta.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.v2beta.CustomAttribute.text] or
  99. // [numbers][google.cloud.retail.v2beta.CustomAttribute.numbers] should be
  100. // set. 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.v2beta.CustomAttribute.text] or
  109. // [numbers][google.cloud.retail.v2beta.CustomAttribute.numbers] should be
  110. // set. 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.v2beta.SearchService.Search].
  114. //
  115. // This field is ignored in a
  116. // [UserEvent][google.cloud.retail.v2beta.UserEvent].
  117. //
  118. // Only set if type [text][google.cloud.retail.v2beta.CustomAttribute.text] is
  119. // set. Otherwise, a INVALID_ARGUMENT error is returned.
  120. optional bool searchable = 3;
  121. // If true, custom attribute values are indexed, so that it can be filtered,
  122. // faceted or boosted in
  123. // [SearchService.Search][google.cloud.retail.v2beta.SearchService.Search].
  124. //
  125. // This field is ignored in a
  126. // [UserEvent][google.cloud.retail.v2beta.UserEvent].
  127. //
  128. // See
  129. // [SearchRequest.filter][google.cloud.retail.v2beta.SearchRequest.filter],
  130. // [SearchRequest.facet_specs][google.cloud.retail.v2beta.SearchRequest.facet_specs]
  131. // and
  132. // [SearchRequest.boost_spec][google.cloud.retail.v2beta.SearchRequest.boost_spec]
  133. // for more details.
  134. optional bool indexable = 4;
  135. }
  136. // Fulfillment information, such as the store IDs for in-store pickup or region
  137. // IDs for different shipping methods.
  138. message FulfillmentInfo {
  139. // The fulfillment type, including commonly used types (such as pickup in
  140. // store and same day delivery), and custom types. Customers have to map
  141. // custom types to their display names before rendering UI.
  142. //
  143. // Supported values:
  144. //
  145. // * "pickup-in-store"
  146. // * "ship-to-store"
  147. // * "same-day-delivery"
  148. // * "next-day-delivery"
  149. // * "custom-type-1"
  150. // * "custom-type-2"
  151. // * "custom-type-3"
  152. // * "custom-type-4"
  153. // * "custom-type-5"
  154. //
  155. // If this field is set to an invalid value other than these, an
  156. // INVALID_ARGUMENT error is returned.
  157. string type = 1;
  158. // The IDs for this [type][google.cloud.retail.v2beta.FulfillmentInfo.type],
  159. // such as the store IDs for
  160. // [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2beta.FulfillmentInfo.type]
  161. // or the region IDs for
  162. // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2beta.FulfillmentInfo.type].
  163. //
  164. // A maximum of 2000 values are allowed. Each value must be a string with a
  165. // length limit of 10 characters, matching the pattern [a-zA-Z0-9_-]+, such as
  166. // "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned.
  167. repeated string place_ids = 2;
  168. }
  169. // [Product][google.cloud.retail.v2beta.Product] thumbnail/detail image.
  170. message Image {
  171. // Required. URI of the image.
  172. //
  173. // This field must be a valid UTF-8 encoded URI with a length limit of 5,000
  174. // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  175. //
  176. // Google Merchant Center property
  177. // [image_link](https://support.google.com/merchants/answer/6324350).
  178. // Schema.org property [Product.image](https://schema.org/image).
  179. string uri = 1 [(google.api.field_behavior) = REQUIRED];
  180. // Height of the image in number of pixels.
  181. //
  182. // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
  183. // returned.
  184. int32 height = 2;
  185. // Width of the image in number of pixels.
  186. //
  187. // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
  188. // returned.
  189. int32 width = 3;
  190. }
  191. // A floating point interval.
  192. message Interval {
  193. // The lower bound of the interval. If neither of the min fields are set, then
  194. // the lower bound is negative infinity.
  195. //
  196. // This field must be not larger than
  197. // [max][google.cloud.retail.v2beta.Interval.max]. Otherwise, an
  198. // INVALID_ARGUMENT error is returned.
  199. oneof min {
  200. // Inclusive lower bound.
  201. double minimum = 1;
  202. // Exclusive lower bound.
  203. double exclusive_minimum = 2;
  204. }
  205. // The upper bound of the interval. If neither of the max fields are set, then
  206. // the upper bound is positive infinity.
  207. //
  208. // This field must be not smaller than
  209. // [min][google.cloud.retail.v2beta.Interval.min]. Otherwise, an
  210. // INVALID_ARGUMENT error is returned.
  211. oneof max {
  212. // Inclusive upper bound.
  213. double maximum = 3;
  214. // Exclusive upper bound.
  215. double exclusive_maximum = 4;
  216. }
  217. }
  218. // The price information of a [Product][google.cloud.retail.v2beta.Product].
  219. message PriceInfo {
  220. // The price range of all
  221. // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  222. // [Product][google.cloud.retail.v2beta.Product] having the same
  223. // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id].
  224. message PriceRange {
  225. // The inclusive
  226. // [Product.pricing_info.price][google.cloud.retail.v2beta.PriceInfo.price]
  227. // interval of all
  228. // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  229. // [Product][google.cloud.retail.v2beta.Product] having the same
  230. // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id].
  231. Interval price = 1;
  232. // The inclusive
  233. // [Product.pricing_info.original_price][google.cloud.retail.v2beta.PriceInfo.original_price]
  234. // internal of all
  235. // [variant][google.cloud.retail.v2beta.Product.Type.VARIANT]
  236. // [Product][google.cloud.retail.v2beta.Product] having the same
  237. // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id].
  238. Interval original_price = 2;
  239. }
  240. // The 3-letter currency code defined in [ISO
  241. // 4217](https://www.iso.org/iso-4217-currency-codes.html).
  242. //
  243. // If this field is an unrecognizable currency code, an INVALID_ARGUMENT
  244. // error is returned.
  245. //
  246. // The [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT]
  247. // [Product][google.cloud.retail.v2beta.Product]s with the same
  248. // [Product.primary_product_id][google.cloud.retail.v2beta.Product.primary_product_id]
  249. // must share the same
  250. // [currency_code][google.cloud.retail.v2beta.PriceInfo.currency_code].
  251. // Otherwise, a FAILED_PRECONDITION error is returned.
  252. string currency_code = 1;
  253. // Price of the product.
  254. //
  255. // Google Merchant Center property
  256. // [price](https://support.google.com/merchants/answer/6324371). Schema.org
  257. // property [Offer.priceSpecification](https://schema.org/priceSpecification).
  258. float price = 2;
  259. // Price of the product without any discount. If zero, by default set to be
  260. // the [price][google.cloud.retail.v2beta.PriceInfo.price].
  261. float original_price = 3;
  262. // The costs associated with the sale of a particular product. Used for gross
  263. // profit reporting.
  264. //
  265. // * Profit = [price][google.cloud.retail.v2beta.PriceInfo.price] -
  266. // [cost][google.cloud.retail.v2beta.PriceInfo.cost]
  267. //
  268. // Google Merchant Center property
  269. // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
  270. float cost = 4;
  271. // The timestamp when the [price][google.cloud.retail.v2beta.PriceInfo.price]
  272. // starts to be effective. This can be set as a future timestamp, and the
  273. // [price][google.cloud.retail.v2beta.PriceInfo.price] is only used for search
  274. // after
  275. // [price_effective_time][google.cloud.retail.v2beta.PriceInfo.price_effective_time].
  276. // If so, the
  277. // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] must
  278. // be set and
  279. // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] is
  280. // used before
  281. // [price_effective_time][google.cloud.retail.v2beta.PriceInfo.price_effective_time].
  282. //
  283. // Do not set if [price][google.cloud.retail.v2beta.PriceInfo.price] is always
  284. // effective because it will cause additional latency during search.
  285. google.protobuf.Timestamp price_effective_time = 5;
  286. // The timestamp when the [price][google.cloud.retail.v2beta.PriceInfo.price]
  287. // stops to be effective. The
  288. // [price][google.cloud.retail.v2beta.PriceInfo.price] is used for search
  289. // before
  290. // [price_expire_time][google.cloud.retail.v2beta.PriceInfo.price_expire_time].
  291. // If this field is set, the
  292. // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] must
  293. // be set and
  294. // [original_price][google.cloud.retail.v2beta.PriceInfo.original_price] is
  295. // used after
  296. // [price_expire_time][google.cloud.retail.v2beta.PriceInfo.price_expire_time].
  297. //
  298. // Do not set if [price][google.cloud.retail.v2beta.PriceInfo.price] is always
  299. // effective because it will cause additional latency during search.
  300. google.protobuf.Timestamp price_expire_time = 6;
  301. // Output only. The price range of all the child
  302. // [Product.Type.VARIANT][google.cloud.retail.v2beta.Product.Type.VARIANT]
  303. // [Product][google.cloud.retail.v2beta.Product]s grouped together on the
  304. // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY]
  305. // [Product][google.cloud.retail.v2beta.Product]. Only populated for
  306. // [Product.Type.PRIMARY][google.cloud.retail.v2beta.Product.Type.PRIMARY]
  307. // [Product][google.cloud.retail.v2beta.Product]s.
  308. //
  309. // Note: This field is OUTPUT_ONLY for
  310. // [ProductService.GetProduct][google.cloud.retail.v2beta.ProductService.GetProduct].
  311. // Do not set this field in API requests.
  312. PriceRange price_range = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  313. }
  314. // The rating of a [Product][google.cloud.retail.v2beta.Product].
  315. message Rating {
  316. // The total number of ratings. This value is independent of the value of
  317. // [rating_histogram][google.cloud.retail.v2beta.Rating.rating_histogram].
  318. //
  319. // This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
  320. // returned.
  321. int32 rating_count = 1;
  322. // The average rating of the [Product][google.cloud.retail.v2beta.Product].
  323. //
  324. // The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
  325. // returned.
  326. float average_rating = 2;
  327. // List of rating counts per rating value (index = rating - 1). The list is
  328. // empty if there is no rating. If the list is non-empty, its size is
  329. // always 5. Otherwise, an INVALID_ARGUMENT error is returned.
  330. //
  331. // For example, [41, 14, 13, 47, 303]. It means that the
  332. // [Product][google.cloud.retail.v2beta.Product] got 41 ratings with 1 star,
  333. // 14 ratings with 2 star, and so on.
  334. repeated int32 rating_histogram = 3;
  335. }
  336. // Information of an end user.
  337. message UserInfo {
  338. // Highly recommended for logged-in users. Unique identifier for logged-in
  339. // user, such as a user name.
  340. //
  341. // The field must be a UTF-8 encoded string with a length limit of 128
  342. // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  343. string user_id = 1;
  344. // The end user's IP address. Required for getting
  345. // [SearchResponse.sponsored_results][google.cloud.retail.v2beta.SearchResponse.sponsored_results].
  346. // This field is used to extract location information for personalization.
  347. //
  348. // This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
  349. // address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
  350. // INVALID_ARGUMENT error is returned.
  351. //
  352. // This should not be set when using the JavaScript tag in
  353. // [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent]
  354. // or if
  355. // [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
  356. // is set.
  357. string ip_address = 2;
  358. // User agent as included in the HTTP header. Required for getting
  359. // [SearchResponse.sponsored_results][google.cloud.retail.v2beta.SearchResponse.sponsored_results].
  360. //
  361. // The field must be a UTF-8 encoded string with a length limit of 1,000
  362. // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  363. //
  364. // This should not be set when using the client side event reporting with
  365. // GTM or JavaScript tag in
  366. // [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent]
  367. // or if
  368. // [direct_user_request][google.cloud.retail.v2beta.UserInfo.direct_user_request]
  369. // is set.
  370. string user_agent = 3;
  371. // True if the request is made directly from the end user, in which case the
  372. // [ip_address][google.cloud.retail.v2beta.UserInfo.ip_address] and
  373. // [user_agent][google.cloud.retail.v2beta.UserInfo.user_agent] can be
  374. // populated from the HTTP request. This flag should be set only if the API
  375. // request is made directly from the end user such as a mobile app (and not if
  376. // a gateway or a server is processing and pushing the user events).
  377. //
  378. // This should not be set when using the JavaScript tag in
  379. // [UserEventService.CollectUserEvent][google.cloud.retail.v2beta.UserEventService.CollectUserEvent].
  380. bool direct_user_request = 4;
  381. }
  382. // Promotion information.
  383. message Promotion {
  384. // ID of the promotion. For example, "free gift".
  385. //
  386. // The value value must be a UTF-8 encoded string with a length limit of 128
  387. // characters, and match the pattern: [a-zA-Z][a-zA-Z0-9_]*. For example,
  388. // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is
  389. // returned.
  390. //
  391. // Google Merchant Center property
  392. // [promotion](https://support.google.com/merchants/answer/7050148).
  393. string promotion_id = 1;
  394. }