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