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