catalog_service.proto 19 KB

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