google-cloud-vision-v1 0.6.0 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,13 +54,12 @@ module Google
54
54
  # See {::Google::Cloud::Vision::V1::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::V1::ProductSearch::Client.configure do |config|
62
- # config.timeout = 10.0
63
- # end
59
+ # # Modify the configuration for all ProductSearch clients
60
+ # ::Google::Cloud::Vision::V1::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,154 +79,97 @@ 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: [4, 14]
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
92
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
97
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
102
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
112
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
117
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
122
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
127
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
137
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
142
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
147
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
152
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
157
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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: [4, 14]
162
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
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.rpcs.purge_products.timeout = 600.0
226
171
  default_config.rpcs.purge_products.retry_policy = {
227
- initial_delay: 0.1,
228
- max_delay: 60.0,
229
- multiplier: 1.3,
230
- retry_codes: []
172
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
231
173
  }
232
174
 
233
175
  default_config
@@ -259,19 +201,15 @@ module Google
259
201
  ##
260
202
  # Create a new ProductSearch client object.
261
203
  #
262
- # ## Examples
263
- #
264
- # To create a new ProductSearch client with the default
265
- # configuration:
266
- #
267
- # client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new
204
+ # @example
268
205
  #
269
- # To create a new ProductSearch client with a custom
270
- # configuration:
206
+ # # Create a client using the default configuration
207
+ # client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new
271
208
  #
272
- # client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new do |config|
273
- # config.timeout = 10.0
274
- # end
209
+ # # Create a client using a custom configuration
210
+ # client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new do |config|
211
+ # config.timeout = 10.0
212
+ # end
275
213
  #
276
214
  # @yield [config] Configure the ProductSearch client.
277
215
  # @yieldparam config [Client::Configuration]
@@ -291,14 +229,13 @@ module Google
291
229
 
292
230
  # Create credentials
293
231
  credentials = @config.credentials
294
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
232
+ # Use self-signed JWT if the endpoint is unchanged from default,
295
233
  # but only if the default endpoint does not have a region prefix.
296
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
297
- @config.endpoint == Client.configure.endpoint &&
234
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
298
235
  !@config.endpoint.split(".").first.include?("-")
299
236
  credentials ||= Credentials.default scope: @config.scope,
300
237
  enable_self_signed_jwt: enable_self_signed_jwt
301
- if credentials.is_a?(String) || credentials.is_a?(Hash)
238
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
302
239
  credentials = Credentials.new credentials, scope: @config.scope
303
240
  end
304
241
  @quota_project_id = @config.quota_project
@@ -306,6 +243,7 @@ module Google
306
243
 
307
244
  @operations_client = Operations.new do |config|
308
245
  config.credentials = credentials
246
+ config.quota_project = @quota_project_id
309
247
  config.endpoint = @config.endpoint
310
248
  end
311
249
 
@@ -370,6 +308,21 @@ module Google
370
308
  #
371
309
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
372
310
  #
311
+ # @example Basic example
312
+ # require "google/cloud/vision/v1"
313
+ #
314
+ # # Create a client object. The client can be reused for multiple calls.
315
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
316
+ #
317
+ # # Create a request. To set request fields, pass in keyword arguments.
318
+ # request = Google::Cloud::Vision::V1::CreateProductSetRequest.new
319
+ #
320
+ # # Call the create_product_set method.
321
+ # result = client.create_product_set request
322
+ #
323
+ # # The returned object is of type Google::Cloud::Vision::V1::ProductSet.
324
+ # p result
325
+ #
373
326
  def create_product_set request, options = nil
374
327
  raise ::ArgumentError, "request must be provided" if request.nil?
375
328
 
@@ -387,16 +340,20 @@ module Google
387
340
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
388
341
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
389
342
 
390
- header_params = {
391
- "parent" => request.parent
392
- }
343
+ header_params = {}
344
+ if request.parent
345
+ header_params["parent"] = request.parent
346
+ end
347
+
393
348
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
394
349
  metadata[:"x-goog-request-params"] ||= request_params_header
395
350
 
396
351
  options.apply_defaults timeout: @config.rpcs.create_product_set.timeout,
397
352
  metadata: metadata,
398
353
  retry_policy: @config.rpcs.create_product_set.retry_policy
399
- options.apply_defaults metadata: @config.metadata,
354
+
355
+ options.apply_defaults timeout: @config.timeout,
356
+ metadata: @config.metadata,
400
357
  retry_policy: @config.retry_policy
401
358
 
402
359
  @product_search_stub.call_rpc :create_product_set, request, options: options do |response, operation|
@@ -447,6 +404,27 @@ module Google
447
404
  #
448
405
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
449
406
  #
407
+ # @example Basic example
408
+ # require "google/cloud/vision/v1"
409
+ #
410
+ # # Create a client object. The client can be reused for multiple calls.
411
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
412
+ #
413
+ # # Create a request. To set request fields, pass in keyword arguments.
414
+ # request = Google::Cloud::Vision::V1::ListProductSetsRequest.new
415
+ #
416
+ # # Call the list_product_sets method.
417
+ # result = client.list_product_sets request
418
+ #
419
+ # # The returned object is of type Gapic::PagedEnumerable. You can
420
+ # # iterate over all elements by calling #each, and the enumerable
421
+ # # will lazily make API calls to fetch subsequent pages. Other
422
+ # # methods are also available for managing paging directly.
423
+ # result.each do |response|
424
+ # # Each element is of type ::Google::Cloud::Vision::V1::ProductSet.
425
+ # p response
426
+ # end
427
+ #
450
428
  def list_product_sets request, options = nil
