google-cloud-vision-v1 0.9.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +3 -3
- data/lib/google/cloud/vision/v1/geometry_pb.rb +24 -18
- data/lib/google/cloud/vision/v1/image_annotator/client.rb +10 -10
- data/lib/google/cloud/vision/v1/image_annotator/operations.rb +14 -16
- data/lib/google/cloud/vision/v1/image_annotator/rest/client.rb +662 -0
- data/lib/google/cloud/vision/v1/image_annotator/rest/operations.rb +814 -0
- data/lib/google/cloud/vision/v1/image_annotator/rest/service_stub.rb +344 -0
- data/lib/google/cloud/vision/v1/image_annotator/rest.rb +55 -0
- data/lib/google/cloud/vision/v1/image_annotator.rb +7 -1
- data/lib/google/cloud/vision/v1/image_annotator_pb.rb +32 -273
- data/lib/google/cloud/vision/v1/product_search/client.rb +26 -34
- data/lib/google/cloud/vision/v1/product_search/operations.rb +14 -16
- data/lib/google/cloud/vision/v1/product_search/rest/client.rb +1970 -0
- data/lib/google/cloud/vision/v1/product_search/rest/operations.rb +814 -0
- data/lib/google/cloud/vision/v1/product_search/rest/service_stub.rb +1178 -0
- data/lib/google/cloud/vision/v1/product_search/rest.rb +66 -0
- data/lib/google/cloud/vision/v1/product_search.rb +7 -1
- data/lib/google/cloud/vision/v1/product_search_pb.rb +27 -28
- data/lib/google/cloud/vision/v1/product_search_service_pb.rb +28 -148
- data/lib/google/cloud/vision/v1/rest.rb +38 -0
- data/lib/google/cloud/vision/v1/text_annotation_pb.rb +25 -65
- data/lib/google/cloud/vision/v1/version.rb +1 -1
- data/lib/google/cloud/vision/v1/web_detection_pb.rb +24 -29
- data/lib/google/cloud/vision/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +381 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/cloud/vision/v1/image_annotator.rb +2 -1
- data/proto_docs/google/protobuf/any.rb +7 -4
- data/proto_docs/google/protobuf/timestamp.rb +1 -3
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +21 -8
@@ -0,0 +1,1970 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/vision/v1/product_search_service_pb"
|
21
|
+
require "google/cloud/vision/v1/product_search/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Vision
|
26
|
+
module V1
|
27
|
+
module ProductSearch
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the ProductSearch service.
|
31
|
+
#
|
32
|
+
# Manages Products and ProductSets of reference images for use in product
|
33
|
+
# search. It uses the following resource model:
|
34
|
+
#
|
35
|
+
# - The API has a collection of {::Google::Cloud::Vision::V1::ProductSet ProductSet} resources, named
|
36
|
+
# `projects/*/locations/*/productSets/*`, which acts as a way to put different
|
37
|
+
# products into groups to limit identification.
|
38
|
+
#
|
39
|
+
# In parallel,
|
40
|
+
#
|
41
|
+
# - The API has a collection of {::Google::Cloud::Vision::V1::Product Product} resources, named
|
42
|
+
# `projects/*/locations/*/products/*`
|
43
|
+
#
|
44
|
+
# - Each {::Google::Cloud::Vision::V1::Product Product} has a collection of {::Google::Cloud::Vision::V1::ReferenceImage ReferenceImage} resources, named
|
45
|
+
# `projects/*/locations/*/products/*/referenceImages/*`
|
46
|
+
#
|
47
|
+
class Client
|
48
|
+
include Paths
|
49
|
+
|
50
|
+
# @private
|
51
|
+
attr_reader :product_search_stub
|
52
|
+
|
53
|
+
##
|
54
|
+
# Configure the ProductSearch Client class.
|
55
|
+
#
|
56
|
+
# See {::Google::Cloud::Vision::V1::ProductSearch::Rest::Client::Configuration}
|
57
|
+
# for a description of the configuration fields.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
#
|
61
|
+
# # Modify the configuration for all ProductSearch clients
|
62
|
+
# ::Google::Cloud::Vision::V1::ProductSearch::Rest::Client.configure do |config|
|
63
|
+
# config.timeout = 10.0
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# @yield [config] Configure the Client client.
|
67
|
+
# @yieldparam config [Client::Configuration]
|
68
|
+
#
|
69
|
+
# @return [Client::Configuration]
|
70
|
+
#
|
71
|
+
def self.configure
|
72
|
+
@configure ||= begin
|
73
|
+
namespace = ["Google", "Cloud", "Vision", "V1"]
|
74
|
+
parent_config = while namespace.any?
|
75
|
+
parent_name = namespace.join "::"
|
76
|
+
parent_const = const_get parent_name
|
77
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
78
|
+
namespace.pop
|
79
|
+
end
|
80
|
+
default_config = Client::Configuration.new parent_config
|
81
|
+
|
82
|
+
default_config.rpcs.create_product_set.timeout = 600.0
|
83
|
+
default_config.rpcs.create_product_set.retry_policy = {
|
84
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
85
|
+
}
|
86
|
+
|
87
|
+
default_config.rpcs.list_product_sets.timeout = 600.0
|
88
|
+
default_config.rpcs.list_product_sets.retry_policy = {
|
89
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
90
|
+
}
|
91
|
+
|
92
|
+
default_config.rpcs.get_product_set.timeout = 600.0
|
93
|
+
default_config.rpcs.get_product_set.retry_policy = {
|
94
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
95
|
+
}
|
96
|
+
|
97
|
+
default_config.rpcs.update_product_set.timeout = 600.0
|
98
|
+
default_config.rpcs.update_product_set.retry_policy = {
|
99
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
100
|
+
}
|
101
|
+
|
102
|
+
default_config.rpcs.delete_product_set.timeout = 600.0
|
103
|
+
default_config.rpcs.delete_product_set.retry_policy = {
|
104
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
105
|
+
}
|
106
|
+
|
107
|
+
default_config.rpcs.create_product.timeout = 600.0
|
108
|
+
default_config.rpcs.create_product.retry_policy = {
|
109
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
110
|
+
}
|
111
|
+
|
112
|
+
default_config.rpcs.list_products.timeout = 600.0
|
113
|
+
default_config.rpcs.list_products.retry_policy = {
|
114
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
115
|
+
}
|
116
|
+
|
117
|
+
default_config.rpcs.get_product.timeout = 600.0
|
118
|
+
default_config.rpcs.get_product.retry_policy = {
|
119
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
120
|
+
}
|
121
|
+
|
122
|
+
default_config.rpcs.update_product.timeout = 600.0
|
123
|
+
default_config.rpcs.update_product.retry_policy = {
|
124
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
125
|
+
}
|
126
|
+
|
127
|
+
default_config.rpcs.delete_product.timeout = 600.0
|
128
|
+
default_config.rpcs.delete_product.retry_policy = {
|
129
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
130
|
+
}
|
131
|
+
|
132
|
+
default_config.rpcs.create_reference_image.timeout = 600.0
|
133
|
+
default_config.rpcs.create_reference_image.retry_policy = {
|
134
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
135
|
+
}
|
136
|
+
|
137
|
+
default_config.rpcs.delete_reference_image.timeout = 600.0
|
138
|
+
default_config.rpcs.delete_reference_image.retry_policy = {
|
139
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
140
|
+
}
|
141
|
+
|
142
|
+
default_config.rpcs.list_reference_images.timeout = 600.0
|
143
|
+
default_config.rpcs.list_reference_images.retry_policy = {
|
144
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
145
|
+
}
|
146
|
+
|
147
|
+
default_config.rpcs.get_reference_image.timeout = 600.0
|
148
|
+
default_config.rpcs.get_reference_image.retry_policy = {
|
149
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
150
|
+
}
|
151
|
+
|
152
|
+
default_config.rpcs.add_product_to_product_set.timeout = 600.0
|
153
|
+
default_config.rpcs.add_product_to_product_set.retry_policy = {
|
154
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
155
|
+
}
|
156
|
+
|
157
|
+
default_config.rpcs.remove_product_from_product_set.timeout = 600.0
|
158
|
+
default_config.rpcs.remove_product_from_product_set.retry_policy = {
|
159
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
160
|
+
}
|
161
|
+
|
162
|
+
default_config.rpcs.list_products_in_product_set.timeout = 600.0
|
163
|
+
default_config.rpcs.list_products_in_product_set.retry_policy = {
|
164
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
165
|
+
}
|
166
|
+
|
167
|
+
default_config.rpcs.import_product_sets.timeout = 600.0
|
168
|
+
default_config.rpcs.import_product_sets.retry_policy = {
|
169
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
170
|
+
}
|
171
|
+
|
172
|
+
default_config.rpcs.purge_products.timeout = 600.0
|
173
|
+
default_config.rpcs.purge_products.retry_policy = {
|
174
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
|
175
|
+
}
|
176
|
+
|
177
|
+
default_config
|
178
|
+
end
|
179
|
+
yield @configure if block_given?
|
180
|
+
@configure
|
181
|
+
end
|
182
|
+
|
183
|
+
##
|
184
|
+
# Configure the ProductSearch Client instance.
|
185
|
+
#
|
186
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
187
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
188
|
+
# should be made on {Client.configure}.
|
189
|
+
#
|
190
|
+
# See {::Google::Cloud::Vision::V1::ProductSearch::Rest::Client::Configuration}
|
191
|
+
# for a description of the configuration fields.
|
192
|
+
#
|
193
|
+
# @yield [config] Configure the Client client.
|
194
|
+
# @yieldparam config [Client::Configuration]
|
195
|
+
#
|
196
|
+
# @return [Client::Configuration]
|
197
|
+
#
|
198
|
+
def configure
|
199
|
+
yield @config if block_given?
|
200
|
+
@config
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# Create a new ProductSearch REST client object.
|
205
|
+
#
|
206
|
+
# @example
|
207
|
+
#
|
208
|
+
# # Create a client using the default configuration
|
209
|
+
# client = ::Google::Cloud::Vision::V1::ProductSearch::Rest::Client.new
|
210
|
+
#
|
211
|
+
# # Create a client using a custom configuration
|
212
|
+
# client = ::Google::Cloud::Vision::V1::ProductSearch::Rest::Client.new do |config|
|
213
|
+
# config.timeout = 10.0
|
214
|
+
# end
|
215
|
+
#
|
216
|
+
# @yield [config] Configure the ProductSearch client.
|
217
|
+
# @yieldparam config [Client::Configuration]
|
218
|
+
#
|
219
|
+
def initialize
|
220
|
+
# Create the configuration object
|
221
|
+
@config = Configuration.new Client.configure
|
222
|
+
|
223
|
+
# Yield the configuration if needed
|
224
|
+
yield @config if block_given?
|
225
|
+
|
226
|
+
# Create credentials
|
227
|
+
credentials = @config.credentials
|
228
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
229
|
+
# but only if the default endpoint does not have a region prefix.
|
230
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
231
|
+
!@config.endpoint.split(".").first.include?("-")
|
232
|
+
credentials ||= Credentials.default scope: @config.scope,
|
233
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
234
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
235
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
236
|
+
end
|
237
|
+
|
238
|
+
@quota_project_id = @config.quota_project
|
239
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
240
|
+
|
241
|
+
@operations_client = ::Google::Cloud::Vision::V1::ProductSearch::Rest::Operations.new do |config|
|
242
|
+
config.credentials = credentials
|
243
|
+
config.quota_project = @quota_project_id
|
244
|
+
config.endpoint = @config.endpoint
|
245
|
+
end
|
246
|
+
|
247
|
+
@product_search_stub = ::Google::Cloud::Vision::V1::ProductSearch::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
248
|
+
end
|
249
|
+
|
250
|
+
##
|
251
|
+
# Get the associated client for long-running operations.
|
252
|
+
#
|
253
|
+
# @return [::Google::Cloud::Vision::V1::ProductSearch::Rest::Operations]
|
254
|
+
#
|
255
|
+
attr_reader :operations_client
|
256
|
+
|
257
|
+
# Service calls
|
258
|
+
|
259
|
+
##
|
260
|
+
# Creates and returns a new ProductSet resource.
|
261
|
+
#
|
262
|
+
# Possible errors:
|
263
|
+
#
|
264
|
+
# * Returns INVALID_ARGUMENT if display_name is missing, or is longer than
|
265
|
+
# 4096 characters.
|
266
|
+
#
|
267
|
+
# @overload create_product_set(request, options = nil)
|
268
|
+
# Pass arguments to `create_product_set` via a request object, either of type
|
269
|
+
# {::Google::Cloud::Vision::V1::CreateProductSetRequest} or an equivalent Hash.
|
270
|
+
#
|
271
|
+
# @param request [::Google::Cloud::Vision::V1::CreateProductSetRequest, ::Hash]
|
272
|
+
# A request object representing the call parameters. Required. To specify no
|
273
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
274
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
275
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
276
|
+
#
|
277
|
+
# @overload create_product_set(parent: nil, product_set: nil, product_set_id: nil)
|
278
|
+
# Pass arguments to `create_product_set` via keyword arguments. Note that at
|
279
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
280
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
281
|
+
#
|
282
|
+
# @param parent [::String]
|
283
|
+
# Required. The project in which the ProductSet should be created.
|
284
|
+
#
|
285
|
+
# Format is `projects/PROJECT_ID/locations/LOC_ID`.
|
286
|
+
# @param product_set [::Google::Cloud::Vision::V1::ProductSet, ::Hash]
|
287
|
+
# Required. The ProductSet to create.
|
288
|
+
# @param product_set_id [::String]
|
289
|
+
# A user-supplied resource id for this ProductSet. If set, the server will
|
290
|
+
# attempt to use this value as the resource id. If it is already in use, an
|
291
|
+
# error is returned with code ALREADY_EXISTS. Must be at most 128 characters
|
292
|
+
# long. It cannot contain the character `/`.
|
293
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
294
|
+
# @yieldparam result [::Google::Cloud::Vision::V1::ProductSet]
|
295
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
296
|
+
#
|
297
|
+
# @return [::Google::Cloud::Vision::V1::ProductSet]
|
298
|
+
#
|
299
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
300
|
+
def create_product_set request, options = nil
|
301
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
302
|
+
|
303
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::CreateProductSetRequest
|
304
|
+
|
305
|
+
# Converts hash and nil to an options object
|
306
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
307
|
+
|
308
|
+
# Customize the options with defaults
|
309
|
+
call_metadata = @config.rpcs.create_product_set.metadata.to_h
|
310
|
+
|
311
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
312
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
313
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
314
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
315
|
+
transports_version_send: [:rest]
|
316
|
+
|
317
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
318
|
+
|
319
|
+
options.apply_defaults timeout: @config.rpcs.create_product_set.timeout,
|
320
|
+
metadata: call_metadata,
|
321
|
+
retry_policy: @config.rpcs.create_product_set.retry_policy
|
322
|
+
|
323
|
+
options.apply_defaults timeout: @config.timeout,
|
324
|
+
metadata: @config.metadata,
|
325
|
+
retry_policy: @config.retry_policy
|
326
|
+
|
327
|
+
@product_search_stub.create_product_set request, options do |result, operation|
|
328
|
+
yield result, operation if block_given?
|
329
|
+
return result
|
330
|
+
end
|
331
|
+
rescue ::Gapic::Rest::Error => e
|
332
|
+
raise ::Google::Cloud::Error.from_error(e)
|
333
|
+
end
|
334
|
+
|
335
|
+
##
|
336
|
+
# Lists ProductSets in an unspecified order.
|
337
|
+
#
|
338
|
+
# Possible errors:
|
339
|
+
#
|
340
|
+
# * Returns INVALID_ARGUMENT if page_size is greater than 100, or less
|
341
|
+
# than 1.
|
342
|
+
#
|
343
|
+
# @overload list_product_sets(request, options = nil)
|
344
|
+
# Pass arguments to `list_product_sets` via a request object, either of type
|
345
|
+
# {::Google::Cloud::Vision::V1::ListProductSetsRequest} or an equivalent Hash.
|
346
|
+
#
|
347
|
+
# @param request [::Google::Cloud::Vision::V1::ListProductSetsRequest, ::Hash]
|
348
|
+
# A request object representing the call parameters. Required. To specify no
|
349
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
350
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
351
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
352
|
+
#
|
353
|
+
# @overload list_product_sets(parent: nil, page_size: nil, page_token: nil)
|
354
|
+
# Pass arguments to `list_product_sets` via keyword arguments. Note that at
|
355
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
356
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
357
|
+
#
|
358
|
+
# @param parent [::String]
|
359
|
+
# Required. The project from which ProductSets should be listed.
|
360
|
+
#
|
361
|
+
# Format is `projects/PROJECT_ID/locations/LOC_ID`.
|
362
|
+
# @param page_size [::Integer]
|
363
|
+
# The maximum number of items to return. Default 10, maximum 100.
|
364
|
+
# @param page_token [::String]
|
365
|
+
# The next_page_token returned from a previous List request, if any.
|
366
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
367
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1::ProductSet>]
|
368
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
369
|
+
#
|
370
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1::ProductSet>]
|
371
|
+
#
|
372
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
373
|
+
def list_product_sets request, options = nil
|
374
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
375
|
+
|
376
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::ListProductSetsRequest
|
377
|
+
|
378
|
+
# Converts hash and nil to an options object
|
379
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
380
|
+
|
381
|
+
# Customize the options with defaults
|
382
|
+
call_metadata = @config.rpcs.list_product_sets.metadata.to_h
|
383
|
+
|
384
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
385
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
386
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
387
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
388
|
+
transports_version_send: [:rest]
|
389
|
+
|
390
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
391
|
+
|
392
|
+
options.apply_defaults timeout: @config.rpcs.list_product_sets.timeout,
|
393
|
+
metadata: call_metadata,
|
394
|
+
retry_policy: @config.rpcs.list_product_sets.retry_policy
|
395
|
+
|
396
|
+
options.apply_defaults timeout: @config.timeout,
|
397
|
+
metadata: @config.metadata,
|
398
|
+
retry_policy: @config.retry_policy
|
399
|
+
|
400
|
+
@product_search_stub.list_product_sets request, options do |result, operation|
|
401
|
+
result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_product_sets, "product_sets", request, result, options
|
402
|
+
yield result, operation if block_given?
|
403
|
+
return result
|
404
|
+
end
|
405
|
+
rescue ::Gapic::Rest::Error => e
|
406
|
+
raise ::Google::Cloud::Error.from_error(e)
|
407
|
+
end
|
408
|
+
|
409
|
+
##
|
410
|
+
# Gets information associated with a ProductSet.
|
411
|
+
#
|
412
|
+
# Possible errors:
|
413
|
+
#
|
414
|
+
# * Returns NOT_FOUND if the ProductSet does not exist.
|
415
|
+
#
|
416
|
+
# @overload get_product_set(request, options = nil)
|
417
|
+
# Pass arguments to `get_product_set` via a request object, either of type
|
418
|
+
# {::Google::Cloud::Vision::V1::GetProductSetRequest} or an equivalent Hash.
|
419
|
+
#
|
420
|
+
# @param request [::Google::Cloud::Vision::V1::GetProductSetRequest, ::Hash]
|
421
|
+
# A request object representing the call parameters. Required. To specify no
|
422
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
423
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
424
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
425
|
+
#
|
426
|
+
# @overload get_product_set(name: nil)
|
427
|
+
# Pass arguments to `get_product_set` via keyword arguments. Note that at
|
428
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
429
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
430
|
+
#
|
431
|
+
# @param name [::String]
|
432
|
+
# Required. Resource name of the ProductSet to get.
|
433
|
+
#
|
434
|
+
# Format is:
|
435
|
+
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
|
436
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
437
|
+
# @yieldparam result [::Google::Cloud::Vision::V1::ProductSet]
|
438
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
439
|
+
#
|
440
|
+
# @return [::Google::Cloud::Vision::V1::ProductSet]
|
441
|
+
#
|
442
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
443
|
+
def get_product_set request, options = nil
|
444
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
445
|
+
|
446
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::GetProductSetRequest
|
447
|
+
|
448
|
+
# Converts hash and nil to an options object
|
449
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
450
|
+
|
451
|
+
# Customize the options with defaults
|
452
|
+
call_metadata = @config.rpcs.get_product_set.metadata.to_h
|
453
|
+
|
454
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
455
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
456
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
457
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
458
|
+
transports_version_send: [:rest]
|
459
|
+
|
460
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
461
|
+
|
462
|
+
options.apply_defaults timeout: @config.rpcs.get_product_set.timeout,
|
463
|
+
metadata: call_metadata,
|
464
|
+
retry_policy: @config.rpcs.get_product_set.retry_policy
|
465
|
+
|
466
|
+
options.apply_defaults timeout: @config.timeout,
|
467
|
+
metadata: @config.metadata,
|
468
|
+
retry_policy: @config.retry_policy
|
469
|
+
|
470
|
+
@product_search_stub.get_product_set request, options do |result, operation|
|
471
|
+
yield result, operation if block_given?
|
472
|
+
return result
|
473
|
+
end
|
474
|
+
rescue ::Gapic::Rest::Error => e
|
475
|
+
raise ::Google::Cloud::Error.from_error(e)
|
476
|
+
end
|
477
|
+
|
478
|
+
##
|
479
|
+
# Makes changes to a ProductSet resource.
|
480
|
+
# Only display_name can be updated currently.
|
481
|
+
#
|
482
|
+
# Possible errors:
|
483
|
+
#
|
484
|
+
# * Returns NOT_FOUND if the ProductSet does not exist.
|
485
|
+
# * Returns INVALID_ARGUMENT if display_name is present in update_mask but
|
486
|
+
# missing from the request or longer than 4096 characters.
|
487
|
+
#
|
488
|
+
# @overload update_product_set(request, options = nil)
|
489
|
+
# Pass arguments to `update_product_set` via a request object, either of type
|
490
|
+
# {::Google::Cloud::Vision::V1::UpdateProductSetRequest} or an equivalent Hash.
|
491
|
+
#
|
492
|
+
# @param request [::Google::Cloud::Vision::V1::UpdateProductSetRequest, ::Hash]
|
493
|
+
# A request object representing the call parameters. Required. To specify no
|
494
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
495
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
496
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
497
|
+
#
|
498
|
+
# @overload update_product_set(product_set: nil, update_mask: nil)
|
499
|
+
# Pass arguments to `update_product_set` via keyword arguments. Note that at
|
500
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
501
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
502
|
+
#
|
503
|
+
# @param product_set [::Google::Cloud::Vision::V1::ProductSet, ::Hash]
|
504
|
+
# Required. The ProductSet resource which replaces the one on the server.
|
505
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
506
|
+
# The {::Google::Protobuf::FieldMask FieldMask} that specifies which fields to
|
507
|
+
# update.
|
508
|
+
# If update_mask isn't specified, all mutable fields are to be updated.
|
509
|
+
# Valid mask path is `display_name`.
|
510
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
511
|
+
# @yieldparam result [::Google::Cloud::Vision::V1::ProductSet]
|
512
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
513
|
+
#
|
514
|
+
# @return [::Google::Cloud::Vision::V1::ProductSet]
|
515
|
+
#
|
516
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
517
|
+
def update_product_set request, options = nil
|
518
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
519
|
+
|
520
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::UpdateProductSetRequest
|
521
|
+
|
522
|
+
# Converts hash and nil to an options object
|
523
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
524
|
+
|
525
|
+
# Customize the options with defaults
|
526
|
+
call_metadata = @config.rpcs.update_product_set.metadata.to_h
|
527
|
+
|
528
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
529
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
530
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
531
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
532
|
+
transports_version_send: [:rest]
|
533
|
+
|
534
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
535
|
+
|
536
|
+
options.apply_defaults timeout: @config.rpcs.update_product_set.timeout,
|
537
|
+
metadata: call_metadata,
|
538
|
+
retry_policy: @config.rpcs.update_product_set.retry_policy
|
539
|
+
|
540
|
+
options.apply_defaults timeout: @config.timeout,
|
541
|
+
metadata: @config.metadata,
|
542
|
+
retry_policy: @config.retry_policy
|
543
|
+
|
544
|
+
@product_search_stub.update_product_set request, options do |result, operation|
|
545
|
+
yield result, operation if block_given?
|
546
|
+
return result
|
547
|
+
end
|
548
|
+
rescue ::Gapic::Rest::Error => e
|
549
|
+
raise ::Google::Cloud::Error.from_error(e)
|
550
|
+
end
|
551
|
+
|
552
|
+
##
|
553
|
+
# Permanently deletes a ProductSet. Products and ReferenceImages in the
|
554
|
+
# ProductSet are not deleted.
|
555
|
+
#
|
556
|
+
# The actual image files are not deleted from Google Cloud Storage.
|
557
|
+
#
|
558
|
+
# @overload delete_product_set(request, options = nil)
|
559
|
+
# Pass arguments to `delete_product_set` via a request object, either of type
|
560
|
+
# {::Google::Cloud::Vision::V1::DeleteProductSetRequest} or an equivalent Hash.
|
561
|
+
#
|
562
|
+
# @param request [::Google::Cloud::Vision::V1::DeleteProductSetRequest, ::Hash]
|
563
|
+
# A request object representing the call parameters. Required. To specify no
|
564
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
565
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
566
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
567
|
+
#
|
568
|
+
# @overload delete_product_set(name: nil)
|
569
|
+
# Pass arguments to `delete_product_set` via keyword arguments. Note that at
|
570
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
571
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
572
|
+
#
|
573
|
+
# @param name [::String]
|
574
|
+
# Required. Resource name of the ProductSet to delete.
|
575
|
+
#
|
576
|
+
# Format is:
|
577
|
+
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
|
578
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
579
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
580
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
581
|
+
#
|
582
|
+
# @return [::Google::Protobuf::Empty]
|
583
|
+
#
|
584
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
585
|
+
def delete_product_set request, options = nil
|
586
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
587
|
+
|
588
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::DeleteProductSetRequest
|
589
|
+
|
590
|
+
# Converts hash and nil to an options object
|
591
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
592
|
+
|
593
|
+
# Customize the options with defaults
|
594
|
+
call_metadata = @config.rpcs.delete_product_set.metadata.to_h
|
595
|
+
|
596
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
597
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
598
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
599
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
600
|
+
transports_version_send: [:rest]
|
601
|
+
|
602
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
603
|
+
|
604
|
+
options.apply_defaults timeout: @config.rpcs.delete_product_set.timeout,
|
605
|
+
metadata: call_metadata,
|
606
|
+
retry_policy: @config.rpcs.delete_product_set.retry_policy
|
607
|
+
|
608
|
+
options.apply_defaults timeout: @config.timeout,
|
609
|
+
metadata: @config.metadata,
|
610
|
+
retry_policy: @config.retry_policy
|
611
|
+
|
612
|
+
@product_search_stub.delete_product_set request, options do |result, operation|
|
613
|
+
yield result, operation if block_given?
|
614
|
+
return result
|
615
|
+
end
|
616
|
+
rescue ::Gapic::Rest::Error => e
|
617
|
+
raise ::Google::Cloud::Error.from_error(e)
|
618
|
+
end
|
619
|
+
|
620
|
+
##
|
621
|
+
# Creates and returns a new product resource.
|
622
|
+
#
|
623
|
+
# Possible errors:
|
624
|
+
#
|
625
|
+
# * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096
|
626
|
+
# characters.
|
627
|
+
# * Returns INVALID_ARGUMENT if description is longer than 4096 characters.
|
628
|
+
# * Returns INVALID_ARGUMENT if product_category is missing or invalid.
|
629
|
+
#
|
630
|
+
# @overload create_product(request, options = nil)
|
631
|
+
# Pass arguments to `create_product` via a request object, either of type
|
632
|
+
# {::Google::Cloud::Vision::V1::CreateProductRequest} or an equivalent Hash.
|
633
|
+
#
|
634
|
+
# @param request [::Google::Cloud::Vision::V1::CreateProductRequest, ::Hash]
|
635
|
+
# A request object representing the call parameters. Required. To specify no
|
636
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
637
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
638
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
639
|
+
#
|
640
|
+
# @overload create_product(parent: nil, product: nil, product_id: nil)
|
641
|
+
# Pass arguments to `create_product` via keyword arguments. Note that at
|
642
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
643
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
644
|
+
#
|
645
|
+
# @param parent [::String]
|
646
|
+
# Required. The project in which the Product should be created.
|
647
|
+
#
|
648
|
+
# Format is
|
649
|
+
# `projects/PROJECT_ID/locations/LOC_ID`.
|
650
|
+
# @param product [::Google::Cloud::Vision::V1::Product, ::Hash]
|
651
|
+
# Required. The product to create.
|
652
|
+
# @param product_id [::String]
|
653
|
+
# A user-supplied resource id for this Product. If set, the server will
|
654
|
+
# attempt to use this value as the resource id. If it is already in use, an
|
655
|
+
# error is returned with code ALREADY_EXISTS. Must be at most 128 characters
|
656
|
+
# long. It cannot contain the character `/`.
|
657
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
658
|
+
# @yieldparam result [::Google::Cloud::Vision::V1::Product]
|
659
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
660
|
+
#
|
661
|
+
# @return [::Google::Cloud::Vision::V1::Product]
|
662
|
+
#
|
663
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
664
|
+
def create_product request, options = nil
|
665
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
666
|
+
|
667
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::CreateProductRequest
|
668
|
+
|
669
|
+
# Converts hash and nil to an options object
|
670
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
671
|
+
|
672
|
+
# Customize the options with defaults
|
673
|
+
call_metadata = @config.rpcs.create_product.metadata.to_h
|
674
|
+
|
675
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
676
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
677
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
678
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
679
|
+
transports_version_send: [:rest]
|
680
|
+
|
681
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
682
|
+
|
683
|
+
options.apply_defaults timeout: @config.rpcs.create_product.timeout,
|
684
|
+
metadata: call_metadata,
|
685
|
+
retry_policy: @config.rpcs.create_product.retry_policy
|
686
|
+
|
687
|
+
options.apply_defaults timeout: @config.timeout,
|
688
|
+
metadata: @config.metadata,
|
689
|
+
retry_policy: @config.retry_policy
|
690
|
+
|
691
|
+
@product_search_stub.create_product request, options do |result, operation|
|
692
|
+
yield result, operation if block_given?
|
693
|
+
return result
|
694
|
+
end
|
695
|
+
rescue ::Gapic::Rest::Error => e
|
696
|
+
raise ::Google::Cloud::Error.from_error(e)
|
697
|
+
end
|
698
|
+
|
699
|
+
##
|
700
|
+
# Lists products in an unspecified order.
|
701
|
+
#
|
702
|
+
# Possible errors:
|
703
|
+
#
|
704
|
+
# * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
|
705
|
+
#
|
706
|
+
# @overload list_products(request, options = nil)
|
707
|
+
# Pass arguments to `list_products` via a request object, either of type
|
708
|
+
# {::Google::Cloud::Vision::V1::ListProductsRequest} or an equivalent Hash.
|
709
|
+
#
|
710
|
+
# @param request [::Google::Cloud::Vision::V1::ListProductsRequest, ::Hash]
|
711
|
+
# A request object representing the call parameters. Required. To specify no
|
712
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
713
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
714
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
715
|
+
#
|
716
|
+
# @overload list_products(parent: nil, page_size: nil, page_token: nil)
|
717
|
+
# Pass arguments to `list_products` via keyword arguments. Note that at
|
718
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
719
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
720
|
+
#
|
721
|
+
# @param parent [::String]
|
722
|
+
# Required. The project OR ProductSet from which Products should be listed.
|
723
|
+
#
|
724
|
+
# Format:
|
725
|
+
# `projects/PROJECT_ID/locations/LOC_ID`
|
726
|
+
# @param page_size [::Integer]
|
727
|
+
# The maximum number of items to return. Default 10, maximum 100.
|
728
|
+
# @param page_token [::String]
|
729
|
+
# The next_page_token returned from a previous List request, if any.
|
730
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
731
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1::Product>]
|
732
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
733
|
+
#
|
734
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1::Product>]
|
735
|
+
#
|
736
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
737
|
+
def list_products request, options = nil
|
738
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
739
|
+
|
740
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::ListProductsRequest
|
741
|
+
|
742
|
+
# Converts hash and nil to an options object
|
743
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
744
|
+
|
745
|
+
# Customize the options with defaults
|
746
|
+
call_metadata = @config.rpcs.list_products.metadata.to_h
|
747
|
+
|
748
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
749
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
750
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
751
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
752
|
+
transports_version_send: [:rest]
|
753
|
+
|
754
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
755
|
+
|
756
|
+
options.apply_defaults timeout: @config.rpcs.list_products.timeout,
|
757
|
+
metadata: call_metadata,
|
758
|
+
retry_policy: @config.rpcs.list_products.retry_policy
|
759
|
+
|
760
|
+
options.apply_defaults timeout: @config.timeout,
|
761
|
+
metadata: @config.metadata,
|
762
|
+
retry_policy: @config.retry_policy
|
763
|
+
|
764
|
+
@product_search_stub.list_products request, options do |result, operation|
|
765
|
+
result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_products, "products", request, result, options
|
766
|
+
yield result, operation if block_given?
|
767
|
+
return result
|
768
|
+
end
|
769
|
+
rescue ::Gapic::Rest::Error => e
|
770
|
+
raise ::Google::Cloud::Error.from_error(e)
|
771
|
+
end
|
772
|
+
|
773
|
+
##
|
774
|
+
# Gets information associated with a Product.
|
775
|
+
#
|
776
|
+
# Possible errors:
|
777
|
+
#
|
778
|
+
# * Returns NOT_FOUND if the Product does not exist.
|
779
|
+
#
|
780
|
+
# @overload get_product(request, options = nil)
|
781
|
+
# Pass arguments to `get_product` via a request object, either of type
|
782
|
+
# {::Google::Cloud::Vision::V1::GetProductRequest} or an equivalent Hash.
|
783
|
+
#
|
784
|
+
# @param request [::Google::Cloud::Vision::V1::GetProductRequest, ::Hash]
|
785
|
+
# A request object representing the call parameters. Required. To specify no
|
786
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
787
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
788
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
789
|
+
#
|
790
|
+
# @overload get_product(name: nil)
|
791
|
+
# Pass arguments to `get_product` via keyword arguments. Note that at
|
792
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
793
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
794
|
+
#
|
795
|
+
# @param name [::String]
|
796
|
+
# Required. Resource name of the Product to get.
|
797
|
+
#
|
798
|
+
# Format is:
|
799
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
|
800
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
801
|
+
# @yieldparam result [::Google::Cloud::Vision::V1::Product]
|
802
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
803
|
+
#
|
804
|
+
# @return [::Google::Cloud::Vision::V1::Product]
|
805
|
+
#
|
806
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
807
|
+
def get_product request, options = nil
|
808
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
809
|
+
|
810
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::GetProductRequest
|
811
|
+
|
812
|
+
# Converts hash and nil to an options object
|
813
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
814
|
+
|
815
|
+
# Customize the options with defaults
|
816
|
+
call_metadata = @config.rpcs.get_product.metadata.to_h
|
817
|
+
|
818
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
819
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
820
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
821
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
822
|
+
transports_version_send: [:rest]
|
823
|
+
|
824
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
825
|
+
|
826
|
+
options.apply_defaults timeout: @config.rpcs.get_product.timeout,
|
827
|
+
metadata: call_metadata,
|
828
|
+
retry_policy: @config.rpcs.get_product.retry_policy
|
829
|
+
|
830
|
+
options.apply_defaults timeout: @config.timeout,
|
831
|
+
metadata: @config.metadata,
|
832
|
+
retry_policy: @config.retry_policy
|
833
|
+
|
834
|
+
@product_search_stub.get_product request, options do |result, operation|
|
835
|
+
yield result, operation if block_given?
|
836
|
+
return result
|
837
|
+
end
|
838
|
+
rescue ::Gapic::Rest::Error => e
|
839
|
+
raise ::Google::Cloud::Error.from_error(e)
|
840
|
+
end
|
841
|
+
|
842
|
+
##
|
843
|
+
# Makes changes to a Product resource.
|
844
|
+
# Only the `display_name`, `description`, and `labels` fields can be updated
|
845
|
+
# right now.
|
846
|
+
#
|
847
|
+
# If labels are updated, the change will not be reflected in queries until
|
848
|
+
# the next index time.
|
849
|
+
#
|
850
|
+
# Possible errors:
|
851
|
+
#
|
852
|
+
# * Returns NOT_FOUND if the Product does not exist.
|
853
|
+
# * Returns INVALID_ARGUMENT if display_name is present in update_mask but is
|
854
|
+
# missing from the request or longer than 4096 characters.
|
855
|
+
# * Returns INVALID_ARGUMENT if description is present in update_mask but is
|
856
|
+
# longer than 4096 characters.
|
857
|
+
# * Returns INVALID_ARGUMENT if product_category is present in update_mask.
|
858
|
+
#
|
859
|
+
# @overload update_product(request, options = nil)
|
860
|
+
# Pass arguments to `update_product` via a request object, either of type
|
861
|
+
# {::Google::Cloud::Vision::V1::UpdateProductRequest} or an equivalent Hash.
|
862
|
+
#
|
863
|
+
# @param request [::Google::Cloud::Vision::V1::UpdateProductRequest, ::Hash]
|
864
|
+
# A request object representing the call parameters. Required. To specify no
|
865
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
866
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
867
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
868
|
+
#
|
869
|
+
# @overload update_product(product: nil, update_mask: nil)
|
870
|
+
# Pass arguments to `update_product` via keyword arguments. Note that at
|
871
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
872
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
873
|
+
#
|
874
|
+
# @param product [::Google::Cloud::Vision::V1::Product, ::Hash]
|
875
|
+
# Required. The Product resource which replaces the one on the server.
|
876
|
+
# product.name is immutable.
|
877
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
878
|
+
# The {::Google::Protobuf::FieldMask FieldMask} that specifies which fields
|
879
|
+
# to update.
|
880
|
+
# If update_mask isn't specified, all mutable fields are to be updated.
|
881
|
+
# Valid mask paths include `product_labels`, `display_name`, and
|
882
|
+
# `description`.
|
883
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
884
|
+
# @yieldparam result [::Google::Cloud::Vision::V1::Product]
|
885
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
886
|
+
#
|
887
|
+
# @return [::Google::Cloud::Vision::V1::Product]
|
888
|
+
#
|
889
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
890
|
+
def update_product request, options = nil
|
891
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
892
|
+
|
893
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::UpdateProductRequest
|
894
|
+
|
895
|
+
# Converts hash and nil to an options object
|
896
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
897
|
+
|
898
|
+
# Customize the options with defaults
|
899
|
+
call_metadata = @config.rpcs.update_product.metadata.to_h
|
900
|
+
|
901
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
902
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
903
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
904
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
905
|
+
transports_version_send: [:rest]
|
906
|
+
|
907
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
908
|
+
|
909
|
+
options.apply_defaults timeout: @config.rpcs.update_product.timeout,
|
910
|
+
metadata: call_metadata,
|
911
|
+
retry_policy: @config.rpcs.update_product.retry_policy
|
912
|
+
|
913
|
+
options.apply_defaults timeout: @config.timeout,
|
914
|
+
metadata: @config.metadata,
|
915
|
+
retry_policy: @config.retry_policy
|
916
|
+
|
917
|
+
@product_search_stub.update_product request, options do |result, operation|
|
918
|
+
yield result, operation if block_given?
|
919
|
+
return result
|
920
|
+
end
|
921
|
+
rescue ::Gapic::Rest::Error => e
|
922
|
+
raise ::Google::Cloud::Error.from_error(e)
|
923
|
+
end
|
924
|
+
|
925
|
+
##
|
926
|
+
# Permanently deletes a product and its reference images.
|
927
|
+
#
|
928
|
+
# Metadata of the product and all its images will be deleted right away, but
|
929
|
+
# search queries against ProductSets containing the product may still work
|
930
|
+
# until all related caches are refreshed.
|
931
|
+
#
|
932
|
+
# @overload delete_product(request, options = nil)
|
933
|
+
# Pass arguments to `delete_product` via a request object, either of type
|
934
|
+
# {::Google::Cloud::Vision::V1::DeleteProductRequest} or an equivalent Hash.
|
935
|
+
#
|
936
|
+
# @param request [::Google::Cloud::Vision::V1::DeleteProductRequest, ::Hash]
|
937
|
+
# A request object representing the call parameters. Required. To specify no
|
938
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
939
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
940
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
941
|
+
#
|
942
|
+
# @overload delete_product(name: nil)
|
943
|
+
# Pass arguments to `delete_product` via keyword arguments. Note that at
|
944
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
945
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
946
|
+
#
|
947
|
+
# @param name [::String]
|
948
|
+
# Required. Resource name of product to delete.
|
949
|
+
#
|
950
|
+
# Format is:
|
951
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
|
952
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
953
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
954
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
955
|
+
#
|
956
|
+
# @return [::Google::Protobuf::Empty]
|
957
|
+
#
|
958
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
959
|
+
def delete_product request, options = nil
|
960
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
961
|
+
|
962
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::DeleteProductRequest
|
963
|
+
|
964
|
+
# Converts hash and nil to an options object
|
965
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
966
|
+
|
967
|
+
# Customize the options with defaults
|
968
|
+
call_metadata = @config.rpcs.delete_product.metadata.to_h
|
969
|
+
|
970
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
971
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
972
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
973
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
974
|
+
transports_version_send: [:rest]
|
975
|
+
|
976
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
977
|
+
|
978
|
+
options.apply_defaults timeout: @config.rpcs.delete_product.timeout,
|
979
|
+
metadata: call_metadata,
|
980
|
+
retry_policy: @config.rpcs.delete_product.retry_policy
|
981
|
+
|
982
|
+
options.apply_defaults timeout: @config.timeout,
|
983
|
+
metadata: @config.metadata,
|
984
|
+
retry_policy: @config.retry_policy
|
985
|
+
|
986
|
+
@product_search_stub.delete_product request, options do |result, operation|
|
987
|
+
yield result, operation if block_given?
|
988
|
+
return result
|
989
|
+
end
|
990
|
+
rescue ::Gapic::Rest::Error => e
|
991
|
+
raise ::Google::Cloud::Error.from_error(e)
|
992
|
+
end
|
993
|
+
|
994
|
+
##
|
995
|
+
# Creates and returns a new ReferenceImage resource.
|
996
|
+
#
|
997
|
+
# The `bounding_poly` field is optional. If `bounding_poly` is not specified,
|
998
|
+
# the system will try to detect regions of interest in the image that are
|
999
|
+
# compatible with the product_category on the parent product. If it is
|
1000
|
+
# specified, detection is ALWAYS skipped. The system converts polygons into
|
1001
|
+
# non-rotated rectangles.
|
1002
|
+
#
|
1003
|
+
# Note that the pipeline will resize the image if the image resolution is too
|
1004
|
+
# large to process (above 50MP).
|
1005
|
+
#
|
1006
|
+
# Possible errors:
|
1007
|
+
#
|
1008
|
+
# * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096
|
1009
|
+
# characters.
|
1010
|
+
# * Returns INVALID_ARGUMENT if the product does not exist.
|
1011
|
+
# * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing
|
1012
|
+
# compatible with the parent product's product_category is detected.
|
1013
|
+
# * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
|
1014
|
+
#
|
1015
|
+
# @overload create_reference_image(request, options = nil)
|
1016
|
+
# Pass arguments to `create_reference_image` via a request object, either of type
|
1017
|
+
# {::Google::Cloud::Vision::V1::CreateReferenceImageRequest} or an equivalent Hash.
|
1018
|
+
#
|
1019
|
+
# @param request [::Google::Cloud::Vision::V1::CreateReferenceImageRequest, ::Hash]
|
1020
|
+
# A request object representing the call parameters. Required. To specify no
|
1021
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1022
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1023
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1024
|
+
#
|
1025
|
+
# @overload create_reference_image(parent: nil, reference_image: nil, reference_image_id: nil)
|
1026
|
+
# Pass arguments to `create_reference_image` via keyword arguments. Note that at
|
1027
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1028
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1029
|
+
#
|
1030
|
+
# @param parent [::String]
|
1031
|
+
# Required. Resource name of the product in which to create the reference image.
|
1032
|
+
#
|
1033
|
+
# Format is
|
1034
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
|
1035
|
+
# @param reference_image [::Google::Cloud::Vision::V1::ReferenceImage, ::Hash]
|
1036
|
+
# Required. The reference image to create.
|
1037
|
+
# If an image ID is specified, it is ignored.
|
1038
|
+
# @param reference_image_id [::String]
|
1039
|
+
# A user-supplied resource id for the ReferenceImage to be added. If set,
|
1040
|
+
# the server will attempt to use this value as the resource id. If it is
|
1041
|
+
# already in use, an error is returned with code ALREADY_EXISTS. Must be at
|
1042
|
+
# most 128 characters long. It cannot contain the character `/`.
|
1043
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1044
|
+
# @yieldparam result [::Google::Cloud::Vision::V1::ReferenceImage]
|
1045
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1046
|
+
#
|
1047
|
+
# @return [::Google::Cloud::Vision::V1::ReferenceImage]
|
1048
|
+
#
|
1049
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1050
|
+
def create_reference_image request, options = nil
|
1051
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1052
|
+
|
1053
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::CreateReferenceImageRequest
|
1054
|
+
|
1055
|
+
# Converts hash and nil to an options object
|
1056
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1057
|
+
|
1058
|
+
# Customize the options with defaults
|
1059
|
+
call_metadata = @config.rpcs.create_reference_image.metadata.to_h
|
1060
|
+
|
1061
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1062
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1063
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1064
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1065
|
+
transports_version_send: [:rest]
|
1066
|
+
|
1067
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1068
|
+
|
1069
|
+
options.apply_defaults timeout: @config.rpcs.create_reference_image.timeout,
|
1070
|
+
metadata: call_metadata,
|
1071
|
+
retry_policy: @config.rpcs.create_reference_image.retry_policy
|
1072
|
+
|
1073
|
+
options.apply_defaults timeout: @config.timeout,
|
1074
|
+
metadata: @config.metadata,
|
1075
|
+
retry_policy: @config.retry_policy
|
1076
|
+
|
1077
|
+
@product_search_stub.create_reference_image request, options do |result, operation|
|
1078
|
+
yield result, operation if block_given?
|
1079
|
+
return result
|
1080
|
+
end
|
1081
|
+
rescue ::Gapic::Rest::Error => e
|
1082
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
##
|
1086
|
+
# Permanently deletes a reference image.
|
1087
|
+
#
|
1088
|
+
# The image metadata will be deleted right away, but search queries
|
1089
|
+
# against ProductSets containing the image may still work until all related
|
1090
|
+
# caches are refreshed.
|
1091
|
+
#
|
1092
|
+
# The actual image files are not deleted from Google Cloud Storage.
|
1093
|
+
#
|
1094
|
+
# @overload delete_reference_image(request, options = nil)
|
1095
|
+
# Pass arguments to `delete_reference_image` via a request object, either of type
|
1096
|
+
# {::Google::Cloud::Vision::V1::DeleteReferenceImageRequest} or an equivalent Hash.
|
1097
|
+
#
|
1098
|
+
# @param request [::Google::Cloud::Vision::V1::DeleteReferenceImageRequest, ::Hash]
|
1099
|
+
# A request object representing the call parameters. Required. To specify no
|
1100
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1101
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1102
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1103
|
+
#
|
1104
|
+
# @overload delete_reference_image(name: nil)
|
1105
|
+
# Pass arguments to `delete_reference_image` via keyword arguments. Note that at
|
1106
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1107
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1108
|
+
#
|
1109
|
+
# @param name [::String]
|
1110
|
+
# Required. The resource name of the reference image to delete.
|
1111
|
+
#
|
1112
|
+
# Format is:
|
1113
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
|
1114
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1115
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1116
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1117
|
+
#
|
1118
|
+
# @return [::Google::Protobuf::Empty]
|
1119
|
+
#
|
1120
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1121
|
+
def delete_reference_image request, options = nil
|
1122
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1123
|
+
|
1124
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::DeleteReferenceImageRequest
|
1125
|
+
|
1126
|
+
# Converts hash and nil to an options object
|
1127
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1128
|
+
|
1129
|
+
# Customize the options with defaults
|
1130
|
+
call_metadata = @config.rpcs.delete_reference_image.metadata.to_h
|
1131
|
+
|
1132
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1133
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1134
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1135
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1136
|
+
transports_version_send: [:rest]
|
1137
|
+
|
1138
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1139
|
+
|
1140
|
+
options.apply_defaults timeout: @config.rpcs.delete_reference_image.timeout,
|
1141
|
+
metadata: call_metadata,
|
1142
|
+
retry_policy: @config.rpcs.delete_reference_image.retry_policy
|
1143
|
+
|
1144
|
+
options.apply_defaults timeout: @config.timeout,
|
1145
|
+
metadata: @config.metadata,
|
1146
|
+
retry_policy: @config.retry_policy
|
1147
|
+
|
1148
|
+
@product_search_stub.delete_reference_image request, options do |result, operation|
|
1149
|
+
yield result, operation if block_given?
|
1150
|
+
return result
|
1151
|
+
end
|
1152
|
+
rescue ::Gapic::Rest::Error => e
|
1153
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1154
|
+
end
|
1155
|
+
|
1156
|
+
##
|
1157
|
+
# Lists reference images.
|
1158
|
+
#
|
1159
|
+
# Possible errors:
|
1160
|
+
#
|
1161
|
+
# * Returns NOT_FOUND if the parent product does not exist.
|
1162
|
+
# * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less
|
1163
|
+
# than 1.
|
1164
|
+
#
|
1165
|
+
# @overload list_reference_images(request, options = nil)
|
1166
|
+
# Pass arguments to `list_reference_images` via a request object, either of type
|
1167
|
+
# {::Google::Cloud::Vision::V1::ListReferenceImagesRequest} or an equivalent Hash.
|
1168
|
+
#
|
1169
|
+
# @param request [::Google::Cloud::Vision::V1::ListReferenceImagesRequest, ::Hash]
|
1170
|
+
# A request object representing the call parameters. Required. To specify no
|
1171
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1172
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1173
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1174
|
+
#
|
1175
|
+
# @overload list_reference_images(parent: nil, page_size: nil, page_token: nil)
|
1176
|
+
# Pass arguments to `list_reference_images` via keyword arguments. Note that at
|
1177
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1178
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1179
|
+
#
|
1180
|
+
# @param parent [::String]
|
1181
|
+
# Required. Resource name of the product containing the reference images.
|
1182
|
+
#
|
1183
|
+
# Format is
|
1184
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
|
1185
|
+
# @param page_size [::Integer]
|
1186
|
+
# The maximum number of items to return. Default 10, maximum 100.
|
1187
|
+
# @param page_token [::String]
|
1188
|
+
# A token identifying a page of results to be returned. This is the value
|
1189
|
+
# of `nextPageToken` returned in a previous reference image list request.
|
1190
|
+
#
|
1191
|
+
# Defaults to the first page if not specified.
|
1192
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1193
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1::ReferenceImage>]
|
1194
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1195
|
+
#
|
1196
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1::ReferenceImage>]
|
1197
|
+
#
|
1198
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1199
|
+
def list_reference_images request, options = nil
|
1200
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1201
|
+
|
1202
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::ListReferenceImagesRequest
|
1203
|
+
|
1204
|
+
# Converts hash and nil to an options object
|
1205
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1206
|
+
|
1207
|
+
# Customize the options with defaults
|
1208
|
+
call_metadata = @config.rpcs.list_reference_images.metadata.to_h
|
1209
|
+
|
1210
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1211
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1212
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1213
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1214
|
+
transports_version_send: [:rest]
|
1215
|
+
|
1216
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1217
|
+
|
1218
|
+
options.apply_defaults timeout: @config.rpcs.list_reference_images.timeout,
|
1219
|
+
metadata: call_metadata,
|
1220
|
+
retry_policy: @config.rpcs.list_reference_images.retry_policy
|
1221
|
+
|
1222
|
+
options.apply_defaults timeout: @config.timeout,
|
1223
|
+
metadata: @config.metadata,
|
1224
|
+
retry_policy: @config.retry_policy
|
1225
|
+
|
1226
|
+
@product_search_stub.list_reference_images request, options do |result, operation|
|
1227
|
+
result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_reference_images, "reference_images", request, result, options
|
1228
|
+
yield result, operation if block_given?
|
1229
|
+
return result
|
1230
|
+
end
|
1231
|
+
rescue ::Gapic::Rest::Error => e
|
1232
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
##
|
1236
|
+
# Gets information associated with a ReferenceImage.
|
1237
|
+
#
|
1238
|
+
# Possible errors:
|
1239
|
+
#
|
1240
|
+
# * Returns NOT_FOUND if the specified image does not exist.
|
1241
|
+
#
|
1242
|
+
# @overload get_reference_image(request, options = nil)
|
1243
|
+
# Pass arguments to `get_reference_image` via a request object, either of type
|
1244
|
+
# {::Google::Cloud::Vision::V1::GetReferenceImageRequest} or an equivalent Hash.
|
1245
|
+
#
|
1246
|
+
# @param request [::Google::Cloud::Vision::V1::GetReferenceImageRequest, ::Hash]
|
1247
|
+
# A request object representing the call parameters. Required. To specify no
|
1248
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1249
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1250
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1251
|
+
#
|
1252
|
+
# @overload get_reference_image(name: nil)
|
1253
|
+
# Pass arguments to `get_reference_image` via keyword arguments. Note that at
|
1254
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1255
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1256
|
+
#
|
1257
|
+
# @param name [::String]
|
1258
|
+
# Required. The resource name of the ReferenceImage to get.
|
1259
|
+
#
|
1260
|
+
# Format is:
|
1261
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
|
1262
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1263
|
+
# @yieldparam result [::Google::Cloud::Vision::V1::ReferenceImage]
|
1264
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1265
|
+
#
|
1266
|
+
# @return [::Google::Cloud::Vision::V1::ReferenceImage]
|
1267
|
+
#
|
1268
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1269
|
+
def get_reference_image request, options = nil
|
1270
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1271
|
+
|
1272
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::GetReferenceImageRequest
|
1273
|
+
|
1274
|
+
# Converts hash and nil to an options object
|
1275
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1276
|
+
|
1277
|
+
# Customize the options with defaults
|
1278
|
+
call_metadata = @config.rpcs.get_reference_image.metadata.to_h
|
1279
|
+
|
1280
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1281
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1282
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1283
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1284
|
+
transports_version_send: [:rest]
|
1285
|
+
|
1286
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1287
|
+
|
1288
|
+
options.apply_defaults timeout: @config.rpcs.get_reference_image.timeout,
|
1289
|
+
metadata: call_metadata,
|
1290
|
+
retry_policy: @config.rpcs.get_reference_image.retry_policy
|
1291
|
+
|
1292
|
+
options.apply_defaults timeout: @config.timeout,
|
1293
|
+
metadata: @config.metadata,
|
1294
|
+
retry_policy: @config.retry_policy
|
1295
|
+
|
1296
|
+
@product_search_stub.get_reference_image request, options do |result, operation|
|
1297
|
+
yield result, operation if block_given?
|
1298
|
+
return result
|
1299
|
+
end
|
1300
|
+
rescue ::Gapic::Rest::Error => e
|
1301
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1302
|
+
end
|
1303
|
+
|
1304
|
+
##
|
1305
|
+
# Adds a Product to the specified ProductSet. If the Product is already
|
1306
|
+
# present, no change is made.
|
1307
|
+
#
|
1308
|
+
# One Product can be added to at most 100 ProductSets.
|
1309
|
+
#
|
1310
|
+
# Possible errors:
|
1311
|
+
#
|
1312
|
+
# * Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
|
1313
|
+
#
|
1314
|
+
# @overload add_product_to_product_set(request, options = nil)
|
1315
|
+
# Pass arguments to `add_product_to_product_set` via a request object, either of type
|
1316
|
+
# {::Google::Cloud::Vision::V1::AddProductToProductSetRequest} or an equivalent Hash.
|
1317
|
+
#
|
1318
|
+
# @param request [::Google::Cloud::Vision::V1::AddProductToProductSetRequest, ::Hash]
|
1319
|
+
# A request object representing the call parameters. Required. To specify no
|
1320
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1321
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1322
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1323
|
+
#
|
1324
|
+
# @overload add_product_to_product_set(name: nil, product: nil)
|
1325
|
+
# Pass arguments to `add_product_to_product_set` via keyword arguments. Note that at
|
1326
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1327
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1328
|
+
#
|
1329
|
+
# @param name [::String]
|
1330
|
+
# Required. The resource name for the ProductSet to modify.
|
1331
|
+
#
|
1332
|
+
# Format is:
|
1333
|
+
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
|
1334
|
+
# @param product [::String]
|
1335
|
+
# Required. The resource name for the Product to be added to this ProductSet.
|
1336
|
+
#
|
1337
|
+
# Format is:
|
1338
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
|
1339
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1340
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1341
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1342
|
+
#
|
1343
|
+
# @return [::Google::Protobuf::Empty]
|
1344
|
+
#
|
1345
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1346
|
+
def add_product_to_product_set request, options = nil
|
1347
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1348
|
+
|
1349
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::AddProductToProductSetRequest
|
1350
|
+
|
1351
|
+
# Converts hash and nil to an options object
|
1352
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1353
|
+
|
1354
|
+
# Customize the options with defaults
|
1355
|
+
call_metadata = @config.rpcs.add_product_to_product_set.metadata.to_h
|
1356
|
+
|
1357
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1358
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1359
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1360
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1361
|
+
transports_version_send: [:rest]
|
1362
|
+
|
1363
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1364
|
+
|
1365
|
+
options.apply_defaults timeout: @config.rpcs.add_product_to_product_set.timeout,
|
1366
|
+
metadata: call_metadata,
|
1367
|
+
retry_policy: @config.rpcs.add_product_to_product_set.retry_policy
|
1368
|
+
|
1369
|
+
options.apply_defaults timeout: @config.timeout,
|
1370
|
+
metadata: @config.metadata,
|
1371
|
+
retry_policy: @config.retry_policy
|
1372
|
+
|
1373
|
+
@product_search_stub.add_product_to_product_set request, options do |result, operation|
|
1374
|
+
yield result, operation if block_given?
|
1375
|
+
return result
|
1376
|
+
end
|
1377
|
+
rescue ::Gapic::Rest::Error => e
|
1378
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1379
|
+
end
|
1380
|
+
|
1381
|
+
##
|
1382
|
+
# Removes a Product from the specified ProductSet.
|
1383
|
+
#
|
1384
|
+
# @overload remove_product_from_product_set(request, options = nil)
|
1385
|
+
# Pass arguments to `remove_product_from_product_set` via a request object, either of type
|
1386
|
+
# {::Google::Cloud::Vision::V1::RemoveProductFromProductSetRequest} or an equivalent Hash.
|
1387
|
+
#
|
1388
|
+
# @param request [::Google::Cloud::Vision::V1::RemoveProductFromProductSetRequest, ::Hash]
|
1389
|
+
# A request object representing the call parameters. Required. To specify no
|
1390
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1391
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1392
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1393
|
+
#
|
1394
|
+
# @overload remove_product_from_product_set(name: nil, product: nil)
|
1395
|
+
# Pass arguments to `remove_product_from_product_set` via keyword arguments. Note that at
|
1396
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1397
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1398
|
+
#
|
1399
|
+
# @param name [::String]
|
1400
|
+
# Required. The resource name for the ProductSet to modify.
|
1401
|
+
#
|
1402
|
+
# Format is:
|
1403
|
+
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
|
1404
|
+
# @param product [::String]
|
1405
|
+
# Required. The resource name for the Product to be removed from this ProductSet.
|
1406
|
+
#
|
1407
|
+
# Format is:
|
1408
|
+
# `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
|
1409
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1410
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1411
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1412
|
+
#
|
1413
|
+
# @return [::Google::Protobuf::Empty]
|
1414
|
+
#
|
1415
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1416
|
+
def remove_product_from_product_set request, options = nil
|
1417
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1418
|
+
|
1419
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::RemoveProductFromProductSetRequest
|
1420
|
+
|
1421
|
+
# Converts hash and nil to an options object
|
1422
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1423
|
+
|
1424
|
+
# Customize the options with defaults
|
1425
|
+
call_metadata = @config.rpcs.remove_product_from_product_set.metadata.to_h
|
1426
|
+
|
1427
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1428
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1429
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1430
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1431
|
+
transports_version_send: [:rest]
|
1432
|
+
|
1433
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1434
|
+
|
1435
|
+
options.apply_defaults timeout: @config.rpcs.remove_product_from_product_set.timeout,
|
1436
|
+
metadata: call_metadata,
|
1437
|
+
retry_policy: @config.rpcs.remove_product_from_product_set.retry_policy
|
1438
|
+
|
1439
|
+
options.apply_defaults timeout: @config.timeout,
|
1440
|
+
metadata: @config.metadata,
|
1441
|
+
retry_policy: @config.retry_policy
|
1442
|
+
|
1443
|
+
@product_search_stub.remove_product_from_product_set request, options do |result, operation|
|
1444
|
+
yield result, operation if block_given?
|
1445
|
+
return result
|
1446
|
+
end
|
1447
|
+
rescue ::Gapic::Rest::Error => e
|
1448
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1449
|
+
end
|
1450
|
+
|
1451
|
+
##
|
1452
|
+
# Lists the Products in a ProductSet, in an unspecified order. If the
|
1453
|
+
# ProductSet does not exist, the products field of the response will be
|
1454
|
+
# empty.
|
1455
|
+
#
|
1456
|
+
# Possible errors:
|
1457
|
+
#
|
1458
|
+
# * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
|
1459
|
+
#
|
1460
|
+
# @overload list_products_in_product_set(request, options = nil)
|
1461
|
+
# Pass arguments to `list_products_in_product_set` via a request object, either of type
|
1462
|
+
# {::Google::Cloud::Vision::V1::ListProductsInProductSetRequest} or an equivalent Hash.
|
1463
|
+
#
|
1464
|
+
# @param request [::Google::Cloud::Vision::V1::ListProductsInProductSetRequest, ::Hash]
|
1465
|
+
# A request object representing the call parameters. Required. To specify no
|
1466
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1467
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1468
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1469
|
+
#
|
1470
|
+
# @overload list_products_in_product_set(name: nil, page_size: nil, page_token: nil)
|
1471
|
+
# Pass arguments to `list_products_in_product_set` via keyword arguments. Note that at
|
1472
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1473
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1474
|
+
#
|
1475
|
+
# @param name [::String]
|
1476
|
+
# Required. The ProductSet resource for which to retrieve Products.
|
1477
|
+
#
|
1478
|
+
# Format is:
|
1479
|
+
# `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
|
1480
|
+
# @param page_size [::Integer]
|
1481
|
+
# The maximum number of items to return. Default 10, maximum 100.
|
1482
|
+
# @param page_token [::String]
|
1483
|
+
# The next_page_token returned from a previous List request, if any.
|
1484
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1485
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1::Product>]
|
1486
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1487
|
+
#
|
1488
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Vision::V1::Product>]
|
1489
|
+
#
|
1490
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1491
|
+
def list_products_in_product_set request, options = nil
|
1492
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1493
|
+
|
1494
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::ListProductsInProductSetRequest
|
1495
|
+
|
1496
|
+
# Converts hash and nil to an options object
|
1497
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1498
|
+
|
1499
|
+
# Customize the options with defaults
|
1500
|
+
call_metadata = @config.rpcs.list_products_in_product_set.metadata.to_h
|
1501
|
+
|
1502
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1503
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1504
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1505
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1506
|
+
transports_version_send: [:rest]
|
1507
|
+
|
1508
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1509
|
+
|
1510
|
+
options.apply_defaults timeout: @config.rpcs.list_products_in_product_set.timeout,
|
1511
|
+
metadata: call_metadata,
|
1512
|
+
retry_policy: @config.rpcs.list_products_in_product_set.retry_policy
|
1513
|
+
|
1514
|
+
options.apply_defaults timeout: @config.timeout,
|
1515
|
+
metadata: @config.metadata,
|
1516
|
+
retry_policy: @config.retry_policy
|
1517
|
+
|
1518
|
+
@product_search_stub.list_products_in_product_set request, options do |result, operation|
|
1519
|
+
result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_products_in_product_set, "products", request, result, options
|
1520
|
+
yield result, operation if block_given?
|
1521
|
+
return result
|
1522
|
+
end
|
1523
|
+
rescue ::Gapic::Rest::Error => e
|
1524
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1525
|
+
end
|
1526
|
+
|
1527
|
+
##
|
1528
|
+
# Asynchronous API that imports a list of reference images to specified
|
1529
|
+
# product sets based on a list of image information.
|
1530
|
+
#
|
1531
|
+
# The {::Google::Longrunning::Operation google.longrunning.Operation} API can be used to keep track of the
|
1532
|
+
# progress and results of the request.
|
1533
|
+
# `Operation.metadata` contains `BatchOperationMetadata`. (progress)
|
1534
|
+
# `Operation.response` contains `ImportProductSetsResponse`. (results)
|
1535
|
+
#
|
1536
|
+
# The input source of this method is a csv file on Google Cloud Storage.
|
1537
|
+
# For the format of the csv file please see
|
1538
|
+
# {::Google::Cloud::Vision::V1::ImportProductSetsGcsSource#csv_file_uri ImportProductSetsGcsSource.csv_file_uri}.
|
1539
|
+
#
|
1540
|
+
# @overload import_product_sets(request, options = nil)
|
1541
|
+
# Pass arguments to `import_product_sets` via a request object, either of type
|
1542
|
+
# {::Google::Cloud::Vision::V1::ImportProductSetsRequest} or an equivalent Hash.
|
1543
|
+
#
|
1544
|
+
# @param request [::Google::Cloud::Vision::V1::ImportProductSetsRequest, ::Hash]
|
1545
|
+
# A request object representing the call parameters. Required. To specify no
|
1546
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1547
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1548
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1549
|
+
#
|
1550
|
+
# @overload import_product_sets(parent: nil, input_config: nil)
|
1551
|
+
# Pass arguments to `import_product_sets` via keyword arguments. Note that at
|
1552
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1553
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1554
|
+
#
|
1555
|
+
# @param parent [::String]
|
1556
|
+
# Required. The project in which the ProductSets should be imported.
|
1557
|
+
#
|
1558
|
+
# Format is `projects/PROJECT_ID/locations/LOC_ID`.
|
1559
|
+
# @param input_config [::Google::Cloud::Vision::V1::ImportProductSetsInputConfig, ::Hash]
|
1560
|
+
# Required. The input content for the list of requests.
|
1561
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1562
|
+
# @yieldparam result [::Gapic::Operation]
|
1563
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1564
|
+
#
|
1565
|
+
# @return [::Gapic::Operation]
|
1566
|
+
#
|
1567
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1568
|
+
def import_product_sets request, options = nil
|
1569
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1570
|
+
|
1571
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::ImportProductSetsRequest
|
1572
|
+
|
1573
|
+
# Converts hash and nil to an options object
|
1574
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1575
|
+
|
1576
|
+
# Customize the options with defaults
|
1577
|
+
call_metadata = @config.rpcs.import_product_sets.metadata.to_h
|
1578
|
+
|
1579
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1580
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1581
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1582
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1583
|
+
transports_version_send: [:rest]
|
1584
|
+
|
1585
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1586
|
+
|
1587
|
+
options.apply_defaults timeout: @config.rpcs.import_product_sets.timeout,
|
1588
|
+
metadata: call_metadata,
|
1589
|
+
retry_policy: @config.rpcs.import_product_sets.retry_policy
|
1590
|
+
|
1591
|
+
options.apply_defaults timeout: @config.timeout,
|
1592
|
+
metadata: @config.metadata,
|
1593
|
+
retry_policy: @config.retry_policy
|
1594
|
+
|
1595
|
+
@product_search_stub.import_product_sets request, options do |result, operation|
|
1596
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1597
|
+
yield result, operation if block_given?
|
1598
|
+
return result
|
1599
|
+
end
|
1600
|
+
rescue ::Gapic::Rest::Error => e
|
1601
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1602
|
+
end
|
1603
|
+
|
1604
|
+
##
|
1605
|
+
# Asynchronous API to delete all Products in a ProductSet or all Products
|
1606
|
+
# that are in no ProductSet.
|
1607
|
+
#
|
1608
|
+
# If a Product is a member of the specified ProductSet in addition to other
|
1609
|
+
# ProductSets, the Product will still be deleted.
|
1610
|
+
#
|
1611
|
+
# It is recommended to not delete the specified ProductSet until after this
|
1612
|
+
# operation has completed. It is also recommended to not add any of the
|
1613
|
+
# Products involved in the batch delete to a new ProductSet while this
|
1614
|
+
# operation is running because those Products may still end up deleted.
|
1615
|
+
#
|
1616
|
+
# It's not possible to undo the PurgeProducts operation. Therefore, it is
|
1617
|
+
# recommended to keep the csv files used in ImportProductSets (if that was
|
1618
|
+
# how you originally built the Product Set) before starting PurgeProducts, in
|
1619
|
+
# case you need to re-import the data after deletion.
|
1620
|
+
#
|
1621
|
+
# If the plan is to purge all of the Products from a ProductSet and then
|
1622
|
+
# re-use the empty ProductSet to re-import new Products into the empty
|
1623
|
+
# ProductSet, you must wait until the PurgeProducts operation has finished
|
1624
|
+
# for that ProductSet.
|
1625
|
+
#
|
1626
|
+
# The {::Google::Longrunning::Operation google.longrunning.Operation} API can be used to keep track of the
|
1627
|
+
# progress and results of the request.
|
1628
|
+
# `Operation.metadata` contains `BatchOperationMetadata`. (progress)
|
1629
|
+
#
|
1630
|
+
# @overload purge_products(request, options = nil)
|
1631
|
+
# Pass arguments to `purge_products` via a request object, either of type
|
1632
|
+
# {::Google::Cloud::Vision::V1::PurgeProductsRequest} or an equivalent Hash.
|
1633
|
+
#
|
1634
|
+
# @param request [::Google::Cloud::Vision::V1::PurgeProductsRequest, ::Hash]
|
1635
|
+
# A request object representing the call parameters. Required. To specify no
|
1636
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1637
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1638
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1639
|
+
#
|
1640
|
+
# @overload purge_products(product_set_purge_config: nil, delete_orphan_products: nil, parent: nil, force: nil)
|
1641
|
+
# Pass arguments to `purge_products` via keyword arguments. Note that at
|
1642
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1643
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1644
|
+
#
|
1645
|
+
# @param product_set_purge_config [::Google::Cloud::Vision::V1::ProductSetPurgeConfig, ::Hash]
|
1646
|
+
# Specify which ProductSet contains the Products to be deleted.
|
1647
|
+
# @param delete_orphan_products [::Boolean]
|
1648
|
+
# If delete_orphan_products is true, all Products that are not in any
|
1649
|
+
# ProductSet will be deleted.
|
1650
|
+
# @param parent [::String]
|
1651
|
+
# Required. The project and location in which the Products should be deleted.
|
1652
|
+
#
|
1653
|
+
# Format is `projects/PROJECT_ID/locations/LOC_ID`.
|
1654
|
+
# @param force [::Boolean]
|
1655
|
+
# The default value is false. Override this value to true to actually perform
|
1656
|
+
# the purge.
|
1657
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1658
|
+
# @yieldparam result [::Gapic::Operation]
|
1659
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1660
|
+
#
|
1661
|
+
# @return [::Gapic::Operation]
|
1662
|
+
#
|
1663
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1664
|
+
def purge_products request, options = nil
|
1665
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1666
|
+
|
1667
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1::PurgeProductsRequest
|
1668
|
+
|
1669
|
+
# Converts hash and nil to an options object
|
1670
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1671
|
+
|
1672
|
+
# Customize the options with defaults
|
1673
|
+
call_metadata = @config.rpcs.purge_products.metadata.to_h
|
1674
|
+
|
1675
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1676
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1677
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1678
|
+
gapic_version: ::Google::Cloud::Vision::V1::VERSION,
|
1679
|
+
transports_version_send: [:rest]
|
1680
|
+
|
1681
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1682
|
+
|
1683
|
+
options.apply_defaults timeout: @config.rpcs.purge_products.timeout,
|
1684
|
+
metadata: call_metadata,
|
1685
|
+
retry_policy: @config.rpcs.purge_products.retry_policy
|
1686
|
+
|
1687
|
+
options.apply_defaults timeout: @config.timeout,
|
1688
|
+
metadata: @config.metadata,
|
1689
|
+
retry_policy: @config.retry_policy
|
1690
|
+
|
1691
|
+
@product_search_stub.purge_products request, options do |result, operation|
|
1692
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1693
|
+
yield result, operation if block_given?
|
1694
|
+
return result
|
1695
|
+
end
|
1696
|
+
rescue ::Gapic::Rest::Error => e
|
1697
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1698
|
+
end
|
1699
|
+
|
1700
|
+
##
|
1701
|
+
# Configuration class for the ProductSearch REST API.
|
1702
|
+
#
|
1703
|
+
# This class represents the configuration for ProductSearch REST,
|
1704
|
+
# providing control over timeouts, retry behavior, logging, transport
|
1705
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1706
|
+
# applied individually to specific RPCs. See
|
1707
|
+
# {::Google::Cloud::Vision::V1::ProductSearch::Rest::Client::Configuration::Rpcs}
|
1708
|
+
# for a list of RPCs that can be configured independently.
|
1709
|
+
#
|
1710
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1711
|
+
# on construction.
|
1712
|
+
#
|
1713
|
+
# @example
|
1714
|
+
#
|
1715
|
+
# # Modify the global config, setting the timeout for
|
1716
|
+
# # create_product_set to 20 seconds,
|
1717
|
+
# # and all remaining timeouts to 10 seconds.
|
1718
|
+
# ::Google::Cloud::Vision::V1::ProductSearch::Rest::Client.configure do |config|
|
1719
|
+
# config.timeout = 10.0
|
1720
|
+
# config.rpcs.create_product_set.timeout = 20.0
|
1721
|
+
# end
|
1722
|
+
#
|
1723
|
+
# # Apply the above configuration only to a new client.
|
1724
|
+
# client = ::Google::Cloud::Vision::V1::ProductSearch::Rest::Client.new do |config|
|
1725
|
+
# config.timeout = 10.0
|
1726
|
+
# config.rpcs.create_product_set.timeout = 20.0
|
1727
|
+
# end
|
1728
|
+
#
|
1729
|
+
# @!attribute [rw] endpoint
|
1730
|
+
# The hostname or hostname:port of the service endpoint.
|
1731
|
+
# Defaults to `"vision.googleapis.com"`.
|
1732
|
+
# @return [::String]
|
1733
|
+
# @!attribute [rw] credentials
|
1734
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1735
|
+
# * (`String`) The path to a service account key file in JSON format
|
1736
|
+
# * (`Hash`) A service account key as a Hash
|
1737
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1738
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
1739
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1740
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
1741
|
+
# * (`nil`) indicating no credentials
|
1742
|
+
# @return [::Object]
|
1743
|
+
# @!attribute [rw] scope
|
1744
|
+
# The OAuth scopes
|
1745
|
+
# @return [::Array<::String>]
|
1746
|
+
# @!attribute [rw] lib_name
|
1747
|
+
# The library name as recorded in instrumentation and logging
|
1748
|
+
# @return [::String]
|
1749
|
+
# @!attribute [rw] lib_version
|
1750
|
+
# The library version as recorded in instrumentation and logging
|
1751
|
+
# @return [::String]
|
1752
|
+
# @!attribute [rw] timeout
|
1753
|
+
# The call timeout in seconds.
|
1754
|
+
# @return [::Numeric]
|
1755
|
+
# @!attribute [rw] metadata
|
1756
|
+
# Additional headers to be sent with the call.
|
1757
|
+
# @return [::Hash{::Symbol=>::String}]
|
1758
|
+
# @!attribute [rw] retry_policy
|
1759
|
+
# The retry policy. The value is a hash with the following keys:
|
1760
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1761
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1762
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1763
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1764
|
+
# trigger a retry.
|
1765
|
+
# @return [::Hash]
|
1766
|
+
# @!attribute [rw] quota_project
|
1767
|
+
# A separate project against which to charge quota.
|
1768
|
+
# @return [::String]
|
1769
|
+
#
|
1770
|
+
class Configuration
|
1771
|
+
extend ::Gapic::Config
|
1772
|
+
|
1773
|
+
config_attr :endpoint, "vision.googleapis.com", ::String
|
1774
|
+
config_attr :credentials, nil do |value|
|
1775
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1776
|
+
allowed.any? { |klass| klass === value }
|
1777
|
+
end
|
1778
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1779
|
+
config_attr :lib_name, nil, ::String, nil
|
1780
|
+
config_attr :lib_version, nil, ::String, nil
|
1781
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1782
|
+
config_attr :metadata, nil, ::Hash, nil
|
1783
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1784
|
+
config_attr :quota_project, nil, ::String, nil
|
1785
|
+
|
1786
|
+
# @private
|
1787
|
+
def initialize parent_config = nil
|
1788
|
+
@parent_config = parent_config unless parent_config.nil?
|
1789
|
+
|
1790
|
+
yield self if block_given?
|
1791
|
+
end
|
1792
|
+
|
1793
|
+
##
|
1794
|
+
# Configurations for individual RPCs
|
1795
|
+
# @return [Rpcs]
|
1796
|
+
#
|
1797
|
+
def rpcs
|
1798
|
+
@rpcs ||= begin
|
1799
|
+
parent_rpcs = nil
|
1800
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1801
|
+
Rpcs.new parent_rpcs
|
1802
|
+
end
|
1803
|
+
end
|
1804
|
+
|
1805
|
+
##
|
1806
|
+
# Configuration RPC class for the ProductSearch API.
|
1807
|
+
#
|
1808
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1809
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1810
|
+
# the following configuration fields:
|
1811
|
+
#
|
1812
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1813
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
1814
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1815
|
+
# include the following keys:
|
1816
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1817
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1818
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1819
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1820
|
+
# trigger a retry.
|
1821
|
+
#
|
1822
|
+
class Rpcs
|
1823
|
+
##
|
1824
|
+
# RPC-specific configuration for `create_product_set`
|
1825
|
+
# @return [::Gapic::Config::Method]
|
1826
|
+
#
|
1827
|
+
attr_reader :create_product_set
|
1828
|
+
##
|
1829
|
+
# RPC-specific configuration for `list_product_sets`
|
1830
|
+
# @return [::Gapic::Config::Method]
|
1831
|
+
#
|
1832
|
+
attr_reader :list_product_sets
|
1833
|
+
##
|
1834
|
+
# RPC-specific configuration for `get_product_set`
|
1835
|
+
# @return [::Gapic::Config::Method]
|
1836
|
+
#
|
1837
|
+
attr_reader :get_product_set
|
1838
|
+
##
|
1839
|
+
# RPC-specific configuration for `update_product_set`
|
1840
|
+
# @return [::Gapic::Config::Method]
|
1841
|
+
#
|
1842
|
+
attr_reader :update_product_set
|
1843
|
+
##
|
1844
|
+
# RPC-specific configuration for `delete_product_set`
|
1845
|
+
# @return [::Gapic::Config::Method]
|
1846
|
+
#
|
1847
|
+
attr_reader :delete_product_set
|
1848
|
+
##
|
1849
|
+
# RPC-specific configuration for `create_product`
|
1850
|
+
# @return [::Gapic::Config::Method]
|
1851
|
+
#
|
1852
|
+
attr_reader :create_product
|
1853
|
+
##
|
1854
|
+
# RPC-specific configuration for `list_products`
|
1855
|
+
# @return [::Gapic::Config::Method]
|
1856
|
+
#
|
1857
|
+
attr_reader :list_products
|
1858
|
+
##
|
1859
|
+
# RPC-specific configuration for `get_product`
|
1860
|
+
# @return [::Gapic::Config::Method]
|
1861
|
+
#
|
1862
|
+
attr_reader :get_product
|
1863
|
+
##
|
1864
|
+
# RPC-specific configuration for `update_product`
|
1865
|
+
# @return [::Gapic::Config::Method]
|
1866
|
+
#
|
1867
|
+
attr_reader :update_product
|
1868
|
+
##
|
1869
|
+
# RPC-specific configuration for `delete_product`
|
1870
|
+
# @return [::Gapic::Config::Method]
|
1871
|
+
#
|
1872
|
+
attr_reader :delete_product
|
1873
|
+
##
|
1874
|
+
# RPC-specific configuration for `create_reference_image`
|
1875
|
+
# @return [::Gapic::Config::Method]
|
1876
|
+
#
|
1877
|
+
attr_reader :create_reference_image
|
1878
|
+
##
|
1879
|
+
# RPC-specific configuration for `delete_reference_image`
|
1880
|
+
# @return [::Gapic::Config::Method]
|
1881
|
+
#
|
1882
|
+
attr_reader :delete_reference_image
|
1883
|
+
##
|
1884
|
+
# RPC-specific configuration for `list_reference_images`
|
1885
|
+
# @return [::Gapic::Config::Method]
|
1886
|
+
#
|
1887
|
+
attr_reader :list_reference_images
|
1888
|
+
##
|
1889
|
+
# RPC-specific configuration for `get_reference_image`
|
1890
|
+
# @return [::Gapic::Config::Method]
|
1891
|
+
#
|
1892
|
+
attr_reader :get_reference_image
|
1893
|
+
##
|
1894
|
+
# RPC-specific configuration for `add_product_to_product_set`
|
1895
|
+
# @return [::Gapic::Config::Method]
|
1896
|
+
#
|
1897
|
+
attr_reader :add_product_to_product_set
|
1898
|
+
##
|
1899
|
+
# RPC-specific configuration for `remove_product_from_product_set`
|
1900
|
+
# @return [::Gapic::Config::Method]
|
1901
|
+
#
|
1902
|
+
attr_reader :remove_product_from_product_set
|
1903
|
+
##
|
1904
|
+
# RPC-specific configuration for `list_products_in_product_set`
|
1905
|
+
# @return [::Gapic::Config::Method]
|
1906
|
+
#
|
1907
|
+
attr_reader :list_products_in_product_set
|
1908
|
+
##
|
1909
|
+
# RPC-specific configuration for `import_product_sets`
|
1910
|
+
# @return [::Gapic::Config::Method]
|
1911
|
+
#
|
1912
|
+
attr_reader :import_product_sets
|
1913
|
+
##
|
1914
|
+
# RPC-specific configuration for `purge_products`
|
1915
|
+
# @return [::Gapic::Config::Method]
|
1916
|
+
#
|
1917
|
+
attr_reader :purge_products
|
1918
|
+
|
1919
|
+
# @private
|
1920
|
+
def initialize parent_rpcs = nil
|
1921
|
+
create_product_set_config = parent_rpcs.create_product_set if parent_rpcs.respond_to? :create_product_set
|
1922
|
+
@create_product_set = ::Gapic::Config::Method.new create_product_set_config
|
1923
|
+
list_product_sets_config = parent_rpcs.list_product_sets if parent_rpcs.respond_to? :list_product_sets
|
1924
|
+
@list_product_sets = ::Gapic::Config::Method.new list_product_sets_config
|
1925
|
+
get_product_set_config = parent_rpcs.get_product_set if parent_rpcs.respond_to? :get_product_set
|
1926
|
+
@get_product_set = ::Gapic::Config::Method.new get_product_set_config
|
1927
|
+
update_product_set_config = parent_rpcs.update_product_set if parent_rpcs.respond_to? :update_product_set
|
1928
|
+
@update_product_set = ::Gapic::Config::Method.new update_product_set_config
|
1929
|
+
delete_product_set_config = parent_rpcs.delete_product_set if parent_rpcs.respond_to? :delete_product_set
|
1930
|
+
@delete_product_set = ::Gapic::Config::Method.new delete_product_set_config
|
1931
|
+
create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product
|
1932
|
+
@create_product = ::Gapic::Config::Method.new create_product_config
|
1933
|
+
list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
|
1934
|
+
@list_products = ::Gapic::Config::Method.new list_products_config
|
1935
|
+
get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
|
1936
|
+
@get_product = ::Gapic::Config::Method.new get_product_config
|
1937
|
+
update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product
|
1938
|
+
@update_product = ::Gapic::Config::Method.new update_product_config
|
1939
|
+
delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product
|
1940
|
+
@delete_product = ::Gapic::Config::Method.new delete_product_config
|
1941
|
+
create_reference_image_config = parent_rpcs.create_reference_image if parent_rpcs.respond_to? :create_reference_image
|
1942
|
+
@create_reference_image = ::Gapic::Config::Method.new create_reference_image_config
|
1943
|
+
delete_reference_image_config = parent_rpcs.delete_reference_image if parent_rpcs.respond_to? :delete_reference_image
|
1944
|
+
@delete_reference_image = ::Gapic::Config::Method.new delete_reference_image_config
|
1945
|
+
list_reference_images_config = parent_rpcs.list_reference_images if parent_rpcs.respond_to? :list_reference_images
|
1946
|
+
@list_reference_images = ::Gapic::Config::Method.new list_reference_images_config
|
1947
|
+
get_reference_image_config = parent_rpcs.get_reference_image if parent_rpcs.respond_to? :get_reference_image
|
1948
|
+
@get_reference_image = ::Gapic::Config::Method.new get_reference_image_config
|
1949
|
+
add_product_to_product_set_config = parent_rpcs.add_product_to_product_set if parent_rpcs.respond_to? :add_product_to_product_set
|
1950
|
+
@add_product_to_product_set = ::Gapic::Config::Method.new add_product_to_product_set_config
|
1951
|
+
remove_product_from_product_set_config = parent_rpcs.remove_product_from_product_set if parent_rpcs.respond_to? :remove_product_from_product_set
|
1952
|
+
@remove_product_from_product_set = ::Gapic::Config::Method.new remove_product_from_product_set_config
|
1953
|
+
list_products_in_product_set_config = parent_rpcs.list_products_in_product_set if parent_rpcs.respond_to? :list_products_in_product_set
|
1954
|
+
@list_products_in_product_set = ::Gapic::Config::Method.new list_products_in_product_set_config
|
1955
|
+
import_product_sets_config = parent_rpcs.import_product_sets if parent_rpcs.respond_to? :import_product_sets
|
1956
|
+
@import_product_sets = ::Gapic::Config::Method.new import_product_sets_config
|
1957
|
+
purge_products_config = parent_rpcs.purge_products if parent_rpcs.respond_to? :purge_products
|
1958
|
+
@purge_products = ::Gapic::Config::Method.new purge_products_config
|
1959
|
+
|
1960
|
+
yield self if block_given?
|
1961
|
+
end
|
1962
|
+
end
|
1963
|
+
end
|
1964
|
+
end
|
1965
|
+
end
|
1966
|
+
end
|
1967
|
+
end
|
1968
|
+
end
|
1969
|
+
end
|
1970
|
+
end
|