product_search_service.proto 34 KB

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