google-cloud-vision-v1p3beta1 0.5.1 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,13 +54,12 @@ module Google
54
54
  # See {::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client::Configuration}
55
55
  # for a description of the configuration fields.
56
56
  #
57
- # ## Example
57
+ # @example
58
58
  #
59
- # To modify the configuration for all ProductSearch clients:
60
- #
61
- # ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
62
- # config.timeout = 10.0
63
- # end
59
+ # # Modify the configuration for all ProductSearch clients
60
+ # ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
61
+ # config.timeout = 10.0
62
+ # end
64
63
  #
65
64
  # @yield [config] Configure the Client client.
66
65
  # @yieldparam config [Client::Configuration]
@@ -80,146 +79,92 @@ module Google
80
79
 
81
80
  default_config.rpcs.create_product_set.timeout = 600.0
82
81
  default_config.rpcs.create_product_set.retry_policy = {
83
- initial_delay: 0.1,
84
- max_delay: 60.0,
85
- multiplier: 1.3,
86
- retry_codes: []
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
87
83
  }
88
84
 
89
85
  default_config.rpcs.list_product_sets.timeout = 600.0
90
86
  default_config.rpcs.list_product_sets.retry_policy = {
91
- initial_delay: 0.1,
92
- max_delay: 60.0,
93
- multiplier: 1.3,
94
- retry_codes: [14, 4]
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
95
88
  }
96
89
 
97
90
  default_config.rpcs.get_product_set.timeout = 600.0
98
91
  default_config.rpcs.get_product_set.retry_policy = {
99
- initial_delay: 0.1,
100
- max_delay: 60.0,
101
- multiplier: 1.3,
102
- retry_codes: [14, 4]
92
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
103
93
  }
104
94
 
105
95
  default_config.rpcs.update_product_set.timeout = 600.0
106
96
  default_config.rpcs.update_product_set.retry_policy = {
107
- initial_delay: 0.1,
108
- max_delay: 60.0,
109
- multiplier: 1.3,
110
- retry_codes: []
97
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
111
98
  }
112
99
 
113
100
  default_config.rpcs.delete_product_set.timeout = 600.0
114
101
  default_config.rpcs.delete_product_set.retry_policy = {
115
- initial_delay: 0.1,
116
- max_delay: 60.0,
117
- multiplier: 1.3,
118
- retry_codes: [14, 4]
102
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
119
103
  }
120
104
 
121
105
  default_config.rpcs.create_product.timeout = 600.0
122
106
  default_config.rpcs.create_product.retry_policy = {
123
- initial_delay: 0.1,
124
- max_delay: 60.0,
125
- multiplier: 1.3,
126
- retry_codes: []
107
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
127
108
  }
128
109
 
129
110
  default_config.rpcs.list_products.timeout = 600.0
130
111
  default_config.rpcs.list_products.retry_policy = {
131
- initial_delay: 0.1,
132
- max_delay: 60.0,
133
- multiplier: 1.3,
134
- retry_codes: [14, 4]
112
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
135
113
  }
136
114
 
137
115
  default_config.rpcs.get_product.timeout = 600.0
138
116
  default_config.rpcs.get_product.retry_policy = {
139
- initial_delay: 0.1,
140
- max_delay: 60.0,
141
- multiplier: 1.3,
142
- retry_codes: [14, 4]
117
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
143
118
  }
144
119
 
145
120
  default_config.rpcs.update_product.timeout = 600.0
146
121
  default_config.rpcs.update_product.retry_policy = {
147
- initial_delay: 0.1,
148
- max_delay: 60.0,
149
- multiplier: 1.3,
150
- retry_codes: []
122
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
151
123
  }
152
124
 
153
125
  default_config.rpcs.delete_product.timeout = 600.0
154
126
  default_config.rpcs.delete_product.retry_policy = {
155
- initial_delay: 0.1,
156
- max_delay: 60.0,
157
- multiplier: 1.3,
158
- retry_codes: [14, 4]
127
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
159
128
  }
160
129
 
161
130
  default_config.rpcs.create_reference_image.timeout = 600.0
162
131
  default_config.rpcs.create_reference_image.retry_policy = {
163
- initial_delay: 0.1,
164
- max_delay: 60.0,
165
- multiplier: 1.3,
166
- retry_codes: []
132
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
167
133
  }
168
134
 
169
135
  default_config.rpcs.delete_reference_image.timeout = 600.0
170
136
  default_config.rpcs.delete_reference_image.retry_policy = {
171
- initial_delay: 0.1,
172
- max_delay: 60.0,
173
- multiplier: 1.3,
174
- retry_codes: [14, 4]
137
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
175
138
  }
176
139
 
177
140
  default_config.rpcs.list_reference_images.timeout = 600.0
178
141
  default_config.rpcs.list_reference_images.retry_policy = {
179
- initial_delay: 0.1,
180
- max_delay: 60.0,
181
- multiplier: 1.3,
182
- retry_codes: [14, 4]
142
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
183
143
  }
184
144
 
185
145
  default_config.rpcs.get_reference_image.timeout = 600.0
186
146
  default_config.rpcs.get_reference_image.retry_policy = {
187
- initial_delay: 0.1,
188
- max_delay: 60.0,
189
- multiplier: 1.3,
190
- retry_codes: [14, 4]
147
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
191
148
  }
192
149
 
193
150
  default_config.rpcs.add_product_to_product_set.timeout = 600.0
194
151
  default_config.rpcs.add_product_to_product_set.retry_policy = {
195
- initial_delay: 0.1,
196
- max_delay: 60.0,
197
- multiplier: 1.3,
198
- retry_codes: []
152
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
199
153
  }
