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