google-cloud-vision-v1 0.1.0

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