451
429
  raise ::ArgumentError, "request must be provided" if request.nil?
452
430
 
@@ -464,16 +442,20 @@ module Google
464
442
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
465
443
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
466
444
 
467
- header_params = {
468
- "parent" => request.parent
469
- }
445
+ header_params = {}
446
+ if request.parent
447
+ header_params["parent"] = request.parent
448
+ end
449
+
470
450
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
471
451
  metadata[:"x-goog-request-params"] ||= request_params_header
472
452
 
473
453
  options.apply_defaults timeout: @config.rpcs.list_product_sets.timeout,
474
454
  metadata: metadata,
475
455
  retry_policy: @config.rpcs.list_product_sets.retry_policy
476
- options.apply_defaults metadata: @config.metadata,
456
+
457
+ options.apply_defaults timeout: @config.timeout,
458
+ metadata: @config.metadata,
477
459
  retry_policy: @config.retry_policy
478
460
 
479
461
  @product_search_stub.call_rpc :list_product_sets, request, options: options do |response, operation|
@@ -521,6 +503,21 @@ module Google
521
503
  #
522
504
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
523
505
  #
506
+ # @example Basic example
507
+ # require "google/cloud/vision/v1"
508
+ #
509
+ # # Create a client object. The client can be reused for multiple calls.
510
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
511
+ #
512
+ # # Create a request. To set request fields, pass in keyword arguments.
513
+ # request = Google::Cloud::Vision::V1::GetProductSetRequest.new
514
+ #
515
+ # # Call the get_product_set method.
516
+ # result = client.get_product_set request
517
+ #
518
+ # # The returned object is of type Google::Cloud::Vision::V1::ProductSet.
519
+ # p result
520
+ #
524
521
  def get_product_set request, options = nil
525
522
  raise ::ArgumentError, "request must be provided" if request.nil?
526
523
 
@@ -538,16 +535,20 @@ module Google
538
535
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
539
536
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
540
537
 
541
- header_params = {
542
- "name" => request.name
543
- }
538
+ header_params = {}
539
+ if request.name
540
+ header_params["name"] = request.name
541
+ end
542
+
544
543
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
545
544
  metadata[:"x-goog-request-params"] ||= request_params_header
546
545
 
547
546
  options.apply_defaults timeout: @config.rpcs.get_product_set.timeout,
548
547
  metadata: metadata,
549
548
  retry_policy: @config.rpcs.get_product_set.retry_policy
550
- options.apply_defaults metadata: @config.metadata,
549
+
550
+ options.apply_defaults timeout: @config.timeout,
551
+ metadata: @config.metadata,
551
552
  retry_policy: @config.retry_policy
552
553
 
553
554
  @product_search_stub.call_rpc :get_product_set, request, options: options do |response, operation|
@@ -599,6 +600,21 @@ module Google
599
600
  #
600
601
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
601
602
  #
603
+ # @example Basic example
604
+ # require "google/cloud/vision/v1"
605
+ #
606
+ # # Create a client object. The client can be reused for multiple calls.
607
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
608
+ #
609
+ # # Create a request. To set request fields, pass in keyword arguments.
610
+ # request = Google::Cloud::Vision::V1::UpdateProductSetRequest.new
611
+ #
612
+ # # Call the update_product_set method.
613
+ # result = client.update_product_set request
614
+ #
615
+ # # The returned object is of type Google::Cloud::Vision::V1::ProductSet.
616
+ # p result
617
+ #
602
618
  def update_product_set request, options = nil
603
619
  raise ::ArgumentError, "request must be provided" if request.nil?
604
620
 
@@ -616,16 +632,20 @@ module Google
616
632
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
617
633
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
618
634
 
619
- header_params = {
620
- "product_set.name" => request.product_set.name
621
- }
635
+ header_params = {}
636
+ if request.product_set&.name
637
+ header_params["product_set.name"] = request.product_set.name
638
+ end
639
+
622
640
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
623
641
  metadata[:"x-goog-request-params"] ||= request_params_header
624
642
 
625
643
  options.apply_defaults timeout: @config.rpcs.update_product_set.timeout,
626
644
  metadata: metadata,
627
645
  retry_policy: @config.rpcs.update_product_set.retry_policy
628
- options.apply_defaults metadata: @config.metadata,
646
+
647
+ options.apply_defaults timeout: @config.timeout,
648
+ metadata: @config.metadata,
629
649
  retry_policy: @config.retry_policy
630
650
 
631
651
  @product_search_stub.call_rpc :update_product_set, request, options: options do |response, operation|
@@ -671,6 +691,21 @@ module Google
671
691
  #
672
692
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
673
693
  #
