google-cloud-vision-v1p4beta1 0.1.0

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