google-cloud-vision 0.31.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -9
  3. data/LICENSE +1 -1
  4. data/README.md +94 -0
  5. data/lib/google/cloud/vision.rb +200 -535
  6. data/lib/google/cloud/vision/v1.rb +129 -55
  7. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +9 -0
  8. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +88 -0
  9. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +539 -0
  10. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +3 -3
  11. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +2 -1
  12. data/lib/google/cloud/vision/{version.rb → v1/doc/google/protobuf/empty.rb} +13 -6
  13. data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +230 -0
  14. data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +109 -0
  15. data/lib/google/cloud/vision/v1/geometry_pb.rb +1 -0
  16. data/lib/google/cloud/vision/v1/helpers.rb +972 -0
  17. data/lib/google/cloud/vision/v1/image_annotator_client.rb +4 -4
  18. data/lib/google/cloud/vision/v1/image_annotator_pb.rb +5 -0
  19. data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +2 -1
  20. data/lib/google/cloud/vision/v1/product_search_client.rb +1337 -0
  21. data/lib/google/cloud/vision/v1/product_search_client_config.json +116 -0
  22. data/lib/google/cloud/vision/v1/product_search_pb.rb +45 -0
  23. data/lib/google/cloud/vision/v1/product_search_service_pb.rb +191 -0
  24. data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +224 -0
  25. data/lib/google/cloud/vision/v1p3beta1.rb +233 -0
  26. data/lib/google/cloud/vision/v1p3beta1/credentials.rb +42 -0
  27. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +72 -0
  28. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +763 -0
  29. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +154 -0
  30. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +533 -0
  31. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +254 -0
  32. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +101 -0
  33. data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +93 -0
  34. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +130 -0
  35. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +29 -0
  36. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +230 -0
  37. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +109 -0
  38. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +90 -0
  39. data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +84 -0
  40. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +156 -0
  41. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +65 -0
  42. data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +43 -0
  43. data/lib/google/cloud/vision/v1p3beta1/helpers.rb +972 -0
  44. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +302 -0
  45. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +36 -0
  46. data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +304 -0
  47. data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +55 -0
  48. data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +1351 -0
  49. data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +116 -0
  50. data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +64 -0
  51. data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +191 -0
  52. data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +222 -0
  53. data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +94 -0
  54. data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +51 -0
  55. metadata +53 -122
  56. data/AUTHENTICATION.md +0 -179
  57. data/CHANGELOG.md +0 -109
  58. data/CODE_OF_CONDUCT.md +0 -40
  59. data/CONTRIBUTING.md +0 -188
  60. data/LOGGING.md +0 -32
  61. data/OVERVIEW.md +0 -202
  62. data/TROUBLESHOOTING.md +0 -37
  63. data/lib/google-cloud-vision.rb +0 -146
  64. data/lib/google/cloud/vision/annotate.rb +0 -303
  65. data/lib/google/cloud/vision/annotation.rb +0 -553
  66. data/lib/google/cloud/vision/annotation/crop_hint.rb +0 -126
  67. data/lib/google/cloud/vision/annotation/entity.rb +0 -225
  68. data/lib/google/cloud/vision/annotation/face.rb +0 -1497
  69. data/lib/google/cloud/vision/annotation/normalized_vertex.rb +0 -76
  70. data/lib/google/cloud/vision/annotation/object_localization.rb +0 -115
  71. data/lib/google/cloud/vision/annotation/properties.rb +0 -220
  72. data/lib/google/cloud/vision/annotation/safe_search.rb +0 -153
  73. data/lib/google/cloud/vision/annotation/text.rb +0 -1015
  74. data/lib/google/cloud/vision/annotation/vertex.rb +0 -91
  75. data/lib/google/cloud/vision/annotation/web.rb +0 -420
  76. data/lib/google/cloud/vision/credentials.rb +0 -57
  77. data/lib/google/cloud/vision/image.rb +0 -832
  78. data/lib/google/cloud/vision/location.rb +0 -98
  79. data/lib/google/cloud/vision/project.rb +0 -367
  80. data/lib/google/cloud/vision/service.rb +0 -83
@@ -13,7 +13,10 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
+ require "google/cloud/vision/v1/product_search_client"
16
17
  require "google/cloud/vision/v1/image_annotator_client"
18
+ require "google/cloud/vision/v1/helpers"
19
+ require "google/cloud/vision/v1/product_search_service_pb"
17
20
  require "google/cloud/vision/v1/image_annotator_pb"
18
21
 
19
22
  module Google
@@ -49,7 +52,7 @@ module Google
49
52
  # ```rb
50
53
  # require "google/cloud/vision"
51
54
  #
52
- # image_annotator_client = Google::Cloud::Vision.new(version: :v1)
55
+ # image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1)
53
56
  # gcs_image_uri = "gs://gapic-toolkit/President_Barack_Obama.jpg"