200
154
 
201
155
  default_config.rpcs.remove_product_from_product_set.timeout = 600.0
202
156
  default_config.rpcs.remove_product_from_product_set.retry_policy = {
203
- initial_delay: 0.1,
204
- max_delay: 60.0,
205
- multiplier: 1.3,
206
- retry_codes: []
157
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
207
158
  }
208
159
 
209
160
  default_config.rpcs.list_products_in_product_set.timeout = 600.0
210
161
  default_config.rpcs.list_products_in_product_set.retry_policy = {
211
- initial_delay: 0.1,
212
- max_delay: 60.0,
213
- multiplier: 1.3,
214
- retry_codes: [14, 4]
162
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
215
163
  }
216
164
 
217
165
  default_config.rpcs.import_product_sets.timeout = 600.0
218
166
  default_config.rpcs.import_product_sets.retry_policy = {
219
- initial_delay: 0.1,
220
- max_delay: 60.0,
221
- multiplier: 1.3,
222
- retry_codes: []
167
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
223
168
  }
224
169
 
225
170
  default_config
@@ -251,19 +196,15 @@ module Google
251
196
  ##
252
197
  # Create a new ProductSearch client object.
253
198
  #
254
- # ## Examples
255
- #
256
- # To create a new ProductSearch client with the default
257
- # configuration:
258
- #
259
- # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
199
+ # @example
260
200
  #
261
- # To create a new ProductSearch client with a custom
262
- # configuration:
201
+ # # Create a client using the default configuration
202
+ # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
263
203
  #
264
- # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
265
- # config.timeout = 10.0
266
- # end
204
+ # # Create a client using a custom configuration
205
+ # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
206
+ # config.timeout = 10.0
207
+ # end
267
208
  #
268
209
  # @yield [config] Configure the ProductSearch client.
269
210
  # @yieldparam config [Client::Configuration]
@@ -283,14 +224,13 @@ module Google
283
224
 
284
225
  # Create credentials
285
226
  credentials = @config.credentials
286
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
227
+ # Use self-signed JWT if the endpoint is unchanged from default,
287
228
  # but only if the default endpoint does not have a region prefix.
288
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
289
- @config.endpoint == Client.configure.endpoint &&
229
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
290
230
  !@config.endpoint.split(".").first.include?("-")
291
231
  credentials ||= Credentials.default scope: @config.scope,
292
232
  enable_self_signed_jwt: enable_self_signed_jwt
293
- if credentials.is_a?(String) || credentials.is_a?(Hash)
233
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
294
234
  credentials = Credentials.new credentials, scope: @config.scope
295
235
  end
296
236
  @quota_project_id = @config.quota_project
@@ -298,6 +238,7 @@ module Google
298
238
 
299
239
  @operations_client = Operations.new do |config|
300
240
  config.credentials = credentials
241
+ config.quota_project = @quota_project_id
301
242
  config.endpoint = @config.endpoint
302
243
  end
303
244
 
@@ -362,6 +303,21 @@ module Google
362
303
  #
363
304
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
364
305
  #
306
+ # @example Basic example
307
+ # require "google/cloud/vision/v1p3beta1"
308
+ #
309
+ # # Create a client object. The client can be reused for multiple calls.
310
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
311
+ #
312
+ # # Create a request. To set request fields, pass in keyword arguments.
313
+ # request = Google::Cloud::Vision::V1p3beta1::CreateProductSetRequest.new
314
+ #
315
+ # # Call the create_product_set method.
316
+ # result = client.create_product_set request
317
+ #
318
+ # # The returned object is of type Google::Cloud::Vision::V1p3beta1::ProductSet.
319
+ # p result
320
+ #
365
321
  def create_product_set request, options = nil
366
322
  raise ::ArgumentError, "request must be provided" if request.nil?
367
323
 
@@ -379,16 +335,20 @@ module Google
379
335
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
380
336
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
381
337
 
382
- header_params = {
383
- "parent" => request.parent
384
- }
338
+ header_params = {}
339
+ if request.parent
340
+ header_params["parent"] = request.parent
341
+ end
342
+
385
343
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
386
344
  metadata[:"x-goog-request-params"] ||= request_params_header
387
345
 
388
346
  options.apply_defaults timeout: @config.rpcs.create_product_set.timeout,
389
347
  metadata: metadata,
390
348
  retry_policy: @config.rpcs.create_product_set.retry_policy
391
- options.apply_defaults metadata: @config.metadata,
349
+
350
+ options.apply_defaults timeout: @config.timeout,
351
+ metadata: @config.metadata,
392
352
  retry_policy: @config.retry_policy
393
353
 
394
354
  @product_search_stub.call_rpc :create_product_set, request, options: options do |response, operation|
@@ -439,6 +399,27 @@ module Google
439
399
  #
440
400
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
441
401
  #
402
+ # @example Basic example
403
+ # require "google/cloud/vision/v1p3beta1"
404
+ #
405
+ # # Create a client object. The client can be reused for multiple calls.
406
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
407
+ #
408
+ # # Create a request. To set request fields, pass in keyword arguments.
409
+ # request = Google::Cloud::Vision::V1p3beta1::ListProductSetsRequest.new
410
+ #
411
+ # # Call the list_product_sets method.
412
+ # result = client.list_product_sets request
413
+ #
414
+ # # The returned object is of type Gapic::PagedEnumerable. You can
415
+ # # iterate over all elements by calling #each, and the enumerable
416
+ # # will lazily make API calls to fetch subsequent pages. Other
417
+ # # methods are also available for managing paging directly.
418
+ # result.each do |response|
419
+ # # Each element is of type ::Google::Cloud::Vision::V1p3beta1::ProductSet.
420
+ # p response
421
+ # end
422
+ #
442
423
  def list_product_sets request, options = nil