694
+ # @example Basic example
695
+ # require "google/cloud/vision/v1"
696
+ #
697
+ # # Create a client object. The client can be reused for multiple calls.
698
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
699
+ #
700
+ # # Create a request. To set request fields, pass in keyword arguments.
701
+ # request = Google::Cloud::Vision::V1::DeleteProductSetRequest.new
702
+ #
703
+ # # Call the delete_product_set method.
704
+ # result = client.delete_product_set request
705
+ #
706
+ # # The returned object is of type Google::Protobuf::Empty.
707
+ # p result
708
+ #
674
709
  def delete_product_set request, options = nil
675
710
  raise ::ArgumentError, "request must be provided" if request.nil?
676
711
 
@@ -688,16 +723,20 @@ module Google
688
723
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
689
724
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
690
725
 
691
- header_params = {
692
- "name" => request.name
693
- }
726
+ header_params = {}
727
+ if request.name
728
+ header_params["name"] = request.name
729
+ end
730
+
694
731
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
695
732
  metadata[:"x-goog-request-params"] ||= request_params_header
696
733
 
697
734
  options.apply_defaults timeout: @config.rpcs.delete_product_set.timeout,
698
735
  metadata: metadata,
699
736
  retry_policy: @config.rpcs.delete_product_set.retry_policy
700
- options.apply_defaults metadata: @config.metadata,
737
+
738
+ options.apply_defaults timeout: @config.timeout,
739
+ metadata: @config.metadata,
701
740
  retry_policy: @config.retry_policy
702
741
 
703
742
  @product_search_stub.call_rpc :delete_product_set, request, options: options do |response, operation|
@@ -754,6 +793,21 @@ module Google
754
793
  #
755
794
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
756
795
  #
796
+ # @example Basic example
797
+ # require "google/cloud/vision/v1"
798
+ #
799
+ # # Create a client object. The client can be reused for multiple calls.
800
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
801
+ #
802
+ # # Create a request. To set request fields, pass in keyword arguments.
803
+ # request = Google::Cloud::Vision::V1::CreateProductRequest.new
804
+ #
805
+ # # Call the create_product method.
806
+ # result = client.create_product request
807
+ #
808
+ # # The returned object is of type Google::Cloud::Vision::V1::Product.
809
+ # p result
810
+ #
757
811
  def create_product request, options = nil
758
812
  raise ::ArgumentError, "request must be provided" if request.nil?
759
813
 
@@ -771,16 +825,20 @@ module Google
771
825
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
772
826
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
773
827
 
774
- header_params = {
775
- "parent" => request.parent
776
- }
828
+ header_params = {}
829
+ if request.parent
830
+ header_params["parent"] = request.parent
831
+ end
832
+
777
833
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
778
834
  metadata[:"x-goog-request-params"] ||= request_params_header
779
835
 
780
836
  options.apply_defaults timeout: @config.rpcs.create_product.timeout,
781
837
  metadata: metadata,
782
838
  retry_policy: @config.rpcs.create_product.retry_policy
783
- options.apply_defaults metadata: @config.metadata,
839
+
840
+ options.apply_defaults timeout: @config.timeout,
841
+ metadata: @config.metadata,
784
842
  retry_policy: @config.retry_policy
785
843
 
786
844
  @product_search_stub.call_rpc :create_product, request, options: options do |response, operation|
@@ -831,6 +889,27 @@ module Google
831
889
  #
832
890
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
833
891
  #
892
+ # @example Basic example
893
+ # require "google/cloud/vision/v1"
894
+ #
895
+ # # Create a client object. The client can be reused for multiple calls.
896
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
897
+ #
898
+ # # Create a request. To set request fields, pass in keyword arguments.
899
+ # request = Google::Cloud::Vision::V1::ListProductsRequest.new
900
+ #
901
+ # # Call the list_products method.
902
+ # result = client.list_products request
903
+ #
904
+ # # The returned object is of type Gapic::PagedEnumerable. You can
905
+ # # iterate over all elements by calling #each, and the enumerable
906
+ # # will lazily make API calls to fetch subsequent pages. Other
907
+ # # methods are also available for managing paging directly.
908
+ # result.each do |response|
909
+ # # Each element is of type ::Google::Cloud::Vision::V1::Product.
910
+ # p response
911
+ # end
912
+ #
834
913
  def list_products request, options = nil
835
914
  raise ::ArgumentError, "request must be provided" if request.nil?
836
915
 
@@ -848,16 +927,20 @@ module Google
848
927
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
849
928
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
850
929
 
851
- header_params = {
852
- "parent" => request.parent
853
- }
930
+ header_params = {}
931
+ if request.parent
932
+ header_params["parent"] = request.parent
933
+ end
934
+
854
935
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
855
936
  metadata[:"x-goog-request-params"] ||= request_params_header
856
937
 
857
938
  options.apply_defaults timeout: @config.rpcs.list_products.timeout,
858
939
  metadata: metadata,
859
940
  retry_policy: @config.rpcs.list_products.retry_policy
860
- options.apply_defaults metadata: @config.metadata,
941
+
942
+ options.apply_defaults timeout: @config.timeout,
943
+ metadata: @config.metadata,
861
944
  retry_policy: @config.retry_policy