54
57
  # source = { gcs_image_uri: gcs_image_uri }
55
58
  # image = { source: source }
@@ -98,60 +101,131 @@ module Google
98
101
  module V1
99
102
  # rubocop:enable LineLength
100
103
 
101
- ##
102
- # Service that performs Google Cloud Vision API detection tasks over client
103
- # images, such as face, landmark, logo, label, and text detection. The
104
- # ImageAnnotator service returns detected entities from the images.
105
- #
106
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
107
- # Provides the means for authenticating requests made by the client. This parameter can
108
- # be many types.
109
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
110
- # authenticating requests made by this client.
111
- # A `String` will be treated as the path to the keyfile to be used for the construction of
112
- # credentials for this client.
113
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
114
- # credentials for this client.
115
- # A `GRPC::Core::Channel` will be used to make calls through.
116
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
117
- # should already be composed with a `GRPC::Core::CallCredentials` object.
118
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
119
- # metadata for requests, generally, to give OAuth credentials.
120
- # @param scopes [Array<String>]
121
- # The OAuth scopes for this service. This parameter is ignored if
122
- # an updater_proc is supplied.
123
- # @param client_config [Hash]
124
- # A Hash for call options for each method. See
125
- # Google::Gax#construct_settings for the structure of
126
- # this data. Falls back to the default config if not specified
127
- # or the specified config is missing data points.
128
- # @param timeout [Numeric]
129
- # The default timeout, in seconds, for calls made through this client.
130
- # @param metadata [Hash]
131
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
132
- # @param exception_transformer [Proc]
133
- # An optional proc that intercepts any exceptions raised during an API call to inject
134
- # custom error handling.
135
- def self.new \
136
- credentials: nil,
137
- scopes: nil,
138
- client_config: nil,
139
- timeout: nil,
140
- metadata: nil,
141
- exception_transformer: nil,
142
- lib_name: nil,
143
- lib_version: nil
144
- kwargs = {
145
- credentials: credentials,
146
- scopes: scopes,
147
- client_config: client_config,
148
- timeout: timeout,
149
- metadata: metadata,
150
- exception_transformer: exception_transformer,
151
- lib_name: lib_name,
152
- lib_version: lib_version
153
- }.select { |_, v| v != nil }
154
- Google::Cloud::Vision::V1::ImageAnnotatorClient.new(**kwargs)
104
+ module ProductSearch
105
+ ##
106
+ # Manages Products and ProductSets of reference images for use in product
107
+ # search. It uses the following resource model:
108
+ #
109
+ # * The API has a collection of {Google::Cloud::Vision::V1::ProductSet ProductSet} resources, named
110
+ # `projects/*/locations/*/productSets/*`, which acts as a way to put different
111
+ # products into groups to limit identification.
112
+ #
113
+ # In parallel,
114
+ #
115
+ # * The API has a collection of {Google::Cloud::Vision::V1::Product Product} resources, named
116
+ # `projects/*/locations/*/products/*`
117
+ #
118
+ # * Each {Google::Cloud::Vision::V1::Product Product} has a collection of {Google::Cloud::Vision::V1::ReferenceImage ReferenceImage} resources, named
119
+ # `projects/*/locations/*/products/*/referenceImages/*`
120
+ #
121
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
122
+ # Provides the means for authenticating requests made by the client. This parameter can
123
+ # be many types.
124
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
125
+ # authenticating requests made by this client.
126
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
127
+ # credentials for this client.
128
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
129
+ # credentials for this client.
130
+ # A `GRPC::Core::Channel` will be used to make calls through.
131
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
132
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
133
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
134
+ # metadata for requests, generally, to give OAuth credentials.
135
+ # @param scopes [Array<String>]
136
+ # The OAuth scopes for this service. This parameter is ignored if
137
+ # an updater_proc is supplied.
138
+ # @param client_config [Hash]
139
+ # A Hash for call options for each method. See
140
+ # Google::Gax#construct_settings for the structure of
141
+ # this data. Falls back to the default config if not specified
142
+ # or the specified config is missing data points.
143
+ # @param timeout [Numeric]
144
+ # The default timeout, in seconds, for calls made through this client.
145
+ # @param metadata [Hash]
146
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
147
+ # @param exception_transformer [Proc]
148
+ # An optional proc that intercepts any exceptions raised during an API call to inject
149
+ # custom error handling.
150
+ def self.new \
151
+ credentials: nil,
152
+ scopes: nil,
153
+ client_config: nil,
154
+ timeout: nil,
155
+ metadata: nil,
156
+ exception_transformer: nil,
157
+ lib_name: nil,
158
+ lib_version: nil
159
+ kwargs = {
160
+ credentials: credentials,
161
+ scopes: scopes,
162
+ client_config: client_config,
163
+ timeout: timeout,
164
+ metadata: metadata,
165
+ exception_transformer: exception_transformer,
166
+ lib_name: lib_name,
167
+ lib_version: lib_version
168
+ }.select { |_, v| v != nil }
169
+ Google::Cloud::Vision::V1::ProductSearchClient.new(**kwargs)
170
+ end
171
+ end
172
+
173
+ module ImageAnnotator
174
+ ##
175
+ # Service that performs Google Cloud Vision API detection tasks over client
176
+ # images, such as face, landmark, logo, label, and text detection. The
177
+ # ImageAnnotator service returns detected entities from the images.
178
+ #
179
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
180
+ # Provides the means for authenticating requests made by the client. This parameter can
181
+ # be many types.
182
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
183
+ # authenticating requests made by this client.
184
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
185
+ # credentials for this client.
186
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
187
+ # credentials for this client.
188
+ # A `GRPC::Core::Channel` will be used to make calls through.
189
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
190
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
191
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
192
+ # metadata for requests, generally, to give OAuth credentials.
193
+ # @param scopes [Array<String>]
194
+ # The OAuth scopes for this service. This parameter is ignored if
195
+ # an updater_proc is supplied.
196
+ # @param client_config [Hash]
197
+ # A Hash for call options for each method. See
198
+ # Google::Gax#construct_settings for the structure of
199
+ # this data. Falls back to the default config if not specified
200
+ # or the specified config is missing data points.
201
+ # @param timeout [Numeric]
202
+ # The default timeout, in seconds, for calls made through this client.
203
+ # @param metadata [Hash]
204
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
205
+ # @param exception_transformer [Proc]
206
+ # An optional proc that intercepts any exceptions raised during an API call to inject
207
+ # custom error handling.
208
+ def self.new \
209
+ credentials: nil,
210
+ scopes: nil,
211
+ client_config: nil,
212
+ timeout: nil,
213
+ metadata: nil,
214
+ exception_transformer: nil,
215
+ lib_name: nil,
216
+ lib_version: nil
217
+ kwargs = {
218
+ credentials: credentials,
219
+ scopes: scopes,
220
+ client_config: client_config,
221
+ timeout: timeout,
222
+ metadata: metadata,
223
+ exception_transformer: exception_transformer,
224
+ lib_name: lib_name,
225
+ lib_version: lib_version
226
+ }.select { |_, v| v != nil }
227
+ Google::Cloud::Vision::V1::ImageAnnotatorClient.new(**kwargs)
228
+ end
155
229
  end
