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