443
424
  raise ::ArgumentError, "request must be provided" if request.nil?
444
425
 
@@ -456,16 +437,20 @@ module Google
456
437
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
457
438
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
458
439
 
459
- header_params = {
460
- "parent" => request.parent
461
- }
440
+ header_params = {}
441
+ if request.parent
442
+ header_params["parent"] = request.parent
443
+ end
444
+
462
445
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
463
446
  metadata[:"x-goog-request-params"] ||= request_params_header
464
447
 
465
448
  options.apply_defaults timeout: @config.rpcs.list_product_sets.timeout,
466
449
  metadata: metadata,
467
450
  retry_policy: @config.rpcs.list_product_sets.retry_policy
468
- options.apply_defaults metadata: @config.metadata,
451
+
452
+ options.apply_defaults timeout: @config.timeout,
453
+ metadata: @config.metadata,
469
454
  retry_policy: @config.retry_policy
470
455
 
471
456
  @product_search_stub.call_rpc :list_product_sets, request, options: options do |response, operation|
@@ -513,6 +498,21 @@ module Google
513
498
  #
514
499
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
515
500
  #
501
+ # @example Basic example
502
+ # require "google/cloud/vision/v1p3beta1"
503
+ #
504
+ # # Create a client object. The client can be reused for multiple calls.
505
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
506
+ #
507
+ # # Create a request. To set request fields, pass in keyword arguments.
508
+ # request = Google::Cloud::Vision::V1p3beta1::GetProductSetRequest.new
509
+ #
510
+ # # Call the get_product_set method.
511
+ # result = client.get_product_set request
512
+ #
513
+ # # The returned object is of type Google::Cloud::Vision::V1p3beta1::ProductSet.
514
+ # p result
515
+ #
516
516
  def get_product_set request, options = nil
517
517
  raise ::ArgumentError, "request must be provided" if request.nil?
518
518
 
@@ -530,16 +530,20 @@ module Google
530
530
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
531
531
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
532
532
 
533
- header_params = {
534
- "name" => request.name
535
- }
533
+ header_params = {}
534
+ if request.name
535
+ header_params["name"] = request.name
536
+ end
537
+
536
538
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
537
539
  metadata[:"x-goog-request-params"] ||= request_params_header
538
540
 
539
541
  options.apply_defaults timeout: @config.rpcs.get_product_set.timeout,
540
542
  metadata: metadata,
541
543
  retry_policy: @config.rpcs.get_product_set.retry_policy
542
- options.apply_defaults metadata: @config.metadata,
544
+
545
+ options.apply_defaults timeout: @config.timeout,
546
+ metadata: @config.metadata,
543
547
  retry_policy: @config.retry_policy
544
548
 
545
549
  @product_search_stub.call_rpc :get_product_set, request, options: options do |response, operation|
@@ -591,6 +595,21 @@ module Google
591
595
  #
592
596
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
593
597
  #
598
+ # @example Basic example
599
+ # require "google/cloud/vision/v1p3beta1"
600
+ #
601
+ # # Create a client object. The client can be reused for multiple calls.
602
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
603
+ #
604
+ # # Create a request. To set request fields, pass in keyword arguments.
605
+ # request = Google::Cloud::Vision::V1p3beta1::UpdateProductSetRequest.new
606
+ #
607
+ # # Call the update_product_set method.
608
+ # result = client.update_product_set request
609
+ #
610
+ # # The returned object is of type Google::Cloud::Vision::V1p3beta1::ProductSet.
611
+ # p result
612
+ #
594
613
  def update_product_set request, options = nil
595
614
  raise ::ArgumentError, "request must be provided" if request.nil?
596
615
 
@@ -608,16 +627,20 @@ module Google
608
627
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
609
628
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
610
629
 
611
- header_params = {
612
- "product_set.name" => request.product_set.name
613
- }
630
+ header_params = {}
631
+ if request.product_set&.name
632
+ header_params["product_set.name"] = request.product_set.name
633
+ end
634
+
614
635
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
615
636
  metadata[:"x-goog-request-params"] ||= request_params_header
616
637
 
617
638
  options.apply_defaults timeout: @config.rpcs.update_product_set.timeout,
618
639
  metadata: metadata,
619
640
  retry_policy: @config.rpcs.update_product_set.retry_policy
620
- options.apply_defaults metadata: @config.metadata,
641
+
642
+ options.apply_defaults timeout: @config.timeout,
643
+ metadata: @config.metadata,
621
644
  retry_policy: @config.retry_policy
622
645
 
623
646
  @product_search_stub.call_rpc :update_product_set, request, options: options do |response, operation|
@@ -667,6 +690,21 @@ module Google
667
690
  #
668
691
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
669
692
  #
693
+ # @example Basic example
694
+ # require "google/cloud/vision/v1p3beta1"
695
+ #
696
+ # # Create a client object. The client can be reused for multiple calls.
697
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
698
+ #
699
+ # # Create a request. To set request fields, pass in keyword arguments.
700
+ # request = Google::Cloud::Vision::V1p3beta1::DeleteProductSetRequest.new
701
+ #
702
+ # # Call the delete_product_set method.
703
+ # result = client.delete_product_set request
704
+ #
705
+ # # The returned object is of type Google::Protobuf::Empty.
706
+ # p result
707
+ #
670
708
  def delete_product_set request, options = nil
671
709
  raise ::ArgumentError, "request must be provided" if request.nil?