156
230
  end
157
231
  end
@@ -73,6 +73,9 @@ module Google
73
73
  # Run web detection.
74
74
  WEB_DETECTION = 10
75
75
 
76
+ # Run Product Search.
77
+ PRODUCT_SEARCH = 12
78
+
76
79
  # Run localizer for object detection.
77
80
  OBJECT_LOCALIZATION = 19
78
81
  end
@@ -506,6 +509,9 @@ module Google
506
509
  # @!attribute [rw] crop_hints_params
507
510
  # @return [Google::Cloud::Vision::V1::CropHintsParams]
508
511
  # Parameters for crop hints annotation request.
512
+ # @!attribute [rw] product_search_params
513
+ # @return [Google::Cloud::Vision::V1::ProductSearchParams]
514
+ # Parameters for product search.
509
515
  # @!attribute [rw] web_detection_params
510
516
  # @return [Google::Cloud::Vision::V1::WebDetectionParams]
511
517
  # Parameters for web detection.
@@ -573,6 +579,9 @@ module Google
573
579
  # @!attribute [rw] web_detection
574
580
  # @return [Google::Cloud::Vision::V1::WebDetection]
575
581
  # If present, web detection has completed successfully.
582
+ # @!attribute [rw] product_search_results
583
+ # @return [Google::Cloud::Vision::V1::ProductSearchResults]
584
+ # If present, product search has completed successfully.
576
585
  # @!attribute [rw] error
577
586
  # @return [Google::Rpc::Status]
578
587
  # If set, represents the error message for the operation.