862
945
 
863
946
  @product_search_stub.call_rpc :list_products, request, options: options do |response, operation|
@@ -905,6 +988,21 @@ module Google
905
988
  #
906
989
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
907
990
  #
991
+ # @example Basic example
992
+ # require "google/cloud/vision/v1"
993
+ #
994
+ # # Create a client object. The client can be reused for multiple calls.
995
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
996
+ #
997
+ # # Create a request. To set request fields, pass in keyword arguments.
998
+ # request = Google::Cloud::Vision::V1::GetProductRequest.new
999
+ #
1000
+ # # Call the get_product method.
1001
+ # result = client.get_product request
1002
+ #
1003
+ # # The returned object is of type Google::Cloud::Vision::V1::Product.
1004
+ # p result
1005
+ #
908
1006
  def get_product request, options = nil
909
1007
  raise ::ArgumentError, "request must be provided" if request.nil?
910
1008
 
@@ -922,16 +1020,20 @@ module Google
922
1020
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
923
1021
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
924
1022
 
925
- header_params = {
926
- "name" => request.name
927
- }
1023
+ header_params = {}
1024
+ if request.name
1025
+ header_params["name"] = request.name
1026
+ end
1027
+
928
1028
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
929
1029
  metadata[:"x-goog-request-params"] ||= request_params_header
930
1030
 
931
1031
  options.apply_defaults timeout: @config.rpcs.get_product.timeout,
932
1032
  metadata: metadata,
933
1033
  retry_policy: @config.rpcs.get_product.retry_policy
934
- options.apply_defaults metadata: @config.metadata,
1034
+
1035
+ options.apply_defaults timeout: @config.timeout,
1036
+ metadata: @config.metadata,
935
1037
  retry_policy: @config.retry_policy
936
1038
 
937
1039
  @product_search_stub.call_rpc :get_product, request, options: options do |response, operation|
@@ -992,6 +1094,21 @@ module Google
992
1094
  #
993
1095
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
994
1096
  #
1097
+ # @example Basic example
1098
+ # require "google/cloud/vision/v1"
1099
+ #
1100
+ # # Create a client object. The client can be reused for multiple calls.
1101
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1102
+ #
1103
+ # # Create a request. To set request fields, pass in keyword arguments.
1104
+ # request = Google::Cloud::Vision::V1::UpdateProductRequest.new
1105
+ #
1106
+ # # Call the update_product method.
1107
+ # result = client.update_product request
1108
+ #
1109
+ # # The returned object is of type Google::Cloud::Vision::V1::Product.
1110
+ # p result
1111
+ #
995
1112
  def update_product request, options = nil
996
1113
  raise ::ArgumentError, "request must be provided" if request.nil?
997
1114
 
@@ -1009,16 +1126,20 @@ module Google
1009
1126
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1010
1127
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1011
1128
 
1012
- header_params = {
1013
- "product.name" => request.product.name
1014
- }
1129
+ header_params = {}
1130
+ if request.product&.name
1131
+ header_params["product.name"] = request.product.name
1132
+ end
1133
+
1015
1134
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1016
1135
  metadata[:"x-goog-request-params"] ||= request_params_header
1017
1136
 
1018
1137
  options.apply_defaults timeout: @config.rpcs.update_product.timeout,
1019
1138
  metadata: metadata,
1020
1139
  retry_policy: @config.rpcs.update_product.retry_policy
1021
- options.apply_defaults metadata: @config.metadata,
1140
+
1141
+ options.apply_defaults timeout: @config.timeout,
1142
+ metadata: @config.metadata,
1022
1143
  retry_policy: @config.retry_policy
1023
1144
 
1024
1145
  @product_search_stub.call_rpc :update_product, request, options: options do |response, operation|
@@ -1065,6 +1186,21 @@ module Google
1065
1186
  #
1066
1187
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1067
1188
  #
1189
+ # @example Basic example
1190
+ # require "google/cloud/vision/v1"
1191
+ #
1192
+ # # Create a client object. The client can be reused for multiple calls.
1193
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1194
+ #
1195
+ # # Create a request. To set request fields, pass in keyword arguments.
1196
+ # request = Google::Cloud::Vision::V1::DeleteProductRequest.new
1197
+ #
1198
+ # # Call the delete_product method.
1199
+ # result = client.delete_product request
1200
+ #
1201
+ # # The returned object is of type Google::Protobuf::Empty.
1202
+ # p result
1203
+ #
1068
1204
  def delete_product request, options = nil
1069
1205
  raise ::ArgumentError, "request must be provided" if request.nil?
1070
1206
 
@@ -1082,16 +1218,20 @@ module Google
1082
1218
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1083
1219
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1084
1220
 
1085
- header_params = {
1086
- "name" => request.name
1087
- }
1221
+ header_params = {}
1222
+ if request.name
1223
+ header_params["name"] = request.name
1224
+ end
1225
+
1088
1226
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1089
1227
  metadata[:"x-goog-request-params"] ||= request_params_header
1090
1228
 
1091
1229
  options.apply_defaults timeout: @config.rpcs.delete_product.timeout,
1092
1230
  metadata: metadata,
