catalog.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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.v2;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/retail/v2/common.proto";
  19. import "google/cloud/retail/v2/import_config.proto";
  20. option csharp_namespace = "Google.Cloud.Retail.V2";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "CatalogProto";
  24. option java_package = "com.google.cloud.retail.v2";
  25. option objc_class_prefix = "RETAIL";
  26. option php_namespace = "Google\\Cloud\\Retail\\V2";
  27. option ruby_package = "Google::Cloud::Retail::V2";
  28. // Configures what level the product should be uploaded with regards to
  29. // how users will be send events and how predictions will be made.
  30. message ProductLevelConfig {
  31. // The type of [Product][google.cloud.retail.v2.Product]s allowed to be
  32. // ingested into the catalog. Acceptable values are:
  33. //
  34. // * `primary` (default): You can ingest
  35. // [Product][google.cloud.retail.v2.Product]s of all types. When
  36. // ingesting a [Product][google.cloud.retail.v2.Product], its type will
  37. // default to
  38. // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if
  39. // unset.
  40. // * `variant` (incompatible with Retail Search): You can only
  41. // ingest
  42. // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
  43. // [Product][google.cloud.retail.v2.Product]s. This means
  44. // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
  45. // cannot be empty.
  46. //
  47. // If this field is set to an invalid value other than these, an
  48. // INVALID_ARGUMENT error is returned.
  49. //
  50. // If this field is `variant` and
  51. // [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
  52. // is `itemGroupId`, an INVALID_ARGUMENT error is returned.
  53. //
  54. // See [Product
  55. // levels](https://cloud.google.com/retail/docs/catalog#product-levels)
  56. // for more details.
  57. string ingestion_product_type = 1;
  58. // Which field of [Merchant Center
  59. // Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
  60. // imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
  61. // values are:
  62. //
  63. // * `offerId` (default): Import `offerId` as the product ID.
  64. // * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
  65. // API will choose one item from the ones with the same `itemGroupId`, and
  66. // use it to represent the item group.
  67. //
  68. // If this field is set to an invalid value other than these, an
  69. // INVALID_ARGUMENT error is returned.
  70. //
  71. // If this field is `itemGroupId` and
  72. // [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
  73. // is `variant`, an INVALID_ARGUMENT error is returned.
  74. //
  75. // See [Product
  76. // levels](https://cloud.google.com/retail/docs/catalog#product-levels)
  77. // for more details.
  78. string merchant_center_product_id_field = 2;
  79. }
  80. // Catalog level attribute config for an attribute. For example, if customers
  81. // want to enable/disable facet for a specific attribute.
  82. message CatalogAttribute {
  83. // The type of an attribute.
  84. enum AttributeType {
  85. // The type of the attribute is unknown.
  86. //
  87. // Used when type cannot be derived from attribute that is not
  88. // [in_use][google.cloud.retail.v2.CatalogAttribute.in_use].
  89. UNKNOWN = 0;
  90. // Textual attribute.
  91. TEXTUAL = 1;
  92. // Numerical attribute.
  93. NUMERICAL = 2;
  94. }
  95. // The status of the indexable option of a catalog attribute.
  96. enum IndexableOption {
  97. // Value used when unset. Defaults to
  98. // [INDEXABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.IndexableOption.INDEXABLE_ENABLED].
  99. INDEXABLE_OPTION_UNSPECIFIED = 0;
  100. // Indexable option enabled for an attribute.
  101. INDEXABLE_ENABLED = 1;
  102. // Indexable option disabled for an attribute.
  103. INDEXABLE_DISABLED = 2;
  104. }
  105. // The status of the dynamic facetable option of a catalog attribute.
  106. enum DynamicFacetableOption {
  107. // Value used when unset. Defaults to
  108. // [DYNAMIC_FACETABLE_ENABLED][google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption.DYNAMIC_FACETABLE_ENABLED].
  109. DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0;
  110. // Dynamic facetable option enabled for an attribute.
  111. DYNAMIC_FACETABLE_ENABLED = 1;
  112. // Dynamic facetable option disabled for an attribute.
  113. DYNAMIC_FACETABLE_DISABLED = 2;
  114. }
  115. // The status of the searchable option of a catalog attribute.
  116. enum SearchableOption {
  117. // Value used when unset. Defaults to
  118. // [SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.SearchableOption.SEARCHABLE_DISABLED].
  119. SEARCHABLE_OPTION_UNSPECIFIED = 0;
  120. // Searchable option enabled for an attribute.
  121. SEARCHABLE_ENABLED = 1;
  122. // Searchable option disabled for an attribute.
  123. SEARCHABLE_DISABLED = 2;
  124. }
  125. // Required. Attribute name.
  126. // For example: `color`, `brands`, `attributes.custom_attribute`, such as
  127. // `attributes.xyz`.
  128. // To be indexable, the attribute name can contain only alpha-numeric
  129. // characters and underscores. For example, an attribute named
  130. // `attributes.abc_xyz` can be indexed, but an attribute named
  131. // `attributes.abc-xyz` cannot be indexed.
  132. string key = 1 [(google.api.field_behavior) = REQUIRED];
  133. // Output only. Indicates whether this attribute has been used by any
  134. // products. `True` if at least one [Product][google.cloud.retail.v2.Product]
  135. // is using this attribute in
  136. // [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
  137. // this field is `False`.
  138. //
  139. // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
  140. // pre-loaded by using
  141. // [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute],
  142. // [CatalogService.ImportCatalogAttributes][], or
  143. // [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
  144. // APIs. This field is `False` for pre-loaded
  145. // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
  146. //
  147. // Only pre-loaded
  148. // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
  149. // neither in use by products nor predefined can be deleted.
  150. // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s that are
  151. // either in use by products or are predefined cannot be deleted; however,
  152. // their configuration properties will reset to default values upon removal
  153. // request.
  154. //
  155. // After catalog changes, it takes about 10 minutes for this field to update.
  156. bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  157. // Output only. The type of this attribute. This is derived from the attribute
  158. // in [Product.attributes][google.cloud.retail.v2.Product.attributes].
  159. AttributeType type = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  160. // When
  161. // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
  162. // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
  163. // are indexed so that it can be filtered, faceted, or boosted in
  164. // [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
  165. IndexableOption indexable_option = 5;
  166. // If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
  167. // facet. Could only be DYNAMIC_FACETABLE_DISABLED if
  168. // [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
  169. // is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
  170. DynamicFacetableOption dynamic_facetable_option = 6;
  171. // When
  172. // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
  173. // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
  174. // are searchable by text queries in
  175. // [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
  176. //
  177. // If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
  178. // will not be searchable by text queries in
  179. // [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
  180. // there are no text values associated to numerical attributes.
  181. SearchableOption searchable_option = 7;
  182. }
  183. // Catalog level attribute config.
  184. message AttributesConfig {
  185. option (google.api.resource) = {
  186. type: "retail.googleapis.com/AttributesConfig"
  187. pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig"
  188. };
  189. // Required. Immutable. The fully qualified resource name of the attribute
  190. // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
  191. string name = 1 [
  192. (google.api.field_behavior) = REQUIRED,
  193. (google.api.field_behavior) = IMMUTABLE
  194. ];
  195. // Enable attribute(s) config at catalog level.
  196. // For example, indexable, dynamic_facetable, or searchable for each
  197. // attribute.
  198. //
  199. // The key is catalog attribute's name.
  200. // For example: `color`, `brands`, `attributes.custom_attribute`, such as
  201. // `attributes.xyz`.
  202. //
  203. // The maximum number of catalog attributes allowed in a request is 1000.
  204. map<string, CatalogAttribute> catalog_attributes = 2;
  205. // Output only. The
  206. // [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
  207. // for this catalog.
  208. AttributeConfigLevel attribute_config_level = 3
  209. [(google.api.field_behavior) = OUTPUT_ONLY];
  210. }
  211. // Catalog level autocomplete config for customers to customize autocomplete
  212. // feature's settings.
  213. message CompletionConfig {
  214. option (google.api.resource) = {
  215. type: "retail.googleapis.com/CompletionConfig"
  216. pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig"
  217. };
  218. // Required. Immutable. Fully qualified name
  219. // `projects/*/locations/*/catalogs/*/completionConfig`
  220. string name = 1 [
  221. (google.api.field_behavior) = REQUIRED,
  222. (google.api.field_behavior) = IMMUTABLE
  223. ];
  224. // Specifies the matching order for autocomplete suggestions, e.g., a query
  225. // consisting of 'sh' with 'out-of-order' specified would suggest "women's
  226. // shoes", whereas a query of 'red s' with 'exact-prefix' specified would
  227. // suggest "red shoes". Currently supported values:
  228. //
  229. // * 'out-of-order'
  230. // * 'exact-prefix'
  231. //
  232. // Default value: 'exact-prefix'.
  233. string matching_order = 2;
  234. // The maximum number of autocomplete suggestions returned per term. Default
  235. // value is 20. If left unset or set to 0, then will fallback to default
  236. // value.
  237. //
  238. // Value range is 1 to 20.
  239. int32 max_suggestions = 3;
  240. // The minimum number of characters needed to be typed in order to get
  241. // suggestions. Default value is 2. If left unset or set to 0, then will
  242. // fallback to default value.
  243. //
  244. // Value range is 1 to 20.
  245. int32 min_prefix_length = 4;
  246. // If set to true, the auto learning function is enabled. Auto learning uses
  247. // user data to generate suggestions using ML techniques. Default value is
  248. // false. Only after enabling auto learning can users use `cloud-retail`
  249. // data in
  250. // [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
  251. bool auto_learning = 11;
  252. // Output only. The source data for the latest import of the autocomplete
  253. // suggestion phrases.
  254. CompletionDataInputConfig suggestions_input_config = 5
  255. [(google.api.field_behavior) = OUTPUT_ONLY];
  256. // Output only. Name of the LRO corresponding to the latest suggestion terms
  257. // list import.
  258. //
  259. // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
  260. // retrieve the latest state of the Long Running Operation.
  261. string last_suggestions_import_operation = 6
  262. [(google.api.field_behavior) = OUTPUT_ONLY];
  263. // Output only. The source data for the latest import of the autocomplete
  264. // denylist phrases.
  265. CompletionDataInputConfig denylist_input_config = 7
  266. [(google.api.field_behavior) = OUTPUT_ONLY];
  267. // Output only. Name of the LRO corresponding to the latest denylist import.
  268. //
  269. // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
  270. // retrieve the latest state of the Long Running Operation.
  271. string last_denylist_import_operation = 8
  272. [(google.api.field_behavior) = OUTPUT_ONLY];
  273. // Output only. The source data for the latest import of the autocomplete
  274. // allowlist phrases.
  275. CompletionDataInputConfig allowlist_input_config = 9
  276. [(google.api.field_behavior) = OUTPUT_ONLY];
  277. // Output only. Name of the LRO corresponding to the latest allowlist import.
  278. //
  279. // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
  280. // retrieve the latest state of the Long Running Operation.
  281. string last_allowlist_import_operation = 10
  282. [(google.api.field_behavior) = OUTPUT_ONLY];
  283. }
  284. // The catalog configuration.
  285. message Catalog {
  286. option (google.api.resource) = {
  287. type: "retail.googleapis.com/Catalog"
  288. pattern: "projects/{project}/locations/{location}/catalogs/{catalog}"
  289. };
  290. // Required. Immutable. The fully qualified resource name of the catalog.
  291. string name = 1 [
  292. (google.api.field_behavior) = REQUIRED,
  293. (google.api.field_behavior) = IMMUTABLE
  294. ];
  295. // Required. Immutable. The catalog display name.
  296. //
  297. // This field must be a UTF-8 encoded string with a length limit of 128
  298. // characters. Otherwise, an INVALID_ARGUMENT error is returned.
  299. string display_name = 2 [
  300. (google.api.field_behavior) = REQUIRED,
  301. (google.api.field_behavior) = IMMUTABLE
  302. ];
  303. // Required. The product level configuration.
  304. ProductLevelConfig product_level_config = 4
  305. [(google.api.field_behavior) = REQUIRED];
  306. }