@@ -0,0 +1,88 @@
1
+ # Copyright 2018 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
+ # https://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
+
16
+ module Google
17
+ module Cloud
18
+ module Vision
19
+ module V1
20
+ # Parameters for a product search request.
21
+ # @!attribute [rw] bounding_poly
22
+ # @return [Google::Cloud::Vision::V1::BoundingPoly]
23
+ # The bounding polygon around the area of interest in the image.
24
+ # Optional. If it is not specified, system discretion will be applied.
25
+ # @!attribute [rw] product_set
26
+ # @return [String]
27
+ # The resource name of a {Google::Cloud::Vision::V1::ProductSet ProductSet} to be searched for similar images.
28
+ #
29
+ # Format is:
30
+ # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
31
+ # @!attribute [rw] product_categories
32
+ # @return [Array<String>]
33
+ # The list of product categories to search in. Currently, we only consider
34
+ # the first category, and either "homegoods", "apparel", or "toys" should be
35
+ # specified.
36
+ # @!attribute [rw] filter
37
+ # @return [String]
38
+ # The filtering expression. This can be used to restrict search results based
39
+ # on Product labels. We currently support an AND of OR of key-value
40
+ # expressions, where each expression within an OR must have the same key.
41
+ #
42
+ # For example, "(color = red OR color = blue) AND brand = Google" is
43
+ # acceptable, but not "(color = red OR brand = Google)" or "color: red".
44
+ class ProductSearchParams; end
45
+
46
+ # Results for a product search request.
47
+ # @!attribute [rw] index_time
48
+ # @return [Google::Protobuf::Timestamp]
49
+ # Timestamp of the index which provided these results. Changes made after
50
+ # this time are not reflected in the current results.
51
+ # @!attribute [rw] results
52
+ # @return [Array<Google::Cloud::Vision::V1::ProductSearchResults::Result>]
53
+ # List of results, one for each product match.
54
+ # @!attribute [rw] product_grouped_results
55
+ # @return [Array<Google::Cloud::Vision::V1::ProductSearchResults::GroupedResult>]
56
+ # List of results grouped by products detected in the query image. Each entry
57
+ # corresponds to one bounding polygon in the query image, and contains the
58
+ # matching products specific to that region. There may be duplicate product
59
+ # matches in the union of all the per-product results.
60
+ class ProductSearchResults
61
+ # Information about a product.
62
+ # @!attribute [rw] product
63
+ # @return [Google::Cloud::Vision::V1::Product]
64
+ # The Product.
65
+ # @!attribute [rw] score
66
+ # @return [Float]
67
+ # A confidence level on the match, ranging from 0 (no confidence) to
68
+ # 1 (full confidence).
69
+ # @!attribute [rw] image
70
+ # @return [String]
71
+ # The resource name of the image from the product that is the closest match
72
+ # to the query.
73
+ class Result; end
74
+
75
+ # Information about the products similar to a single product in a query
76
+ # image.
77
+ # @!attribute [rw] bounding_poly
78
+ # @return [Google::Cloud::Vision::V1::BoundingPoly]
79
+ # The bounding polygon around the product detected in the query image.
80
+ # @!attribute [rw] results
81
+ # @return [Array<Google::Cloud::Vision::V1::ProductSearchResults::Result>]
82
+ # List of results, one for each product match.
83
+ class GroupedResult; end
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,539 @@
1
+ # Copyright 2018 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
+ # https://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
+
16
+ module Google
17
+ module Cloud
18
+ module Vision
19
+ module V1
20
+ # A Product contains ReferenceImages.
21
+ # @!attribute [rw] name
22
+ # @return [String]
23
+ # The resource name of the product.
24
+ #
25
+ # Format is:
26
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
27
+ #
28
+ # This field is ignored when creating a product.
29
+ # @!attribute [rw] display_name
30
+ # @return [String]
31
+ # The user-provided name for this Product. Must not be empty. Must be at most
32
+ # 4096 characters long.
33
+ # @!attribute [rw] description
34
+ # @return [String]
35
+ # User-provided metadata to be stored with this product. Must be at most 4096
36
+ # characters long.
37
+ # @!attribute [rw] product_category
38
+ # @return [String]
39
+ # The category for the product identified by the reference image. This should
40
+ # be either "homegoods", "apparel", or "toys".
41
+ #
42
+ # This field is immutable.
43
+ # @!attribute [rw] product_labels
44
+ # @return [Array<Google::Cloud::Vision::V1::Product::KeyValue>]
45
+ # Key-value pairs that can be attached to a product. At query time,
46
+ # constraints can be specified based on the product_labels.
47
+ #
48
+ # Note that integer values can be provided as strings, e.g. "1199". Only
49
+ # strings with integer values can match a range-based restriction which is
50
+ # to be supported soon.
51
+ #
52
+ # Multiple values can be assigned to the same key. One product may have up to
53
+ # 100 product_labels.
54
+ class Product
55
+ # A product label represented as a key-value pair.
56
+ # @!attribute [rw] key
57
+ # @return [String]
58
+ # The key of the label attached to the product. Cannot be empty and cannot
59
+ # exceed 128 bytes.
60
+ # @!attribute [rw] value
61
+ # @return [String]
62
+ # The value of the label attached to the product. Cannot be empty and
63
+ # cannot exceed 128 bytes.
64
+ class KeyValue; end
65
+ end
66
+
67
+ # A ProductSet contains Products. A ProductSet can contain a maximum of 1
68
+ # million reference images. If the limit is exceeded, periodic indexing will
69
+ # fail.
70
+ # @!attribute [rw] name
71
+ # @return [String]
72
+ # The resource name of the ProductSet.
73
+ #
74
+ # Format is:
75
+ # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
76
+ #
77
+ # This field is ignored when creating a ProductSet.
78
+ # @!attribute [rw] display_name
79
+ # @return [String]
80
+ # The user-provided name for this ProductSet. Must not be empty. Must be at
81
+ # most 4096 characters long.
82
+ # @!attribute [rw] index_time
83
+ # @return [Google::Protobuf::Timestamp]
84
+ # Output only. The time at which this ProductSet was last indexed. Query
85
+ # results will reflect all updates before this time. If this ProductSet has
86
+ # never been indexed, this field is 0.
87
+ #
88
+ # This field is ignored when creating a ProductSet.
89
+ # @!attribute [rw] index_error
90
+ # @return [Google::Rpc::Status]
91
+ # Output only. If there was an error with indexing the product set, the field
92
+ # is populated.
93
+ #
94
+ # This field is ignored when creating a ProductSet.
95
+ class ProductSet; end
96
+
97
+ # A `ReferenceImage` represents a product image and its associated metadata,
98
+ # such as bounding boxes.
99
+ # @!attribute [rw] name
100
+ # @return [String]
101
+ # The resource name of the reference image.
102
+ #
103
+ # Format is:
104
+ #
105
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
106
+ #
107
+ # This field is ignored when creating a reference image.
108
+ # @!attribute [rw] uri
109
+ # @return [String]
110
+ # The Google Cloud Storage URI of the reference image.
111
+ #
112
+ # The URI must start with `gs://`.
113
+ #
114
+ # Required.
115
+ # @!attribute [rw] bounding_polys
116
+ # @return [Array<Google::Cloud::Vision::V1::BoundingPoly>]
117
+ # Bounding polygons around the areas of interest in the reference image.
118
+ # Optional. If this field is empty, the system will try to detect regions of
119
+ # interest. At most 10 bounding polygons will be used.
120
+ #
121
+ # The provided shape is converted into a non-rotated rectangle. Once
122
+ # converted, the small edge of the rectangle must be greater than or equal
123
+ # to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5
124
+ # is not).
125
+ class ReferenceImage; end
126
+
127
+ # Request message for the `CreateProduct` method.
128
+ # @!attribute [rw] parent
129
+ # @return [String]
130
+ # The project in which the Product should be created.
131
+ #
132
+ # Format is
133
+ # `projects/PROJECT_ID/locations/LOC_ID`.
134
+ # @!attribute [rw] product
135
+ # @return [Google::Cloud::Vision::V1::Product]
136
+ # The product to create.
137
+ # @!attribute [rw] product_id
138
+ # @return [String]
139
+ # A user-supplied resource id for this Product. If set, the server will
140
+ # attempt to use this value as the resource id. If it is already in use, an
141
+ # error is returned with code ALREADY_EXISTS. Must be at most 128 characters
142
+ # long. It cannot contain the character `/`.
143
+ class CreateProductRequest; end
144
+
145
+ # Request message for the `ListProducts` method.
146
+ # @!attribute [rw] parent
147
+ # @return [String]
148
+ # The project OR ProductSet from which Products should be listed.
149
+ #
150
+ # Format:
151
+ # `projects/PROJECT_ID/locations/LOC_ID`
152
+ # @!attribute [rw] page_size
153
+ # @return [Integer]
154
+ # The maximum number of items to return. Default 10, maximum 100.
155
+ # @!attribute [rw] page_token
156
+ # @return [String]
157
+ # The next_page_token returned from a previous List request, if any.
158
+ class ListProductsRequest; end
159
+
160
+ # Response message for the `ListProducts` method.
161
+ # @!attribute [rw] products
162
+ # @return [Array<Google::Cloud::Vision::V1::Product>]
163
+ # List of products.
164
+ # @!attribute [rw] next_page_token
165
+ # @return [String]
166
+ # Token to retrieve the next page of results, or empty if there are no more
167
+ # results in the list.
168
+ class ListProductsResponse; end
169
+
170
+ # Request message for the `GetProduct` method.
171
+ # @!attribute [rw] name
172
+ # @return [String]
173
+ # Resource name of the Product to get.
174
+ #
175
+ # Format is:
176
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
177
+ class GetProductRequest; end
178
+
179
+ # Request message for the `UpdateProduct` method.
180
+ # @!attribute [rw] product
181
+ # @return [Google::Cloud::Vision::V1::Product]
182
+ # The Product resource which replaces the one on the server.
183
+ # product.name is immutable.
184
+ # @!attribute [rw] update_mask
185
+ # @return [Google::Protobuf::FieldMask]
186
+ # The {Google::Protobuf::FieldMask FieldMask} that specifies which fields
187
+ # to update.
188
+ # If update_mask isn't specified, all mutable fields are to be updated.
189
+ # Valid mask paths include `product_labels`, `display_name`, and
190
+ # `description`.
191
+ class UpdateProductRequest; end
192
+
193
+ # Request message for the `DeleteProduct` method.
194
+ # @!attribute [rw] name
195
+ # @return [String]
196
+ # Resource name of product to delete.
197
+ #
198
+ # Format is:
199
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
200
+ class DeleteProductRequest; end
201
+
202
+ # Request message for the `CreateProductSet` method.
203
+ # @!attribute [rw] parent
204
+ # @return [String]
205
+ # The project in which the ProductSet should be created.
206
+ #
207
+ # Format is `projects/PROJECT_ID/locations/LOC_ID`.
208
+ # @!attribute [rw] product_set
209
+ # @return [Google::Cloud::Vision::V1::ProductSet]
210
+ # The ProductSet to create.
211
+ # @!attribute [rw] product_set_id
212
+ # @return [String]
213
+ # A user-supplied resource id for this ProductSet. If set, the server will
214
+ # attempt to use this value as the resource id. If it is already in use, an
215
+ # error is returned with code ALREADY_EXISTS. Must be at most 128 characters
216
+ # long. It cannot contain the character `/`.
217
+ class CreateProductSetRequest; end
218
+
219
+ # Request message for the `ListProductSets` method.
220
+ # @!attribute [rw] parent
221
+ # @return [String]
222
+ # The project from which ProductSets should be listed.
223
+ #
224
+ # Format is `projects/PROJECT_ID/locations/LOC_ID`.
225
+ # @!attribute [rw] page_size
226
+ # @return [Integer]
227
+ # The maximum number of items to return. Default 10, maximum 100.
228
+ # @!attribute [rw] page_token
229
+ # @return [String]
230
+ # The next_page_token returned from a previous List request, if any.
231
+ class ListProductSetsRequest; end
232
+
233
+ # Response message for the `ListProductSets` method.
234
+ # @!attribute [rw] product_sets
235
+ # @return [Array<Google::Cloud::Vision::V1::ProductSet>]
236
+ # List of ProductSets.
237
+ # @!attribute [rw] next_page_token
238
+ # @return [String]
239
+ # Token to retrieve the next page of results, or empty if there are no more
240
+ # results in the list.
241
+ class ListProductSetsResponse; end
242
+
243
+ # Request message for the `GetProductSet` method.
244
+ # @!attribute [rw] name
245
+ # @return [String]
246
+ # Resource name of the ProductSet to get.
247
+ #
248
+ # Format is:
249
+ # `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`
250
+ class GetProductSetRequest; end
251
+
252
+ # Request message for the `UpdateProductSet` method.
253
+ # @!attribute [rw] product_set
254
+ # @return [Google::Cloud::Vision::V1::ProductSet]
255
+ # The ProductSet resource which replaces the one on the server.
256
+ # @!attribute [rw] update_mask
257
+ # @return [Google::Protobuf::FieldMask]
258
+ # The {Google::Protobuf::FieldMask FieldMask} that specifies which fields to
259
+ # update.
260
+ # If update_mask isn't specified, all mutable fields are to be updated.
261
+ # Valid mask path is `display_name`.
262
+ class UpdateProductSetRequest; end
263
+
264
+ # Request message for the `DeleteProductSet` method.
265
+ # @!attribute [rw] name
266
+ # @return [String]
267
+ # Resource name of the ProductSet to delete.
268
+ #
269
+ # Format is:
270
+ # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
271
+ class DeleteProductSetRequest; end
272
+
273
+ # Request message for the `CreateReferenceImage` method.
274
+ # @!attribute [rw] parent
275
+ # @return [String]
276
+ # Resource name of the product in which to create the reference image.
277
+ #
278
+ # Format is
279
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
280
+ # @!attribute [rw] reference_image
281
+ # @return [Google::Cloud::Vision::V1::ReferenceImage]
282
+ # The reference image to create.
283
+ # If an image ID is specified, it is ignored.
284
+ # @!attribute [rw] reference_image_id
285
+ # @return [String]
286
+ # A user-supplied resource id for the ReferenceImage to be added. If set,
287
+ # the server will attempt to use this value as the resource id. If it is
288
+ # already in use, an error is returned with code ALREADY_EXISTS. Must be at
289
+ # most 128 characters long. It cannot contain the character `/`.
290
+ class CreateReferenceImageRequest; end
291
+
292
+ # Request message for the `ListReferenceImages` method.
293
+ # @!attribute [rw] parent
294
+ # @return [String]
295
+ # Resource name of the product containing the reference images.
296
+ #
297
+ # Format is
298
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
299
+ # @!attribute [rw] page_size
300
+ # @return [Integer]
301
+ # The maximum number of items to return. Default 10, maximum 100.
302
+ # @!attribute [rw] page_token
303
+ # @return [String]
304
+ # A token identifying a page of results to be returned. This is the value
305
+ # of `nextPageToken` returned in a previous reference image list request.
306
+ #
307
+ # Defaults to the first page if not specified.
308
+ class ListReferenceImagesRequest; end
309
+
310
+ # Response message for the `ListReferenceImages` method.
311
+ # @!attribute [rw] reference_images
312
+ # @return [Array<Google::Cloud::Vision::V1::ReferenceImage>]
313
+ # The list of reference images.
314
+ # @!attribute [rw] page_size
315
+ # @return [Integer]
316
+ # The maximum number of items to return. Default 10, maximum 100.
317
+ # @!attribute [rw] next_page_token
318
+ # @return [String]
319
+ # The next_page_token returned from a previous List request, if any.
320
+ class ListReferenceImagesResponse; end
321
+
322
+ # Request message for the `GetReferenceImage` method.
323
+ # @!attribute [rw] name
324
+ # @return [String]
325
+ # The resource name of the ReferenceImage to get.
326
+ #
327
+ # Format is:
328
+ #
329
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
330
+ class GetReferenceImageRequest; end
331
+
332
+ # Request message for the `DeleteReferenceImage` method.
333
+ # @!attribute [rw] name
334
+ # @return [String]
335
+ # The resource name of the reference image to delete.
336
+ #
337
+ # Format is:
338
+ #
339
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
340
+ class DeleteReferenceImageRequest; end
341
+
342
+ # Request message for the `AddProductToProductSet` method.
343
+ # @!attribute [rw] name
344
+ # @return [String]
345
+ # The resource name for the ProductSet to modify.
346
+ #
347
+ # Format is:
348
+ # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
349
+ # @!attribute [rw] product
350
+ # @return [String]
351
+ # The resource name for the Product to be added to this ProductSet.
352
+ #
353
+ # Format is:
354
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
355
+ class AddProductToProductSetRequest; end
356
+
357
+ # Request message for the `RemoveProductFromProductSet` method.
358
+ # @!attribute [rw] name
359
+ # @return [String]
360
+ # The resource name for the ProductSet to modify.
361
+ #
362
+ # Format is:
363
+ # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
364
+ # @!attribute [rw] product
365
+ # @return [String]
366
+ # The resource name for the Product to be removed from this ProductSet.
367
+ #
368
+ # Format is:
369
+ # `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
370
+ class RemoveProductFromProductSetRequest; end
371
+
372
+ # Request message for the `ListProductsInProductSet` method.
373
+ # @!attribute [rw] name
374
+ # @return [String]
375
+ # The ProductSet resource for which to retrieve Products.
376
+ #
377
+ # Format is:
378
+ # `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
379
+ # @!attribute [rw] page_size
380
+ # @return [Integer]
381
+ # The maximum number of items to return. Default 10, maximum 100.
382
+ # @!attribute [rw] page_token
383
+ # @return [String]
384
+ # The next_page_token returned from a previous List request, if any.
385
+ class ListProductsInProductSetRequest; end
386
+
387
+ # Response message for the `ListProductsInProductSet` method.
388
+ # @!attribute [rw] products
389
+ # @return [Array<Google::Cloud::Vision::V1::Product>]
390
+ # The list of Products.
391
+ # @!attribute [rw] next_page_token
392
+ # @return [String]
393
+ # Token to retrieve the next page of results, or empty if there are no more
394
+ # results in the list.
395
+ class ListProductsInProductSetResponse; end
396
+
397
+ # The Google Cloud Storage location for a csv file which preserves a list of
398
+ # ImportProductSetRequests in each line.
399
+ # @!attribute [rw] csv_file_uri
400
+ # @return [String]
401
+ # The Google Cloud Storage URI of the input csv file.
402
+ #
403
+ # The URI must start with `gs://`.
404
+ #
405
+ # The format of the input csv file should be one image per line.
406
+ # In each line, there are 8 columns.
407
+ #
408
+ # 1. image-uri
409
+ # 2. image-id
410
+ # 3. product-set-id
411
+ # 4. product-id
412
+ # 5. product-category
413
+ # 6. product-display-name
414
+ # 7. labels
415
+ # 8. bounding-poly
416
+ #
417
+ # The `image-uri`, `product-set-id`, `product-id`, and `product-category`
418
+ # columns are required. All other columns are optional.
419
+ #
420
+ # If the `ProductSet` or `Product` specified by the `product-set-id` and
421
+ # `product-id` values does not exist, then the system will create a new
422
+ # `ProductSet` or `Product` for the image. In this case, the
423
+ # `product-display-name` column refers to
424
+ # {Google::Cloud::Vision::V1::Product#display_name display_name}, the
425
+ # `product-category` column refers to
426
+ # {Google::Cloud::Vision::V1::Product#product_category product_category}, and the
427
+ # `labels` column refers to {Google::Cloud::Vision::V1::Product#product_labels product_labels}.
428
+ #
429
+ # The `image-id` column is optional but must be unique if provided. If it is
430
+ # empty, the system will automatically assign a unique id to the image.
431
+ #
432
+ # The `product-display-name` column is optional. If it is empty, the system
433
+ # sets the {Google::Cloud::Vision::V1::Product#display_name display_name} field for the product to a
434
+ # space (" "). You can update the `display_name` later by using the API.
435
+ #
436
+ # If a `Product` with the specified `product-id` already exists, then the
437
+ # system ignores the `product-display-name`, `product-category`, and `labels`
438
+ # columns.
439
+ #
440
+ # The `labels` column (optional) is a line containing a list of
441
+ # comma-separated key-value pairs, in the following format:
442
+ #
443
+ # "key_1=value_1,key_2=value_2,...,key_n=value_n"
444
+ #
445
+ # The `bounding-poly` column (optional) identifies one region of
446
+ # interest from the image in the same manner as `CreateReferenceImage`. If
447
+ # you do not specify the `bounding-poly` column, then the system will try to
448
+ # detect regions of interest automatically.
449
+ #
450
+ # At most one `bounding-poly` column is allowed per line. If the image
451
+ # contains multiple regions of interest, add a line to the CSV file that
452
+ # includes the same product information, and the `bounding-poly` values for
453
+ # each region of interest.
454
+ #
455
+ # The `bounding-poly` column must contain an even number of comma-separated
456
+ # numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use
457
+ # non-negative integers for absolute bounding polygons, and float values
458
+ # in [0, 1] for normalized bounding polygons.
459
+ #
460
+ # The system will resize the image if the image resolution is too
461
+ # large to process (larger than 20MP).
462
+ class ImportProductSetsGcsSource; end
463
+
464
+ # The input content for the `ImportProductSets` method.
465
+ # @!attribute [rw] gcs_source
466
+ # @return [Google::Cloud::Vision::V1::ImportProductSetsGcsSource]
467
+ # The Google Cloud Storage location for a csv file which preserves a list
468
+ # of ImportProductSetRequests in each line.
469
+ class ImportProductSetsInputConfig; end
470
+
471
+ # Request message for the `ImportProductSets` method.
472
+ # @!attribute [rw] parent
473
+ # @return [String]
474
+ # The project in which the ProductSets should be imported.
475
+ #
476
+ # Format is `projects/PROJECT_ID/locations/LOC_ID`.
477
+ # @!attribute [rw] input_config
478
+ # @return [Google::Cloud::Vision::V1::ImportProductSetsInputConfig]
479
+ # The input content for the list of requests.
480
+ class ImportProductSetsRequest; end
481
+
482
+ # Response message for the `ImportProductSets` method.
483
+ #
484
+ # This message is returned by the
485
+ # {Google::Longrunning::Operations::GetOperation} method in the returned
486
+ # {Google::Longrunning::Operation#response} field.
487
+ # @!attribute [rw] reference_images
488
+ # @return [Array<Google::Cloud::Vision::V1::ReferenceImage>]
489
+ # The list of reference_images that are imported successfully.
490
+ # @!attribute [rw] statuses
491
+ # @return [Array<Google::Rpc::Status>]
492
+ # The rpc status for each ImportProductSet request, including both successes
493
+ # and errors.
494
+ #
495
+ # The number of statuses here matches the number of lines in the csv file,
496
+ # and statuses[i] stores the success or failure status of processing the i-th
497
+ # line of the csv, starting from line 0.
498
+ class ImportProductSetsResponse; end
499
+
500
+ # Metadata for the batch operations such as the current state.
501
+ #
502
+ # This is included in the `metadata` field of the `Operation` returned by the
503
+ # `GetOperation` call of the `google::longrunning::Operations` service.
504
+ # @!attribute [rw] state
505
+ # @return [Google::Cloud::Vision::V1::BatchOperationMetadata::State]
506
+ # The current state of the batch operation.
507
+ # @!attribute [rw] submit_time
508
+ # @return [Google::Protobuf::Timestamp]
509
+ # The time when the batch request was submitted to the server.
510
+ # @!attribute [rw] end_time
511
+ # @return [Google::Protobuf::Timestamp]
512
+ # The time when the batch request is finished and
513
+ # {Google::Longrunning::Operation#done} is set to true.
514
+ class BatchOperationMetadata
515
+ # Enumerates the possible states that the batch request can be in.
516
+ module State
517
+ # Invalid.
518
+ STATE_UNSPECIFIED = 0
519
+
520
+ # Request is actively being processed.
521
+ PROCESSING = 1
522
+
523
+ # The request is done and at least one item has been successfully
524
+ # processed.
525
+ SUCCESSFUL = 2
526
+
527
+ # The request is done and no item has been successfully processed.
528
+ FAILED = 3
529
+
530
+ # The request is done after the longrunning.Operations.CancelOperation has
531
+ # been called by the user. Any records that were processed before the
532
+ # cancel command are output as specified in the request.
533
+ CANCELLED = 4
534
+ end
535
+ end
536
+ end
537
+ end
538
+ end
539
+ end