1093
1231
  retry_policy: @config.rpcs.delete_product.retry_policy
1094
- options.apply_defaults metadata: @config.metadata,
1232
+
1233
+ options.apply_defaults timeout: @config.timeout,
1234
+ metadata: @config.metadata,
1095
1235
  retry_policy: @config.retry_policy
1096
1236
 
1097
1237
  @product_search_stub.call_rpc :delete_product, request, options: options do |response, operation|
@@ -1160,6 +1300,21 @@ module Google
1160
1300
  #
1161
1301
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1162
1302
  #
1303
+ # @example Basic example
1304
+ # require "google/cloud/vision/v1"
1305
+ #
1306
+ # # Create a client object. The client can be reused for multiple calls.
1307
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1308
+ #
1309
+ # # Create a request. To set request fields, pass in keyword arguments.
1310
+ # request = Google::Cloud::Vision::V1::CreateReferenceImageRequest.new
1311
+ #
1312
+ # # Call the create_reference_image method.
1313
+ # result = client.create_reference_image request
1314
+ #
1315
+ # # The returned object is of type Google::Cloud::Vision::V1::ReferenceImage.
1316
+ # p result
1317
+ #
1163
1318
  def create_reference_image request, options = nil
1164
1319
  raise ::ArgumentError, "request must be provided" if request.nil?
1165
1320
 
@@ -1177,16 +1332,20 @@ module Google
1177
1332
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1178
1333
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1179
1334
 
1180
- header_params = {
1181
- "parent" => request.parent
1182
- }
1335
+ header_params = {}
1336
+ if request.parent
1337
+ header_params["parent"] = request.parent
1338
+ end
1339
+
1183
1340
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1184
1341
  metadata[:"x-goog-request-params"] ||= request_params_header
1185
1342
 
1186
1343
  options.apply_defaults timeout: @config.rpcs.create_reference_image.timeout,
1187
1344
  metadata: metadata,
1188
1345
  retry_policy: @config.rpcs.create_reference_image.retry_policy
1189
- options.apply_defaults metadata: @config.metadata,
1346
+
1347
+ options.apply_defaults timeout: @config.timeout,
1348
+ metadata: @config.metadata,
1190
1349
  retry_policy: @config.retry_policy
1191
1350
 
1192
1351
  @product_search_stub.call_rpc :create_reference_image, request, options: options do |response, operation|
@@ -1235,6 +1394,21 @@ module Google
1235
1394
  #
1236
1395
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1237
1396
  #
1397
+ # @example Basic example
1398
+ # require "google/cloud/vision/v1"
1399
+ #
1400
+ # # Create a client object. The client can be reused for multiple calls.
1401
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1402
+ #
1403
+ # # Create a request. To set request fields, pass in keyword arguments.
1404
+ # request = Google::Cloud::Vision::V1::DeleteReferenceImageRequest.new
1405
+ #
1406
+ # # Call the delete_reference_image method.
1407
+ # result = client.delete_reference_image request
1408
+ #
1409
+ # # The returned object is of type Google::Protobuf::Empty.
1410
+ # p result
1411
+ #
1238
1412
  def delete_reference_image request, options = nil
1239
1413
  raise ::ArgumentError, "request must be provided" if request.nil?
1240
1414
 
@@ -1252,16 +1426,20 @@ module Google
1252
1426
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1253
1427
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1254
1428
 
1255
- header_params = {
1256
- "name" => request.name
1257
- }
1429
+ header_params = {}
1430
+ if request.name
1431
+ header_params["name"] = request.name
1432
+ end
1433
+
1258
1434
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1259
1435
  metadata[:"x-goog-request-params"] ||= request_params_header
1260
1436
 
1261
1437
  options.apply_defaults timeout: @config.rpcs.delete_reference_image.timeout,
1262
1438
  metadata: metadata,
1263
1439
  retry_policy: @config.rpcs.delete_reference_image.retry_policy
1264
- options.apply_defaults metadata: @config.metadata,
1440
+
1441
+ options.apply_defaults timeout: @config.timeout,
1442
+ metadata: @config.metadata,
1265
1443
  retry_policy: @config.retry_policy
1266
1444
 
1267
1445
  @product_search_stub.call_rpc :delete_reference_image, request, options: options do |response, operation|
@@ -1317,6 +1495,27 @@ module Google
1317
1495
  #
1318
1496
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1319
1497
  #
1498
+ # @example Basic example
1499
+ # require "google/cloud/vision/v1"
1500
+ #
1501
+ # # Create a client object. The client can be reused for multiple calls.
1502
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1503
+ #
1504
+ # # Create a request. To set request fields, pass in keyword arguments.
1505
+ # request = Google::Cloud::Vision::V1::ListReferenceImagesRequest.new
1506
+ #
1507
+ # # Call the list_reference_images method.
1508
+ # result = client.list_reference_images request
1509
+ #
1510
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1511
+ # # iterate over all elements by calling #each, and the enumerable
1512
+ # # will lazily make API calls to fetch subsequent pages. Other
1513
+ # # methods are also available for managing paging directly.
1514
+ # result.each do |response|
1515
+ # # Each element is of type ::Google::Cloud::Vision::V1::ReferenceImage.
1516
+ # p response
1517
+ # end
1518
+ #
1320
1519
  def list_reference_images request, options = nil
