google-cloud-vision 0.32.3 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/google/cloud/vision.rb +26 -26
- data/lib/google/cloud/vision/v1.rb +27 -27
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +85 -10
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +7 -4
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +2 -1
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +11 -11
- data/lib/google/cloud/vision/v1/image_annotator_client.rb +132 -0
- data/lib/google/cloud/vision/v1/image_annotator_client_config.json +10 -0
- data/lib/google/cloud/vision/v1/image_annotator_pb.rb +26 -0
- data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +19 -1
- data/lib/google/cloud/vision/v1/product_search_client.rb +319 -335
- data/lib/google/cloud/vision/v1/product_search_client_config.json +18 -18
- data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +1 -17
- data/lib/google/cloud/vision/v1/web_detection_pb.rb +5 -5
- metadata +2 -2
@@ -25,6 +25,16 @@
|
|
25
25
|
"retry_codes_name": "idempotent",
|
26
26
|
"retry_params_name": "default"
|
27
27
|
},
|
28
|
+
"BatchAnnotateFiles": {
|
29
|
+
"timeout_millis": 60000,
|
30
|
+
"retry_codes_name": "idempotent",
|
31
|
+
"retry_params_name": "default"
|
32
|
+
},
|
33
|
+
"AsyncBatchAnnotateImages": {
|
34
|
+
"timeout_millis": 60000,
|
35
|
+
"retry_codes_name": "idempotent",
|
36
|
+
"retry_params_name": "default"
|
37
|
+
},
|
28
38
|
"AsyncBatchAnnotateFiles": {
|
29
39
|
"timeout_millis": 60000,
|
30
40
|
"retry_codes_name": "idempotent",
|
@@ -199,6 +199,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
199
199
|
add_message "google.cloud.vision.v1.AnnotateFileResponse" do
|
200
200
|
optional :input_config, :message, 1, "google.cloud.vision.v1.InputConfig"
|
201
201
|
repeated :responses, :message, 2, "google.cloud.vision.v1.AnnotateImageResponse"
|
202
|
+
optional :total_pages, :int32, 3
|
202
203
|
end
|
203
204
|
add_message "google.cloud.vision.v1.BatchAnnotateImagesRequest" do
|
204
205
|
repeated :requests, :message, 1, "google.cloud.vision.v1.AnnotateImageRequest"
|
@@ -206,6 +207,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
206
207
|
add_message "google.cloud.vision.v1.BatchAnnotateImagesResponse" do
|
207
208
|
repeated :responses, :message, 1, "google.cloud.vision.v1.AnnotateImageResponse"
|
208
209
|
end
|
210
|
+
add_message "google.cloud.vision.v1.AnnotateFileRequest" do
|
211
|
+
optional :input_config, :message, 1, "google.cloud.vision.v1.InputConfig"
|
212
|
+
repeated :features, :message, 2, "google.cloud.vision.v1.Feature"
|
213
|
+
optional :image_context, :message, 3, "google.cloud.vision.v1.ImageContext"
|
214
|
+
repeated :pages, :int32, 4
|
215
|
+
end
|
216
|
+
add_message "google.cloud.vision.v1.BatchAnnotateFilesRequest" do
|
217
|
+
repeated :requests, :message, 1, "google.cloud.vision.v1.AnnotateFileRequest"
|
218
|
+
end
|
219
|
+
add_message "google.cloud.vision.v1.BatchAnnotateFilesResponse" do
|
220
|
+
repeated :responses, :message, 1, "google.cloud.vision.v1.AnnotateFileResponse"
|
221
|
+
end
|
209
222
|
add_message "google.cloud.vision.v1.AsyncAnnotateFileRequest" do
|
210
223
|
optional :input_config, :message, 1, "google.cloud.vision.v1.InputConfig"
|
211
224
|
repeated :features, :message, 2, "google.cloud.vision.v1.Feature"
|
@@ -215,6 +228,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
215
228
|
add_message "google.cloud.vision.v1.AsyncAnnotateFileResponse" do
|
216
229
|
optional :output_config, :message, 1, "google.cloud.vision.v1.OutputConfig"
|
217
230
|
end
|
231
|
+
add_message "google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest" do
|
232
|
+
repeated :requests, :message, 1, "google.cloud.vision.v1.AnnotateImageRequest"
|
233
|
+
optional :output_config, :message, 2, "google.cloud.vision.v1.OutputConfig"
|
234
|
+
end
|
235
|
+
add_message "google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse" do
|
236
|
+
optional :output_config, :message, 1, "google.cloud.vision.v1.OutputConfig"
|
237
|
+
end
|
218
238
|
add_message "google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest" do
|
219
239
|
repeated :requests, :message, 1, "google.cloud.vision.v1.AsyncAnnotateFileRequest"
|
220
240
|
end
|
@@ -223,6 +243,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
223
243
|
end
|
224
244
|
add_message "google.cloud.vision.v1.InputConfig" do
|
225
245
|
optional :gcs_source, :message, 1, "google.cloud.vision.v1.GcsSource"
|
246
|
+
optional :content, :bytes, 3
|
226
247
|
optional :mime_type, :string, 2
|
227
248
|
end
|
228
249
|
add_message "google.cloud.vision.v1.OutputConfig" do
|
@@ -288,8 +309,13 @@ module Google
|
|
288
309
|
AnnotateFileResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AnnotateFileResponse").msgclass
|
289
310
|
BatchAnnotateImagesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.BatchAnnotateImagesRequest").msgclass
|
290
311
|
BatchAnnotateImagesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.BatchAnnotateImagesResponse").msgclass
|
312
|
+
AnnotateFileRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AnnotateFileRequest").msgclass
|
313
|
+
BatchAnnotateFilesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.BatchAnnotateFilesRequest").msgclass
|
314
|
+
BatchAnnotateFilesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.BatchAnnotateFilesResponse").msgclass
|
291
315
|
AsyncAnnotateFileRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AsyncAnnotateFileRequest").msgclass
|
292
316
|
AsyncAnnotateFileResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AsyncAnnotateFileResponse").msgclass
|
317
|
+
AsyncBatchAnnotateImagesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest").msgclass
|
318
|
+
AsyncBatchAnnotateImagesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse").msgclass
|
293
319
|
AsyncBatchAnnotateFilesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest").msgclass
|
294
320
|
AsyncBatchAnnotateFilesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse").msgclass
|
295
321
|
InputConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.InputConfig").msgclass
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: google/cloud/vision/v1/image_annotator.proto for package 'google.cloud.vision.v1'
|
3
3
|
# Original file comments:
|
4
|
-
# Copyright
|
4
|
+
# Copyright 2019 Google LLC.
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -39,6 +39,24 @@ module Google
|
|
39
39
|
|
40
40
|
# Run image detection and annotation for a batch of images.
|
41
41
|
rpc :BatchAnnotateImages, BatchAnnotateImagesRequest, BatchAnnotateImagesResponse
|
42
|
+
# Service that performs image detection and annotation for a batch of files.
|
43
|
+
# Now only "application/pdf", "image/tiff" and "image/gif" are supported.
|
44
|
+
#
|
45
|
+
# This service will extract at most 5 (customers can specify which 5 in
|
46
|
+
# AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each
|
47
|
+
# file provided and perform detection and annotation for each image
|
48
|
+
# extracted.
|
49
|
+
rpc :BatchAnnotateFiles, BatchAnnotateFilesRequest, BatchAnnotateFilesResponse
|
50
|
+
# Run asynchronous image detection and annotation for a list of images.
|
51
|
+
#
|
52
|
+
# Progress and results can be retrieved through the
|
53
|
+
# `google.longrunning.Operations` interface.
|
54
|
+
# `Operation.metadata` contains `OperationMetadata` (metadata).
|
55
|
+
# `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results).
|
56
|
+
#
|
57
|
+
# This service will write image annotation outputs to json files in customer
|
58
|
+
# GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
|
59
|
+
rpc :AsyncBatchAnnotateImages, AsyncBatchAnnotateImagesRequest, Google::Longrunning::Operation
|
42
60
|
# Run asynchronous image detection and annotation for a list of generic
|
43
61
|
# files, such as PDF files, which may contain multiple pages and multiple
|
44
62
|
# images per page. Progress and results can be retrieved through the
|
@@ -69,6 +69,10 @@ module Google
|
|
69
69
|
DEFAULT_TIMEOUT = 30
|
70
70
|
|
71
71
|
PAGE_DESCRIPTORS = {
|
72
|
+
"list_product_sets" => Google::Gax::PageDescriptor.new(
|
73
|
+
"page_token",
|
74
|
+
"next_page_token",
|
75
|
+
"product_sets"),
|
72
76
|
"list_products" => Google::Gax::PageDescriptor.new(
|
73
77
|
"page_token",
|
74
78
|
"next_page_token",
|
@@ -77,10 +81,6 @@ module Google
|
|
77
81
|
"page_token",
|
78
82
|
"next_page_token",
|
79
83
|
"reference_images"),
|
80
|
-
"list_product_sets" => Google::Gax::PageDescriptor.new(
|
81
|
-
"page_token",
|
82
|
-
"next_page_token",
|
83
|
-
"product_sets"),
|
84
84
|
"list_products_in_product_set" => Google::Gax::PageDescriptor.new(
|
85
85
|
"page_token",
|
86
86
|
"next_page_token",
|
@@ -290,113 +290,113 @@ module Google
|
|
290
290
|
&Google::Cloud::Vision::V1::ProductSearch::Stub.method(:new)
|
291
291
|
)
|
292
292
|
|
293
|
-
@
|
294
|
-
@product_search_stub.method(:
|
295
|
-
defaults["
|
293
|
+
@create_product_set = Google::Gax.create_api_call(
|
294
|
+
@product_search_stub.method(:create_product_set),
|
295
|
+
defaults["create_product_set"],
|
296
296
|
exception_transformer: exception_transformer,
|
297
297
|
params_extractor: proc do |request|
|
298
298
|
{'parent' => request.parent}
|
299
299
|
end
|
300
300
|
)
|
301
|
-
@
|
302
|
-
@product_search_stub.method(:
|
303
|
-
defaults["
|
301
|
+
@list_product_sets = Google::Gax.create_api_call(
|
302
|
+
@product_search_stub.method(:list_product_sets),
|
303
|
+
defaults["list_product_sets"],
|
304
304
|
exception_transformer: exception_transformer,
|
305
305
|
params_extractor: proc do |request|
|
306
306
|
{'parent' => request.parent}
|
307
307
|
end
|
308
308
|
)
|
309
|
-
@
|
310
|
-
@product_search_stub.method(:
|
311
|
-
defaults["
|
309
|
+
@get_product_set = Google::Gax.create_api_call(
|
310
|
+
@product_search_stub.method(:get_product_set),
|
311
|
+
defaults["get_product_set"],
|
312
312
|
exception_transformer: exception_transformer,
|
313
313
|
params_extractor: proc do |request|
|
314
314
|
{'name' => request.name}
|
315
315
|
end
|
316
316
|
)
|
317
|
-
@
|
318
|
-
@product_search_stub.method(:
|
319
|
-
defaults["
|
317
|
+
@update_product_set = Google::Gax.create_api_call(
|
318
|
+
@product_search_stub.method(:update_product_set),
|
319
|
+
defaults["update_product_set"],
|
320
320
|
exception_transformer: exception_transformer,
|
321
321
|
params_extractor: proc do |request|
|
322
|
-
{'
|
322
|
+
{'product_set.name' => request.product_set.name}
|
323
323
|
end
|
324
324
|
)
|
325
|
-
@
|
326
|
-
@product_search_stub.method(:
|
327
|
-
defaults["
|
325
|
+
@delete_product_set = Google::Gax.create_api_call(
|
326
|
+
@product_search_stub.method(:delete_product_set),
|
327
|
+
defaults["delete_product_set"],
|
328
328
|
exception_transformer: exception_transformer,
|
329
329
|
params_extractor: proc do |request|
|
330
330
|
{'name' => request.name}
|
331
331
|
end
|
332
332
|
)
|
333
|
-
@
|
334
|
-
@product_search_stub.method(:
|
335
|
-
defaults["
|
333
|
+
@create_product = Google::Gax.create_api_call(
|
334
|
+
@product_search_stub.method(:create_product),
|
335
|
+
defaults["create_product"],
|
336
336
|
exception_transformer: exception_transformer,
|
337
337
|
params_extractor: proc do |request|
|
338
338
|
{'parent' => request.parent}
|
339
339
|
end
|
340
340
|
)
|
341
|
-
@
|
342
|
-
@product_search_stub.method(:
|
343
|
-
defaults["
|
341
|
+
@list_products = Google::Gax.create_api_call(
|
342
|
+
@product_search_stub.method(:list_products),
|
343
|
+
defaults["list_products"],
|
344
344
|
exception_transformer: exception_transformer,
|
345
345
|
params_extractor: proc do |request|
|
346
|
-
{'
|
346
|
+
{'parent' => request.parent}
|
347
347
|
end
|
348
348
|
)
|
349
|
-
@
|
350
|
-
@product_search_stub.method(:
|
351
|
-
defaults["
|
349
|
+
@get_product = Google::Gax.create_api_call(
|
350
|
+
@product_search_stub.method(:get_product),
|
351
|
+
defaults["get_product"],
|
352
352
|
exception_transformer: exception_transformer,
|
353
353
|
params_extractor: proc do |request|
|
354
354
|
{'name' => request.name}
|
355
355
|
end
|
356
356
|
)
|
357
|
-
@
|
358
|
-
@product_search_stub.method(:
|
359
|
-
defaults["
|
357
|
+
@update_product = Google::Gax.create_api_call(
|
358
|
+
@product_search_stub.method(:update_product),
|
359
|
+
defaults["update_product"],
|
360
360
|
exception_transformer: exception_transformer,
|
361
361
|
params_extractor: proc do |request|
|
362
|
-
{'
|
362
|
+
{'product.name' => request.product.name}
|
363
363
|
end
|
364
364
|
)
|
365
|
-
@
|
366
|
-
@product_search_stub.method(:
|
367
|
-
defaults["
|
365
|
+
@delete_product = Google::Gax.create_api_call(
|
366
|
+
@product_search_stub.method(:delete_product),
|
367
|
+
defaults["delete_product"],
|
368
368
|
exception_transformer: exception_transformer,
|
369
369
|
params_extractor: proc do |request|
|
370
|
-
{'
|
370
|
+
{'name' => request.name}
|
371
371
|
end
|
372
372
|
)
|
373
|
-
@
|
374
|
-
@product_search_stub.method(:
|
375
|
-
defaults["
|
373
|
+
@create_reference_image = Google::Gax.create_api_call(
|
374
|
+
@product_search_stub.method(:create_reference_image),
|
375
|
+
defaults["create_reference_image"],
|
376
376
|
exception_transformer: exception_transformer,
|
377
377
|
params_extractor: proc do |request|
|
378
378
|
{'parent' => request.parent}
|
379
379
|
end
|
380
380
|
)
|
381
|
-
@
|
382
|
-
@product_search_stub.method(:
|
383
|
-
defaults["
|
381
|
+
@delete_reference_image = Google::Gax.create_api_call(
|
382
|
+
@product_search_stub.method(:delete_reference_image),
|
383
|
+
defaults["delete_reference_image"],
|
384
384
|
exception_transformer: exception_transformer,
|
385
385
|
params_extractor: proc do |request|
|
386
386
|
{'name' => request.name}
|
387
387
|
end
|
388
388
|
)
|
389
|
-
@
|
390
|
-
@product_search_stub.method(:
|
391
|
-
defaults["
|
389
|
+
@list_reference_images = Google::Gax.create_api_call(
|
390
|
+
@product_search_stub.method(:list_reference_images),
|
391
|
+
defaults["list_reference_images"],
|
392
392
|
exception_transformer: exception_transformer,
|
393
393
|
params_extractor: proc do |request|
|
394
|
-
{'
|
394
|
+
{'parent' => request.parent}
|
395
395
|
end
|
396
396
|
)
|
397
|
-
@
|
398
|
-
@product_search_stub.method(:
|
399
|
-
defaults["
|
397
|
+
@get_reference_image = Google::Gax.create_api_call(
|
398
|
+
@product_search_stub.method(:get_reference_image),
|
399
|
+
defaults["get_reference_image"],
|
400
400
|
exception_transformer: exception_transformer,
|
401
401
|
params_extractor: proc do |request|
|
402
402
|
{'name' => request.name}
|
@@ -438,26 +438,23 @@ module Google
|
|
438
438
|
|
439
439
|
# Service calls
|
440
440
|
|
441
|
-
# Creates and returns a new
|
441
|
+
# Creates and returns a new ProductSet resource.
|
442
442
|
#
|
443
443
|
# Possible errors:
|
444
444
|
#
|
445
|
-
# * Returns INVALID_ARGUMENT if display_name is missing or longer than
|
446
|
-
# characters.
|
447
|
-
# * Returns INVALID_ARGUMENT if description is longer than 4096 characters.
|
448
|
-
# * Returns INVALID_ARGUMENT if product_category is missing or invalid.
|
445
|
+
# * Returns INVALID_ARGUMENT if display_name is missing, or is longer than
|
446
|
+
# 4096 characters.
|
449
447
|
#
|
450
448
|
# @param parent [String]
|
451
|
-
# The project in which the
|
449
|
+
# The project in which the ProductSet should be created.
|
452
450
|
#
|
453
|
-
# Format is
|
454
|
-
#
|
455
|
-
#
|
456
|
-
#
|
457
|
-
# A hash of the same form as `Google::Cloud::Vision::V1::Product`
|
451
|
+
# Format is `projects/PROJECT_ID/locations/LOC_ID`.
|
452
|
+
# @param product_set [Google::Cloud::Vision::V1::ProductSet | Hash]
|
453
|
+
# The ProductSet to create.
|
454
|
+
# A hash of the same form as `Google::Cloud::Vision::V1::ProductSet`
|
458
455
|
# can also be provided.
|
459
|
-
# @param
|
460
|
-
# A user-supplied resource id for this
|
456
|
+
# @param product_set_id [String]
|
457
|
+
# A user-supplied resource id for this ProductSet. If set, the server will
|
461
458
|
# attempt to use this value as the resource id. If it is already in use, an
|
462
459
|
# error is returned with code ALREADY_EXISTS. Must be at most 128 characters
|
463
460
|
# long. It cannot contain the character `/`.
|
@@ -465,9 +462,9 @@ module Google
|
|
465
462
|
# Overrides the default settings for this call, e.g, timeout,
|
466
463
|
# retries, etc.
|
467
464
|
# @yield [result, operation] Access the result along with the RPC operation
|
468
|
-
# @yieldparam result [Google::Cloud::Vision::V1::
|
465
|
+
# @yieldparam result [Google::Cloud::Vision::V1::ProductSet]
|
469
466
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
470
|
-
# @return [Google::Cloud::Vision::V1::
|
467
|
+
# @return [Google::Cloud::Vision::V1::ProductSet]
|
471
468
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
472
469
|
# @example
|
473
470
|
# require "google/cloud/vision"
|
@@ -475,36 +472,36 @@ module Google
|
|
475
472
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
476
473
|
# formatted_parent = Google::Cloud::Vision::V1::ProductSearchClient.location_path("[PROJECT]", "[LOCATION]")
|
477
474
|
#
|
478
|
-
# # TODO: Initialize `
|
479
|
-
#
|
480
|
-
# response = product_search_client.
|
475
|
+
# # TODO: Initialize `product_set`:
|
476
|
+
# product_set = {}
|
477
|
+
# response = product_search_client.create_product_set(formatted_parent, product_set)
|
481
478
|
|
482
|
-
def
|
479
|
+
def create_product_set \
|
483
480
|
parent,
|
484
|
-
|
485
|
-
|
481
|
+
product_set,
|
482
|
+
product_set_id: nil,
|
486
483
|
options: nil,
|
487
484
|
&block
|
488
485
|
req = {
|
489
486
|
parent: parent,
|
490
|
-
|
491
|
-
|
487
|
+
product_set: product_set,
|
488
|
+
product_set_id: product_set_id
|
492
489
|
}.delete_if { |_, v| v.nil? }
|
493
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
494
|
-
@
|
490
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::CreateProductSetRequest)
|
491
|
+
@create_product_set.call(req, options, &block)
|
495
492
|
end
|
496
493
|
|
497
|
-
# Lists
|
494
|
+
# Lists ProductSets in an unspecified order.
|
498
495
|
#
|
499
496
|
# Possible errors:
|
500
497
|
#
|
501
|
-
# * Returns INVALID_ARGUMENT if page_size is greater than 100 or less
|
498
|
+
# * Returns INVALID_ARGUMENT if page_size is greater than 100, or less
|
499
|
+
# than 1.
|
502
500
|
#
|
503
501
|
# @param parent [String]
|
504
|
-
# The project
|
502
|
+
# The project from which ProductSets should be listed.
|
505
503
|
#
|
506
|
-
# Format
|
507
|
-
# `projects/PROJECT_ID/locations/LOC_ID`
|
504
|
+
# Format is `projects/PROJECT_ID/locations/LOC_ID`.
|
508
505
|
# @param page_size [Integer]
|
509
506
|
# The maximum number of resources contained in the underlying API
|
510
507
|
# response. If page streaming is performed per-resource, this
|
@@ -515,10 +512,10 @@ module Google
|
|
515
512
|
# Overrides the default settings for this call, e.g, timeout,
|
516
513
|
# retries, etc.
|
517
514
|
# @yield [result, operation] Access the result along with the RPC operation
|
518
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::
|
515
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::ProductSet>]
|
519
516
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
520
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::
|
521
|
-
# An enumerable of Google::Cloud::Vision::V1::
|
517
|
+
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::ProductSet>]
|
518
|
+
# An enumerable of Google::Cloud::Vision::V1::ProductSet instances.
|
522
519
|
# See Google::Gax::PagedEnumerable documentation for other
|
523
520
|
# operations such as per-page iteration or access to the response
|
524
521
|
# object.
|
@@ -530,19 +527,19 @@ module Google
|
|
530
527
|
# formatted_parent = Google::Cloud::Vision::V1::ProductSearchClient.location_path("[PROJECT]", "[LOCATION]")
|
531
528
|
#
|
532
529
|
# # Iterate over all results.
|
533
|
-
# product_search_client.
|
530
|
+
# product_search_client.list_product_sets(formatted_parent).each do |element|
|
534
531
|
# # Process element.
|
535
532
|
# end
|
536
533
|
#
|
537
534
|
# # Or iterate over results one page at a time.
|
538
|
-
# product_search_client.
|
535
|
+
# product_search_client.list_product_sets(formatted_parent).each_page do |page|
|
539
536
|
# # Process each page at a time.
|
540
537
|
# page.each do |element|
|
541
538
|
# # Process element.
|
542
539
|
# end
|
543
540
|
# end
|
544
541
|
|
545
|
-
def
|
542
|
+
def list_product_sets \
|
546
543
|
parent,
|
547
544
|
page_size: nil,
|
548
545
|
options: nil,
|
@@ -551,121 +548,107 @@ module Google
|
|
551
548
|
parent: parent,
|
552
549
|
page_size: page_size
|
553
550
|
}.delete_if { |_, v| v.nil? }
|
554
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
555
|
-
@
|
551
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::ListProductSetsRequest)
|
552
|
+
@list_product_sets.call(req, options, &block)
|
556
553
|
end
|
557
554
|
|
558
|
-
# Gets information associated with a
|
555
|
+
# Gets information associated with a ProductSet.
|
559
556
|
#
|
560
557
|
# Possible errors:
|
561
558
|
#
|
562
|
-
# * Returns NOT_FOUND if the
|
559
|
+
# * Returns NOT_FOUND if the ProductSet does not exist.
|
563
560
|
#
|
564
561
|
# @param name [String]
|
565
|
-
# Resource name of the
|
562
|
+
# Resource name of the ProductSet to get.
|
566
563
|
#
|
567
564
|
# Format is:
|
568
|
-
# `projects/PROJECT_ID/locations/
|
565
|
+
# `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`
|
569
566
|
# @param options [Google::Gax::CallOptions]
|
570
567
|
# Overrides the default settings for this call, e.g, timeout,
|
571
568
|
# retries, etc.
|
572
569
|
# @yield [result, operation] Access the result along with the RPC operation
|
573
|
-
# @yieldparam result [Google::Cloud::Vision::V1::
|
570
|
+
# @yieldparam result [Google::Cloud::Vision::V1::ProductSet]
|
574
571
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
575
|
-
# @return [Google::Cloud::Vision::V1::
|
572
|
+
# @return [Google::Cloud::Vision::V1::ProductSet]
|
576
573
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
577
574
|
# @example
|
578
575
|
# require "google/cloud/vision"
|
579
576
|
#
|
580
577
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
581
|
-
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.
|
582
|
-
# response = product_search_client.
|
578
|
+
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.product_set_path("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]")
|
579
|
+
# response = product_search_client.get_product_set(formatted_name)
|
583
580
|
|
584
|
-
def
|
581
|
+
def get_product_set \
|
585
582
|
name,
|
586
583
|
options: nil,
|
587
584
|
&block
|
588
585
|
req = {
|
589
586
|
name: name
|
590
587
|
}.delete_if { |_, v| v.nil? }
|
591
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
592
|
-
@
|
588
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::GetProductSetRequest)
|
589
|
+
@get_product_set.call(req, options, &block)
|
593
590
|
end
|
594
591
|
|
595
|
-
# Makes changes to a
|
596
|
-
# Only
|
597
|
-
# right now.
|
598
|
-
#
|
599
|
-
# If labels are updated, the change will not be reflected in queries until
|
600
|
-
# the next index time.
|
592
|
+
# Makes changes to a ProductSet resource.
|
593
|
+
# Only display_name can be updated currently.
|
601
594
|
#
|
602
595
|
# Possible errors:
|
603
596
|
#
|
604
|
-
# * Returns NOT_FOUND if the
|
605
|
-
# * Returns INVALID_ARGUMENT if display_name is present in update_mask but
|
597
|
+
# * Returns NOT_FOUND if the ProductSet does not exist.
|
598
|
+
# * Returns INVALID_ARGUMENT if display_name is present in update_mask but
|
606
599
|
# missing from the request or longer than 4096 characters.
|
607
|
-
# * Returns INVALID_ARGUMENT if description is present in update_mask but is
|
608
|
-
# longer than 4096 characters.
|
609
|
-
# * Returns INVALID_ARGUMENT if product_category is present in update_mask.
|
610
600
|
#
|
611
|
-
# @param
|
612
|
-
# The
|
613
|
-
#
|
614
|
-
# A hash of the same form as `Google::Cloud::Vision::V1::Product`
|
601
|
+
# @param product_set [Google::Cloud::Vision::V1::ProductSet | Hash]
|
602
|
+
# The ProductSet resource which replaces the one on the server.
|
603
|
+
# A hash of the same form as `Google::Cloud::Vision::V1::ProductSet`
|
615
604
|
# can also be provided.
|
616
605
|
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
617
|
-
# The {Google::Protobuf::FieldMask FieldMask} that specifies which fields
|
618
|
-
#
|
606
|
+
# The {Google::Protobuf::FieldMask FieldMask} that specifies which fields to
|
607
|
+
# update.
|
619
608
|
# If update_mask isn't specified, all mutable fields are to be updated.
|
620
|
-
# Valid mask
|
621
|
-
# `description`.
|
609
|
+
# Valid mask path is `display_name`.
|
622
610
|
# A hash of the same form as `Google::Protobuf::FieldMask`
|
623
611
|
# can also be provided.
|
624
612
|
# @param options [Google::Gax::CallOptions]
|
625
613
|
# Overrides the default settings for this call, e.g, timeout,
|
626
614
|
# retries, etc.
|
627
615
|
# @yield [result, operation] Access the result along with the RPC operation
|
628
|
-
# @yieldparam result [Google::Cloud::Vision::V1::
|
616
|
+
# @yieldparam result [Google::Cloud::Vision::V1::ProductSet]
|
629
617
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
630
|
-
# @return [Google::Cloud::Vision::V1::
|
618
|
+
# @return [Google::Cloud::Vision::V1::ProductSet]
|
631
619
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
632
620
|
# @example
|
633
621
|
# require "google/cloud/vision"
|
634
622
|
#
|
635
623
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
636
624
|
#
|
637
|
-
# # TODO: Initialize `
|
638
|
-
#
|
639
|
-
# response = product_search_client.
|
625
|
+
# # TODO: Initialize `product_set`:
|
626
|
+
# product_set = {}
|
627
|
+
# response = product_search_client.update_product_set(product_set)
|
640
628
|
|
641
|
-
def
|
642
|
-
|
629
|
+
def update_product_set \
|
630
|
+
product_set,
|
643
631
|
update_mask: nil,
|
644
632
|
options: nil,
|
645
633
|
&block
|
646
634
|
req = {
|
647
|
-
|
635
|
+
product_set: product_set,
|
648
636
|
update_mask: update_mask
|
649
637
|
}.delete_if { |_, v| v.nil? }
|
650
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
651
|
-
@
|
638
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::UpdateProductSetRequest)
|
639
|
+
@update_product_set.call(req, options, &block)
|
652
640
|
end
|
653
641
|
|
654
|
-
# Permanently deletes a
|
655
|
-
#
|
656
|
-
# Metadata of the product and all its images will be deleted right away, but
|
657
|
-
# search queries against ProductSets containing the product may still work
|
658
|
-
# until all related caches are refreshed.
|
659
|
-
#
|
660
|
-
# Possible errors:
|
642
|
+
# Permanently deletes a ProductSet. Products and ReferenceImages in the
|
643
|
+
# ProductSet are not deleted.
|
661
644
|
#
|
662
|
-
#
|
645
|
+
# The actual image files are not deleted from Google Cloud Storage.
|
663
646
|
#
|
664
647
|
# @param name [String]
|
665
|
-
# Resource name of
|
648
|
+
# Resource name of the ProductSet to delete.
|
666
649
|
#
|
667
650
|
# Format is:
|
668
|
-
# `projects/PROJECT_ID/locations/LOC_ID/
|
651
|
+
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
|
669
652
|
# @param options [Google::Gax::CallOptions]
|
670
653
|
# Overrides the default settings for this call, e.g, timeout,
|
671
654
|
# retries, etc.
|
@@ -677,34 +660,88 @@ module Google
|
|
677
660
|
# require "google/cloud/vision"
|
678
661
|
#
|
679
662
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
680
|
-
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.
|
681
|
-
# product_search_client.
|
663
|
+
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.product_set_path("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]")
|
664
|
+
# product_search_client.delete_product_set(formatted_name)
|
682
665
|
|
683
|
-
def
|
666
|
+
def delete_product_set \
|
684
667
|
name,
|
685
668
|
options: nil,
|
686
669
|
&block
|
687
670
|
req = {
|
688
671
|
name: name
|
689
672
|
}.delete_if { |_, v| v.nil? }
|
690
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
691
|
-
@
|
673
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::DeleteProductSetRequest)
|
674
|
+
@delete_product_set.call(req, options, &block)
|
692
675
|
nil
|
693
676
|
end
|
694
677
|
|
695
|
-
#
|
678
|
+
# Creates and returns a new product resource.
|
696
679
|
#
|
697
680
|
# Possible errors:
|
698
681
|
#
|
699
|
-
# * Returns
|
700
|
-
#
|
701
|
-
#
|
682
|
+
# * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096
|
683
|
+
# characters.
|
684
|
+
# * Returns INVALID_ARGUMENT if description is longer than 4096 characters.
|
685
|
+
# * Returns INVALID_ARGUMENT if product_category is missing or invalid.
|
702
686
|
#
|
703
687
|
# @param parent [String]
|
704
|
-
#
|
688
|
+
# The project in which the Product should be created.
|
705
689
|
#
|
706
690
|
# Format is
|
707
|
-
# `projects/PROJECT_ID/locations/LOC_ID
|
691
|
+
# `projects/PROJECT_ID/locations/LOC_ID`.
|
692
|
+
# @param product [Google::Cloud::Vision::V1::Product | Hash]
|
693
|
+
# The product to create.
|
694
|
+
# A hash of the same form as `Google::Cloud::Vision::V1::Product`
|
695
|
+
# can also be provided.
|
696
|
+
# @param product_id [String]
|
697
|
+
# A user-supplied resource id for this Product. If set, the server will
|
698
|
+
# attempt to use this value as the resource id. If it is already in use, an
|
699
|
+
# error is returned with code ALREADY_EXISTS. Must be at most 128 characters
|
700
|
+
# long. It cannot contain the character `/`.
|
701
|
+
# @param options [Google::Gax::CallOptions]
|
702
|
+
# Overrides the default settings for this call, e.g, timeout,
|
703
|
+
# retries, etc.
|
704
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
705
|
+
# @yieldparam result [Google::Cloud::Vision::V1::Product]
|
706
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
707
|
+
# @return [Google::Cloud::Vision::V1::Product]
|
708
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
709
|
+
# @example
|
710
|
+
# require "google/cloud/vision"
|
711
|
+
#
|
712
|
+
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
713
|
+
# formatted_parent = Google::Cloud::Vision::V1::ProductSearchClient.location_path("[PROJECT]", "[LOCATION]")
|
714
|
+
#
|
715
|
+
# # TODO: Initialize `product`:
|
716
|
+
# product = {}
|
717
|
+
# response = product_search_client.create_product(formatted_parent, product)
|
718
|
+
|
719
|
+
def create_product \
|
720
|
+
parent,
|
721
|
+
product,
|
722
|
+
product_id: nil,
|
723
|
+
options: nil,
|
724
|
+
&block
|
725
|
+
req = {
|
726
|
+
parent: parent,
|
727
|
+
product: product,
|
728
|
+
product_id: product_id
|
729
|
+
}.delete_if { |_, v| v.nil? }
|
730
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::CreateProductRequest)
|
731
|
+
@create_product.call(req, options, &block)
|
732
|
+
end
|
733
|
+
|
734
|
+
# Lists products in an unspecified order.
|
735
|
+
#
|
736
|
+
# Possible errors:
|
737
|
+
#
|
738
|
+
# * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
|
739
|
+
#
|
740
|
+
# @param parent [String]
|
741
|
+
# The project OR ProductSet from which Products should be listed.
|
742
|
+
#
|
743
|
+
# Format:
|
744
|
+
# `projects/PROJECT_ID/locations/LOC_ID`
|
708
745
|
# @param page_size [Integer]
|
709
746
|
# The maximum number of resources contained in the underlying API
|
710
747
|
# response. If page streaming is performed per-resource, this
|
@@ -715,10 +752,10 @@ module Google
|
|
715
752
|
# Overrides the default settings for this call, e.g, timeout,
|
716
753
|
# retries, etc.
|
717
754
|
# @yield [result, operation] Access the result along with the RPC operation
|
718
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::
|
755
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::Product>]
|
719
756
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
720
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::
|
721
|
-
# An enumerable of Google::Cloud::Vision::V1::
|
757
|
+
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::Product>]
|
758
|
+
# An enumerable of Google::Cloud::Vision::V1::Product instances.
|
722
759
|
# See Google::Gax::PagedEnumerable documentation for other
|
723
760
|
# operations such as per-page iteration or access to the response
|
724
761
|
# object.
|
@@ -727,22 +764,22 @@ module Google
|
|
727
764
|
# require "google/cloud/vision"
|
728
765
|
#
|
729
766
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
730
|
-
# formatted_parent = Google::Cloud::Vision::V1::ProductSearchClient.
|
767
|
+
# formatted_parent = Google::Cloud::Vision::V1::ProductSearchClient.location_path("[PROJECT]", "[LOCATION]")
|
731
768
|
#
|
732
769
|
# # Iterate over all results.
|
733
|
-
# product_search_client.
|
770
|
+
# product_search_client.list_products(formatted_parent).each do |element|
|
734
771
|
# # Process element.
|
735
772
|
# end
|
736
773
|
#
|
737
774
|
# # Or iterate over results one page at a time.
|
738
|
-
# product_search_client.
|
775
|
+
# product_search_client.list_products(formatted_parent).each_page do |page|
|
739
776
|
# # Process each page at a time.
|
740
777
|
# page.each do |element|
|
741
778
|
# # Process element.
|
742
779
|
# end
|
743
780
|
# end
|
744
781
|
|
745
|
-
def
|
782
|
+
def list_products \
|
746
783
|
parent,
|
747
784
|
page_size: nil,
|
748
785
|
options: nil,
|
@@ -751,66 +788,117 @@ module Google
|
|
751
788
|
parent: parent,
|
752
789
|
page_size: page_size
|
753
790
|
}.delete_if { |_, v| v.nil? }
|
754
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
755
|
-
@
|
791
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::ListProductsRequest)
|
792
|
+
@list_products.call(req, options, &block)
|
756
793
|
end
|
757
794
|
|
758
|
-
# Gets information associated with a
|
795
|
+
# Gets information associated with a Product.
|
759
796
|
#
|
760
797
|
# Possible errors:
|
761
798
|
#
|
762
|
-
# * Returns NOT_FOUND if the
|
799
|
+
# * Returns NOT_FOUND if the Product does not exist.
|
763
800
|
#
|
764
801
|
# @param name [String]
|
765
|
-
#
|
802
|
+
# Resource name of the Product to get.
|
766
803
|
#
|
767
804
|
# Format is:
|
768
|
-
#
|
769
|
-
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
|
805
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
|
770
806
|
# @param options [Google::Gax::CallOptions]
|
771
807
|
# Overrides the default settings for this call, e.g, timeout,
|
772
808
|
# retries, etc.
|
773
809
|
# @yield [result, operation] Access the result along with the RPC operation
|
774
|
-
# @yieldparam result [Google::Cloud::Vision::V1::
|
810
|
+
# @yieldparam result [Google::Cloud::Vision::V1::Product]
|
775
811
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
776
|
-
# @return [Google::Cloud::Vision::V1::
|
812
|
+
# @return [Google::Cloud::Vision::V1::Product]
|
777
813
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
778
814
|
# @example
|
779
815
|
# require "google/cloud/vision"
|
780
816
|
#
|
781
817
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
782
|
-
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.
|
783
|
-
# response = product_search_client.
|
818
|
+
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.product_path("[PROJECT]", "[LOCATION]", "[PRODUCT]")
|
819
|
+
# response = product_search_client.get_product(formatted_name)
|
784
820
|
|
785
|
-
def
|
821
|
+
def get_product \
|
786
822
|
name,
|
787
823
|
options: nil,
|
788
824
|
&block
|
789
825
|
req = {
|
790
826
|
name: name
|
791
827
|
}.delete_if { |_, v| v.nil? }
|
792
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
793
|
-
@
|
828
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::GetProductRequest)
|
829
|
+
@get_product.call(req, options, &block)
|
794
830
|
end
|
795
831
|
|
796
|
-
#
|
797
|
-
#
|
798
|
-
#
|
799
|
-
# against ProductSets containing the image may still work until all related
|
800
|
-
# caches are refreshed.
|
832
|
+
# Makes changes to a Product resource.
|
833
|
+
# Only the `display_name`, `description`, and `labels` fields can be updated
|
834
|
+
# right now.
|
801
835
|
#
|
802
|
-
#
|
836
|
+
# If labels are updated, the change will not be reflected in queries until
|
837
|
+
# the next index time.
|
803
838
|
#
|
804
839
|
# Possible errors:
|
805
840
|
#
|
806
|
-
# * Returns NOT_FOUND if the
|
841
|
+
# * Returns NOT_FOUND if the Product does not exist.
|
842
|
+
# * Returns INVALID_ARGUMENT if display_name is present in update_mask but is
|
843
|
+
# missing from the request or longer than 4096 characters.
|
844
|
+
# * Returns INVALID_ARGUMENT if description is present in update_mask but is
|
845
|
+
# longer than 4096 characters.
|
846
|
+
# * Returns INVALID_ARGUMENT if product_category is present in update_mask.
|
847
|
+
#
|
848
|
+
# @param product [Google::Cloud::Vision::V1::Product | Hash]
|
849
|
+
# The Product resource which replaces the one on the server.
|
850
|
+
# product.name is immutable.
|
851
|
+
# A hash of the same form as `Google::Cloud::Vision::V1::Product`
|
852
|
+
# can also be provided.
|
853
|
+
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
854
|
+
# The {Google::Protobuf::FieldMask FieldMask} that specifies which fields
|
855
|
+
# to update.
|
856
|
+
# If update_mask isn't specified, all mutable fields are to be updated.
|
857
|
+
# Valid mask paths include `product_labels`, `display_name`, and
|
858
|
+
# `description`.
|
859
|
+
# A hash of the same form as `Google::Protobuf::FieldMask`
|
860
|
+
# can also be provided.
|
861
|
+
# @param options [Google::Gax::CallOptions]
|
862
|
+
# Overrides the default settings for this call, e.g, timeout,
|
863
|
+
# retries, etc.
|
864
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
865
|
+
# @yieldparam result [Google::Cloud::Vision::V1::Product]
|
866
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
867
|
+
# @return [Google::Cloud::Vision::V1::Product]
|
868
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
869
|
+
# @example
|
870
|
+
# require "google/cloud/vision"
|
871
|
+
#
|
872
|
+
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
873
|
+
#
|
874
|
+
# # TODO: Initialize `product`:
|
875
|
+
# product = {}
|
876
|
+
# response = product_search_client.update_product(product)
|
877
|
+
|
878
|
+
def update_product \
|
879
|
+
product,
|
880
|
+
update_mask: nil,
|
881
|
+
options: nil,
|
882
|
+
&block
|
883
|
+
req = {
|
884
|
+
product: product,
|
885
|
+
update_mask: update_mask
|
886
|
+
}.delete_if { |_, v| v.nil? }
|
887
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::UpdateProductRequest)
|
888
|
+
@update_product.call(req, options, &block)
|
889
|
+
end
|
890
|
+
|
891
|
+
# Permanently deletes a product and its reference images.
|
892
|
+
#
|
893
|
+
# Metadata of the product and all its images will be deleted right away, but
|
894
|
+
# search queries against ProductSets containing the product may still work
|
895
|
+
# until all related caches are refreshed.
|
807
896
|
#
|
808
897
|
# @param name [String]
|
809
|
-
#
|
898
|
+
# Resource name of product to delete.
|
810
899
|
#
|
811
900
|
# Format is:
|
812
|
-
#
|
813
|
-
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
|
901
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
|
814
902
|
# @param options [Google::Gax::CallOptions]
|
815
903
|
# Overrides the default settings for this call, e.g, timeout,
|
816
904
|
# retries, etc.
|
@@ -822,18 +910,18 @@ module Google
|
|
822
910
|
# require "google/cloud/vision"
|
823
911
|
#
|
824
912
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
825
|
-
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.
|
826
|
-
# product_search_client.
|
913
|
+
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.product_path("[PROJECT]", "[LOCATION]", "[PRODUCT]")
|
914
|
+
# product_search_client.delete_product(formatted_name)
|
827
915
|
|
828
|
-
def
|
916
|
+
def delete_product \
|
829
917
|
name,
|
830
918
|
options: nil,
|
831
919
|
&block
|
832
920
|
req = {
|
833
921
|
name: name
|
834
922
|
}.delete_if { |_, v| v.nil? }
|
835
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
836
|
-
@
|
923
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::DeleteProductRequest)
|
924
|
+
@delete_product.call(req, options, &block)
|
837
925
|
nil
|
838
926
|
end
|
839
927
|
|
@@ -905,70 +993,59 @@ module Google
|
|
905
993
|
@create_reference_image.call(req, options, &block)
|
906
994
|
end
|
907
995
|
|
908
|
-
#
|
996
|
+
# Permanently deletes a reference image.
|
909
997
|
#
|
910
|
-
#
|
998
|
+
# The image metadata will be deleted right away, but search queries
|
999
|
+
# against ProductSets containing the image may still work until all related
|
1000
|
+
# caches are refreshed.
|
911
1001
|
#
|
912
|
-
#
|
913
|
-
# 4096 characters.
|
1002
|
+
# The actual image files are not deleted from Google Cloud Storage.
|
914
1003
|
#
|
915
|
-
# @param
|
916
|
-
# The
|
1004
|
+
# @param name [String]
|
1005
|
+
# The resource name of the reference image to delete.
|
917
1006
|
#
|
918
|
-
# Format is
|
919
|
-
#
|
920
|
-
#
|
921
|
-
# A hash of the same form as `Google::Cloud::Vision::V1::ProductSet`
|
922
|
-
# can also be provided.
|
923
|
-
# @param product_set_id [String]
|
924
|
-
# A user-supplied resource id for this ProductSet. If set, the server will
|
925
|
-
# attempt to use this value as the resource id. If it is already in use, an
|
926
|
-
# error is returned with code ALREADY_EXISTS. Must be at most 128 characters
|
927
|
-
# long. It cannot contain the character `/`.
|
1007
|
+
# Format is:
|
1008
|
+
#
|
1009
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
|
928
1010
|
# @param options [Google::Gax::CallOptions]
|
929
1011
|
# Overrides the default settings for this call, e.g, timeout,
|
930
1012
|
# retries, etc.
|
931
1013
|
# @yield [result, operation] Access the result along with the RPC operation
|
932
|
-
# @yieldparam result [
|
1014
|
+
# @yieldparam result []
|
933
1015
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
934
|
-
# @return [Google::Cloud::Vision::V1::ProductSet]
|
935
1016
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
936
1017
|
# @example
|
937
1018
|
# require "google/cloud/vision"
|
938
1019
|
#
|
939
1020
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
940
|
-
#
|
941
|
-
#
|
942
|
-
# # TODO: Initialize `product_set`:
|
943
|
-
# product_set = {}
|
944
|
-
# response = product_search_client.create_product_set(formatted_parent, product_set)
|
1021
|
+
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.reference_image_path("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
|
1022
|
+
# product_search_client.delete_reference_image(formatted_name)
|
945
1023
|
|
946
|
-
def
|
947
|
-
|
948
|
-
product_set,
|
949
|
-
product_set_id: nil,
|
1024
|
+
def delete_reference_image \
|
1025
|
+
name,
|
950
1026
|
options: nil,
|
951
1027
|
&block
|
952
1028
|
req = {
|
953
|
-
|
954
|
-
product_set: product_set,
|
955
|
-
product_set_id: product_set_id
|
1029
|
+
name: name
|
956
1030
|
}.delete_if { |_, v| v.nil? }
|
957
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
958
|
-
@
|
1031
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::DeleteReferenceImageRequest)
|
1032
|
+
@delete_reference_image.call(req, options, &block)
|
1033
|
+
nil
|
959
1034
|
end
|
960
1035
|
|
961
|
-
# Lists
|
1036
|
+
# Lists reference images.
|
962
1037
|
#
|
963
1038
|
# Possible errors:
|
964
1039
|
#
|
965
|
-
# * Returns
|
1040
|
+
# * Returns NOT_FOUND if the parent product does not exist.
|
1041
|
+
# * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less
|
966
1042
|
# than 1.
|
967
1043
|
#
|
968
1044
|
# @param parent [String]
|
969
|
-
#
|
1045
|
+
# Resource name of the product containing the reference images.
|
970
1046
|
#
|
971
|
-
# Format is
|
1047
|
+
# Format is
|
1048
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
|
972
1049
|
# @param page_size [Integer]
|
973
1050
|
# The maximum number of resources contained in the underlying API
|
974
1051
|
# response. If page streaming is performed per-resource, this
|
@@ -979,10 +1056,10 @@ module Google
|
|
979
1056
|
# Overrides the default settings for this call, e.g, timeout,
|
980
1057
|
# retries, etc.
|
981
1058
|
# @yield [result, operation] Access the result along with the RPC operation
|
982
|
-
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::
|
1059
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::ReferenceImage>]
|
983
1060
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
984
|
-
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::
|
985
|
-
# An enumerable of Google::Cloud::Vision::V1::
|
1061
|
+
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Vision::V1::ReferenceImage>]
|
1062
|
+
# An enumerable of Google::Cloud::Vision::V1::ReferenceImage instances.
|
986
1063
|
# See Google::Gax::PagedEnumerable documentation for other
|
987
1064
|
# operations such as per-page iteration or access to the response
|
988
1065
|
# object.
|
@@ -991,22 +1068,22 @@ module Google
|
|
991
1068
|
# require "google/cloud/vision"
|
992
1069
|
#
|
993
1070
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
994
|
-
# formatted_parent = Google::Cloud::Vision::V1::ProductSearchClient.
|
1071
|
+
# formatted_parent = Google::Cloud::Vision::V1::ProductSearchClient.product_path("[PROJECT]", "[LOCATION]", "[PRODUCT]")
|
995
1072
|
#
|
996
1073
|
# # Iterate over all results.
|
997
|
-
# product_search_client.
|
1074
|
+
# product_search_client.list_reference_images(formatted_parent).each do |element|
|
998
1075
|
# # Process element.
|
999
1076
|
# end
|
1000
1077
|
#
|
1001
1078
|
# # Or iterate over results one page at a time.
|
1002
|
-
# product_search_client.
|
1079
|
+
# product_search_client.list_reference_images(formatted_parent).each_page do |page|
|
1003
1080
|
# # Process each page at a time.
|
1004
1081
|
# page.each do |element|
|
1005
1082
|
# # Process element.
|
1006
1083
|
# end
|
1007
1084
|
# end
|
1008
1085
|
|
1009
|
-
def
|
1086
|
+
def list_reference_images \
|
1010
1087
|
parent,
|
1011
1088
|
page_size: nil,
|
1012
1089
|
options: nil,
|
@@ -1015,135 +1092,46 @@ module Google
|
|
1015
1092
|
parent: parent,
|
1016
1093
|
page_size: page_size
|
1017
1094
|
}.delete_if { |_, v| v.nil? }
|
1018
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
1019
|
-
@
|
1095
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::ListReferenceImagesRequest)
|
1096
|
+
@list_reference_images.call(req, options, &block)
|
1020
1097
|
end
|
1021
1098
|
|
1022
|
-
# Gets information associated with a
|
1099
|
+
# Gets information associated with a ReferenceImage.
|
1023
1100
|
#
|
1024
1101
|
# Possible errors:
|
1025
1102
|
#
|
1026
|
-
# * Returns NOT_FOUND if the
|
1103
|
+
# * Returns NOT_FOUND if the specified image does not exist.
|
1027
1104
|
#
|
1028
1105
|
# @param name [String]
|
1029
|
-
#
|
1106
|
+
# The resource name of the ReferenceImage to get.
|
1030
1107
|
#
|
1031
1108
|
# Format is:
|
1032
|
-
# `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID`
|
1033
|
-
# @param options [Google::Gax::CallOptions]
|
1034
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1035
|
-
# retries, etc.
|
1036
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1037
|
-
# @yieldparam result [Google::Cloud::Vision::V1::ProductSet]
|
1038
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1039
|
-
# @return [Google::Cloud::Vision::V1::ProductSet]
|
1040
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1041
|
-
# @example
|
1042
|
-
# require "google/cloud/vision"
|
1043
|
-
#
|
1044
|
-
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
1045
|
-
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.product_set_path("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]")
|
1046
|
-
# response = product_search_client.get_product_set(formatted_name)
|
1047
|
-
|
1048
|
-
def get_product_set \
|
1049
|
-
name,
|
1050
|
-
options: nil,
|
1051
|
-
&block
|
1052
|
-
req = {
|
1053
|
-
name: name
|
1054
|
-
}.delete_if { |_, v| v.nil? }
|
1055
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::GetProductSetRequest)
|
1056
|
-
@get_product_set.call(req, options, &block)
|
1057
|
-
end
|
1058
|
-
|
1059
|
-
# Makes changes to a ProductSet resource.
|
1060
|
-
# Only display_name can be updated currently.
|
1061
|
-
#
|
1062
|
-
# Possible errors:
|
1063
|
-
#
|
1064
|
-
# * Returns NOT_FOUND if the ProductSet does not exist.
|
1065
|
-
# * Returns INVALID_ARGUMENT if display_name is present in update_mask but
|
1066
|
-
# missing from the request or longer than 4096 characters.
|
1067
|
-
#
|
1068
|
-
# @param product_set [Google::Cloud::Vision::V1::ProductSet | Hash]
|
1069
|
-
# The ProductSet resource which replaces the one on the server.
|
1070
|
-
# A hash of the same form as `Google::Cloud::Vision::V1::ProductSet`
|
1071
|
-
# can also be provided.
|
1072
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
1073
|
-
# The {Google::Protobuf::FieldMask FieldMask} that specifies which fields to
|
1074
|
-
# update.
|
1075
|
-
# If update_mask isn't specified, all mutable fields are to be updated.
|
1076
|
-
# Valid mask path is `display_name`.
|
1077
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
1078
|
-
# can also be provided.
|
1079
|
-
# @param options [Google::Gax::CallOptions]
|
1080
|
-
# Overrides the default settings for this call, e.g, timeout,
|
1081
|
-
# retries, etc.
|
1082
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
1083
|
-
# @yieldparam result [Google::Cloud::Vision::V1::ProductSet]
|
1084
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1085
|
-
# @return [Google::Cloud::Vision::V1::ProductSet]
|
1086
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1087
|
-
# @example
|
1088
|
-
# require "google/cloud/vision"
|
1089
|
-
#
|
1090
|
-
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
1091
1109
|
#
|
1092
|
-
#
|
1093
|
-
# product_set = {}
|
1094
|
-
# response = product_search_client.update_product_set(product_set)
|
1095
|
-
|
1096
|
-
def update_product_set \
|
1097
|
-
product_set,
|
1098
|
-
update_mask: nil,
|
1099
|
-
options: nil,
|
1100
|
-
&block
|
1101
|
-
req = {
|
1102
|
-
product_set: product_set,
|
1103
|
-
update_mask: update_mask
|
1104
|
-
}.delete_if { |_, v| v.nil? }
|
1105
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::UpdateProductSetRequest)
|
1106
|
-
@update_product_set.call(req, options, &block)
|
1107
|
-
end
|
1108
|
-
|
1109
|
-
# Permanently deletes a ProductSet. Products and ReferenceImages in the
|
1110
|
-
# ProductSet are not deleted.
|
1111
|
-
#
|
1112
|
-
# The actual image files are not deleted from Google Cloud Storage.
|
1113
|
-
#
|
1114
|
-
# Possible errors:
|
1115
|
-
#
|
1116
|
-
# * Returns NOT_FOUND if the ProductSet does not exist.
|
1117
|
-
#
|
1118
|
-
# @param name [String]
|
1119
|
-
# Resource name of the ProductSet to delete.
|
1120
|
-
#
|
1121
|
-
# Format is:
|
1122
|
-
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
|
1110
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
|
1123
1111
|
# @param options [Google::Gax::CallOptions]
|
1124
1112
|
# Overrides the default settings for this call, e.g, timeout,
|
1125
1113
|
# retries, etc.
|
1126
1114
|
# @yield [result, operation] Access the result along with the RPC operation
|
1127
|
-
# @yieldparam result []
|
1115
|
+
# @yieldparam result [Google::Cloud::Vision::V1::ReferenceImage]
|
1128
1116
|
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
1117
|
+
# @return [Google::Cloud::Vision::V1::ReferenceImage]
|
1129
1118
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1130
1119
|
# @example
|
1131
1120
|
# require "google/cloud/vision"
|
1132
1121
|
#
|
1133
1122
|
# product_search_client = Google::Cloud::Vision::ProductSearch.new(version: :v1)
|
1134
|
-
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.
|
1135
|
-
# product_search_client.
|
1123
|
+
# formatted_name = Google::Cloud::Vision::V1::ProductSearchClient.reference_image_path("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]")
|
1124
|
+
# response = product_search_client.get_reference_image(formatted_name)
|
1136
1125
|
|
1137
|
-
def
|
1126
|
+
def get_reference_image \
|
1138
1127
|
name,
|
1139
1128
|
options: nil,
|
1140
1129
|
&block
|
1141
1130
|
req = {
|
1142
1131
|
name: name
|
1143
1132
|
}.delete_if { |_, v| v.nil? }
|
1144
|
-
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::
|
1145
|
-
@
|
1146
|
-
nil
|
1133
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Vision::V1::GetReferenceImageRequest)
|
1134
|
+
@get_reference_image.call(req, options, &block)
|
1147
1135
|
end
|
1148
1136
|
|
1149
1137
|
# Adds a Product to the specified ProductSet. If the Product is already
|
@@ -1196,10 +1184,6 @@ module Google
|
|
1196
1184
|
|
1197
1185
|
# Removes a Product from the specified ProductSet.
|
1198
1186
|
#
|
1199
|
-
# Possible errors:
|
1200
|
-
#
|
1201
|
-
# * Returns NOT_FOUND If the Product is not found under the ProductSet.
|
1202
|
-
#
|
1203
1187
|
# @param name [String]
|
1204
1188
|
# The resource name for the ProductSet to modify.
|
1205
1189
|
#
|