672
710
 
@@ -684,16 +722,20 @@ module Google
684
722
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
685
723
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
686
724
 
687
- header_params = {
688
- "name" => request.name
689
- }
725
+ header_params = {}
726
+ if request.name
727
+ header_params["name"] = request.name
728
+ end
729
+
690
730
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
691
731
  metadata[:"x-goog-request-params"] ||= request_params_header
692
732
 
693
733
  options.apply_defaults timeout: @config.rpcs.delete_product_set.timeout,
694
734
  metadata: metadata,
695
735
  retry_policy: @config.rpcs.delete_product_set.retry_policy
696
- options.apply_defaults metadata: @config.metadata,
736
+
737
+ options.apply_defaults timeout: @config.timeout,
738
+ metadata: @config.metadata,
697
739
  retry_policy: @config.retry_policy
698
740
 
699
741
  @product_search_stub.call_rpc :delete_product_set, request, options: options do |response, operation|
@@ -750,6 +792,21 @@ module Google
750
792
  #
751
793
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
752
794
  #
795
+ # @example Basic example
796
+ # require "google/cloud/vision/v1p3beta1"
797
+ #
798
+ # # Create a client object. The client can be reused for multiple calls.
799
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
800
+ #
801
+ # # Create a request. To set request fields, pass in keyword arguments.
802
+ # request = Google::Cloud::Vision::V1p3beta1::CreateProductRequest.new
803
+ #
804
+ # # Call the create_product method.
805
+ # result = client.create_product request
806
+ #
807
+ # # The returned object is of type Google::Cloud::Vision::V1p3beta1::Product.
808
+ # p result
809
+ #
753
810
  def create_product request, options = nil
754
811
  raise ::ArgumentError, "request must be provided" if request.nil?
755
812
 
@@ -767,16 +824,20 @@ module Google
767
824
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
768
825
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
769
826
 
770
- header_params = {
771
- "parent" => request.parent
772
- }
827
+ header_params = {}
828
+ if request.parent
829
+ header_params["parent"] = request.parent
830
+ end
831
+
773
832
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
774
833
  metadata[:"x-goog-request-params"] ||= request_params_header
775
834
 
776
835
  options.apply_defaults timeout: @config.rpcs.create_product.timeout,
777
836
  metadata: metadata,
778
837
  retry_policy: @config.rpcs.create_product.retry_policy
779
- options.apply_defaults metadata: @config.metadata,
838
+
839
+ options.apply_defaults timeout: @config.timeout,
840
+ metadata: @config.metadata,
780
841
  retry_policy: @config.retry_policy
781
842
 
782
843
  @product_search_stub.call_rpc :create_product, request, options: options do |response, operation|
@@ -827,6 +888,27 @@ module Google
827
888
  #
828
889
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
829
890
  #
891
+ # @example Basic example
892
+ # require "google/cloud/vision/v1p3beta1"
893
+ #
894
+ # # Create a client object. The client can be reused for multiple calls.
895
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
896
+ #
897
+ # # Create a request. To set request fields, pass in keyword arguments.
898
+ # request = Google::Cloud::Vision::V1p3beta1::ListProductsRequest.new
899
+ #
900
+ # # Call the list_products method.
901
+ # result = client.list_products request
902
+ #
903
+ # # The returned object is of type Gapic::PagedEnumerable. You can
904
+ # # iterate over all elements by calling #each, and the enumerable
905
+ # # will lazily make API calls to fetch subsequent pages. Other
906
+ # # methods are also available for managing paging directly.
907
+ # result.each do |response|
908
+ # # Each element is of type ::Google::Cloud::Vision::V1p3beta1::Product.
909
+ # p response
910
+ # end
911
+ #
830
912
  def list_products request, options = nil
831
913
  raise ::ArgumentError, "request must be provided" if request.nil?
832
914
 
@@ -844,16 +926,20 @@ module Google
844
926
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
845
927
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
846
928
 
847
- header_params = {
848
- "parent" => request.parent
849
- }
929
+ header_params = {}
930
+ if request.parent
931
+ header_params["parent"] = request.parent
932
+ end
933
+
850
934
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
851
935
  metadata[:"x-goog-request-params"] ||= request_params_header
852
936
 
853
937
  options.apply_defaults timeout: @config.rpcs.list_products.timeout,
854
938
  metadata: metadata,
855
939
  retry_policy: @config.rpcs.list_products.retry_policy
856
- options.apply_defaults metadata: @config.metadata,
940
+
941
+ options.apply_defaults timeout: @config.timeout,
942
+ metadata: @config.metadata,
857
943
  retry_policy: @config.retry_policy
858
944
 
859
945
  @product_search_stub.call_rpc :list_products, request, options: options do |response, operation|
@@ -901,6 +987,21 @@ module Google
901
987
  #
902
988
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
903
989
  #
990
+ # @example Basic example
991
+ # require "google/cloud/vision/v1p3beta1"
992
+ #
993
+ # # Create a client object. The client can be reused for multiple calls.
994
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
995
+ #
996
+ # # Create a request. To set request fields, pass in keyword arguments.
997
+ # request = Google::Cloud::Vision::V1p3beta1::GetProductRequest.new
998
+ #
999
+ # # Call the get_product method.
1000
+ # result = client.get_product request
1001
+ #
1002
+ # # The returned object is of type Google::Cloud::Vision::V1p3beta1::Product.
1003
+ # p result
1004
+ #
904
1005
  def get_product request, options = nil
905
1006
  raise ::ArgumentError, "request must be provided" if request.nil?
906
1007
 
@@ -918,16 +1019,20 @@ module Google
918
1019
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
919
1020
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
920
1021
 
