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