google-apis-vision_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1503 @@
1
+ # Copyright 2020 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
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module VisionV1
23
+ # Cloud Vision API
24
+ #
25
+ # Integrates Google Vision features, including image labeling, face, logo, and
26
+ # landmark detection, optical character recognition (OCR), and detection of
27
+ # explicit content, into applications.
28
+ #
29
+ # @example
30
+ # require 'google/apis/vision_v1'
31
+ #
32
+ # Vision = Google::Apis::VisionV1 # Alias the module
33
+ # service = Vision::VisionService.new
34
+ #
35
+ # @see https://cloud.google.com/vision/
36
+ class VisionService < Google::Apis::Core::BaseService
37
+ # @return [String]
38
+ # API key. Your API key identifies your project and provides you with API access,
39
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
40
+ attr_accessor :key
41
+
42
+ # @return [String]
43
+ # Available to use for quota purposes for server-side applications. Can be any
44
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
45
+ attr_accessor :quota_user
46
+
47
+ def initialize
48
+ super('https://vision.googleapis.com/', '',
49
+ client_name: 'google-apis-vision_v1',
50
+ client_version: Google::Apis::VisionV1::GEM_VERSION)
51
+ @batch_path = 'batch'
52
+ end
53
+
54
+ # Service that performs image detection and annotation for a batch of files. Now
55
+ # only "application/pdf", "image/tiff" and "image/gif" are supported. This
56
+ # service will extract at most 5 (customers can specify which 5 in
57
+ # AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file
58
+ # provided and perform detection and annotation for each image extracted.
59
+ # @param [Google::Apis::VisionV1::BatchAnnotateFilesRequest] batch_annotate_files_request_object
60
+ # @param [String] fields
61
+ # Selector specifying which fields to include in a partial response.
62
+ # @param [String] quota_user
63
+ # Available to use for quota purposes for server-side applications. Can be any
64
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
65
+ # @param [Google::Apis::RequestOptions] options
66
+ # Request-specific options
67
+ #
68
+ # @yield [result, err] Result & error if block supplied
69
+ # @yieldparam result [Google::Apis::VisionV1::BatchAnnotateFilesResponse] parsed result object
70
+ # @yieldparam err [StandardError] error object if request failed
71
+ #
72
+ # @return [Google::Apis::VisionV1::BatchAnnotateFilesResponse]
73
+ #
74
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
75
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
76
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
77
+ def annotate_file(batch_annotate_files_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
78
+ command = make_simple_command(:post, 'v1/files:annotate', options)
79
+ command.request_representation = Google::Apis::VisionV1::BatchAnnotateFilesRequest::Representation
80
+ command.request_object = batch_annotate_files_request_object
81
+ command.response_representation = Google::Apis::VisionV1::BatchAnnotateFilesResponse::Representation
82
+ command.response_class = Google::Apis::VisionV1::BatchAnnotateFilesResponse
83
+ command.query['fields'] = fields unless fields.nil?
84
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
85
+ execute_or_queue_command(command, &block)
86
+ end
87
+
88
+ # Run asynchronous image detection and annotation for a list of generic files,
89
+ # such as PDF files, which may contain multiple pages and multiple images per
90
+ # page. Progress and results can be retrieved through the `google.longrunning.
91
+ # Operations` interface. `Operation.metadata` contains `OperationMetadata` (
92
+ # metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (
93
+ # results).
94
+ # @param [Google::Apis::VisionV1::AsyncBatchAnnotateFilesRequest] async_batch_annotate_files_request_object
95
+ # @param [String] fields
96
+ # Selector specifying which fields to include in a partial response.
97
+ # @param [String] quota_user
98
+ # Available to use for quota purposes for server-side applications. Can be any
99
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
100
+ # @param [Google::Apis::RequestOptions] options
101
+ # Request-specific options
102
+ #
103
+ # @yield [result, err] Result & error if block supplied
104
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
105
+ # @yieldparam err [StandardError] error object if request failed
106
+ #
107
+ # @return [Google::Apis::VisionV1::Operation]
108
+ #
109
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
110
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
111
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
112
+ def async_batch_annotate_files(async_batch_annotate_files_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
113
+ command = make_simple_command(:post, 'v1/files:asyncBatchAnnotate', options)
114
+ command.request_representation = Google::Apis::VisionV1::AsyncBatchAnnotateFilesRequest::Representation
115
+ command.request_object = async_batch_annotate_files_request_object
116
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
117
+ command.response_class = Google::Apis::VisionV1::Operation
118
+ command.query['fields'] = fields unless fields.nil?
119
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
120
+ execute_or_queue_command(command, &block)
121
+ end
122
+
123
+ # Run image detection and annotation for a batch of images.
124
+ # @param [Google::Apis::VisionV1::BatchAnnotateImagesRequest] batch_annotate_images_request_object
125
+ # @param [String] fields
126
+ # Selector specifying which fields to include in a partial response.
127
+ # @param [String] quota_user
128
+ # Available to use for quota purposes for server-side applications. Can be any
129
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
130
+ # @param [Google::Apis::RequestOptions] options
131
+ # Request-specific options
132
+ #
133
+ # @yield [result, err] Result & error if block supplied
134
+ # @yieldparam result [Google::Apis::VisionV1::BatchAnnotateImagesResponse] parsed result object
135
+ # @yieldparam err [StandardError] error object if request failed
136
+ #
137
+ # @return [Google::Apis::VisionV1::BatchAnnotateImagesResponse]
138
+ #
139
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
140
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
141
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
142
+ def annotate_image(batch_annotate_images_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
143
+ command = make_simple_command(:post, 'v1/images:annotate', options)
144
+ command.request_representation = Google::Apis::VisionV1::BatchAnnotateImagesRequest::Representation
145
+ command.request_object = batch_annotate_images_request_object
146
+ command.response_representation = Google::Apis::VisionV1::BatchAnnotateImagesResponse::Representation
147
+ command.response_class = Google::Apis::VisionV1::BatchAnnotateImagesResponse
148
+ command.query['fields'] = fields unless fields.nil?
149
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
150
+ execute_or_queue_command(command, &block)
151
+ end
152
+
153
+ # Run asynchronous image detection and annotation for a list of images. Progress
154
+ # and results can be retrieved through the `google.longrunning.Operations`
155
+ # interface. `Operation.metadata` contains `OperationMetadata` (metadata). `
156
+ # Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results).
157
+ # This service will write image annotation outputs to json files in customer GCS
158
+ # bucket, each json file containing BatchAnnotateImagesResponse proto.
159
+ # @param [Google::Apis::VisionV1::AsyncBatchAnnotateImagesRequest] async_batch_annotate_images_request_object
160
+ # @param [String] fields
161
+ # Selector specifying which fields to include in a partial response.
162
+ # @param [String] quota_user
163
+ # Available to use for quota purposes for server-side applications. Can be any
164
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
165
+ # @param [Google::Apis::RequestOptions] options
166
+ # Request-specific options
167
+ #
168
+ # @yield [result, err] Result & error if block supplied
169
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
170
+ # @yieldparam err [StandardError] error object if request failed
171
+ #
172
+ # @return [Google::Apis::VisionV1::Operation]
173
+ #
174
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
175
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
176
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
177
+ def async_batch_annotate_images(async_batch_annotate_images_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
178
+ command = make_simple_command(:post, 'v1/images:asyncBatchAnnotate', options)
179
+ command.request_representation = Google::Apis::VisionV1::AsyncBatchAnnotateImagesRequest::Representation
180
+ command.request_object = async_batch_annotate_images_request_object
181
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
182
+ command.response_class = Google::Apis::VisionV1::Operation
183
+ command.query['fields'] = fields unless fields.nil?
184
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
185
+ execute_or_queue_command(command, &block)
186
+ end
187
+
188
+ # Gets the latest state of a long-running operation. Clients can use this method
189
+ # to poll the operation result at intervals as recommended by the API service.
190
+ # @param [String] name
191
+ # The name of the operation resource.
192
+ # @param [String] fields
193
+ # Selector specifying which fields to include in a partial response.
194
+ # @param [String] quota_user
195
+ # Available to use for quota purposes for server-side applications. Can be any
196
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
197
+ # @param [Google::Apis::RequestOptions] options
198
+ # Request-specific options
199
+ #
200
+ # @yield [result, err] Result & error if block supplied
201
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
202
+ # @yieldparam err [StandardError] error object if request failed
203
+ #
204
+ # @return [Google::Apis::VisionV1::Operation]
205
+ #
206
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
207
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
208
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
209
+ def get_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
210
+ command = make_simple_command(:get, 'v1/{+name}', options)
211
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
212
+ command.response_class = Google::Apis::VisionV1::Operation
213
+ command.params['name'] = name unless name.nil?
214
+ command.query['fields'] = fields unless fields.nil?
215
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
216
+ execute_or_queue_command(command, &block)
217
+ end
218
+
219
+ # Starts asynchronous cancellation on a long-running operation. The server makes
220
+ # a best effort to cancel the operation, but success is not guaranteed. If the
221
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
222
+ # Clients can use Operations.GetOperation or other methods to check whether the
223
+ # cancellation succeeded or whether the operation completed despite cancellation.
224
+ # On successful cancellation, the operation is not deleted; instead, it becomes
225
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
226
+ # corresponding to `Code.CANCELLED`.
227
+ # @param [String] name
228
+ # The name of the operation resource to be cancelled.
229
+ # @param [Google::Apis::VisionV1::CancelOperationRequest] cancel_operation_request_object
230
+ # @param [String] fields
231
+ # Selector specifying which fields to include in a partial response.
232
+ # @param [String] quota_user
233
+ # Available to use for quota purposes for server-side applications. Can be any
234
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
235
+ # @param [Google::Apis::RequestOptions] options
236
+ # Request-specific options
237
+ #
238
+ # @yield [result, err] Result & error if block supplied
239
+ # @yieldparam result [Google::Apis::VisionV1::Empty] parsed result object
240
+ # @yieldparam err [StandardError] error object if request failed
241
+ #
242
+ # @return [Google::Apis::VisionV1::Empty]
243
+ #
244
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
245
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
246
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
247
+ def cancel_operation(name, cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
248
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
249
+ command.request_representation = Google::Apis::VisionV1::CancelOperationRequest::Representation
250
+ command.request_object = cancel_operation_request_object
251
+ command.response_representation = Google::Apis::VisionV1::Empty::Representation
252
+ command.response_class = Google::Apis::VisionV1::Empty
253
+ command.params['name'] = name unless name.nil?
254
+ command.query['fields'] = fields unless fields.nil?
255
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
256
+ execute_or_queue_command(command, &block)
257
+ end
258
+
259
+ # Deletes a long-running operation. This method indicates that the client is no
260
+ # longer interested in the operation result. It does not cancel the operation.
261
+ # If the server doesn't support this method, it returns `google.rpc.Code.
262
+ # UNIMPLEMENTED`.
263
+ # @param [String] name
264
+ # The name of the operation resource to be deleted.
265
+ # @param [String] fields
266
+ # Selector specifying which fields to include in a partial response.
267
+ # @param [String] quota_user
268
+ # Available to use for quota purposes for server-side applications. Can be any
269
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
270
+ # @param [Google::Apis::RequestOptions] options
271
+ # Request-specific options
272
+ #
273
+ # @yield [result, err] Result & error if block supplied
274
+ # @yieldparam result [Google::Apis::VisionV1::Empty] parsed result object
275
+ # @yieldparam err [StandardError] error object if request failed
276
+ #
277
+ # @return [Google::Apis::VisionV1::Empty]
278
+ #
279
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
280
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
281
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
282
+ def delete_operation(name, fields: nil, quota_user: nil, options: nil, &block)
283
+ command = make_simple_command(:delete, 'v1/{+name}', options)
284
+ command.response_representation = Google::Apis::VisionV1::Empty::Representation
285
+ command.response_class = Google::Apis::VisionV1::Empty
286
+ command.params['name'] = name unless name.nil?
287
+ command.query['fields'] = fields unless fields.nil?
288
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
289
+ execute_or_queue_command(command, &block)
290
+ end
291
+
292
+ # Gets the latest state of a long-running operation. Clients can use this method
293
+ # to poll the operation result at intervals as recommended by the API service.
294
+ # @param [String] name
295
+ # The name of the operation resource.
296
+ # @param [String] fields
297
+ # Selector specifying which fields to include in a partial response.
298
+ # @param [String] quota_user
299
+ # Available to use for quota purposes for server-side applications. Can be any
300
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
301
+ # @param [Google::Apis::RequestOptions] options
302
+ # Request-specific options
303
+ #
304
+ # @yield [result, err] Result & error if block supplied
305
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
306
+ # @yieldparam err [StandardError] error object if request failed
307
+ #
308
+ # @return [Google::Apis::VisionV1::Operation]
309
+ #
310
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
311
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
312
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
313
+ def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
314
+ command = make_simple_command(:get, 'v1/{+name}', options)
315
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
316
+ command.response_class = Google::Apis::VisionV1::Operation
317
+ command.params['name'] = name unless name.nil?
318
+ command.query['fields'] = fields unless fields.nil?
319
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
320
+ execute_or_queue_command(command, &block)
321
+ end
322
+
323
+ # Lists operations that match the specified filter in the request. If the server
324
+ # doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
325
+ # binding allows API services to override the binding to use different resource
326
+ # name schemes, such as `users/*/operations`. To override the binding, API
327
+ # services can add a binding such as `"/v1/`name=users/*`/operations"` to their
328
+ # service configuration. For backwards compatibility, the default name includes
329
+ # the operations collection id, however overriding users must ensure the name
330
+ # binding is the parent resource, without the operations collection id.
331
+ # @param [String] name
332
+ # The name of the operation's parent resource.
333
+ # @param [String] filter
334
+ # The standard list filter.
335
+ # @param [Fixnum] page_size
336
+ # The standard list page size.
337
+ # @param [String] page_token
338
+ # The standard list page token.
339
+ # @param [String] fields
340
+ # Selector specifying which fields to include in a partial response.
341
+ # @param [String] quota_user
342
+ # Available to use for quota purposes for server-side applications. Can be any
343
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
344
+ # @param [Google::Apis::RequestOptions] options
345
+ # Request-specific options
346
+ #
347
+ # @yield [result, err] Result & error if block supplied
348
+ # @yieldparam result [Google::Apis::VisionV1::ListOperationsResponse] parsed result object
349
+ # @yieldparam err [StandardError] error object if request failed
350
+ #
351
+ # @return [Google::Apis::VisionV1::ListOperationsResponse]
352
+ #
353
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
354
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
355
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
356
+ def list_operations(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
357
+ command = make_simple_command(:get, 'v1/{+name}', options)
358
+ command.response_representation = Google::Apis::VisionV1::ListOperationsResponse::Representation
359
+ command.response_class = Google::Apis::VisionV1::ListOperationsResponse
360
+ command.params['name'] = name unless name.nil?
361
+ command.query['filter'] = filter unless filter.nil?
362
+ command.query['pageSize'] = page_size unless page_size.nil?
363
+ command.query['pageToken'] = page_token unless page_token.nil?
364
+ command.query['fields'] = fields unless fields.nil?
365
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
366
+ execute_or_queue_command(command, &block)
367
+ end
368
+
369
+ # Service that performs image detection and annotation for a batch of files. Now
370
+ # only "application/pdf", "image/tiff" and "image/gif" are supported. This
371
+ # service will extract at most 5 (customers can specify which 5 in
372
+ # AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file
373
+ # provided and perform detection and annotation for each image extracted.
374
+ # @param [String] parent
375
+ # Optional. Target project and location to make a call. Format: `projects/`
376
+ # project-id`/locations/`location-id``. If no parent is specified, a region will
377
+ # be chosen automatically. Supported location-ids: `us`: USA country only, `asia`
378
+ # : East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `
379
+ # projects/project-A/locations/eu`.
380
+ # @param [Google::Apis::VisionV1::BatchAnnotateFilesRequest] batch_annotate_files_request_object
381
+ # @param [String] fields
382
+ # Selector specifying which fields to include in a partial response.
383
+ # @param [String] quota_user
384
+ # Available to use for quota purposes for server-side applications. Can be any
385
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
386
+ # @param [Google::Apis::RequestOptions] options
387
+ # Request-specific options
388
+ #
389
+ # @yield [result, err] Result & error if block supplied
390
+ # @yieldparam result [Google::Apis::VisionV1::BatchAnnotateFilesResponse] parsed result object
391
+ # @yieldparam err [StandardError] error object if request failed
392
+ #
393
+ # @return [Google::Apis::VisionV1::BatchAnnotateFilesResponse]
394
+ #
395
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
396
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
397
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
398
+ def annotate_project_file(parent, batch_annotate_files_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
399
+ command = make_simple_command(:post, 'v1/{+parent}/files:annotate', options)
400
+ command.request_representation = Google::Apis::VisionV1::BatchAnnotateFilesRequest::Representation
401
+ command.request_object = batch_annotate_files_request_object
402
+ command.response_representation = Google::Apis::VisionV1::BatchAnnotateFilesResponse::Representation
403
+ command.response_class = Google::Apis::VisionV1::BatchAnnotateFilesResponse
404
+ command.params['parent'] = parent unless parent.nil?
405
+ command.query['fields'] = fields unless fields.nil?
406
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
407
+ execute_or_queue_command(command, &block)
408
+ end
409
+
410
+ # Run asynchronous image detection and annotation for a list of generic files,
411
+ # such as PDF files, which may contain multiple pages and multiple images per
412
+ # page. Progress and results can be retrieved through the `google.longrunning.
413
+ # Operations` interface. `Operation.metadata` contains `OperationMetadata` (
414
+ # metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (
415
+ # results).
416
+ # @param [String] parent
417
+ # Optional. Target project and location to make a call. Format: `projects/`
418
+ # project-id`/locations/`location-id``. If no parent is specified, a region will
419
+ # be chosen automatically. Supported location-ids: `us`: USA country only, `asia`
420
+ # : East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `
421
+ # projects/project-A/locations/eu`.
422
+ # @param [Google::Apis::VisionV1::AsyncBatchAnnotateFilesRequest] async_batch_annotate_files_request_object
423
+ # @param [String] fields
424
+ # Selector specifying which fields to include in a partial response.
425
+ # @param [String] quota_user
426
+ # Available to use for quota purposes for server-side applications. Can be any
427
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
428
+ # @param [Google::Apis::RequestOptions] options
429
+ # Request-specific options
430
+ #
431
+ # @yield [result, err] Result & error if block supplied
432
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
433
+ # @yieldparam err [StandardError] error object if request failed
434
+ #
435
+ # @return [Google::Apis::VisionV1::Operation]
436
+ #
437
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
438
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
439
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
440
+ def async_project_file_batch_annotate(parent, async_batch_annotate_files_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
441
+ command = make_simple_command(:post, 'v1/{+parent}/files:asyncBatchAnnotate', options)
442
+ command.request_representation = Google::Apis::VisionV1::AsyncBatchAnnotateFilesRequest::Representation
443
+ command.request_object = async_batch_annotate_files_request_object
444
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
445
+ command.response_class = Google::Apis::VisionV1::Operation
446
+ command.params['parent'] = parent unless parent.nil?
447
+ command.query['fields'] = fields unless fields.nil?
448
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
449
+ execute_or_queue_command(command, &block)
450
+ end
451
+
452
+ # Run image detection and annotation for a batch of images.
453
+ # @param [String] parent
454
+ # Optional. Target project and location to make a call. Format: `projects/`
455
+ # project-id`/locations/`location-id``. If no parent is specified, a region will
456
+ # be chosen automatically. Supported location-ids: `us`: USA country only, `asia`
457
+ # : East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `
458
+ # projects/project-A/locations/eu`.
459
+ # @param [Google::Apis::VisionV1::BatchAnnotateImagesRequest] batch_annotate_images_request_object
460
+ # @param [String] fields
461
+ # Selector specifying which fields to include in a partial response.
462
+ # @param [String] quota_user
463
+ # Available to use for quota purposes for server-side applications. Can be any
464
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
465
+ # @param [Google::Apis::RequestOptions] options
466
+ # Request-specific options
467
+ #
468
+ # @yield [result, err] Result & error if block supplied
469
+ # @yieldparam result [Google::Apis::VisionV1::BatchAnnotateImagesResponse] parsed result object
470
+ # @yieldparam err [StandardError] error object if request failed
471
+ #
472
+ # @return [Google::Apis::VisionV1::BatchAnnotateImagesResponse]
473
+ #
474
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
475
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
476
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
477
+ def annotate_project_image(parent, batch_annotate_images_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
478
+ command = make_simple_command(:post, 'v1/{+parent}/images:annotate', options)
479
+ command.request_representation = Google::Apis::VisionV1::BatchAnnotateImagesRequest::Representation
480
+ command.request_object = batch_annotate_images_request_object
481
+ command.response_representation = Google::Apis::VisionV1::BatchAnnotateImagesResponse::Representation
482
+ command.response_class = Google::Apis::VisionV1::BatchAnnotateImagesResponse
483
+ command.params['parent'] = parent unless parent.nil?
484
+ command.query['fields'] = fields unless fields.nil?
485
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
486
+ execute_or_queue_command(command, &block)
487
+ end
488
+
489
+ # Run asynchronous image detection and annotation for a list of images. Progress
490
+ # and results can be retrieved through the `google.longrunning.Operations`
491
+ # interface. `Operation.metadata` contains `OperationMetadata` (metadata). `
492
+ # Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results).
493
+ # This service will write image annotation outputs to json files in customer GCS
494
+ # bucket, each json file containing BatchAnnotateImagesResponse proto.
495
+ # @param [String] parent
496
+ # Optional. Target project and location to make a call. Format: `projects/`
497
+ # project-id`/locations/`location-id``. If no parent is specified, a region will
498
+ # be chosen automatically. Supported location-ids: `us`: USA country only, `asia`
499
+ # : East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `
500
+ # projects/project-A/locations/eu`.
501
+ # @param [Google::Apis::VisionV1::AsyncBatchAnnotateImagesRequest] async_batch_annotate_images_request_object
502
+ # @param [String] fields
503
+ # Selector specifying which fields to include in a partial response.
504
+ # @param [String] quota_user
505
+ # Available to use for quota purposes for server-side applications. Can be any
506
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
507
+ # @param [Google::Apis::RequestOptions] options
508
+ # Request-specific options
509
+ #
510
+ # @yield [result, err] Result & error if block supplied
511
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
512
+ # @yieldparam err [StandardError] error object if request failed
513
+ #
514
+ # @return [Google::Apis::VisionV1::Operation]
515
+ #
516
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
517
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
518
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
519
+ def async_project_image_batch_annotate(parent, async_batch_annotate_images_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
520
+ command = make_simple_command(:post, 'v1/{+parent}/images:asyncBatchAnnotate', options)
521
+ command.request_representation = Google::Apis::VisionV1::AsyncBatchAnnotateImagesRequest::Representation
522
+ command.request_object = async_batch_annotate_images_request_object
523
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
524
+ command.response_class = Google::Apis::VisionV1::Operation
525
+ command.params['parent'] = parent unless parent.nil?
526
+ command.query['fields'] = fields unless fields.nil?
527
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
528
+ execute_or_queue_command(command, &block)
529
+ end
530
+
531
+ # Service that performs image detection and annotation for a batch of files. Now
532
+ # only "application/pdf", "image/tiff" and "image/gif" are supported. This
533
+ # service will extract at most 5 (customers can specify which 5 in
534
+ # AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file
535
+ # provided and perform detection and annotation for each image extracted.
536
+ # @param [String] parent
537
+ # Optional. Target project and location to make a call. Format: `projects/`
538
+ # project-id`/locations/`location-id``. If no parent is specified, a region will
539
+ # be chosen automatically. Supported location-ids: `us`: USA country only, `asia`
540
+ # : East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `
541
+ # projects/project-A/locations/eu`.
542
+ # @param [Google::Apis::VisionV1::BatchAnnotateFilesRequest] batch_annotate_files_request_object
543
+ # @param [String] fields
544
+ # Selector specifying which fields to include in a partial response.
545
+ # @param [String] quota_user
546
+ # Available to use for quota purposes for server-side applications. Can be any
547
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
548
+ # @param [Google::Apis::RequestOptions] options
549
+ # Request-specific options
550
+ #
551
+ # @yield [result, err] Result & error if block supplied
552
+ # @yieldparam result [Google::Apis::VisionV1::BatchAnnotateFilesResponse] parsed result object
553
+ # @yieldparam err [StandardError] error object if request failed
554
+ #
555
+ # @return [Google::Apis::VisionV1::BatchAnnotateFilesResponse]
556
+ #
557
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
558
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
559
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
560
+ def annotate_project_location_file(parent, batch_annotate_files_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
561
+ command = make_simple_command(:post, 'v1/{+parent}/files:annotate', options)
562
+ command.request_representation = Google::Apis::VisionV1::BatchAnnotateFilesRequest::Representation
563
+ command.request_object = batch_annotate_files_request_object
564
+ command.response_representation = Google::Apis::VisionV1::BatchAnnotateFilesResponse::Representation
565
+ command.response_class = Google::Apis::VisionV1::BatchAnnotateFilesResponse
566
+ command.params['parent'] = parent unless parent.nil?
567
+ command.query['fields'] = fields unless fields.nil?
568
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
569
+ execute_or_queue_command(command, &block)
570
+ end
571
+
572
+ # Run asynchronous image detection and annotation for a list of generic files,
573
+ # such as PDF files, which may contain multiple pages and multiple images per
574
+ # page. Progress and results can be retrieved through the `google.longrunning.
575
+ # Operations` interface. `Operation.metadata` contains `OperationMetadata` (
576
+ # metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (
577
+ # results).
578
+ # @param [String] parent
579
+ # Optional. Target project and location to make a call. Format: `projects/`
580
+ # project-id`/locations/`location-id``. If no parent is specified, a region will
581
+ # be chosen automatically. Supported location-ids: `us`: USA country only, `asia`
582
+ # : East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `
583
+ # projects/project-A/locations/eu`.
584
+ # @param [Google::Apis::VisionV1::AsyncBatchAnnotateFilesRequest] async_batch_annotate_files_request_object
585
+ # @param [String] fields
586
+ # Selector specifying which fields to include in a partial response.
587
+ # @param [String] quota_user
588
+ # Available to use for quota purposes for server-side applications. Can be any
589
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
590
+ # @param [Google::Apis::RequestOptions] options
591
+ # Request-specific options
592
+ #
593
+ # @yield [result, err] Result & error if block supplied
594
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
595
+ # @yieldparam err [StandardError] error object if request failed
596
+ #
597
+ # @return [Google::Apis::VisionV1::Operation]
598
+ #
599
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
600
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
601
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
602
+ def async_project_location_file_batch_annotate(parent, async_batch_annotate_files_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
603
+ command = make_simple_command(:post, 'v1/{+parent}/files:asyncBatchAnnotate', options)
604
+ command.request_representation = Google::Apis::VisionV1::AsyncBatchAnnotateFilesRequest::Representation
605
+ command.request_object = async_batch_annotate_files_request_object
606
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
607
+ command.response_class = Google::Apis::VisionV1::Operation
608
+ command.params['parent'] = parent unless parent.nil?
609
+ command.query['fields'] = fields unless fields.nil?
610
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
611
+ execute_or_queue_command(command, &block)
612
+ end
613
+
614
+ # Run image detection and annotation for a batch of images.
615
+ # @param [String] parent
616
+ # Optional. Target project and location to make a call. Format: `projects/`
617
+ # project-id`/locations/`location-id``. If no parent is specified, a region will
618
+ # be chosen automatically. Supported location-ids: `us`: USA country only, `asia`
619
+ # : East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `
620
+ # projects/project-A/locations/eu`.
621
+ # @param [Google::Apis::VisionV1::BatchAnnotateImagesRequest] batch_annotate_images_request_object
622
+ # @param [String] fields
623
+ # Selector specifying which fields to include in a partial response.
624
+ # @param [String] quota_user
625
+ # Available to use for quota purposes for server-side applications. Can be any
626
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
627
+ # @param [Google::Apis::RequestOptions] options
628
+ # Request-specific options
629
+ #
630
+ # @yield [result, err] Result & error if block supplied
631
+ # @yieldparam result [Google::Apis::VisionV1::BatchAnnotateImagesResponse] parsed result object
632
+ # @yieldparam err [StandardError] error object if request failed
633
+ #
634
+ # @return [Google::Apis::VisionV1::BatchAnnotateImagesResponse]
635
+ #
636
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
637
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
638
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
639
+ def annotate_project_location_image(parent, batch_annotate_images_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
640
+ command = make_simple_command(:post, 'v1/{+parent}/images:annotate', options)
641
+ command.request_representation = Google::Apis::VisionV1::BatchAnnotateImagesRequest::Representation
642
+ command.request_object = batch_annotate_images_request_object
643
+ command.response_representation = Google::Apis::VisionV1::BatchAnnotateImagesResponse::Representation
644
+ command.response_class = Google::Apis::VisionV1::BatchAnnotateImagesResponse
645
+ command.params['parent'] = parent unless parent.nil?
646
+ command.query['fields'] = fields unless fields.nil?
647
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
648
+ execute_or_queue_command(command, &block)
649
+ end
650
+
651
+ # Run asynchronous image detection and annotation for a list of images. Progress
652
+ # and results can be retrieved through the `google.longrunning.Operations`
653
+ # interface. `Operation.metadata` contains `OperationMetadata` (metadata). `
654
+ # Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results).
655
+ # This service will write image annotation outputs to json files in customer GCS
656
+ # bucket, each json file containing BatchAnnotateImagesResponse proto.
657
+ # @param [String] parent
658
+ # Optional. Target project and location to make a call. Format: `projects/`
659
+ # project-id`/locations/`location-id``. If no parent is specified, a region will
660
+ # be chosen automatically. Supported location-ids: `us`: USA country only, `asia`
661
+ # : East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `
662
+ # projects/project-A/locations/eu`.
663
+ # @param [Google::Apis::VisionV1::AsyncBatchAnnotateImagesRequest] async_batch_annotate_images_request_object
664
+ # @param [String] fields
665
+ # Selector specifying which fields to include in a partial response.
666
+ # @param [String] quota_user
667
+ # Available to use for quota purposes for server-side applications. Can be any
668
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
669
+ # @param [Google::Apis::RequestOptions] options
670
+ # Request-specific options
671
+ #
672
+ # @yield [result, err] Result & error if block supplied
673
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
674
+ # @yieldparam err [StandardError] error object if request failed
675
+ #
676
+ # @return [Google::Apis::VisionV1::Operation]
677
+ #
678
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
679
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
680
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
681
+ def async_project_location_image_batch_annotate(parent, async_batch_annotate_images_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
682
+ command = make_simple_command(:post, 'v1/{+parent}/images:asyncBatchAnnotate', options)
683
+ command.request_representation = Google::Apis::VisionV1::AsyncBatchAnnotateImagesRequest::Representation
684
+ command.request_object = async_batch_annotate_images_request_object
685
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
686
+ command.response_class = Google::Apis::VisionV1::Operation
687
+ command.params['parent'] = parent unless parent.nil?
688
+ command.query['fields'] = fields unless fields.nil?
689
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
690
+ execute_or_queue_command(command, &block)
691
+ end
692
+
693
+ # Gets the latest state of a long-running operation. Clients can use this method
694
+ # to poll the operation result at intervals as recommended by the API service.
695
+ # @param [String] name
696
+ # The name of the operation resource.
697
+ # @param [String] fields
698
+ # Selector specifying which fields to include in a partial response.
699
+ # @param [String] quota_user
700
+ # Available to use for quota purposes for server-side applications. Can be any
701
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
702
+ # @param [Google::Apis::RequestOptions] options
703
+ # Request-specific options
704
+ #
705
+ # @yield [result, err] Result & error if block supplied
706
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
707
+ # @yieldparam err [StandardError] error object if request failed
708
+ #
709
+ # @return [Google::Apis::VisionV1::Operation]
710
+ #
711
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
712
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
713
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
714
+ def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
715
+ command = make_simple_command(:get, 'v1/{+name}', options)
716
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
717
+ command.response_class = Google::Apis::VisionV1::Operation
718
+ command.params['name'] = name unless name.nil?
719
+ command.query['fields'] = fields unless fields.nil?
720
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
721
+ execute_or_queue_command(command, &block)
722
+ end
723
+
724
+ # Adds a Product to the specified ProductSet. If the Product is already present,
725
+ # no change is made. One Product can be added to at most 100 ProductSets.
726
+ # Possible errors: * Returns NOT_FOUND if the Product or the ProductSet doesn't
727
+ # exist.
728
+ # @param [String] name
729
+ # Required. The resource name for the ProductSet to modify. Format is: `projects/
730
+ # PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
731
+ # @param [Google::Apis::VisionV1::AddProductToProductSetRequest] add_product_to_product_set_request_object
732
+ # @param [String] fields
733
+ # Selector specifying which fields to include in a partial response.
734
+ # @param [String] quota_user
735
+ # Available to use for quota purposes for server-side applications. Can be any
736
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
737
+ # @param [Google::Apis::RequestOptions] options
738
+ # Request-specific options
739
+ #
740
+ # @yield [result, err] Result & error if block supplied
741
+ # @yieldparam result [Google::Apis::VisionV1::Empty] parsed result object
742
+ # @yieldparam err [StandardError] error object if request failed
743
+ #
744
+ # @return [Google::Apis::VisionV1::Empty]
745
+ #
746
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
747
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
748
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
749
+ def add_product_to_product_set(name, add_product_to_product_set_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
750
+ command = make_simple_command(:post, 'v1/{+name}:addProduct', options)
751
+ command.request_representation = Google::Apis::VisionV1::AddProductToProductSetRequest::Representation
752
+ command.request_object = add_product_to_product_set_request_object
753
+ command.response_representation = Google::Apis::VisionV1::Empty::Representation
754
+ command.response_class = Google::Apis::VisionV1::Empty
755
+ command.params['name'] = name unless name.nil?
756
+ command.query['fields'] = fields unless fields.nil?
757
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
758
+ execute_or_queue_command(command, &block)
759
+ end
760
+
761
+ # Creates and returns a new ProductSet resource. Possible errors: * Returns
762
+ # INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
763
+ # @param [String] parent
764
+ # Required. The project in which the ProductSet should be created. Format is `
765
+ # projects/PROJECT_ID/locations/LOC_ID`.
766
+ # @param [Google::Apis::VisionV1::ProductSet] product_set_object
767
+ # @param [String] product_set_id
768
+ # A user-supplied resource id for this ProductSet. If set, the server will
769
+ # attempt to use this value as the resource id. If it is already in use, an
770
+ # error is returned with code ALREADY_EXISTS. Must be at most 128 characters
771
+ # long. It cannot contain the character `/`.
772
+ # @param [String] fields
773
+ # Selector specifying which fields to include in a partial response.
774
+ # @param [String] quota_user
775
+ # Available to use for quota purposes for server-side applications. Can be any
776
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
777
+ # @param [Google::Apis::RequestOptions] options
778
+ # Request-specific options
779
+ #
780
+ # @yield [result, err] Result & error if block supplied
781
+ # @yieldparam result [Google::Apis::VisionV1::ProductSet] parsed result object
782
+ # @yieldparam err [StandardError] error object if request failed
783
+ #
784
+ # @return [Google::Apis::VisionV1::ProductSet]
785
+ #
786
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
787
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
788
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
789
+ def create_project_location_product_set(parent, product_set_object = nil, product_set_id: nil, fields: nil, quota_user: nil, options: nil, &block)
790
+ command = make_simple_command(:post, 'v1/{+parent}/productSets', options)
791
+ command.request_representation = Google::Apis::VisionV1::ProductSet::Representation
792
+ command.request_object = product_set_object
793
+ command.response_representation = Google::Apis::VisionV1::ProductSet::Representation
794
+ command.response_class = Google::Apis::VisionV1::ProductSet
795
+ command.params['parent'] = parent unless parent.nil?
796
+ command.query['productSetId'] = product_set_id unless product_set_id.nil?
797
+ command.query['fields'] = fields unless fields.nil?
798
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
799
+ execute_or_queue_command(command, &block)
800
+ end
801
+
802
+ # Permanently deletes a ProductSet. Products and ReferenceImages in the
803
+ # ProductSet are not deleted. The actual image files are not deleted from Google
804
+ # Cloud Storage.
805
+ # @param [String] name
806
+ # Required. Resource name of the ProductSet to delete. Format is: `projects/
807
+ # PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
808
+ # @param [String] fields
809
+ # Selector specifying which fields to include in a partial response.
810
+ # @param [String] quota_user
811
+ # Available to use for quota purposes for server-side applications. Can be any
812
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
813
+ # @param [Google::Apis::RequestOptions] options
814
+ # Request-specific options
815
+ #
816
+ # @yield [result, err] Result & error if block supplied
817
+ # @yieldparam result [Google::Apis::VisionV1::Empty] parsed result object
818
+ # @yieldparam err [StandardError] error object if request failed
819
+ #
820
+ # @return [Google::Apis::VisionV1::Empty]
821
+ #
822
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
823
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
824
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
825
+ def delete_project_location_product_set(name, fields: nil, quota_user: nil, options: nil, &block)
826
+ command = make_simple_command(:delete, 'v1/{+name}', options)
827
+ command.response_representation = Google::Apis::VisionV1::Empty::Representation
828
+ command.response_class = Google::Apis::VisionV1::Empty
829
+ command.params['name'] = name unless name.nil?
830
+ command.query['fields'] = fields unless fields.nil?
831
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
832
+ execute_or_queue_command(command, &block)
833
+ end
834
+
835
+ # Gets information associated with a ProductSet. Possible errors: * Returns
836
+ # NOT_FOUND if the ProductSet does not exist.
837
+ # @param [String] name
838
+ # Required. Resource name of the ProductSet to get. Format is: `projects/
839
+ # PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
840
+ # @param [String] fields
841
+ # Selector specifying which fields to include in a partial response.
842
+ # @param [String] quota_user
843
+ # Available to use for quota purposes for server-side applications. Can be any
844
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
845
+ # @param [Google::Apis::RequestOptions] options
846
+ # Request-specific options
847
+ #
848
+ # @yield [result, err] Result & error if block supplied
849
+ # @yieldparam result [Google::Apis::VisionV1::ProductSet] parsed result object
850
+ # @yieldparam err [StandardError] error object if request failed
851
+ #
852
+ # @return [Google::Apis::VisionV1::ProductSet]
853
+ #
854
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
855
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
856
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
857
+ def get_project_location_product_set(name, fields: nil, quota_user: nil, options: nil, &block)
858
+ command = make_simple_command(:get, 'v1/{+name}', options)
859
+ command.response_representation = Google::Apis::VisionV1::ProductSet::Representation
860
+ command.response_class = Google::Apis::VisionV1::ProductSet
861
+ command.params['name'] = name unless name.nil?
862
+ command.query['fields'] = fields unless fields.nil?
863
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
864
+ execute_or_queue_command(command, &block)
865
+ end
866
+
867
+ # Asynchronous API that imports a list of reference images to specified product
868
+ # sets based on a list of image information. The google.longrunning.Operation
869
+ # API can be used to keep track of the progress and results of the request. `
870
+ # Operation.metadata` contains `BatchOperationMetadata`. (progress) `Operation.
871
+ # response` contains `ImportProductSetsResponse`. (results) The input source of
872
+ # this method is a csv file on Google Cloud Storage. For the format of the csv
873
+ # file please see ImportProductSetsGcsSource.csv_file_uri.
874
+ # @param [String] parent
875
+ # Required. The project in which the ProductSets should be imported. Format is `
876
+ # projects/PROJECT_ID/locations/LOC_ID`.
877
+ # @param [Google::Apis::VisionV1::ImportProductSetsRequest] import_product_sets_request_object
878
+ # @param [String] fields
879
+ # Selector specifying which fields to include in a partial response.
880
+ # @param [String] quota_user
881
+ # Available to use for quota purposes for server-side applications. Can be any
882
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
883
+ # @param [Google::Apis::RequestOptions] options
884
+ # Request-specific options
885
+ #
886
+ # @yield [result, err] Result & error if block supplied
887
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
888
+ # @yieldparam err [StandardError] error object if request failed
889
+ #
890
+ # @return [Google::Apis::VisionV1::Operation]
891
+ #
892
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
893
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
894
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
895
+ def import_product_sets(parent, import_product_sets_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
896
+ command = make_simple_command(:post, 'v1/{+parent}/productSets:import', options)
897
+ command.request_representation = Google::Apis::VisionV1::ImportProductSetsRequest::Representation
898
+ command.request_object = import_product_sets_request_object
899
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
900
+ command.response_class = Google::Apis::VisionV1::Operation
901
+ command.params['parent'] = parent unless parent.nil?
902
+ command.query['fields'] = fields unless fields.nil?
903
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
904
+ execute_or_queue_command(command, &block)
905
+ end
906
+
907
+ # Lists ProductSets in an unspecified order. Possible errors: * Returns
908
+ # INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
909
+ # @param [String] parent
910
+ # Required. The project from which ProductSets should be listed. Format is `
911
+ # projects/PROJECT_ID/locations/LOC_ID`.
912
+ # @param [Fixnum] page_size
913
+ # The maximum number of items to return. Default 10, maximum 100.
914
+ # @param [String] page_token
915
+ # The next_page_token returned from a previous List request, if any.
916
+ # @param [String] fields
917
+ # Selector specifying which fields to include in a partial response.
918
+ # @param [String] quota_user
919
+ # Available to use for quota purposes for server-side applications. Can be any
920
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
921
+ # @param [Google::Apis::RequestOptions] options
922
+ # Request-specific options
923
+ #
924
+ # @yield [result, err] Result & error if block supplied
925
+ # @yieldparam result [Google::Apis::VisionV1::ListProductSetsResponse] parsed result object
926
+ # @yieldparam err [StandardError] error object if request failed
927
+ #
928
+ # @return [Google::Apis::VisionV1::ListProductSetsResponse]
929
+ #
930
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
931
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
932
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
933
+ def list_project_location_product_sets(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
934
+ command = make_simple_command(:get, 'v1/{+parent}/productSets', options)
935
+ command.response_representation = Google::Apis::VisionV1::ListProductSetsResponse::Representation
936
+ command.response_class = Google::Apis::VisionV1::ListProductSetsResponse
937
+ command.params['parent'] = parent unless parent.nil?
938
+ command.query['pageSize'] = page_size unless page_size.nil?
939
+ command.query['pageToken'] = page_token unless page_token.nil?
940
+ command.query['fields'] = fields unless fields.nil?
941
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
942
+ execute_or_queue_command(command, &block)
943
+ end
944
+
945
+ # Makes changes to a ProductSet resource. Only display_name can be updated
946
+ # currently. Possible errors: * Returns NOT_FOUND if the ProductSet does not
947
+ # exist. * Returns INVALID_ARGUMENT if display_name is present in update_mask
948
+ # but missing from the request or longer than 4096 characters.
949
+ # @param [String] name
950
+ # The resource name of the ProductSet. Format is: `projects/PROJECT_ID/locations/
951
+ # LOC_ID/productSets/PRODUCT_SET_ID`. This field is ignored when creating a
952
+ # ProductSet.
953
+ # @param [Google::Apis::VisionV1::ProductSet] product_set_object
954
+ # @param [String] update_mask
955
+ # The FieldMask that specifies which fields to update. If update_mask isn't
956
+ # specified, all mutable fields are to be updated. Valid mask path is `
957
+ # display_name`.
958
+ # @param [String] fields
959
+ # Selector specifying which fields to include in a partial response.
960
+ # @param [String] quota_user
961
+ # Available to use for quota purposes for server-side applications. Can be any
962
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
963
+ # @param [Google::Apis::RequestOptions] options
964
+ # Request-specific options
965
+ #
966
+ # @yield [result, err] Result & error if block supplied
967
+ # @yieldparam result [Google::Apis::VisionV1::ProductSet] parsed result object
968
+ # @yieldparam err [StandardError] error object if request failed
969
+ #
970
+ # @return [Google::Apis::VisionV1::ProductSet]
971
+ #
972
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
973
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
974
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
975
+ def patch_project_location_product_set(name, product_set_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
976
+ command = make_simple_command(:patch, 'v1/{+name}', options)
977
+ command.request_representation = Google::Apis::VisionV1::ProductSet::Representation
978
+ command.request_object = product_set_object
979
+ command.response_representation = Google::Apis::VisionV1::ProductSet::Representation
980
+ command.response_class = Google::Apis::VisionV1::ProductSet
981
+ command.params['name'] = name unless name.nil?
982
+ command.query['updateMask'] = update_mask unless update_mask.nil?
983
+ command.query['fields'] = fields unless fields.nil?
984
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
985
+ execute_or_queue_command(command, &block)
986
+ end
987
+
988
+ # Removes a Product from the specified ProductSet.
989
+ # @param [String] name
990
+ # Required. The resource name for the ProductSet to modify. Format is: `projects/
991
+ # PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
992
+ # @param [Google::Apis::VisionV1::RemoveProductFromProductSetRequest] remove_product_from_product_set_request_object
993
+ # @param [String] fields
994
+ # Selector specifying which fields to include in a partial response.
995
+ # @param [String] quota_user
996
+ # Available to use for quota purposes for server-side applications. Can be any
997
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
998
+ # @param [Google::Apis::RequestOptions] options
999
+ # Request-specific options
1000
+ #
1001
+ # @yield [result, err] Result & error if block supplied
1002
+ # @yieldparam result [Google::Apis::VisionV1::Empty] parsed result object
1003
+ # @yieldparam err [StandardError] error object if request failed
1004
+ #
1005
+ # @return [Google::Apis::VisionV1::Empty]
1006
+ #
1007
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1008
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1009
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1010
+ def remove_product_from_product_set(name, remove_product_from_product_set_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1011
+ command = make_simple_command(:post, 'v1/{+name}:removeProduct', options)
1012
+ command.request_representation = Google::Apis::VisionV1::RemoveProductFromProductSetRequest::Representation
1013
+ command.request_object = remove_product_from_product_set_request_object
1014
+ command.response_representation = Google::Apis::VisionV1::Empty::Representation
1015
+ command.response_class = Google::Apis::VisionV1::Empty
1016
+ command.params['name'] = name unless name.nil?
1017
+ command.query['fields'] = fields unless fields.nil?
1018
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1019
+ execute_or_queue_command(command, &block)
1020
+ end
1021
+
1022
+ # Lists the Products in a ProductSet, in an unspecified order. If the ProductSet
1023
+ # does not exist, the products field of the response will be empty. Possible
1024
+ # errors: * Returns INVALID_ARGUMENT if page_size is greater than 100 or less
1025
+ # than 1.
1026
+ # @param [String] name
1027
+ # Required. The ProductSet resource for which to retrieve Products. Format is: `
1028
+ # projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
1029
+ # @param [Fixnum] page_size
1030
+ # The maximum number of items to return. Default 10, maximum 100.
1031
+ # @param [String] page_token
1032
+ # The next_page_token returned from a previous List request, if any.
1033
+ # @param [String] fields
1034
+ # Selector specifying which fields to include in a partial response.
1035
+ # @param [String] quota_user
1036
+ # Available to use for quota purposes for server-side applications. Can be any
1037
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1038
+ # @param [Google::Apis::RequestOptions] options
1039
+ # Request-specific options
1040
+ #
1041
+ # @yield [result, err] Result & error if block supplied
1042
+ # @yieldparam result [Google::Apis::VisionV1::ListProductsInProductSetResponse] parsed result object
1043
+ # @yieldparam err [StandardError] error object if request failed
1044
+ #
1045
+ # @return [Google::Apis::VisionV1::ListProductsInProductSetResponse]
1046
+ #
1047
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1048
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1049
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1050
+ def list_project_location_product_set_products(name, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1051
+ command = make_simple_command(:get, 'v1/{+name}/products', options)
1052
+ command.response_representation = Google::Apis::VisionV1::ListProductsInProductSetResponse::Representation
1053
+ command.response_class = Google::Apis::VisionV1::ListProductsInProductSetResponse
1054
+ command.params['name'] = name unless name.nil?
1055
+ command.query['pageSize'] = page_size unless page_size.nil?
1056
+ command.query['pageToken'] = page_token unless page_token.nil?
1057
+ command.query['fields'] = fields unless fields.nil?
1058
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1059
+ execute_or_queue_command(command, &block)
1060
+ end
1061
+
1062
+ # Creates and returns a new product resource. Possible errors: * Returns
1063
+ # INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. *
1064
+ # Returns INVALID_ARGUMENT if description is longer than 4096 characters. *
1065
+ # Returns INVALID_ARGUMENT if product_category is missing or invalid.
1066
+ # @param [String] parent
1067
+ # Required. The project in which the Product should be created. Format is `
1068
+ # projects/PROJECT_ID/locations/LOC_ID`.
1069
+ # @param [Google::Apis::VisionV1::Product] product_object
1070
+ # @param [String] product_id
1071
+ # A user-supplied resource id for this Product. If set, the server will attempt
1072
+ # to use this value as the resource id. If it is already in use, an error is
1073
+ # returned with code ALREADY_EXISTS. Must be at most 128 characters long. It
1074
+ # cannot contain the character `/`.
1075
+ # @param [String] fields
1076
+ # Selector specifying which fields to include in a partial response.
1077
+ # @param [String] quota_user
1078
+ # Available to use for quota purposes for server-side applications. Can be any
1079
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1080
+ # @param [Google::Apis::RequestOptions] options
1081
+ # Request-specific options
1082
+ #
1083
+ # @yield [result, err] Result & error if block supplied
1084
+ # @yieldparam result [Google::Apis::VisionV1::Product] parsed result object
1085
+ # @yieldparam err [StandardError] error object if request failed
1086
+ #
1087
+ # @return [Google::Apis::VisionV1::Product]
1088
+ #
1089
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1090
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1091
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1092
+ def create_project_location_product(parent, product_object = nil, product_id: nil, fields: nil, quota_user: nil, options: nil, &block)
1093
+ command = make_simple_command(:post, 'v1/{+parent}/products', options)
1094
+ command.request_representation = Google::Apis::VisionV1::Product::Representation
1095
+ command.request_object = product_object
1096
+ command.response_representation = Google::Apis::VisionV1::Product::Representation
1097
+ command.response_class = Google::Apis::VisionV1::Product
1098
+ command.params['parent'] = parent unless parent.nil?
1099
+ command.query['productId'] = product_id unless product_id.nil?
1100
+ command.query['fields'] = fields unless fields.nil?
1101
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1102
+ execute_or_queue_command(command, &block)
1103
+ end
1104
+
1105
+ # Permanently deletes a product and its reference images. Metadata of the
1106
+ # product and all its images will be deleted right away, but search queries
1107
+ # against ProductSets containing the product may still work until all related
1108
+ # caches are refreshed.
1109
+ # @param [String] name
1110
+ # Required. Resource name of product to delete. Format is: `projects/PROJECT_ID/
1111
+ # locations/LOC_ID/products/PRODUCT_ID`
1112
+ # @param [String] fields
1113
+ # Selector specifying which fields to include in a partial response.
1114
+ # @param [String] quota_user
1115
+ # Available to use for quota purposes for server-side applications. Can be any
1116
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1117
+ # @param [Google::Apis::RequestOptions] options
1118
+ # Request-specific options
1119
+ #
1120
+ # @yield [result, err] Result & error if block supplied
1121
+ # @yieldparam result [Google::Apis::VisionV1::Empty] parsed result object
1122
+ # @yieldparam err [StandardError] error object if request failed
1123
+ #
1124
+ # @return [Google::Apis::VisionV1::Empty]
1125
+ #
1126
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1127
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1128
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1129
+ def delete_project_location_product(name, fields: nil, quota_user: nil, options: nil, &block)
1130
+ command = make_simple_command(:delete, 'v1/{+name}', options)
1131
+ command.response_representation = Google::Apis::VisionV1::Empty::Representation
1132
+ command.response_class = Google::Apis::VisionV1::Empty
1133
+ command.params['name'] = name unless name.nil?
1134
+ command.query['fields'] = fields unless fields.nil?
1135
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1136
+ execute_or_queue_command(command, &block)
1137
+ end
1138
+
1139
+ # Gets information associated with a Product. Possible errors: * Returns
1140
+ # NOT_FOUND if the Product does not exist.
1141
+ # @param [String] name
1142
+ # Required. Resource name of the Product to get. Format is: `projects/PROJECT_ID/
1143
+ # locations/LOC_ID/products/PRODUCT_ID`
1144
+ # @param [String] fields
1145
+ # Selector specifying which fields to include in a partial response.
1146
+ # @param [String] quota_user
1147
+ # Available to use for quota purposes for server-side applications. Can be any
1148
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1149
+ # @param [Google::Apis::RequestOptions] options
1150
+ # Request-specific options
1151
+ #
1152
+ # @yield [result, err] Result & error if block supplied
1153
+ # @yieldparam result [Google::Apis::VisionV1::Product] parsed result object
1154
+ # @yieldparam err [StandardError] error object if request failed
1155
+ #
1156
+ # @return [Google::Apis::VisionV1::Product]
1157
+ #
1158
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1159
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1160
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1161
+ def get_project_location_product(name, fields: nil, quota_user: nil, options: nil, &block)
1162
+ command = make_simple_command(:get, 'v1/{+name}', options)
1163
+ command.response_representation = Google::Apis::VisionV1::Product::Representation
1164
+ command.response_class = Google::Apis::VisionV1::Product
1165
+ command.params['name'] = name unless name.nil?
1166
+ command.query['fields'] = fields unless fields.nil?
1167
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1168
+ execute_or_queue_command(command, &block)
1169
+ end
1170
+
1171
+ # Lists products in an unspecified order. Possible errors: * Returns
1172
+ # INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
1173
+ # @param [String] parent
1174
+ # Required. The project OR ProductSet from which Products should be listed.
1175
+ # Format: `projects/PROJECT_ID/locations/LOC_ID`
1176
+ # @param [Fixnum] page_size
1177
+ # The maximum number of items to return. Default 10, maximum 100.
1178
+ # @param [String] page_token
1179
+ # The next_page_token returned from a previous List request, if any.
1180
+ # @param [String] fields
1181
+ # Selector specifying which fields to include in a partial response.
1182
+ # @param [String] quota_user
1183
+ # Available to use for quota purposes for server-side applications. Can be any
1184
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1185
+ # @param [Google::Apis::RequestOptions] options
1186
+ # Request-specific options
1187
+ #
1188
+ # @yield [result, err] Result & error if block supplied
1189
+ # @yieldparam result [Google::Apis::VisionV1::ListProductsResponse] parsed result object
1190
+ # @yieldparam err [StandardError] error object if request failed
1191
+ #
1192
+ # @return [Google::Apis::VisionV1::ListProductsResponse]
1193
+ #
1194
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1195
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1196
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1197
+ def list_project_location_products(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1198
+ command = make_simple_command(:get, 'v1/{+parent}/products', options)
1199
+ command.response_representation = Google::Apis::VisionV1::ListProductsResponse::Representation
1200
+ command.response_class = Google::Apis::VisionV1::ListProductsResponse
1201
+ command.params['parent'] = parent unless parent.nil?
1202
+ command.query['pageSize'] = page_size unless page_size.nil?
1203
+ command.query['pageToken'] = page_token unless page_token.nil?
1204
+ command.query['fields'] = fields unless fields.nil?
1205
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1206
+ execute_or_queue_command(command, &block)
1207
+ end
1208
+
1209
+ # Makes changes to a Product resource. Only the `display_name`, `description`,
1210
+ # and `labels` fields can be updated right now. If labels are updated, the
1211
+ # change will not be reflected in queries until the next index time. Possible
1212
+ # errors: * Returns NOT_FOUND if the Product does not exist. * Returns
1213
+ # INVALID_ARGUMENT if display_name is present in update_mask but is missing from
1214
+ # the request or longer than 4096 characters. * Returns INVALID_ARGUMENT if
1215
+ # description is present in update_mask but is longer than 4096 characters. *
1216
+ # Returns INVALID_ARGUMENT if product_category is present in update_mask.
1217
+ # @param [String] name
1218
+ # The resource name of the product. Format is: `projects/PROJECT_ID/locations/
1219
+ # LOC_ID/products/PRODUCT_ID`. This field is ignored when creating a product.
1220
+ # @param [Google::Apis::VisionV1::Product] product_object
1221
+ # @param [String] update_mask
1222
+ # The FieldMask that specifies which fields to update. If update_mask isn't
1223
+ # specified, all mutable fields are to be updated. Valid mask paths include `
1224
+ # product_labels`, `display_name`, and `description`.
1225
+ # @param [String] fields
1226
+ # Selector specifying which fields to include in a partial response.
1227
+ # @param [String] quota_user
1228
+ # Available to use for quota purposes for server-side applications. Can be any
1229
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1230
+ # @param [Google::Apis::RequestOptions] options
1231
+ # Request-specific options
1232
+ #
1233
+ # @yield [result, err] Result & error if block supplied
1234
+ # @yieldparam result [Google::Apis::VisionV1::Product] parsed result object
1235
+ # @yieldparam err [StandardError] error object if request failed
1236
+ #
1237
+ # @return [Google::Apis::VisionV1::Product]
1238
+ #
1239
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1240
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1241
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1242
+ def patch_project_location_product(name, product_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
1243
+ command = make_simple_command(:patch, 'v1/{+name}', options)
1244
+ command.request_representation = Google::Apis::VisionV1::Product::Representation
1245
+ command.request_object = product_object
1246
+ command.response_representation = Google::Apis::VisionV1::Product::Representation
1247
+ command.response_class = Google::Apis::VisionV1::Product
1248
+ command.params['name'] = name unless name.nil?
1249
+ command.query['updateMask'] = update_mask unless update_mask.nil?
1250
+ command.query['fields'] = fields unless fields.nil?
1251
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1252
+ execute_or_queue_command(command, &block)
1253
+ end
1254
+
1255
+ # Asynchronous API to delete all Products in a ProductSet or all Products that
1256
+ # are in no ProductSet. If a Product is a member of the specified ProductSet in
1257
+ # addition to other ProductSets, the Product will still be deleted. It is
1258
+ # recommended to not delete the specified ProductSet until after this operation
1259
+ # has completed. It is also recommended to not add any of the Products involved
1260
+ # in the batch delete to a new ProductSet while this operation is running
1261
+ # because those Products may still end up deleted. It's not possible to undo the
1262
+ # PurgeProducts operation. Therefore, it is recommended to keep the csv files
1263
+ # used in ImportProductSets (if that was how you originally built the Product
1264
+ # Set) before starting PurgeProducts, in case you need to re-import the data
1265
+ # after deletion. If the plan is to purge all of the Products from a ProductSet
1266
+ # and then re-use the empty ProductSet to re-import new Products into the empty
1267
+ # ProductSet, you must wait until the PurgeProducts operation has finished for
1268
+ # that ProductSet. The google.longrunning.Operation API can be used to keep
1269
+ # track of the progress and results of the request. `Operation.metadata`
1270
+ # contains `BatchOperationMetadata`. (progress)
1271
+ # @param [String] parent
1272
+ # Required. The project and location in which the Products should be deleted.
1273
+ # Format is `projects/PROJECT_ID/locations/LOC_ID`.
1274
+ # @param [Google::Apis::VisionV1::PurgeProductsRequest] purge_products_request_object
1275
+ # @param [String] fields
1276
+ # Selector specifying which fields to include in a partial response.
1277
+ # @param [String] quota_user
1278
+ # Available to use for quota purposes for server-side applications. Can be any
1279
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1280
+ # @param [Google::Apis::RequestOptions] options
1281
+ # Request-specific options
1282
+ #
1283
+ # @yield [result, err] Result & error if block supplied
1284
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
1285
+ # @yieldparam err [StandardError] error object if request failed
1286
+ #
1287
+ # @return [Google::Apis::VisionV1::Operation]
1288
+ #
1289
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1290
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1291
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1292
+ def purge_products(parent, purge_products_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
1293
+ command = make_simple_command(:post, 'v1/{+parent}/products:purge', options)
1294
+ command.request_representation = Google::Apis::VisionV1::PurgeProductsRequest::Representation
1295
+ command.request_object = purge_products_request_object
1296
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
1297
+ command.response_class = Google::Apis::VisionV1::Operation
1298
+ command.params['parent'] = parent unless parent.nil?
1299
+ command.query['fields'] = fields unless fields.nil?
1300
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1301
+ execute_or_queue_command(command, &block)
1302
+ end
1303
+
1304
+ # Creates and returns a new ReferenceImage resource. The `bounding_poly` field
1305
+ # is optional. If `bounding_poly` is not specified, the system will try to
1306
+ # detect regions of interest in the image that are compatible with the
1307
+ # product_category on the parent product. If it is specified, detection is
1308
+ # ALWAYS skipped. The system converts polygons into non-rotated rectangles. Note
1309
+ # that the pipeline will resize the image if the image resolution is too large
1310
+ # to process (above 50MP). Possible errors: * Returns INVALID_ARGUMENT if the
1311
+ # image_uri is missing or longer than 4096 characters. * Returns
1312
+ # INVALID_ARGUMENT if the product does not exist. * Returns INVALID_ARGUMENT if
1313
+ # bounding_poly is not provided, and nothing compatible with the parent product'
1314
+ # s product_category is detected. * Returns INVALID_ARGUMENT if bounding_poly
1315
+ # contains more than 10 polygons.
1316
+ # @param [String] parent
1317
+ # Required. Resource name of the product in which to create the reference image.
1318
+ # Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
1319
+ # @param [Google::Apis::VisionV1::ReferenceImage] reference_image_object
1320
+ # @param [String] reference_image_id
1321
+ # A user-supplied resource id for the ReferenceImage to be added. If set, the
1322
+ # server will attempt to use this value as the resource id. If it is already in
1323
+ # use, an error is returned with code ALREADY_EXISTS. Must be at most 128
1324
+ # characters long. It cannot contain the character `/`.
1325
+ # @param [String] fields
1326
+ # Selector specifying which fields to include in a partial response.
1327
+ # @param [String] quota_user
1328
+ # Available to use for quota purposes for server-side applications. Can be any
1329
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1330
+ # @param [Google::Apis::RequestOptions] options
1331
+ # Request-specific options
1332
+ #
1333
+ # @yield [result, err] Result & error if block supplied
1334
+ # @yieldparam result [Google::Apis::VisionV1::ReferenceImage] parsed result object
1335
+ # @yieldparam err [StandardError] error object if request failed
1336
+ #
1337
+ # @return [Google::Apis::VisionV1::ReferenceImage]
1338
+ #
1339
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1340
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1341
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1342
+ def create_project_location_product_reference_image(parent, reference_image_object = nil, reference_image_id: nil, fields: nil, quota_user: nil, options: nil, &block)
1343
+ command = make_simple_command(:post, 'v1/{+parent}/referenceImages', options)
1344
+ command.request_representation = Google::Apis::VisionV1::ReferenceImage::Representation
1345
+ command.request_object = reference_image_object
1346
+ command.response_representation = Google::Apis::VisionV1::ReferenceImage::Representation
1347
+ command.response_class = Google::Apis::VisionV1::ReferenceImage
1348
+ command.params['parent'] = parent unless parent.nil?
1349
+ command.query['referenceImageId'] = reference_image_id unless reference_image_id.nil?
1350
+ command.query['fields'] = fields unless fields.nil?
1351
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1352
+ execute_or_queue_command(command, &block)
1353
+ end
1354
+
1355
+ # Permanently deletes a reference image. The image metadata will be deleted
1356
+ # right away, but search queries against ProductSets containing the image may
1357
+ # still work until all related caches are refreshed. The actual image files are
1358
+ # not deleted from Google Cloud Storage.
1359
+ # @param [String] name
1360
+ # Required. The resource name of the reference image to delete. Format is: `
1361
+ # projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/
1362
+ # IMAGE_ID`
1363
+ # @param [String] fields
1364
+ # Selector specifying which fields to include in a partial response.
1365
+ # @param [String] quota_user
1366
+ # Available to use for quota purposes for server-side applications. Can be any
1367
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1368
+ # @param [Google::Apis::RequestOptions] options
1369
+ # Request-specific options
1370
+ #
1371
+ # @yield [result, err] Result & error if block supplied
1372
+ # @yieldparam result [Google::Apis::VisionV1::Empty] parsed result object
1373
+ # @yieldparam err [StandardError] error object if request failed
1374
+ #
1375
+ # @return [Google::Apis::VisionV1::Empty]
1376
+ #
1377
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1378
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1379
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1380
+ def delete_project_location_product_reference_image(name, fields: nil, quota_user: nil, options: nil, &block)
1381
+ command = make_simple_command(:delete, 'v1/{+name}', options)
1382
+ command.response_representation = Google::Apis::VisionV1::Empty::Representation
1383
+ command.response_class = Google::Apis::VisionV1::Empty
1384
+ command.params['name'] = name unless name.nil?
1385
+ command.query['fields'] = fields unless fields.nil?
1386
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1387
+ execute_or_queue_command(command, &block)
1388
+ end
1389
+
1390
+ # Gets information associated with a ReferenceImage. Possible errors: * Returns
1391
+ # NOT_FOUND if the specified image does not exist.
1392
+ # @param [String] name
1393
+ # Required. The resource name of the ReferenceImage to get. Format is: `projects/
1394
+ # PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
1395
+ # @param [String] fields
1396
+ # Selector specifying which fields to include in a partial response.
1397
+ # @param [String] quota_user
1398
+ # Available to use for quota purposes for server-side applications. Can be any
1399
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1400
+ # @param [Google::Apis::RequestOptions] options
1401
+ # Request-specific options
1402
+ #
1403
+ # @yield [result, err] Result & error if block supplied
1404
+ # @yieldparam result [Google::Apis::VisionV1::ReferenceImage] parsed result object
1405
+ # @yieldparam err [StandardError] error object if request failed
1406
+ #
1407
+ # @return [Google::Apis::VisionV1::ReferenceImage]
1408
+ #
1409
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1410
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1411
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1412
+ def get_project_location_product_reference_image(name, fields: nil, quota_user: nil, options: nil, &block)
1413
+ command = make_simple_command(:get, 'v1/{+name}', options)
1414
+ command.response_representation = Google::Apis::VisionV1::ReferenceImage::Representation
1415
+ command.response_class = Google::Apis::VisionV1::ReferenceImage
1416
+ command.params['name'] = name unless name.nil?
1417
+ command.query['fields'] = fields unless fields.nil?
1418
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1419
+ execute_or_queue_command(command, &block)
1420
+ end
1421
+
1422
+ # Lists reference images. Possible errors: * Returns NOT_FOUND if the parent
1423
+ # product does not exist. * Returns INVALID_ARGUMENT if the page_size is greater
1424
+ # than 100, or less than 1.
1425
+ # @param [String] parent
1426
+ # Required. Resource name of the product containing the reference images. Format
1427
+ # is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
1428
+ # @param [Fixnum] page_size
1429
+ # The maximum number of items to return. Default 10, maximum 100.
1430
+ # @param [String] page_token
1431
+ # A token identifying a page of results to be returned. This is the value of `
1432
+ # nextPageToken` returned in a previous reference image list request. Defaults
1433
+ # to the first page if not specified.
1434
+ # @param [String] fields
1435
+ # Selector specifying which fields to include in a partial response.
1436
+ # @param [String] quota_user
1437
+ # Available to use for quota purposes for server-side applications. Can be any
1438
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1439
+ # @param [Google::Apis::RequestOptions] options
1440
+ # Request-specific options
1441
+ #
1442
+ # @yield [result, err] Result & error if block supplied
1443
+ # @yieldparam result [Google::Apis::VisionV1::ListReferenceImagesResponse] parsed result object
1444
+ # @yieldparam err [StandardError] error object if request failed
1445
+ #
1446
+ # @return [Google::Apis::VisionV1::ListReferenceImagesResponse]
1447
+ #
1448
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1449
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1450
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1451
+ def list_project_location_product_reference_images(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
1452
+ command = make_simple_command(:get, 'v1/{+parent}/referenceImages', options)
1453
+ command.response_representation = Google::Apis::VisionV1::ListReferenceImagesResponse::Representation
1454
+ command.response_class = Google::Apis::VisionV1::ListReferenceImagesResponse
1455
+ command.params['parent'] = parent unless parent.nil?
1456
+ command.query['pageSize'] = page_size unless page_size.nil?
1457
+ command.query['pageToken'] = page_token unless page_token.nil?
1458
+ command.query['fields'] = fields unless fields.nil?
1459
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1460
+ execute_or_queue_command(command, &block)
1461
+ end
1462
+
1463
+ # Gets the latest state of a long-running operation. Clients can use this method
1464
+ # to poll the operation result at intervals as recommended by the API service.
1465
+ # @param [String] name
1466
+ # The name of the operation resource.
1467
+ # @param [String] fields
1468
+ # Selector specifying which fields to include in a partial response.
1469
+ # @param [String] quota_user
1470
+ # Available to use for quota purposes for server-side applications. Can be any
1471
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
1472
+ # @param [Google::Apis::RequestOptions] options
1473
+ # Request-specific options
1474
+ #
1475
+ # @yield [result, err] Result & error if block supplied
1476
+ # @yieldparam result [Google::Apis::VisionV1::Operation] parsed result object
1477
+ # @yieldparam err [StandardError] error object if request failed
1478
+ #
1479
+ # @return [Google::Apis::VisionV1::Operation]
1480
+ #
1481
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1482
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1483
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1484
+ def get_project_operation(name, fields: nil, quota_user: nil, options: nil, &block)
1485
+ command = make_simple_command(:get, 'v1/{+name}', options)
1486
+ command.response_representation = Google::Apis::VisionV1::Operation::Representation
1487
+ command.response_class = Google::Apis::VisionV1::Operation
1488
+ command.params['name'] = name unless name.nil?
1489
+ command.query['fields'] = fields unless fields.nil?
1490
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1491
+ execute_or_queue_command(command, &block)
1492
+ end
1493
+
1494
+ protected
1495
+
1496
+ def apply_command_defaults(command)
1497
+ command.query['key'] = key unless key.nil?
1498
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1499
+ end
1500
+ end
1501
+ end
1502
+ end
1503
+ end