921
- header_params = {
922
- "name" => request.name
923
- }
1022
+ header_params = {}
1023
+ if request.name
1024
+ header_params["name"] = request.name
1025
+ end
1026
+
924
1027
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
925
1028
  metadata[:"x-goog-request-params"] ||= request_params_header
926
1029
 
927
1030
  options.apply_defaults timeout: @config.rpcs.get_product.timeout,
928
1031
  metadata: metadata,
929
1032
  retry_policy: @config.rpcs.get_product.retry_policy
930
- options.apply_defaults metadata: @config.metadata,
1033
+
1034
+ options.apply_defaults timeout: @config.timeout,
1035
+ metadata: @config.metadata,
931
1036
  retry_policy: @config.retry_policy
932
1037
 
933
1038
  @product_search_stub.call_rpc :get_product, request, options: options do |response, operation|
@@ -987,6 +1092,21 @@ module Google
987
1092
  #
988
1093
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
989
1094
  #
1095
+ # @example Basic example
1096
+ # require "google/cloud/vision/v1p3beta1"
1097
+ #
1098
+ # # Create a client object. The client can be reused for multiple calls.
1099
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1100
+ #
1101
+ # # Create a request. To set request fields, pass in keyword arguments.
1102
+ # request = Google::Cloud::Vision::V1p3beta1::UpdateProductRequest.new
1103
+ #
1104
+ # # Call the update_product method.
1105
+ # result = client.update_product request
1106
+ #
1107
+ # # The returned object is of type Google::Cloud::Vision::V1p3beta1::Product.
1108
+ # p result
1109
+ #
990
1110
  def update_product request, options = nil
991
1111
  raise ::ArgumentError, "request must be provided" if request.nil?
992
1112
 
@@ -1004,16 +1124,20 @@ module Google
1004
1124
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1005
1125
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1006
1126
 
1007
- header_params = {
1008
- "product.name" => request.product.name
1009
- }
1127
+ header_params = {}
1128
+ if request.product&.name
1129
+ header_params["product.name"] = request.product.name
1130
+ end
1131
+
1010
1132
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1011
1133
  metadata[:"x-goog-request-params"] ||= request_params_header
1012
1134
 
1013
1135
  options.apply_defaults timeout: @config.rpcs.update_product.timeout,
1014
1136
  metadata: metadata,
1015
1137
  retry_policy: @config.rpcs.update_product.retry_policy
1016
- options.apply_defaults metadata: @config.metadata,
1138
+
1139
+ options.apply_defaults timeout: @config.timeout,
1140
+ metadata: @config.metadata,
1017
1141
  retry_policy: @config.retry_policy
1018
1142
 
1019
1143
  @product_search_stub.call_rpc :update_product, request, options: options do |response, operation|
@@ -1064,6 +1188,21 @@ module Google
1064
1188
  #
1065
1189
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1066
1190
  #
1191
+ # @example Basic example
1192
+ # require "google/cloud/vision/v1p3beta1"
1193
+ #
1194
+ # # Create a client object. The client can be reused for multiple calls.
1195
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1196
+ #
1197
+ # # Create a request. To set request fields, pass in keyword arguments.
1198
+ # request = Google::Cloud::Vision::V1p3beta1::DeleteProductRequest.new
1199
+ #
1200
+ # # Call the delete_product method.
1201
+ # result = client.delete_product request
1202
+ #
1203
+ # # The returned object is of type Google::Protobuf::Empty.
1204
+ # p result
1205
+ #
1067
1206
  def delete_product request, options = nil
1068
1207
  raise ::ArgumentError, "request must be provided" if request.nil?
1069
1208
 
@@ -1081,16 +1220,20 @@ module Google
1081
1220
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1082
1221
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1083
1222
 
1084
- header_params = {
1085
- "name" => request.name
1086
- }
1223
+ header_params = {}
1224
+ if request.name
1225
+ header_params["name"] = request.name
1226
+ end
1227
+
1087
1228
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1088
1229
  metadata[:"x-goog-request-params"] ||= request_params_header
1089
1230
 
1090
1231
  options.apply_defaults timeout: @config.rpcs.delete_product.timeout,
1091
1232
  metadata: metadata,
1092
1233
  retry_policy: @config.rpcs.delete_product.retry_policy
1093
- options.apply_defaults metadata: @config.metadata,
1234
+
1235
+ options.apply_defaults timeout: @config.timeout,
1236
+ metadata: @config.metadata,
1094
1237
  retry_policy: @config.retry_policy
1095
1238
 
1096
1239
  @product_search_stub.call_rpc :delete_product, request, options: options do |response, operation|
@@ -1159,6 +1302,21 @@ module Google
1159
1302
  #
1160
1303
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1161
1304
  #
1305
+ # @example Basic example
1306
+ # require "google/cloud/vision/v1p3beta1"
1307
+ #
1308
+ # # Create a client object. The client can be reused for multiple calls.
1309
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1310
+ #
1311
+ # # Create a request. To set request fields, pass in keyword arguments.
1312
+ # request = Google::Cloud::Vision::V1p3beta1::CreateReferenceImageRequest.new
1313
+ #
1314
+ # # Call the create_reference_image method.
1315
+ # result = client.create_reference_image request
1316
+ #
1317
+ # # The returned object is of type Google::Cloud::Vision::V1p3beta1::ReferenceImage.
1318
+ # p result
1319
+ #
1162
1320
  def create_reference_image request, options = nil
1163
1321
  raise ::ArgumentError, "request must be provided" if request.nil?
1164
1322
 