1321
1520
  raise ::ArgumentError, "request must be provided" if request.nil?
1322
1521
 
@@ -1334,16 +1533,20 @@ module Google
1334
1533
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1335
1534
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1336
1535
 
1337
- header_params = {
1338
- "parent" => request.parent
1339
- }
1536
+ header_params = {}
1537
+ if request.parent
1538
+ header_params["parent"] = request.parent
1539
+ end
1540
+
1340
1541
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1341
1542
  metadata[:"x-goog-request-params"] ||= request_params_header
1342
1543
 
1343
1544
  options.apply_defaults timeout: @config.rpcs.list_reference_images.timeout,
1344
1545
  metadata: metadata,
1345
1546
  retry_policy: @config.rpcs.list_reference_images.retry_policy
1346
- options.apply_defaults metadata: @config.metadata,
1547
+
1548
+ options.apply_defaults timeout: @config.timeout,
1549
+ metadata: @config.metadata,
1347
1550
  retry_policy: @config.retry_policy
1348
1551
 
1349
1552
  @product_search_stub.call_rpc :list_reference_images, request, options: options do |response, operation|
@@ -1391,6 +1594,21 @@ module Google
1391
1594
  #
1392
1595
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1393
1596
  #
1597
+ # @example Basic example
1598
+ # require "google/cloud/vision/v1"
1599
+ #
1600
+ # # Create a client object. The client can be reused for multiple calls.
1601
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1602
+ #
1603
+ # # Create a request. To set request fields, pass in keyword arguments.
1604
+ # request = Google::Cloud::Vision::V1::GetReferenceImageRequest.new
1605
+ #
1606
+ # # Call the get_reference_image method.
1607
+ # result = client.get_reference_image request
1608
+ #
1609
+ # # The returned object is of type Google::Cloud::Vision::V1::ReferenceImage.
1610
+ # p result
1611
+ #
1394
1612
  def get_reference_image request, options = nil
1395
1613
  raise ::ArgumentError, "request must be provided" if request.nil?
1396
1614
 
@@ -1408,16 +1626,20 @@ module Google
1408
1626
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1409
1627
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1410
1628
 
1411
- header_params = {
1412
- "name" => request.name
1413
- }
1629
+ header_params = {}
1630
+ if request.name
1631
+ header_params["name"] = request.name
1632
+ end
1633
+
1414
1634
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1415
1635
  metadata[:"x-goog-request-params"] ||= request_params_header
1416
1636
 
1417
1637
  options.apply_defaults timeout: @config.rpcs.get_reference_image.timeout,
1418
1638
  metadata: metadata,
1419
1639
  retry_policy: @config.rpcs.get_reference_image.retry_policy
1420
- options.apply_defaults metadata: @config.metadata,
1640
+
1641
+ options.apply_defaults timeout: @config.timeout,
1642
+ metadata: @config.metadata,
1421
1643
  retry_policy: @config.retry_policy
1422
1644
 
1423
1645
  @product_search_stub.call_rpc :get_reference_image, request, options: options do |response, operation|
@@ -1472,6 +1694,21 @@ module Google
1472
1694
  #
1473
1695
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1474
1696
  #
1697
+ # @example Basic example
1698
+ # require "google/cloud/vision/v1"
1699
+ #
1700
+ # # Create a client object. The client can be reused for multiple calls.
1701
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1702
+ #
1703
+ # # Create a request. To set request fields, pass in keyword arguments.
1704
+ # request = Google::Cloud::Vision::V1::AddProductToProductSetRequest.new
1705
+ #
1706
+ # # Call the add_product_to_product_set method.
1707
+ # result = client.add_product_to_product_set request
1708
+ #
1709
+ # # The returned object is of type Google::Protobuf::Empty.
1710
+ # p result
1711
+ #
1475
1712
  def add_product_to_product_set request, options = nil
1476
1713
  raise ::ArgumentError, "request must be provided" if request.nil?
1477
1714
 
@@ -1489,16 +1726,20 @@ module Google
1489
1726
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1490
1727
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1491
1728
 
1492
- header_params = {
1493
- "name" => request.name
1494
- }
1729
+ header_params = {}
1730
+ if request.name
1731
+ header_params["name"] = request.name
1732
+ end
1733
+
1495
1734
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1496
1735
  metadata[:"x-goog-request-params"] ||= request_params_header
1497
1736
 
1498
1737
  options.apply_defaults timeout: @config.rpcs.add_product_to_product_set.timeout,
1499
1738
  metadata: metadata,
1500
1739
  retry_policy: @config.rpcs.add_product_to_product_set.retry_policy
1501
- options.apply_defaults metadata: @config.metadata,
1740
+
1741
+ options.apply_defaults timeout: @config.timeout,
1742
+ metadata: @config.metadata,
1502
1743
  retry_policy: @config.retry_policy
1503
1744
 
1504
1745
  @product_search_stub.call_rpc :add_product_to_product_set, request, options: options do |response, operation|
