-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
catalog_service.proto
476 lines (432 loc) · 18.8 KB
/
catalog_service.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.retail.v2;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/retail/v2/catalog.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Retail.V2";
option go_package = "cloud.google.com/go/retail/apiv2/retailpb;retailpb";
option java_multiple_files = true;
option java_outer_classname = "CatalogServiceProto";
option java_package = "com.google.cloud.retail.v2";
option objc_class_prefix = "RETAIL";
option php_namespace = "Google\\Cloud\\Retail\\V2";
option ruby_package = "Google::Cloud::Retail::V2";
// Service for managing catalog configuration.
service CatalogService {
option (google.api.default_host) = "retail.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";
// Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with
// the project.
rpc ListCatalogs(ListCatalogsRequest) returns (ListCatalogsResponse) {
option (google.api.http) = {
get: "/v2/{parent=projects/*/locations/*}/catalogs"
};
option (google.api.method_signature) = "parent";
}
// Updates the [Catalog][google.cloud.retail.v2.Catalog]s.
rpc UpdateCatalog(UpdateCatalogRequest) returns (Catalog) {
option (google.api.http) = {
patch: "/v2/{catalog.name=projects/*/locations/*/catalogs/*}"
body: "catalog"
};
option (google.api.method_signature) = "catalog,update_mask";
}
// Set a specified branch id as default branch. API methods such as
// [SearchService.Search][google.cloud.retail.v2.SearchService.Search],
// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct],
// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
// will treat requests using "default_branch" to the actual branch id set as
// default.
//
// For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as
// default, setting
// [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
// `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent
// to setting
// [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
// `projects/*/locations/*/catalogs/*/branches/1`.
//
// Using multiple branches can be useful when developers would like
// to have a staging branch to test and verify for future usage. When it
// becomes ready, developers switch on the staging branch using this API while
// keeping using `projects/*/locations/*/catalogs/*/branches/default_branch`
// as [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to
// route the traffic to this staging branch.
//
// CAUTION: If you have live predict/search traffic, switching the default
// branch could potentially cause outages if the ID space of the new branch is
// very different from the old one.
//
// More specifically:
//
// * PredictionService will only return product IDs from branch {newBranch}.
// * SearchService will only return product IDs from branch {newBranch}
// (if branch is not explicitly set).
// * UserEventService will only join events with products from branch
// {newBranch}.
rpc SetDefaultBranch(SetDefaultBranchRequest)
returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch"
body: "*"
};
option (google.api.method_signature) = "catalog";
}
// Get which branch is currently default branch set by
// [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch]
// method under a specified parent catalog.
rpc GetDefaultBranch(GetDefaultBranchRequest)
returns (GetDefaultBranchResponse) {
option (google.api.http) = {
get: "/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch"
};
option (google.api.method_signature) = "catalog";
}
// Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig].
rpc GetCompletionConfig(GetCompletionConfigRequest)
returns (CompletionConfig) {
option (google.api.http) = {
get: "/v2/{name=projects/*/locations/*/catalogs/*/completionConfig}"
};
option (google.api.method_signature) = "name";
}
// Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s.
rpc UpdateCompletionConfig(UpdateCompletionConfigRequest)
returns (CompletionConfig) {
option (google.api.http) = {
patch: "/v2/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}"
body: "completion_config"
};
option (google.api.method_signature) = "completion_config,update_mask";
}
// Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
rpc GetAttributesConfig(GetAttributesConfigRequest)
returns (AttributesConfig) {
option (google.api.http) = {
get: "/v2/{name=projects/*/locations/*/catalogs/*/attributesConfig}"
};
option (google.api.method_signature) = "name";
}
// Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
//
// The catalog attributes in the request will be updated in the catalog, or
// inserted if they do not exist. Existing catalog attributes not included in
// the request will remain unchanged. Attributes that are assigned to
// products, but do not exist at the catalog level, are always included in the
// response. The product attribute is assigned default values for missing
// catalog attribute fields, e.g., searchable and dynamic facetable options.
rpc UpdateAttributesConfig(UpdateAttributesConfigRequest)
returns (AttributesConfig) {
option (google.api.http) = {
patch: "/v2/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}"
body: "attributes_config"
};
option (google.api.method_signature) = "attributes_config,update_mask";
}
// Adds the specified
// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the
// [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
//
// If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add
// already exists, an ALREADY_EXISTS error is returned.
rpc AddCatalogAttribute(AddCatalogAttributeRequest)
returns (AttributesConfig) {
option (google.api.http) = {
post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute"
body: "*"
};
}
// Removes the specified
// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the
// [AttributesConfig][google.cloud.retail.v2.AttributesConfig].
//
// If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
// remove does not exist, a NOT_FOUND error is returned.
rpc RemoveCatalogAttribute(RemoveCatalogAttributeRequest)
returns (AttributesConfig) {
option (google.api.http) = {
post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute"
body: "*"
};
}
// Replaces the specified
// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the
// [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the
// catalog attribute with the same
// [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key].
//
// If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to
// replace does not exist, a NOT_FOUND error is returned.
rpc ReplaceCatalogAttribute(ReplaceCatalogAttributeRequest)
returns (AttributesConfig) {
option (google.api.http) = {
post: "/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute"
body: "*"
};
}
}
// Request for
// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
// method.
message ListCatalogsRequest {
// Required. The account resource name with an associated location.
//
// If the caller does not have permission to list
// [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
// of whether or not this location exists, a PERMISSION_DENIED error is
// returned.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "locations.googleapis.com/Location"
}
];
// Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
// unspecified, defaults to 50. The maximum allowed value is 1000. Values
// above 1000 will be coerced to 1000.
//
// If this field is negative, an INVALID_ARGUMENT is returned.
int32 page_size = 2;
// A page token
// [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
// received from a previous
// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
// call. Provide this to retrieve the subsequent page.
//
// When paginating, all other parameters provided to
// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
// must match the call that provided the page token. Otherwise, an
// INVALID_ARGUMENT error is returned.
string page_token = 3;
}
// Response for
// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
// method.
message ListCatalogsResponse {
// All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
repeated Catalog catalogs = 1;
// A token that can be sent as
// [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
// to retrieve the next page. If this field is omitted, there are no
// subsequent pages.
string next_page_token = 2;
}
// Request for
// [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
// method.
message UpdateCatalogRequest {
// Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
//
// If the caller does not have permission to update the
// [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
// exists, a PERMISSION_DENIED error is returned.
//
// If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
// a NOT_FOUND error is returned.
Catalog catalog = 1 [(google.api.field_behavior) = REQUIRED];
// Indicates which fields in the provided
// [Catalog][google.cloud.retail.v2.Catalog] to update.
//
// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
// is returned.
google.protobuf.FieldMask update_mask = 2;
}
// Request message to set a specified branch as new default_branch.
message SetDefaultBranchRequest {
// Full resource name of the catalog, such as
// `projects/*/locations/global/catalogs/default_catalog`.
string catalog = 1 [
(google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
];
// The final component of the resource name of a branch.
//
// This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
// error is returned.
//
// If there are no sufficient active products in the targeted branch and
// [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a
// FAILED_PRECONDITION error is returned.
string branch_id = 2 [
(google.api.resource_reference) = { type: "retail.googleapis.com/Branch" }
];
// Some note on this request, this can be retrieved by
// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]
// before next valid default branch set occurs.
//
// This field must be a UTF-8 encoded string with a length limit of 1,000
// characters. Otherwise, an INVALID_ARGUMENT error is returned.
string note = 3;
// If set to true, it permits switching to a branch with
// [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even
// if it has no sufficient active products.
bool force = 4;
}
// Request message to show which branch is currently the default branch.
message GetDefaultBranchRequest {
// The parent catalog resource name, such as
// `projects/*/locations/global/catalogs/default_catalog`.
string catalog = 1 [
(google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
];
}
// Response message of
// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch].
message GetDefaultBranchResponse {
// Full resource name of the branch id currently set as default branch.
string branch = 1 [
(google.api.resource_reference) = { type: "retail.googleapis.com/Branch" }
];
// The time when this branch is set to default.
google.protobuf.Timestamp set_time = 2;
// This corresponds to
// [SetDefaultBranchRequest.note][google.cloud.retail.v2.SetDefaultBranchRequest.note]
// field, when this branch was set as default.
string note = 3;
}
// Request for
// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
// method.
message GetCompletionConfigRequest {
// Required. Full CompletionConfig resource name. Format:
// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "retail.googleapis.com/CompletionConfig"
}
];
}
// Request for
// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
// method.
message UpdateCompletionConfigRequest {
// Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
// to update.
//
// If the caller does not have permission to update the
// [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
// PERMISSION_DENIED error is returned.
//
// If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
// update does not exist, a NOT_FOUND error is returned.
CompletionConfig completion_config = 1
[(google.api.field_behavior) = REQUIRED];
// Indicates which fields in the provided
// [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
// following are the only supported fields:
//
// * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
// * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
// * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
// * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
//
// If not set, all supported fields are updated.
google.protobuf.FieldMask update_mask = 2;
}
// Request for
// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
// method.
message GetAttributesConfigRequest {
// Required. Full AttributesConfig resource name. Format:
// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "retail.googleapis.com/AttributesConfig"
}
];
}
// Request for
// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
// method.
message UpdateAttributesConfigRequest {
// Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
// to update.
AttributesConfig attributes_config = 1
[(google.api.field_behavior) = REQUIRED];
// Indicates which fields in the provided
// [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
// following is the only supported field:
//
// * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
//
// If not set, all supported fields are updated.
google.protobuf.FieldMask update_mask = 2;
}
// Request for
// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
// method.
message AddCatalogAttributeRequest {
// Required. Full AttributesConfig resource name. Format:
// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
string attributes_config = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "retail.googleapis.com/AttributesConfig"
}
];
// Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
// to add.
CatalogAttribute catalog_attribute = 2
[(google.api.field_behavior) = REQUIRED];
}
// Request for
// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]
// method.
message RemoveCatalogAttributeRequest {
// Required. Full AttributesConfig resource name. Format:
// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
string attributes_config = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "retail.googleapis.com/AttributesConfig"
}
];
// Required. The attribute name key of the
// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
string key = 2 [(google.api.field_behavior) = REQUIRED];
}
// Request for
// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
// method.
message ReplaceCatalogAttributeRequest {
// Required. Full AttributesConfig resource name. Format:
// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
string attributes_config = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "retail.googleapis.com/AttributesConfig"
}
];
// Required. The updated
// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
CatalogAttribute catalog_attribute = 2
[(google.api.field_behavior) = REQUIRED];
// Indicates which fields in the provided
// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
// following are NOT supported:
//
// * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
//
// If not set, all supported fields are updated.
google.protobuf.FieldMask update_mask = 3;
}