@@ -1176,16 +1334,20 @@ module Google
1176
1334
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1177
1335
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1178
1336
 
1179
- header_params = {
1180
- "parent" => request.parent
1181
- }
1337
+ header_params = {}
1338
+ if request.parent
1339
+ header_params["parent"] = request.parent
1340
+ end
1341
+
1182
1342
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1183
1343
  metadata[:"x-goog-request-params"] ||= request_params_header
1184
1344
 
1185
1345
  options.apply_defaults timeout: @config.rpcs.create_reference_image.timeout,
1186
1346
  metadata: metadata,
1187
1347
  retry_policy: @config.rpcs.create_reference_image.retry_policy
1188
- options.apply_defaults metadata: @config.metadata,
1348
+
1349
+ options.apply_defaults timeout: @config.timeout,
1350
+ metadata: @config.metadata,
1189
1351
  retry_policy: @config.retry_policy
1190
1352
 
1191
1353
  @product_search_stub.call_rpc :create_reference_image, request, options: options do |response, operation|
@@ -1239,6 +1401,21 @@ module Google
1239
1401
  #
1240
1402
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1241
1403
  #
1404
+ # @example Basic example
1405
+ # require "google/cloud/vision/v1p3beta1"
1406
+ #
1407
+ # # Create a client object. The client can be reused for multiple calls.
1408
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1409
+ #
1410
+ # # Create a request. To set request fields, pass in keyword arguments.
1411
+ # request = Google::Cloud::Vision::V1p3beta1::DeleteReferenceImageRequest.new
1412
+ #
1413
+ # # Call the delete_reference_image method.
1414
+ # result = client.delete_reference_image request
1415
+ #
1416
+ # # The returned object is of type Google::Protobuf::Empty.
1417
+ # p result
1418
+ #
1242
1419
  def delete_reference_image request, options = nil
1243
1420
  raise ::ArgumentError, "request must be provided" if request.nil?
1244
1421
 
@@ -1256,16 +1433,20 @@ module Google
1256
1433
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1257
1434
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1258
1435
 
1259
- header_params = {
1260
- "name" => request.name
1261
- }
1436
+ header_params = {}
1437
+ if request.name
1438
+ header_params["name"] = request.name
1439
+ end
1440
+
1262
1441
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1263
1442
  metadata[:"x-goog-request-params"] ||= request_params_header
1264
1443
 
1265
1444
  options.apply_defaults timeout: @config.rpcs.delete_reference_image.timeout,
1266
1445
  metadata: metadata,
1267
1446
  retry_policy: @config.rpcs.delete_reference_image.retry_policy
1268
- options.apply_defaults metadata: @config.metadata,
1447
+
1448
+ options.apply_defaults timeout: @config.timeout,
1449
+ metadata: @config.metadata,
1269
1450
  retry_policy: @config.retry_policy
1270
1451
 
1271
1452
  @product_search_stub.call_rpc :delete_reference_image, request, options: options do |response, operation|
@@ -1321,6 +1502,27 @@ module Google
1321
1502
  #
1322
1503
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1323
1504
  #
1505
+ # @example Basic example
1506
+ # require "google/cloud/vision/v1p3beta1"
1507
+ #
1508
+ # # Create a client object. The client can be reused for multiple calls.
1509
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1510
+ #
1511
+ # # Create a request. To set request fields, pass in keyword arguments.
1512
+ # request = Google::Cloud::Vision::V1p3beta1::ListReferenceImagesRequest.new
1513
+ #
1514
+ # # Call the list_reference_images method.
1515
+ # result = client.list_reference_images request
1516
+ #
1517
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1518
+ # # iterate over all elements by calling #each, and the enumerable
1519
+ # # will lazily make API calls to fetch subsequent pages. Other
1520
+ # # methods are also available for managing paging directly.
1521
+ # result.each do |response|
1522
+ # # Each element is of type ::Google::Cloud::Vision::V1p3beta1::ReferenceImage.
1523
+ # p response
1524
+ # end
1525
+ #
1324
1526
  def list_reference_images request, options = nil
1325
1527
  raise ::ArgumentError, "request must be provided" if request.nil?
1326
1528
 
@@ -1338,16 +1540,20 @@ module Google
1338
1540
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1339
1541
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1340
1542
 
1341
- header_params = {
1342
- "parent" => request.parent
1343
- }
1543
+ header_params = {}
1544
+ if request.parent
1545
+ header_params["parent"] = request.parent
1546
+ end
1547
+
1344
1548
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1345
1549
  metadata[:"x-goog-request-params"] ||= request_params_header
1346
1550
 
1347
1551
  options.apply_defaults timeout: @config.rpcs.list_reference_images.timeout,
1348
1552
  metadata: metadata,
1349
1553
  retry_policy: @config.rpcs.list_reference_images.retry_policy
1350
- options.apply_defaults metadata: @config.metadata,
1554
+
1555
+ options.apply_defaults timeout: @config.timeout,
1556
+ metadata: @config.metadata,
1351
1557
  retry_policy: @config.retry_policy
1352
1558
 
1353
1559
  @product_search_stub.call_rpc :list_reference_images, request, options: options do |response, operation|
@@ -1396,6 +1602,21 @@ module Google
1396
1602
  #
1397
1603
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1398
1604
  #
1605
+ # @example Basic example
1606
+ # require "google/cloud/vision/v1p3beta1"
1607
+ #
1608
+ # # Create a client object. The client can be reused for multiple calls.
1609
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1610
+ #
1611
+ # # Create a request. To set request fields, pass in keyword arguments.
1612
+ # request = Google::Cloud::Vision::V1p3beta1::GetReferenceImageRequest.new
1613
+ #
1614
+ # # Call the get_reference_image method.
1615
+ # result = client.get_reference_image request
1616
+ #
1617
+ # # The returned object is of type Google::Cloud::Vision::V1p3beta1::ReferenceImage.
1618
+ # p result
1619
+ #
1399
1620
  def get_reference_image request, options = nil