@@ -1546,6 +1787,21 @@ module Google
1546
1787
  #
1547
1788
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1548
1789
  #
1790
+ # @example Basic example
1791
+ # require "google/cloud/vision/v1"
1792
+ #
1793
+ # # Create a client object. The client can be reused for multiple calls.
1794
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1795
+ #
1796
+ # # Create a request. To set request fields, pass in keyword arguments.
1797
+ # request = Google::Cloud::Vision::V1::RemoveProductFromProductSetRequest.new
1798
+ #
1799
+ # # Call the remove_product_from_product_set method.
1800
+ # result = client.remove_product_from_product_set request
1801
+ #
1802
+ # # The returned object is of type Google::Protobuf::Empty.
1803
+ # p result
1804
+ #
1549
1805
  def remove_product_from_product_set request, options = nil
1550
1806
  raise ::ArgumentError, "request must be provided" if request.nil?
1551
1807
 
@@ -1563,16 +1819,20 @@ module Google
1563
1819
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1564
1820
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1565
1821
 
1566
- header_params = {
1567
- "name" => request.name
1568
- }
1822
+ header_params = {}
1823
+ if request.name
1824
+ header_params["name"] = request.name
1825
+ end
1826
+
1569
1827
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1570
1828
  metadata[:"x-goog-request-params"] ||= request_params_header
1571
1829
 
1572
1830
  options.apply_defaults timeout: @config.rpcs.remove_product_from_product_set.timeout,
1573
1831
  metadata: metadata,
1574
1832
  retry_policy: @config.rpcs.remove_product_from_product_set.retry_policy
1575
- options.apply_defaults metadata: @config.metadata,
1833
+
1834
+ options.apply_defaults timeout: @config.timeout,
1835
+ metadata: @config.metadata,
1576
1836
  retry_policy: @config.retry_policy
1577
1837
 
1578
1838
  @product_search_stub.call_rpc :remove_product_from_product_set, request, options: options do |response, operation|
@@ -1625,6 +1885,27 @@ module Google
1625
1885
  #
1626
1886
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1627
1887
  #
1888
+ # @example Basic example
1889
+ # require "google/cloud/vision/v1"
1890
+ #
1891
+ # # Create a client object. The client can be reused for multiple calls.
1892
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1893
+ #
1894
+ # # Create a request. To set request fields, pass in keyword arguments.
1895
+ # request = Google::Cloud::Vision::V1::ListProductsInProductSetRequest.new
1896
+ #
1897
+ # # Call the list_products_in_product_set method.
1898
+ # result = client.list_products_in_product_set request
1899
+ #
1900
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1901
+ # # iterate over all elements by calling #each, and the enumerable
1902
+ # # will lazily make API calls to fetch subsequent pages. Other
1903
+ # # methods are also available for managing paging directly.
1904
+ # result.each do |response|
1905
+ # # Each element is of type ::Google::Cloud::Vision::V1::Product.
1906
+ # p response
1907
+ # end
1908
+ #
1628
1909
  def list_products_in_product_set request, options = nil
1629
1910
  raise ::ArgumentError, "request must be provided" if request.nil?
1630
1911
 
@@ -1642,16 +1923,20 @@ module Google
1642
1923
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1643
1924
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1644
1925
 
1645
- header_params = {
1646
- "name" => request.name
1647
- }
1926
+ header_params = {}
1927
+ if request.name
1928
+ header_params["name"] = request.name
1929
+ end
1930
+
1648
1931
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1649
1932
  metadata[:"x-goog-request-params"] ||= request_params_header
1650
1933
 
1651
1934
  options.apply_defaults timeout: @config.rpcs.list_products_in_product_set.timeout,
1652
1935
  metadata: metadata,
1653
1936
  retry_policy: @config.rpcs.list_products_in_product_set.retry_policy
1654
- options.apply_defaults metadata: @config.metadata,
1937
+
1938
+ options.apply_defaults timeout: @config.timeout,
1939
+ metadata: @config.metadata,
1655
1940
  retry_policy: @config.retry_policy
1656
1941
 
1657
1942
  @product_search_stub.call_rpc :list_products_in_product_set, request, options: options do |response, operation|
@@ -1706,6 +1991,28 @@ module Google
1706
1991
  #
1707
1992
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1708
1993
  #
1994
+ # @example Basic example
1995
+ # require "google/cloud/vision/v1"
1996
+ #
1997
+ # # Create a client object. The client can be reused for multiple calls.
1998
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
1999
+ #
2000
+ # # Create a request. To set request fields, pass in keyword arguments.
2001
+ # request = Google::Cloud::Vision::V1::ImportProductSetsRequest.new
2002
+ #
2003
+ # # Call the import_product_sets method.
2004
+ # result = client.import_product_sets request
2005
+ #
2006
+ # # The returned object is of type Gapic::Operation. You can use this
2007
+ # # object to check the status of an operation, cancel it, or wait
2008
+ # # for results. Here is how to block until completion:
2009
+ # result.wait_until_done! timeout: 60
2010
+ # if result.response?
2011
+ # p result.response
2012
+ # else
2013
+ # puts "Error!"
2014
+ # end
2015
+ #
1709
2016
  def import_product_sets request, options = nil
