product_search_service.proto 37 KB

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