1400
1621
  raise ::ArgumentError, "request must be provided" if request.nil?
1401
1622
 
@@ -1413,16 +1634,20 @@ module Google
1413
1634
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1414
1635
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1415
1636
 
1416
- header_params = {
1417
- "name" => request.name
1418
- }
1637
+ header_params = {}
1638
+ if request.name
1639
+ header_params["name"] = request.name
1640
+ end
1641
+
1419
1642
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1420
1643
  metadata[:"x-goog-request-params"] ||= request_params_header
1421
1644
 
1422
1645
  options.apply_defaults timeout: @config.rpcs.get_reference_image.timeout,
1423
1646
  metadata: metadata,
1424
1647
  retry_policy: @config.rpcs.get_reference_image.retry_policy
1425
- options.apply_defaults metadata: @config.metadata,
1648
+
1649
+ options.apply_defaults timeout: @config.timeout,
1650
+ metadata: @config.metadata,
1426
1651
  retry_policy: @config.retry_policy
1427
1652
 
1428
1653
  @product_search_stub.call_rpc :get_reference_image, request, options: options do |response, operation|
@@ -1477,6 +1702,21 @@ module Google
1477
1702
  #
1478
1703
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1479
1704
  #
1705
+ # @example Basic example
1706
+ # require "google/cloud/vision/v1p3beta1"
1707
+ #
1708
+ # # Create a client object. The client can be reused for multiple calls.
1709
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1710
+ #
1711
+ # # Create a request. To set request fields, pass in keyword arguments.
1712
+ # request = Google::Cloud::Vision::V1p3beta1::AddProductToProductSetRequest.new
1713
+ #
1714
+ # # Call the add_product_to_product_set method.
1715
+ # result = client.add_product_to_product_set request
1716
+ #
1717
+ # # The returned object is of type Google::Protobuf::Empty.
1718
+ # p result
1719
+ #
1480
1720
  def add_product_to_product_set request, options = nil
1481
1721
  raise ::ArgumentError, "request must be provided" if request.nil?
1482
1722
 
@@ -1494,16 +1734,20 @@ module Google
1494
1734
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1495
1735
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1496
1736
 
1497
- header_params = {
1498
- "name" => request.name
1499
- }
1737
+ header_params = {}
1738
+ if request.name
1739
+ header_params["name"] = request.name
1740
+ end
1741
+
1500
1742
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1501
1743
  metadata[:"x-goog-request-params"] ||= request_params_header
1502
1744
 
1503
1745
  options.apply_defaults timeout: @config.rpcs.add_product_to_product_set.timeout,
1504
1746
  metadata: metadata,
1505
1747
  retry_policy: @config.rpcs.add_product_to_product_set.retry_policy
1506
- options.apply_defaults metadata: @config.metadata,
1748
+
1749
+ options.apply_defaults timeout: @config.timeout,
1750
+ metadata: @config.metadata,
1507
1751
  retry_policy: @config.retry_policy
1508
1752
 
1509
1753
  @product_search_stub.call_rpc :add_product_to_product_set, request, options: options do |response, operation|
@@ -1555,6 +1799,21 @@ module Google
1555
1799
  #
1556
1800
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1557
1801
  #
1802
+ # @example Basic example
1803
+ # require "google/cloud/vision/v1p3beta1"
1804
+ #
1805
+ # # Create a client object. The client can be reused for multiple calls.
1806
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1807
+ #
1808
+ # # Create a request. To set request fields, pass in keyword arguments.
1809
+ # request = Google::Cloud::Vision::V1p3beta1::RemoveProductFromProductSetRequest.new
1810
+ #
1811
+ # # Call the remove_product_from_product_set method.
1812
+ # result = client.remove_product_from_product_set request
1813
+ #
1814
+ # # The returned object is of type Google::Protobuf::Empty.
1815
+ # p result
1816
+ #
1558
1817
  def remove_product_from_product_set request, options = nil
1559
1818
  raise ::ArgumentError, "request must be provided" if request.nil?
1560
1819
 
@@ -1572,16 +1831,20 @@ module Google
1572
1831
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1573
1832
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1574
1833
 
1575
- header_params = {
1576
- "name" => request.name
1577
- }
1834
+ header_params = {}
1835
+ if request.name
1836
+ header_params["name"] = request.name
1837
+ end
1838
+
1578
1839
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1579
1840
  metadata[:"x-goog-request-params"] ||= request_params_header
1580
1841
 
1581
1842
  options.apply_defaults timeout: @config.rpcs.remove_product_from_product_set.timeout,
1582
1843
  metadata: metadata,
1583
1844
  retry_policy: @config.rpcs.remove_product_from_product_set.retry_policy
1584
- options.apply_defaults metadata: @config.metadata,
1845
+
1846
+ options.apply_defaults timeout: @config.timeout,
1847
+ metadata: @config.metadata,
1585
1848
  retry_policy: @config.retry_policy
1586
1849
 
1587
1850
  @product_search_stub.call_rpc :remove_product_from_product_set, request, options: options do |response, operation|
@@ -1634,6 +1897,27 @@ module Google
1634
1897
  #
1635
1898
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1636
1899
  #