1710
2017
  raise ::ArgumentError, "request must be provided" if request.nil?
1711
2018
 
@@ -1723,16 +2030,20 @@ module Google
1723
2030
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1724
2031
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1725
2032
 
1726
- header_params = {
1727
- "parent" => request.parent
1728
- }
2033
+ header_params = {}
2034
+ if request.parent
2035
+ header_params["parent"] = request.parent
2036
+ end
2037
+
1729
2038
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1730
2039
  metadata[:"x-goog-request-params"] ||= request_params_header
1731
2040
 
1732
2041
  options.apply_defaults timeout: @config.rpcs.import_product_sets.timeout,
1733
2042
  metadata: metadata,
1734
2043
  retry_policy: @config.rpcs.import_product_sets.retry_policy
1735
- options.apply_defaults metadata: @config.metadata,
2044
+
2045
+ options.apply_defaults timeout: @config.timeout,
2046
+ metadata: @config.metadata,
1736
2047
  retry_policy: @config.retry_policy
1737
2048
 
1738
2049
  @product_search_stub.call_rpc :import_product_sets, request, options: options do |response, operation|
@@ -1806,6 +2117,28 @@ module Google
1806
2117
  #
1807
2118
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1808
2119
  #
2120
+ # @example Basic example
2121
+ # require "google/cloud/vision/v1"
2122
+ #
2123
+ # # Create a client object. The client can be reused for multiple calls.
2124
+ # client = Google::Cloud::Vision::V1::ProductSearch::Client.new
2125
+ #
2126
+ # # Create a request. To set request fields, pass in keyword arguments.
2127
+ # request = Google::Cloud::Vision::V1::PurgeProductsRequest.new
2128
+ #
2129
+ # # Call the purge_products method.
2130
+ # result = client.purge_products request
2131
+ #
2132
+ # # The returned object is of type Gapic::Operation. You can use this
2133
+ # # object to check the status of an operation, cancel it, or wait
2134
+ # # for results. Here is how to block until completion:
2135
+ # result.wait_until_done! timeout: 60
2136
+ # if result.response?
2137
+ # p result.response
2138
+ # else
2139
+ # puts "Error!"
2140
+ # end
2141
+ #
1809
2142
  def purge_products request, options = nil
1810
2143
  raise ::ArgumentError, "request must be provided" if request.nil?
1811
2144
 
@@ -1823,16 +2156,20 @@ module Google
1823
2156
  gapic_version: ::Google::Cloud::Vision::V1::VERSION
1824
2157
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1825
2158
 
1826
- header_params = {
1827
- "parent" => request.parent
1828
- }
2159
+ header_params = {}
2160
+ if request.parent
2161
+ header_params["parent"] = request.parent
2162
+ end
2163
+
1829
2164
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1830
2165
  metadata[:"x-goog-request-params"] ||= request_params_header
1831
2166
 
1832
2167
  options.apply_defaults timeout: @config.rpcs.purge_products.timeout,
1833
2168
  metadata: metadata,
1834
2169
  retry_policy: @config.rpcs.purge_products.retry_policy
1835
- options.apply_defaults metadata: @config.metadata,
2170
+
2171
+ options.apply_defaults timeout: @config.timeout,
2172
+ metadata: @config.metadata,
1836
2173
  retry_policy: @config.retry_policy
1837
2174
 
1838
2175
  @product_search_stub.call_rpc :purge_products, request, options: options do |response, operation|
@@ -1857,22 +2194,21 @@ module Google
1857
2194
  # Configuration can be applied globally to all clients, or to a single client
1858
2195
  # on construction.
1859
2196
  #
1860
- # # Examples
1861
- #
1862
- # To modify the global config, setting the timeout for create_product_set
1863
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1864
- #
1865
- # ::Google::Cloud::Vision::V1::ProductSearch::Client.configure do |config|
1866
- # config.timeout = 10.0
1867
- # config.rpcs.create_product_set.timeout = 20.0
1868
- # end
1869
- #
1870
- # To apply the above configuration only to a new client:
1871
- #
1872
- # client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new do |config|
1873
- # config.timeout = 10.0
1874
- # config.rpcs.create_product_set.timeout = 20.0
1875
- # end
2197
+ # @example
2198
+ #
2199
+ # # Modify the global config, setting the timeout for
2200
+ # # create_product_set to 20 seconds,
2201
+ # # and all remaining timeouts to 10 seconds.
2202
+ # ::Google::Cloud::Vision::V1::ProductSearch::Client.configure do |config|
2203
+ # config.timeout = 10.0
2204
+ # config.rpcs.create_product_set.timeout = 20.0
2205
+ # end
2206
+ #
2207
+ # # Apply the above configuration only to a new client.
2208
+ # client = ::Google::Cloud::Vision::V1::ProductSearch::Client.new do |config|
2209
+ # config.timeout = 10.0
2210
+ # config.rpcs.create_product_set.timeout = 20.0
2211
+ # end
1876
2212
  #
1877
2213
  # @!attribute [rw] endpoint
1878
2214
  # The hostname or hostname:port of the service endpoint.