product_search_service.proto 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  1. // Copyright 2022 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.vision.v1;
  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/vision/v1/geometry.proto";
  21. import "google/longrunning/operations.proto";
  22. import "google/protobuf/empty.proto";
  23. import "google/protobuf/field_mask.proto";
  24. import "google/protobuf/timestamp.proto";
  25. import "google/rpc/status.proto";
  26. option cc_enable_arenas = true;
  27. option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision";
  28. option java_multiple_files = true;
  29. option java_outer_classname = "ProductSearchServiceProto";
  30. option java_package = "com.google.cloud.vision.v1";
  31. option objc_class_prefix = "GCVN";
  32. // Manages Products and ProductSets of reference images for use in product
  33. // search. It uses the following resource model:
  34. //
  35. // - The API has a collection of [ProductSet][google.cloud.vision.v1.ProductSet] resources, named
  36. // `projects/*/locations/*/productSets/*`, which acts as a way to put different
  37. // products into groups to limit identification.
  38. //
  39. // In parallel,
  40. //
  41. // - The API has a collection of [Product][google.cloud.vision.v1.Product] resources, named
  42. // `projects/*/locations/*/products/*`
  43. //
  44. // - Each [Product][google.cloud.vision.v1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, named
  45. // `projects/*/locations/*/products/*/referenceImages/*`
  46. service ProductSearch {
  47. option (google.api.default_host) = "vision.googleapis.com";
  48. option (google.api.oauth_scopes) =
  49. "https://www.googleapis.com/auth/cloud-platform,"
  50. "https://www.googleapis.com/auth/cloud-vision";
  51. // Creates and returns a new ProductSet resource.
  52. //
  53. // Possible errors:
  54. //
  55. // * Returns INVALID_ARGUMENT if display_name is missing, or is longer than
  56. // 4096 characters.
  57. rpc CreateProductSet(CreateProductSetRequest) returns (ProductSet) {
  58. option (google.api.http) = {
  59. post: "/v1/{parent=projects/*/locations/*}/productSets"
  60. body: "product_set"
  61. };
  62. option (google.api.method_signature) = "parent,product_set,product_set_id";
  63. }
  64. // Lists ProductSets in an unspecified order.
  65. //
  66. // Possible errors:
  67. //
  68. // * Returns INVALID_ARGUMENT if page_size is greater than 100, or less
  69. // than 1.
  70. rpc ListProductSets(ListProductSetsRequest) returns (ListProductSetsResponse) {
  71. option (google.api.http) = {
  72. get: "/v1/{parent=projects/*/locations/*}/productSets"
  73. };
  74. option (google.api.method_signature) = "parent";
  75. }
  76. // Gets information associated with a ProductSet.
  77. //
  78. // Possible errors:
  79. //
  80. // * Returns NOT_FOUND if the ProductSet does not exist.
  81. rpc GetProductSet(GetProductSetRequest) returns (ProductSet) {
  82. option (google.api.http) = {
  83. get: "/v1/{name=projects/*/locations/*/productSets/*}"
  84. };
  85. option (google.api.method_signature) = "name";
  86. }
  87. // Makes changes to a ProductSet resource.
  88. // Only display_name can be updated currently.
  89. //
  90. // Possible errors:
  91. //
  92. // * Returns NOT_FOUND if the ProductSet does not exist.
  93. // * Returns INVALID_ARGUMENT if display_name is present in update_mask but
  94. // missing from the request or longer than 4096 characters.
  95. rpc UpdateProductSet(UpdateProductSetRequest) returns (ProductSet) {
  96. option (google.api.http) = {
  97. patch: "/v1/{product_set.name=projects/*/locations/*/productSets/*}"
  98. body: "product_set"
  99. };
  100. option (google.api.method_signature) = "product_set,update_mask";
  101. }
  102. // Permanently deletes a ProductSet. Products and ReferenceImages in the
  103. // ProductSet are not deleted.
  104. //
  105. // The actual image files are not deleted from Google Cloud Storage.
  106. rpc DeleteProductSet(DeleteProductSetRequest) returns (google.protobuf.Empty) {
  107. option (google.api.http) = {
  108. delete: "/v1/{name=projects/*/locations/*/productSets/*}"
  109. };
  110. option (google.api.method_signature) = "name";
  111. }
  112. // Creates and returns a new product resource.
  113. //
  114. // Possible errors:
  115. //
  116. // * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096
  117. // characters.
  118. // * Returns INVALID_ARGUMENT if description is longer than 4096 characters.
  119. // * Returns INVALID_ARGUMENT if product_category is missing or invalid.
  120. rpc CreateProduct(CreateProductRequest) returns (Product) {
  121. option (google.api.http) = {
  122. post: "/v1/{parent=projects/*/locations/*}/products"
  123. body: "product"
  124. };
  125. option (google.api.method_signature) = "parent,product,product_id";
  126. }
  127. // Lists products in an unspecified order.
  128. //
  129. // Possible errors:
  130. //
  131. // * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
  132. rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) {
  133. option (google.api.http) = {
  134. get: "/v1/{parent=projects/*/locations/*}/products"
  135. };
  136. option (google.api.method_signature) = "parent";
  137. }
  138. // Gets information associated with a Product.
  139. //
  140. // Possible errors:
  141. //
  142. // * Returns NOT_FOUND if the Product does not exist.
  143. rpc GetProduct(GetProductRequest) returns (Product) {
  144. option (google.api.http) = {
  145. get: "/v1/{name=projects/*/locations/*/products/*}"
  146. };
  147. option (google.api.method_signature) = "name";
  148. }
  149. // Makes changes to a Product resource.
  150. // Only the `display_name`, `description`, and `labels` fields can be updated
  151. // right now.
  152. //
  153. // If labels are updated, the change will not be reflected in queries until
  154. // the next index time.
  155. //
  156. // Possible errors:
  157. //
  158. // * Returns NOT_FOUND if the Product does not exist.
  159. // * Returns INVALID_ARGUMENT if display_name is present in update_mask but is
  160. // missing from the request or longer than 4096 characters.
  161. // * Returns INVALID_ARGUMENT if description is present in update_mask but is
  162. // longer than 4096 characters.
  163. // * Returns INVALID_ARGUMENT if product_category is present in update_mask.
  164. rpc UpdateProduct(UpdateProductRequest) returns (Product) {
  165. option (google.api.http) = {
  166. patch: "/v1/{product.name=projects/*/locations/*/products/*}"
  167. body: "product"
  168. };
  169. option (google.api.method_signature) = "product,update_mask";
  170. }
  171. // Permanently deletes a product and its reference images.
  172. //
  173. // Metadata of the product and all its images will be deleted right away, but
  174. // search queries against ProductSets containing the product may still work
  175. // until all related caches are refreshed.
  176. rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) {
  177. option (google.api.http) = {
  178. delete: "/v1/{name=projects/*/locations/*/products/*}"
  179. };
  180. option (google.api.method_signature) = "name";
  181. }
  182. // Creates and returns a new ReferenceImage resource.
  183. //
  184. // The `bounding_poly` field is optional. If `bounding_poly` is not specified,
  185. // the system will try to detect regions of interest in the image that are
  186. // compatible with the product_category on the parent product. If it is
  187. // specified, detection is ALWAYS skipped. The system converts polygons into
  188. // non-rotated rectangles.
  189. //
  190. // Note that the pipeline will resize the image if the image resolution is too
  191. // large to process (above 50MP).
  192. //
  193. // Possible errors:
  194. //
  195. // * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096
  196. // characters.
  197. // * Returns INVALID_ARGUMENT if the product does not exist.
  198. // * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing
  199. // compatible with the parent product's product_category is detected.
  200. // * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
  201. rpc CreateReferenceImage(CreateReferenceImageRequest) returns (ReferenceImage) {
  202. option (google.api.http) = {
  203. post: "/v1/{parent=projects/*/locations/*/products/*}/referenceImages"
  204. body: "reference_image"
  205. };
  206. option (google.api.method_signature) = "parent,reference_image,reference_image_id";
  207. }
  208. // Permanently deletes a reference image.
  209. //
  210. // The image metadata will be deleted right away, but search queries
  211. // against ProductSets containing the image may still work until all related
  212. // caches are refreshed.
  213. //
  214. // The actual image files are not deleted from Google Cloud Storage.
  215. rpc DeleteReferenceImage(DeleteReferenceImageRequest) returns (google.protobuf.Empty) {
  216. option (google.api.http) = {
  217. delete: "/v1/{name=projects/*/locations/*/products/*/referenceImages/*}"
  218. };
  219. option (google.api.method_signature) = "name";
  220. }
  221. // Lists reference images.
  222. //
  223. // Possible errors:
  224. //
  225. // * Returns NOT_FOUND if the parent product does not exist.
  226. // * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less
  227. // than 1.
  228. rpc ListReferenceImages(ListReferenceImagesRequest) returns (ListReferenceImagesResponse) {
  229. option (google.api.http) = {
  230. get: "/v1/{parent=projects/*/locations/*/products/*}/referenceImages"
  231. };
  232. option (google.api.method_signature) = "parent";
  233. }
  234. // Gets information associated with a ReferenceImage.
  235. //
  236. // Possible errors:
  237. //
  238. // * Returns NOT_FOUND if the specified image does not exist.
  239. rpc GetReferenceImage(GetReferenceImageRequest) returns (ReferenceImage) {
  240. option (google.api.http) = {
  241. get: "/v1/{name=projects/*/locations/*/products/*/referenceImages/*}"
  242. };
  243. option (google.api.method_signature) = "name";
  244. }
  245. // Adds a Product to the specified ProductSet. If the Product is already
  246. // present, no change is made.
  247. //
  248. // One Product can be added to at most 100 ProductSets.
  249. //
  250. // Possible errors:
  251. //
  252. // * Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
  253. rpc AddProductToProductSet(AddProductToProductSetRequest) returns (google.protobuf.Empty) {
  254. option (google.api.http) = {
  255. post: "/v1/{name=projects/*/locations/*/productSets/*}:addProduct"
  256. body: "*"
  257. };
  258. option (google.api.method_signature) = "name,product";
  259. }
  260. // Removes a Product from the specified ProductSet.
  261. rpc RemoveProductFromProductSet(RemoveProductFromProductSetRequest) returns (google.protobuf.Empty) {
  262. option (google.api.http) = {
  263. post: "/v1/{name=projects/*/locations/*/productSets/*}:removeProduct"
  264. body: "*"
  265. };
  266. option (google.api.method_signature) = "name,product";
  267. }
  268. // Lists the Products in a ProductSet, in an unspecified order. If the
  269. // ProductSet does not exist, the products field of the response will be
  270. // empty.
  271. //
  272. // Possible errors:
  273. //
  274. // * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
  275. rpc ListProductsInProductSet(ListProductsInProductSetRequest) returns (ListProductsInProductSetResponse) {
  276. option (google.api.http) = {
  277. get: "/v1/{name=projects/*/locations/*/productSets/*}/products"
  278. };
  279. option (google.api.method_signature) = "name";
  280. }
  281. // Asynchronous API that imports a list of reference images to specified
  282. // product sets based on a list of image information.
  283. //
  284. // The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the
  285. // progress and results of the request.
  286. // `Operation.metadata` contains `BatchOperationMetadata`. (progress)
  287. // `Operation.response` contains `ImportProductSetsResponse`. (results)
  288. //
  289. // The input source of this method is a csv file on Google Cloud Storage.
  290. // For the format of the csv file please see
  291. // [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri].
  292. rpc ImportProductSets(ImportProductSetsRequest) returns (google.longrunning.Operation) {
  293. option (google.api.http) = {
  294. post: "/v1/{parent=projects/*/locations/*}/productSets:import"
  295. body: "*"
  296. };
  297. option (google.api.method_signature) = "parent,input_config";
  298. option (google.longrunning.operation_info) = {
  299. response_type: "ImportProductSetsResponse"
  300. metadata_type: "BatchOperationMetadata"
  301. };
  302. }
  303. // Asynchronous API to delete all Products in a ProductSet or all Products
  304. // that are in no ProductSet.
  305. //
  306. // If a Product is a member of the specified ProductSet in addition to other
  307. // ProductSets, the Product will still be deleted.
  308. //
  309. // It is recommended to not delete the specified ProductSet until after this
  310. // operation has completed. It is also recommended to not add any of the
  311. // Products involved in the batch delete to a new ProductSet while this
  312. // operation is running because those Products may still end up deleted.
  313. //
  314. // It's not possible to undo the PurgeProducts operation. Therefore, it is
  315. // recommended to keep the csv files used in ImportProductSets (if that was
  316. // how you originally built the Product Set) before starting PurgeProducts, in
  317. // case you need to re-import the data after deletion.
  318. //
  319. // If the plan is to purge all of the Products from a ProductSet and then
  320. // re-use the empty ProductSet to re-import new Products into the empty
  321. // ProductSet, you must wait until the PurgeProducts operation has finished
  322. // for that ProductSet.
  323. //
  324. // The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the
  325. // progress and results of the request.
  326. // `Operation.metadata` contains `BatchOperationMetadata`. (progress)
  327. rpc PurgeProducts(PurgeProductsRequest) returns (google.longrunning.Operation) {
  328. option (google.api.http) = {
  329. post: "/v1/{parent=projects/*/locations/*}/products:purge"
  330. body: "*"
  331. };
  332. option (google.api.method_signature) = "parent";
  333. option (google.longrunning.operation_info) = {
  334. response_type: "google.protobuf.Empty"
  335. metadata_type: "BatchOperationMetadata"
  336. };
  337. }
  338. }
  339. // A Product contains ReferenceImages.
  340. message Product {
  341. option (google.api.resource) = {
  342. type: "vision.googleapis.com/Product"
  343. pattern: "projects/{project}/locations/{location}/products/{product}"
  344. };
  345. // A product label represented as a key-value pair.
  346. message KeyValue {
  347. // The key of the label attached to the product. Cannot be empty and cannot
  348. // exceed 128 bytes.
  349. string key = 1;
  350. // The value of the label attached to the product. Cannot be empty and
  351. // cannot exceed 128 bytes.
  352. string value = 2;
  353. }
  354. // The resource name of the product.
  355. //
  356. // Format is:
  357. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
  358. //
  359. // This field is ignored when creating a product.
  360. string name = 1;
  361. // The user-provided name for this Product. Must not be empty. Must be at most
  362. // 4096 characters long.
  363. string display_name = 2;
  364. // User-provided metadata to be stored with this product. Must be at most 4096
  365. // characters long.
  366. string description = 3;
  367. // Immutable. The category for the product identified by the reference image. This should
  368. // be one of "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1" or
  369. // "general-v1". The legacy categories "homegoods", "apparel", and "toys" are
  370. // still supported, but these should not be used for new products.
  371. string product_category = 4 [(google.api.field_behavior) = IMMUTABLE];
  372. // Key-value pairs that can be attached to a product. At query time,
  373. // constraints can be specified based on the product_labels.
  374. //
  375. // Note that integer values can be provided as strings, e.g. "1199". Only
  376. // strings with integer values can match a range-based restriction which is
  377. // to be supported soon.
  378. //
  379. // Multiple values can be assigned to the same key. One product may have up to
  380. // 500 product_labels.
  381. //
  382. // Notice that the total number of distinct product_labels over all products
  383. // in one ProductSet cannot exceed 1M, otherwise the product search pipeline
  384. // will refuse to work for that ProductSet.
  385. repeated KeyValue product_labels = 5;
  386. }
  387. // A ProductSet contains Products. A ProductSet can contain a maximum of 1
  388. // million reference images. If the limit is exceeded, periodic indexing will
  389. // fail.
  390. message ProductSet {
  391. option (google.api.resource) = {
  392. type: "vision.googleapis.com/ProductSet"
  393. pattern: "projects/{project}/locations/{location}/productSets/{product_set}"
  394. };
  395. // The resource name of the ProductSet.
  396. //
  397. // Format is:
  398. // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
  399. //
  400. // This field is ignored when creating a ProductSet.
  401. string name = 1;
  402. // The user-provided name for this ProductSet. Must not be empty. Must be at
  403. // most 4096 characters long.
  404. string display_name = 2;
  405. // Output only. The time at which this ProductSet was last indexed. Query
  406. // results will reflect all updates before this time. If this ProductSet has
  407. // never been indexed, this timestamp is the default value
  408. // "1970-01-01T00:00:00Z".
  409. //
  410. // This field is ignored when creating a ProductSet.
  411. google.protobuf.Timestamp index_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  412. // Output only. If there was an error with indexing the product set, the field
  413. // is populated.
  414. //
  415. // This field is ignored when creating a ProductSet.
  416. google.rpc.Status index_error = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  417. }
  418. // A `ReferenceImage` represents a product image and its associated metadata,
  419. // such as bounding boxes.
  420. message ReferenceImage {
  421. option (google.api.resource) = {
  422. type: "vision.googleapis.com/ReferenceImage"
  423. pattern: "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}"
  424. };
  425. // The resource name of the reference image.
  426. //
  427. // Format is:
  428. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
  429. //
  430. // This field is ignored when creating a reference image.
  431. string name = 1;
  432. // Required. The Google Cloud Storage URI of the reference image.
  433. //
  434. // The URI must start with `gs://`.
  435. string uri = 2 [(google.api.field_behavior) = REQUIRED];
  436. // Optional. Bounding polygons around the areas of interest in the reference image.
  437. // If this field is empty, the system will try to detect regions of
  438. // interest. At most 10 bounding polygons will be used.
  439. //
  440. // The provided shape is converted into a non-rotated rectangle. Once
  441. // converted, the small edge of the rectangle must be greater than or equal
  442. // to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5
  443. // is not).
  444. repeated BoundingPoly bounding_polys = 3 [(google.api.field_behavior) = OPTIONAL];
  445. }
  446. // Request message for the `CreateProduct` method.
  447. message CreateProductRequest {
  448. // Required. The project in which the Product should be created.
  449. //
  450. // Format is
  451. // `projects/PROJECT_ID/locations/LOC_ID`.
  452. string parent = 1 [
  453. (google.api.field_behavior) = REQUIRED,
  454. (google.api.resource_reference) = {
  455. type: "locations.googleapis.com/Location"
  456. }
  457. ];
  458. // Required. The product to create.
  459. Product product = 2 [(google.api.field_behavior) = REQUIRED];
  460. // A user-supplied resource id for this Product. If set, the server will
  461. // attempt to use this value as the resource id. If it is already in use, an
  462. // error is returned with code ALREADY_EXISTS. Must be at most 128 characters
  463. // long. It cannot contain the character `/`.
  464. string product_id = 3;
  465. }
  466. // Request message for the `ListProducts` method.
  467. message ListProductsRequest {
  468. // Required. The project OR ProductSet from which Products should be listed.
  469. //
  470. // Format:
  471. // `projects/PROJECT_ID/locations/LOC_ID`
  472. string parent = 1 [
  473. (google.api.field_behavior) = REQUIRED,
  474. (google.api.resource_reference) = {
  475. type: "locations.googleapis.com/Location"
  476. }
  477. ];
  478. // The maximum number of items to return. Default 10, maximum 100.
  479. int32 page_size = 2;
  480. // The next_page_token returned from a previous List request, if any.
  481. string page_token = 3;
  482. }
  483. // Response message for the `ListProducts` method.
  484. message ListProductsResponse {
  485. // List of products.
  486. repeated Product products = 1;
  487. // Token to retrieve the next page of results, or empty if there are no more
  488. // results in the list.
  489. string next_page_token = 2;
  490. }
  491. // Request message for the `GetProduct` method.
  492. message GetProductRequest {
  493. // Required. Resource name of the Product to get.
  494. //
  495. // Format is:
  496. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
  497. string name = 1 [
  498. (google.api.field_behavior) = REQUIRED,
  499. (google.api.resource_reference) = {
  500. type: "vision.googleapis.com/Product"
  501. }
  502. ];
  503. }
  504. // Request message for the `UpdateProduct` method.
  505. message UpdateProductRequest {
  506. // Required. The Product resource which replaces the one on the server.
  507. // product.name is immutable.
  508. Product product = 1 [(google.api.field_behavior) = REQUIRED];
  509. // The [FieldMask][google.protobuf.FieldMask] that specifies which fields
  510. // to update.
  511. // If update_mask isn't specified, all mutable fields are to be updated.
  512. // Valid mask paths include `product_labels`, `display_name`, and
  513. // `description`.
  514. google.protobuf.FieldMask update_mask = 2;
  515. }
  516. // Request message for the `DeleteProduct` method.
  517. message DeleteProductRequest {
  518. // Required. Resource name of product to delete.
  519. //
  520. // Format is:
  521. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
  522. string name = 1 [
  523. (google.api.field_behavior) = REQUIRED,
  524. (google.api.resource_reference) = {
  525. type: "vision.googleapis.com/Product"
  526. }
  527. ];
  528. }
  529. // Request message for the `CreateProductSet` method.
  530. message CreateProductSetRequest {
  531. // Required. The project in which the ProductSet should be created.
  532. //
  533. // Format is `projects/PROJECT_ID/locations/LOC_ID`.
  534. string parent = 1 [
  535. (google.api.field_behavior) = REQUIRED,
  536. (google.api.resource_reference) = {
  537. type: "locations.googleapis.com/Location"
  538. }
  539. ];
  540. // Required. The ProductSet to create.
  541. ProductSet product_set = 2 [(google.api.field_behavior) = REQUIRED];
  542. // A user-supplied resource id for this ProductSet. If set, the server will
  543. // attempt to use this value as the resource id. If it is already in use, an
  544. // error is returned with code ALREADY_EXISTS. Must be at most 128 characters
  545. // long. It cannot contain the character `/`.
  546. string product_set_id = 3;
  547. }
  548. // Request message for the `ListProductSets` method.
  549. message ListProductSetsRequest {
  550. // Required. The project from which ProductSets should be listed.
  551. //
  552. // Format is `projects/PROJECT_ID/locations/LOC_ID`.
  553. string parent = 1 [
  554. (google.api.field_behavior) = REQUIRED,
  555. (google.api.resource_reference) = {
  556. type: "locations.googleapis.com/Location"
  557. }
  558. ];
  559. // The maximum number of items to return. Default 10, maximum 100.
  560. int32 page_size = 2;
  561. // The next_page_token returned from a previous List request, if any.
  562. string page_token = 3;
  563. }
  564. // Response message for the `ListProductSets` method.
  565. message ListProductSetsResponse {
  566. // List of ProductSets.
  567. repeated ProductSet product_sets = 1;
  568. // Token to retrieve the next page of results, or empty if there are no more
  569. // results in the list.
  570. string next_page_token = 2;
  571. }
  572. // Request message for the `GetProductSet` method.
  573. message GetProductSetRequest {
  574. // Required. Resource name of the ProductSet to get.
  575. //
  576. // Format is:
  577. // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
  578. string name = 1 [
  579. (google.api.field_behavior) = REQUIRED,
  580. (google.api.resource_reference) = {
  581. type: "vision.googleapis.com/ProductSet"
  582. }
  583. ];
  584. }
  585. // Request message for the `UpdateProductSet` method.
  586. message UpdateProductSetRequest {
  587. // Required. The ProductSet resource which replaces the one on the server.
  588. ProductSet product_set = 1 [(google.api.field_behavior) = REQUIRED];
  589. // The [FieldMask][google.protobuf.FieldMask] that specifies which fields to
  590. // update.
  591. // If update_mask isn't specified, all mutable fields are to be updated.
  592. // Valid mask path is `display_name`.
  593. google.protobuf.FieldMask update_mask = 2;
  594. }
  595. // Request message for the `DeleteProductSet` method.
  596. message DeleteProductSetRequest {
  597. // Required. Resource name of the ProductSet to delete.
  598. //
  599. // Format is:
  600. // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
  601. string name = 1 [
  602. (google.api.field_behavior) = REQUIRED,
  603. (google.api.resource_reference) = {
  604. type: "vision.googleapis.com/ProductSet"
  605. }
  606. ];
  607. }
  608. // Request message for the `CreateReferenceImage` method.
  609. message CreateReferenceImageRequest {
  610. // Required. Resource name of the product in which to create the reference image.
  611. //
  612. // Format is
  613. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
  614. string parent = 1 [
  615. (google.api.field_behavior) = REQUIRED,
  616. (google.api.resource_reference) = {
  617. type: "vision.googleapis.com/Product"
  618. }
  619. ];
  620. // Required. The reference image to create.
  621. // If an image ID is specified, it is ignored.
  622. ReferenceImage reference_image = 2 [(google.api.field_behavior) = REQUIRED];
  623. // A user-supplied resource id for the ReferenceImage to be added. If set,
  624. // the server will attempt to use this value as the resource id. If it is
  625. // already in use, an error is returned with code ALREADY_EXISTS. Must be at
  626. // most 128 characters long. It cannot contain the character `/`.
  627. string reference_image_id = 3;
  628. }
  629. // Request message for the `ListReferenceImages` method.
  630. message ListReferenceImagesRequest {
  631. // Required. Resource name of the product containing the reference images.
  632. //
  633. // Format is
  634. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
  635. string parent = 1 [
  636. (google.api.field_behavior) = REQUIRED,
  637. (google.api.resource_reference) = {
  638. type: "vision.googleapis.com/Product"
  639. }
  640. ];
  641. // The maximum number of items to return. Default 10, maximum 100.
  642. int32 page_size = 2;
  643. // A token identifying a page of results to be returned. This is the value
  644. // of `nextPageToken` returned in a previous reference image list request.
  645. //
  646. // Defaults to the first page if not specified.
  647. string page_token = 3;
  648. }
  649. // Response message for the `ListReferenceImages` method.
  650. message ListReferenceImagesResponse {
  651. // The list of reference images.
  652. repeated ReferenceImage reference_images = 1;
  653. // The maximum number of items to return. Default 10, maximum 100.
  654. int32 page_size = 2;
  655. // The next_page_token returned from a previous List request, if any.
  656. string next_page_token = 3;
  657. }
  658. // Request message for the `GetReferenceImage` method.
  659. message GetReferenceImageRequest {
  660. // Required. The resource name of the ReferenceImage to get.
  661. //
  662. // Format is:
  663. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
  664. string name = 1 [
  665. (google.api.field_behavior) = REQUIRED,
  666. (google.api.resource_reference) = {
  667. type: "vision.googleapis.com/ReferenceImage"
  668. }
  669. ];
  670. }
  671. // Request message for the `DeleteReferenceImage` method.
  672. message DeleteReferenceImageRequest {
  673. // Required. The resource name of the reference image to delete.
  674. //
  675. // Format is:
  676. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
  677. string name = 1 [
  678. (google.api.field_behavior) = REQUIRED,
  679. (google.api.resource_reference) = {
  680. type: "vision.googleapis.com/ReferenceImage"
  681. }
  682. ];
  683. }
  684. // Request message for the `AddProductToProductSet` method.
  685. message AddProductToProductSetRequest {
  686. // Required. The resource name for the ProductSet to modify.
  687. //
  688. // Format is:
  689. // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
  690. string name = 1 [
  691. (google.api.field_behavior) = REQUIRED,
  692. (google.api.resource_reference) = {
  693. type: "vision.googleapis.com/ProductSet"
  694. }
  695. ];
  696. // Required. The resource name for the Product to be added to this ProductSet.
  697. //
  698. // Format is:
  699. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
  700. string product = 2 [
  701. (google.api.field_behavior) = REQUIRED,
  702. (google.api.resource_reference) = {
  703. type: "vision.googleapis.com/Product"
  704. }
  705. ];
  706. }
  707. // Request message for the `RemoveProductFromProductSet` method.
  708. message RemoveProductFromProductSetRequest {
  709. // Required. The resource name for the ProductSet to modify.
  710. //
  711. // Format is:
  712. // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
  713. string name = 1 [
  714. (google.api.field_behavior) = REQUIRED,
  715. (google.api.resource_reference) = {
  716. type: "vision.googleapis.com/ProductSet"
  717. }
  718. ];
  719. // Required. The resource name for the Product to be removed from this ProductSet.
  720. //
  721. // Format is:
  722. // `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
  723. string product = 2 [
  724. (google.api.field_behavior) = REQUIRED,
  725. (google.api.resource_reference) = {
  726. type: "vision.googleapis.com/Product"
  727. }
  728. ];
  729. }
  730. // Request message for the `ListProductsInProductSet` method.
  731. message ListProductsInProductSetRequest {
  732. // Required. The ProductSet resource for which to retrieve Products.
  733. //
  734. // Format is:
  735. // `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
  736. string name = 1 [
  737. (google.api.field_behavior) = REQUIRED,
  738. (google.api.resource_reference) = {
  739. type: "vision.googleapis.com/ProductSet"
  740. }
  741. ];
  742. // The maximum number of items to return. Default 10, maximum 100.
  743. int32 page_size = 2;
  744. // The next_page_token returned from a previous List request, if any.
  745. string page_token = 3;
  746. }
  747. // Response message for the `ListProductsInProductSet` method.
  748. message ListProductsInProductSetResponse {
  749. // The list of Products.
  750. repeated Product products = 1;
  751. // Token to retrieve the next page of results, or empty if there are no more
  752. // results in the list.
  753. string next_page_token = 2;
  754. }
  755. // The Google Cloud Storage location for a csv file which preserves a list of
  756. // ImportProductSetRequests in each line.
  757. message ImportProductSetsGcsSource {
  758. // The Google Cloud Storage URI of the input csv file.
  759. //
  760. // The URI must start with `gs://`.
  761. //
  762. // The format of the input csv file should be one image per line.
  763. // In each line, there are 8 columns.
  764. //
  765. // 1. image-uri
  766. // 2. image-id
  767. // 3. product-set-id
  768. // 4. product-id
  769. // 5. product-category
  770. // 6. product-display-name
  771. // 7. labels
  772. // 8. bounding-poly
  773. //
  774. // The `image-uri`, `product-set-id`, `product-id`, and `product-category`
  775. // columns are required. All other columns are optional.
  776. //
  777. // If the `ProductSet` or `Product` specified by the `product-set-id` and
  778. // `product-id` values does not exist, then the system will create a new
  779. // `ProductSet` or `Product` for the image. In this case, the
  780. // `product-display-name` column refers to
  781. // [display_name][google.cloud.vision.v1.Product.display_name], the
  782. // `product-category` column refers to
  783. // [product_category][google.cloud.vision.v1.Product.product_category], and the
  784. // `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels].
  785. //
  786. // The `image-id` column is optional but must be unique if provided. If it is
  787. // empty, the system will automatically assign a unique id to the image.
  788. //
  789. // The `product-display-name` column is optional. If it is empty, the system
  790. // sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a
  791. // space (" "). You can update the `display_name` later by using the API.
  792. //
  793. // If a `Product` with the specified `product-id` already exists, then the
  794. // system ignores the `product-display-name`, `product-category`, and `labels`
  795. // columns.
  796. //
  797. // The `labels` column (optional) is a line containing a list of
  798. // comma-separated key-value pairs, in the following format:
  799. //
  800. // "key_1=value_1,key_2=value_2,...,key_n=value_n"
  801. //
  802. // The `bounding-poly` column (optional) identifies one region of
  803. // interest from the image in the same manner as `CreateReferenceImage`. If
  804. // you do not specify the `bounding-poly` column, then the system will try to
  805. // detect regions of interest automatically.
  806. //
  807. // At most one `bounding-poly` column is allowed per line. If the image
  808. // contains multiple regions of interest, add a line to the CSV file that
  809. // includes the same product information, and the `bounding-poly` values for
  810. // each region of interest.
  811. //
  812. // The `bounding-poly` column must contain an even number of comma-separated
  813. // numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use
  814. // non-negative integers for absolute bounding polygons, and float values
  815. // in [0, 1] for normalized bounding polygons.
  816. //
  817. // The system will resize the image if the image resolution is too
  818. // large to process (larger than 20MP).
  819. string csv_file_uri = 1;
  820. }
  821. // The input content for the `ImportProductSets` method.
  822. message ImportProductSetsInputConfig {
  823. // The source of the input.
  824. oneof source {
  825. // The Google Cloud Storage location for a csv file which preserves a list
  826. // of ImportProductSetRequests in each line.
  827. ImportProductSetsGcsSource gcs_source = 1;
  828. }
  829. }
  830. // Request message for the `ImportProductSets` method.
  831. message ImportProductSetsRequest {
  832. // Required. The project in which the ProductSets should be imported.
  833. //
  834. // Format is `projects/PROJECT_ID/locations/LOC_ID`.
  835. string parent = 1 [
  836. (google.api.field_behavior) = REQUIRED,
  837. (google.api.resource_reference) = {
  838. type: "locations.googleapis.com/Location"
  839. }
  840. ];
  841. // Required. The input content for the list of requests.
  842. ImportProductSetsInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED];
  843. }
  844. // Response message for the `ImportProductSets` method.
  845. //
  846. // This message is returned by the
  847. // [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned
  848. // [google.longrunning.Operation.response][google.longrunning.Operation.response] field.
  849. message ImportProductSetsResponse {
  850. // The list of reference_images that are imported successfully.
  851. repeated ReferenceImage reference_images = 1;
  852. // The rpc status for each ImportProductSet request, including both successes
  853. // and errors.
  854. //
  855. // The number of statuses here matches the number of lines in the csv file,
  856. // and statuses[i] stores the success or failure status of processing the i-th
  857. // line of the csv, starting from line 0.
  858. repeated google.rpc.Status statuses = 2;
  859. }
  860. // Metadata for the batch operations such as the current state.
  861. //
  862. // This is included in the `metadata` field of the `Operation` returned by the
  863. // `GetOperation` call of the `google::longrunning::Operations` service.
  864. message BatchOperationMetadata {
  865. // Enumerates the possible states that the batch request can be in.
  866. enum State {
  867. // Invalid.
  868. STATE_UNSPECIFIED = 0;
  869. // Request is actively being processed.
  870. PROCESSING = 1;
  871. // The request is done and at least one item has been successfully
  872. // processed.
  873. SUCCESSFUL = 2;
  874. // The request is done and no item has been successfully processed.
  875. FAILED = 3;
  876. // The request is done after the longrunning.Operations.CancelOperation has
  877. // been called by the user. Any records that were processed before the
  878. // cancel command are output as specified in the request.
  879. CANCELLED = 4;
  880. }
  881. // The current state of the batch operation.
  882. State state = 1;
  883. // The time when the batch request was submitted to the server.
  884. google.protobuf.Timestamp submit_time = 2;
  885. // The time when the batch request is finished and
  886. // [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true.
  887. google.protobuf.Timestamp end_time = 3;
  888. }
  889. // Config to control which ProductSet contains the Products to be deleted.
  890. message ProductSetPurgeConfig {
  891. // The ProductSet that contains the Products to delete. If a Product is a
  892. // member of product_set_id in addition to other ProductSets, the Product will
  893. // still be deleted.
  894. string product_set_id = 1;
  895. }
  896. // Request message for the `PurgeProducts` method.
  897. message PurgeProductsRequest {
  898. // The Products to delete.
  899. oneof target {
  900. // Specify which ProductSet contains the Products to be deleted.
  901. ProductSetPurgeConfig product_set_purge_config = 2;
  902. // If delete_orphan_products is true, all Products that are not in any
  903. // ProductSet will be deleted.
  904. bool delete_orphan_products = 3;
  905. }
  906. // Required. The project and location in which the Products should be deleted.
  907. //
  908. // Format is `projects/PROJECT_ID/locations/LOC_ID`.
  909. string parent = 1 [
  910. (google.api.field_behavior) = REQUIRED,
  911. (google.api.resource_reference) = {
  912. type: "locations.googleapis.com/Location"
  913. }
  914. ];
  915. // The default value is false. Override this value to true to actually perform
  916. // the purge.
  917. bool force = 4;
  918. }