1900
+ # @example Basic example
1901
+ # require "google/cloud/vision/v1p3beta1"
1902
+ #
1903
+ # # Create a client object. The client can be reused for multiple calls.
1904
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
1905
+ #
1906
+ # # Create a request. To set request fields, pass in keyword arguments.
1907
+ # request = Google::Cloud::Vision::V1p3beta1::ListProductsInProductSetRequest.new
1908
+ #
1909
+ # # Call the list_products_in_product_set method.
1910
+ # result = client.list_products_in_product_set request
1911
+ #
1912
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1913
+ # # iterate over all elements by calling #each, and the enumerable
1914
+ # # will lazily make API calls to fetch subsequent pages. Other
1915
+ # # methods are also available for managing paging directly.
1916
+ # result.each do |response|
1917
+ # # Each element is of type ::Google::Cloud::Vision::V1p3beta1::Product.
1918
+ # p response
1919
+ # end
1920
+ #
1637
1921
  def list_products_in_product_set request, options = nil
1638
1922
  raise ::ArgumentError, "request must be provided" if request.nil?
1639
1923
 
@@ -1651,16 +1935,20 @@ module Google
1651
1935
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1652
1936
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1653
1937
 
1654
- header_params = {
1655
- "name" => request.name
1656
- }
1938
+ header_params = {}
1939
+ if request.name
1940
+ header_params["name"] = request.name
1941
+ end
1942
+
1657
1943
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1658
1944
  metadata[:"x-goog-request-params"] ||= request_params_header
1659
1945
 
1660
1946
  options.apply_defaults timeout: @config.rpcs.list_products_in_product_set.timeout,
1661
1947
  metadata: metadata,
1662
1948
  retry_policy: @config.rpcs.list_products_in_product_set.retry_policy
1663
- options.apply_defaults metadata: @config.metadata,
1949
+
1950
+ options.apply_defaults timeout: @config.timeout,
1951
+ metadata: @config.metadata,
1664
1952
  retry_policy: @config.retry_policy
1665
1953
 
1666
1954
  @product_search_stub.call_rpc :list_products_in_product_set, request, options: options do |response, operation|
@@ -1715,6 +2003,28 @@ module Google
1715
2003
  #
1716
2004
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1717
2005
  #
2006
+ # @example Basic example
2007
+ # require "google/cloud/vision/v1p3beta1"
2008
+ #
2009
+ # # Create a client object. The client can be reused for multiple calls.
2010
+ # client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
2011
+ #
2012
+ # # Create a request. To set request fields, pass in keyword arguments.
2013
+ # request = Google::Cloud::Vision::V1p3beta1::ImportProductSetsRequest.new
2014
+ #
2015
+ # # Call the import_product_sets method.
2016
+ # result = client.import_product_sets request
2017
+ #
2018
+ # # The returned object is of type Gapic::Operation. You can use this
2019
+ # # object to check the status of an operation, cancel it, or wait
2020
+ # # for results. Here is how to block until completion:
2021
+ # result.wait_until_done! timeout: 60
2022
+ # if result.response?
2023
+ # p result.response
2024
+ # else
2025
+ # puts "Error!"
2026
+ # end
2027
+ #
1718
2028
  def import_product_sets request, options = nil
1719
2029
  raise ::ArgumentError, "request must be provided" if request.nil?
1720
2030
 
@@ -1732,16 +2042,20 @@ module Google
1732
2042
  gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
1733
2043
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1734
2044
 
1735
- header_params = {
1736
- "parent" => request.parent
1737
- }
2045
+ header_params = {}
2046
+ if request.parent
2047
+ header_params["parent"] = request.parent
2048
+ end
2049
+
1738
2050
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1739
2051
  metadata[:"x-goog-request-params"] ||= request_params_header
1740
2052
 
1741
2053
  options.apply_defaults timeout: @config.rpcs.import_product_sets.timeout,
1742
2054
  metadata: metadata,
1743
2055
  retry_policy: @config.rpcs.import_product_sets.retry_policy
1744
- options.apply_defaults metadata: @config.metadata,
2056
+
2057
+ options.apply_defaults timeout: @config.timeout,
2058
+ metadata: @config.metadata,
1745
2059
  retry_policy: @config.retry_policy
1746
2060
 
1747
2061
  @product_search_stub.call_rpc :import_product_sets, request, options: options do |response, operation|
@@ -1766,22 +2080,21 @@ module Google
1766
2080
  # Configuration can be applied globally to all clients, or to a single client
1767
2081
  # on construction.
1768
2082
  #
1769
- # # Examples
1770
- #
1771
- # To modify the global config, setting the timeout for create_product_set
1772
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1773
- #
1774
- # ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
1775
- # config.timeout = 10.0
1776
- # config.rpcs.create_product_set.timeout = 20.0
1777
- # end
1778
- #
1779
- # To apply the above configuration only to a new client:
1780
- #
1781
- # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
1782
- # config.timeout = 10.0
1783
- # config.rpcs.create_product_set.timeout = 20.0
1784
- # end
2083
+ # @example
2084
+ #
2085
+ # # Modify the global config, setting the timeout for
2086
+ # # create_product_set to 20 seconds,
2087
+ # # and all remaining timeouts to 10 seconds.
2088
+ # ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
2089
+ # config.timeout = 10.0
2090
+ # config.rpcs.create_product_set.timeout = 20.0
2091
+ # end
2092
+ #
2093
+ # # Apply the above configuration only to a new client.
2094
+ # client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
2095
+ # config.timeout = 10.0
2096
+ # config.rpcs.create_product_set.timeout = 20.0
2097
+ # end
1785
2098
  #
1786
2099
  # @!attribute [rw] endpoint
1787
2100
  # The hostname or hostname:port of the service endpoint.