google-cloud-vision-v1p4beta1 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/README.md +1 -1
  4. data/lib/google/cloud/vision/v1p4beta1/face_pb.rb +0 -1
  5. data/lib/google/cloud/vision/v1p4beta1/geometry_pb.rb +0 -2
  6. data/lib/google/cloud/vision/v1p4beta1/image_annotator/client.rb +8 -8
  7. data/lib/google/cloud/vision/v1p4beta1/image_annotator/operations.rb +12 -14
  8. data/lib/google/cloud/vision/v1p4beta1/image_annotator/rest/client.rb +610 -0
  9. data/lib/google/cloud/vision/v1p4beta1/image_annotator/rest/operations.rb +793 -0
  10. data/lib/google/cloud/vision/v1p4beta1/image_annotator/rest/service_stub.rb +280 -0
  11. data/lib/google/cloud/vision/v1p4beta1/image_annotator/rest.rb +55 -0
  12. data/lib/google/cloud/vision/v1p4beta1/image_annotator.rb +7 -1
  13. data/lib/google/cloud/vision/v1p4beta1/image_annotator_pb.rb +0 -1
  14. data/lib/google/cloud/vision/v1p4beta1/product_search/client.rb +24 -32
  15. data/lib/google/cloud/vision/v1p4beta1/product_search/operations.rb +12 -14
  16. data/lib/google/cloud/vision/v1p4beta1/product_search/rest/client.rb +1973 -0
  17. data/lib/google/cloud/vision/v1p4beta1/product_search/rest/operations.rb +793 -0
  18. data/lib/google/cloud/vision/v1p4beta1/product_search/rest/service_stub.rb +1178 -0
  19. data/lib/google/cloud/vision/v1p4beta1/product_search/rest.rb +70 -0
  20. data/lib/google/cloud/vision/v1p4beta1/product_search.rb +7 -1
  21. data/lib/google/cloud/vision/v1p4beta1/product_search_pb.rb +0 -1
  22. data/lib/google/cloud/vision/v1p4beta1/rest.rb +38 -0
  23. data/lib/google/cloud/vision/v1p4beta1/text_annotation_pb.rb +0 -1
  24. data/lib/google/cloud/vision/v1p4beta1/version.rb +1 -1
  25. data/lib/google/cloud/vision/v1p4beta1/web_detection_pb.rb +0 -2
  26. data/lib/google/cloud/vision/v1p4beta1.rb +7 -2
  27. data/proto_docs/google/api/client.rb +318 -0
  28. data/proto_docs/google/api/launch_stage.rb +71 -0
  29. data/proto_docs/google/cloud/vision/v1p4beta1/image_annotator.rb +2 -1
  30. data/proto_docs/google/rpc/status.rb +4 -2
  31. metadata +18 -7
@@ -0,0 +1,610 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/vision/v1p4beta1/image_annotator_pb"
21
+ require "google/cloud/vision/v1p4beta1/image_annotator/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Vision
26
+ module V1p4beta1
27
+ module ImageAnnotator
28
+ module Rest
29
+ ##
30
+ # REST client for the ImageAnnotator service.
31
+ #
32
+ # Service that performs Google Cloud Vision API detection tasks over client
33
+ # images, such as face, landmark, logo, label, and text detection. The
34
+ # ImageAnnotator service returns detected entities from the images.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :image_annotator_stub
41
+
42
+ ##
43
+ # Configure the ImageAnnotator Client class.
44
+ #
45
+ # See {::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all ImageAnnotator clients
51
+ # ::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Vision", "V1p4beta1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.rpcs.batch_annotate_images.timeout = 600.0
72
+ default_config.rpcs.batch_annotate_images.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
74
+ }
75
+
76
+ default_config.rpcs.batch_annotate_files.timeout = 600.0
77
+ default_config.rpcs.batch_annotate_files.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
79
+ }
80
+
81
+ default_config.rpcs.async_batch_annotate_images.timeout = 600.0
82
+ default_config.rpcs.async_batch_annotate_images.retry_policy = {
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
84
+ }
85
+
86
+ default_config.rpcs.async_batch_annotate_files.timeout = 600.0
87
+ default_config.rpcs.async_batch_annotate_files.retry_policy = {
88
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
89
+ }
90
+
91
+ default_config
92
+ end
93
+ yield @configure if block_given?
94
+ @configure
95
+ end
96
+
97
+ ##
98
+ # Configure the ImageAnnotator Client instance.
99
+ #
100
+ # The configuration is set to the derived mode, meaning that values can be changed,
101
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
102
+ # should be made on {Client.configure}.
103
+ #
104
+ # See {::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Client::Configuration}
105
+ # for a description of the configuration fields.
106
+ #
107
+ # @yield [config] Configure the Client client.
108
+ # @yieldparam config [Client::Configuration]
109
+ #
110
+ # @return [Client::Configuration]
111
+ #
112
+ def configure
113
+ yield @config if block_given?
114
+ @config
115
+ end
116
+
117
+ ##
118
+ # Create a new ImageAnnotator REST client object.
119
+ #
120
+ # @example
121
+ #
122
+ # # Create a client using the default configuration
123
+ # client = ::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Client.new
124
+ #
125
+ # # Create a client using a custom configuration
126
+ # client = ::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Client.new do |config|
127
+ # config.timeout = 10.0
128
+ # end
129
+ #
130
+ # @yield [config] Configure the ImageAnnotator client.
131
+ # @yieldparam config [Client::Configuration]
132
+ #
133
+ def initialize
134
+ # Create the configuration object
135
+ @config = Configuration.new Client.configure
136
+
137
+ # Yield the configuration if needed
138
+ yield @config if block_given?
139
+
140
+ # Create credentials
141
+ credentials = @config.credentials
142
+ # Use self-signed JWT if the endpoint is unchanged from default,
143
+ # but only if the default endpoint does not have a region prefix.
144
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
145
+ !@config.endpoint.split(".").first.include?("-")
146
+ credentials ||= Credentials.default scope: @config.scope,
147
+ enable_self_signed_jwt: enable_self_signed_jwt
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
149
+ credentials = Credentials.new credentials, scope: @config.scope
150
+ end
151
+
152
+ @quota_project_id = @config.quota_project
153
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
+
155
+ @operations_client = ::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Operations.new do |config|
156
+ config.credentials = credentials
157
+ config.quota_project = @quota_project_id
158
+ config.endpoint = @config.endpoint
159
+ end
160
+
161
+ @image_annotator_stub = ::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
162
+ end
163
+
164
+ ##
165
+ # Get the associated client for long-running operations.
166
+ #
167
+ # @return [::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Operations]
168
+ #
169
+ attr_reader :operations_client
170
+
171
+ # Service calls
172
+
173
+ ##
174
+ # Run image detection and annotation for a batch of images.
175
+ #
176
+ # @overload batch_annotate_images(request, options = nil)
177
+ # Pass arguments to `batch_annotate_images` via a request object, either of type
178
+ # {::Google::Cloud::Vision::V1p4beta1::BatchAnnotateImagesRequest} or an equivalent Hash.
179
+ #
180
+ # @param request [::Google::Cloud::Vision::V1p4beta1::BatchAnnotateImagesRequest, ::Hash]
181
+ # A request object representing the call parameters. Required. To specify no
182
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
183
+ # @param options [::Gapic::CallOptions, ::Hash]
184
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
185
+ #
186
+ # @overload batch_annotate_images(requests: nil)
187
+ # Pass arguments to `batch_annotate_images` via keyword arguments. Note that at
188
+ # least one keyword argument is required. To specify no parameters, or to keep all
189
+ # the default parameter values, pass an empty Hash as a request object (see above).
190
+ #
191
+ # @param requests [::Array<::Google::Cloud::Vision::V1p4beta1::AnnotateImageRequest, ::Hash>]
192
+ # Required. Individual image annotation requests for this batch.
193
+ # @yield [result, operation] Access the result along with the TransportOperation object
194
+ # @yieldparam result [::Google::Cloud::Vision::V1p4beta1::BatchAnnotateImagesResponse]
195
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
196
+ #
197
+ # @return [::Google::Cloud::Vision::V1p4beta1::BatchAnnotateImagesResponse]
198
+ #
199
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
200
+ def batch_annotate_images request, options = nil
201
+ raise ::ArgumentError, "request must be provided" if request.nil?
202
+
203
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p4beta1::BatchAnnotateImagesRequest
204
+
205
+ # Converts hash and nil to an options object
206
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
207
+
208
+ # Customize the options with defaults
209
+ call_metadata = @config.rpcs.batch_annotate_images.metadata.to_h
210
+
211
+ # Set x-goog-api-client and x-goog-user-project headers
212
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
213
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
214
+ gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION,
215
+ transports_version_send: [:rest]
216
+
217
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
218
+
219
+ options.apply_defaults timeout: @config.rpcs.batch_annotate_images.timeout,
220
+ metadata: call_metadata,
221
+ retry_policy: @config.rpcs.batch_annotate_images.retry_policy
222
+
223
+ options.apply_defaults timeout: @config.timeout,
224
+ metadata: @config.metadata,
225
+ retry_policy: @config.retry_policy
226
+
227
+ @image_annotator_stub.batch_annotate_images request, options do |result, operation|
228
+ yield result, operation if block_given?
229
+ return result
230
+ end
231
+ rescue ::Gapic::Rest::Error => e
232
+ raise ::Google::Cloud::Error.from_error(e)
233
+ end
234
+
235
+ ##
236
+ # Service that performs image detection and annotation for a batch of files.
237
+ # Now only "application/pdf", "image/tiff" and "image/gif" are supported.
238
+ #
239
+ # This service will extract at most 5 (customers can specify which 5 in
240
+ # AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each
241
+ # file provided and perform detection and annotation for each image
242
+ # extracted.
243
+ #
244
+ # @overload batch_annotate_files(request, options = nil)
245
+ # Pass arguments to `batch_annotate_files` via a request object, either of type
246
+ # {::Google::Cloud::Vision::V1p4beta1::BatchAnnotateFilesRequest} or an equivalent Hash.
247
+ #
248
+ # @param request [::Google::Cloud::Vision::V1p4beta1::BatchAnnotateFilesRequest, ::Hash]
249
+ # A request object representing the call parameters. Required. To specify no
250
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
251
+ # @param options [::Gapic::CallOptions, ::Hash]
252
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
253
+ #
254
+ # @overload batch_annotate_files(requests: nil)
255
+ # Pass arguments to `batch_annotate_files` via keyword arguments. Note that at
256
+ # least one keyword argument is required. To specify no parameters, or to keep all
257
+ # the default parameter values, pass an empty Hash as a request object (see above).
258
+ #
259
+ # @param requests [::Array<::Google::Cloud::Vision::V1p4beta1::AnnotateFileRequest, ::Hash>]
260
+ # Required. The list of file annotation requests. Right now we support only
261
+ # one AnnotateFileRequest in BatchAnnotateFilesRequest.
262
+ # @yield [result, operation] Access the result along with the TransportOperation object
263
+ # @yieldparam result [::Google::Cloud::Vision::V1p4beta1::BatchAnnotateFilesResponse]
264
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
265
+ #
266
+ # @return [::Google::Cloud::Vision::V1p4beta1::BatchAnnotateFilesResponse]
267
+ #
268
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
269
+ def batch_annotate_files request, options = nil
270
+ raise ::ArgumentError, "request must be provided" if request.nil?
271
+
272
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p4beta1::BatchAnnotateFilesRequest
273
+
274
+ # Converts hash and nil to an options object
275
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
276
+
277
+ # Customize the options with defaults
278
+ call_metadata = @config.rpcs.batch_annotate_files.metadata.to_h
279
+
280
+ # Set x-goog-api-client and x-goog-user-project headers
281
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
282
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
283
+ gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION,
284
+ transports_version_send: [:rest]
285
+
286
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
287
+
288
+ options.apply_defaults timeout: @config.rpcs.batch_annotate_files.timeout,
289
+ metadata: call_metadata,
290
+ retry_policy: @config.rpcs.batch_annotate_files.retry_policy
291
+
292
+ options.apply_defaults timeout: @config.timeout,
293
+ metadata: @config.metadata,
294
+ retry_policy: @config.retry_policy
295
+
296
+ @image_annotator_stub.batch_annotate_files request, options do |result, operation|
297
+ yield result, operation if block_given?
298
+ return result
299
+ end
300
+ rescue ::Gapic::Rest::Error => e
301
+ raise ::Google::Cloud::Error.from_error(e)
302
+ end
303
+
304
+ ##
305
+ # Run asynchronous image detection and annotation for a list of images.
306
+ #
307
+ # Progress and results can be retrieved through the
308
+ # `google.longrunning.Operations` interface.
309
+ # `Operation.metadata` contains `OperationMetadata` (metadata).
310
+ # `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results).
311
+ #
312
+ # This service will write image annotation outputs to json files in customer
313
+ # GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
314
+ #
315
+ # @overload async_batch_annotate_images(request, options = nil)
316
+ # Pass arguments to `async_batch_annotate_images` via a request object, either of type
317
+ # {::Google::Cloud::Vision::V1p4beta1::AsyncBatchAnnotateImagesRequest} or an equivalent Hash.
318
+ #
319
+ # @param request [::Google::Cloud::Vision::V1p4beta1::AsyncBatchAnnotateImagesRequest, ::Hash]
320
+ # A request object representing the call parameters. Required. To specify no
321
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
322
+ # @param options [::Gapic::CallOptions, ::Hash]
323
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
324
+ #
325
+ # @overload async_batch_annotate_images(requests: nil, output_config: nil)
326
+ # Pass arguments to `async_batch_annotate_images` via keyword arguments. Note that at
327
+ # least one keyword argument is required. To specify no parameters, or to keep all
328
+ # the default parameter values, pass an empty Hash as a request object (see above).
329
+ #
330
+ # @param requests [::Array<::Google::Cloud::Vision::V1p4beta1::AnnotateImageRequest, ::Hash>]
331
+ # Required. Individual image annotation requests for this batch.
332
+ # @param output_config [::Google::Cloud::Vision::V1p4beta1::OutputConfig, ::Hash]
333
+ # Required. The desired output location and metadata (e.g. format).
334
+ # @yield [result, operation] Access the result along with the TransportOperation object
335
+ # @yieldparam result [::Gapic::Operation]
336
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
337
+ #
338
+ # @return [::Gapic::Operation]
339
+ #
340
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
341
+ def async_batch_annotate_images request, options = nil
342
+ raise ::ArgumentError, "request must be provided" if request.nil?
343
+
344
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p4beta1::AsyncBatchAnnotateImagesRequest
345
+
346
+ # Converts hash and nil to an options object
347
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
348
+
349
+ # Customize the options with defaults
350
+ call_metadata = @config.rpcs.async_batch_annotate_images.metadata.to_h
351
+
352
+ # Set x-goog-api-client and x-goog-user-project headers
353
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
354
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
355
+ gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION,
356
+ transports_version_send: [:rest]
357
+
358
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
359
+
360
+ options.apply_defaults timeout: @config.rpcs.async_batch_annotate_images.timeout,
361
+ metadata: call_metadata,
362
+ retry_policy: @config.rpcs.async_batch_annotate_images.retry_policy
363
+
364
+ options.apply_defaults timeout: @config.timeout,
365
+ metadata: @config.metadata,
366
+ retry_policy: @config.retry_policy
367
+
368
+ @image_annotator_stub.async_batch_annotate_images request, options do |result, operation|
369
+ result = ::Gapic::Operation.new result, @operations_client, options: options
370
+ yield result, operation if block_given?
371
+ return result
372
+ end
373
+ rescue ::Gapic::Rest::Error => e
374
+ raise ::Google::Cloud::Error.from_error(e)
375
+ end
376
+
377
+ ##
378
+ # Run asynchronous image detection and annotation for a list of generic
379
+ # files, such as PDF files, which may contain multiple pages and multiple
380
+ # images per page. Progress and results can be retrieved through the
381
+ # `google.longrunning.Operations` interface.
382
+ # `Operation.metadata` contains `OperationMetadata` (metadata).
383
+ # `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
384
+ #
385
+ # @overload async_batch_annotate_files(request, options = nil)
386
+ # Pass arguments to `async_batch_annotate_files` via a request object, either of type
387
+ # {::Google::Cloud::Vision::V1p4beta1::AsyncBatchAnnotateFilesRequest} or an equivalent Hash.
388
+ #
389
+ # @param request [::Google::Cloud::Vision::V1p4beta1::AsyncBatchAnnotateFilesRequest, ::Hash]
390
+ # A request object representing the call parameters. Required. To specify no
391
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
392
+ # @param options [::Gapic::CallOptions, ::Hash]
393
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
394
+ #
395
+ # @overload async_batch_annotate_files(requests: nil)
396
+ # Pass arguments to `async_batch_annotate_files` via keyword arguments. Note that at
397
+ # least one keyword argument is required. To specify no parameters, or to keep all
398
+ # the default parameter values, pass an empty Hash as a request object (see above).
399
+ #
400
+ # @param requests [::Array<::Google::Cloud::Vision::V1p4beta1::AsyncAnnotateFileRequest, ::Hash>]
401
+ # Required. Individual async file annotation requests for this batch.
402
+ # @yield [result, operation] Access the result along with the TransportOperation object
403
+ # @yieldparam result [::Gapic::Operation]
404
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
405
+ #
406
+ # @return [::Gapic::Operation]
407
+ #
408
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
409
+ def async_batch_annotate_files request, options = nil
410
+ raise ::ArgumentError, "request must be provided" if request.nil?
411
+
412
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p4beta1::AsyncBatchAnnotateFilesRequest
413
+
414
+ # Converts hash and nil to an options object
415
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
416
+
417
+ # Customize the options with defaults
418
+ call_metadata = @config.rpcs.async_batch_annotate_files.metadata.to_h
419
+
420
+ # Set x-goog-api-client and x-goog-user-project headers
421
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
422
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
423
+ gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION,
424
+ transports_version_send: [:rest]
425
+
426
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
427
+
428
+ options.apply_defaults timeout: @config.rpcs.async_batch_annotate_files.timeout,
429
+ metadata: call_metadata,
430
+ retry_policy: @config.rpcs.async_batch_annotate_files.retry_policy
431
+
432
+ options.apply_defaults timeout: @config.timeout,
433
+ metadata: @config.metadata,
434
+ retry_policy: @config.retry_policy
435
+
436
+ @image_annotator_stub.async_batch_annotate_files request, options do |result, operation|
437
+ result = ::Gapic::Operation.new result, @operations_client, options: options
438
+ yield result, operation if block_given?
439
+ return result
440
+ end
441
+ rescue ::Gapic::Rest::Error => e
442
+ raise ::Google::Cloud::Error.from_error(e)
443
+ end
444
+
445
+ ##
446
+ # Configuration class for the ImageAnnotator REST API.
447
+ #
448
+ # This class represents the configuration for ImageAnnotator REST,
449
+ # providing control over timeouts, retry behavior, logging, transport
450
+ # parameters, and other low-level controls. Certain parameters can also be
451
+ # applied individually to specific RPCs. See
452
+ # {::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Client::Configuration::Rpcs}
453
+ # for a list of RPCs that can be configured independently.
454
+ #
455
+ # Configuration can be applied globally to all clients, or to a single client
456
+ # on construction.
457
+ #
458
+ # @example
459
+ #
460
+ # # Modify the global config, setting the timeout for
461
+ # # batch_annotate_images to 20 seconds,
462
+ # # and all remaining timeouts to 10 seconds.
463
+ # ::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Client.configure do |config|
464
+ # config.timeout = 10.0
465
+ # config.rpcs.batch_annotate_images.timeout = 20.0
466
+ # end
467
+ #
468
+ # # Apply the above configuration only to a new client.
469
+ # client = ::Google::Cloud::Vision::V1p4beta1::ImageAnnotator::Rest::Client.new do |config|
470
+ # config.timeout = 10.0
471
+ # config.rpcs.batch_annotate_images.timeout = 20.0
472
+ # end
473
+ #
474
+ # @!attribute [rw] endpoint
475
+ # The hostname or hostname:port of the service endpoint.
476
+ # Defaults to `"vision.googleapis.com"`.
477
+ # @return [::String]
478
+ # @!attribute [rw] credentials
479
+ # Credentials to send with calls. You may provide any of the following types:
480
+ # * (`String`) The path to a service account key file in JSON format
481
+ # * (`Hash`) A service account key as a Hash
482
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
483
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
484
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
485
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
486
+ # * (`nil`) indicating no credentials
487
+ # @return [::Object]
488
+ # @!attribute [rw] scope
489
+ # The OAuth scopes
490
+ # @return [::Array<::String>]
491
+ # @!attribute [rw] lib_name
492
+ # The library name as recorded in instrumentation and logging
493
+ # @return [::String]
494
+ # @!attribute [rw] lib_version
495
+ # The library version as recorded in instrumentation and logging
496
+ # @return [::String]
497
+ # @!attribute [rw] timeout
498
+ # The call timeout in seconds.
499
+ # @return [::Numeric]
500
+ # @!attribute [rw] metadata
501
+ # Additional headers to be sent with the call.
502
+ # @return [::Hash{::Symbol=>::String}]
503
+ # @!attribute [rw] retry_policy
504
+ # The retry policy. The value is a hash with the following keys:
505
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
506
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
507
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
508
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
509
+ # trigger a retry.
510
+ # @return [::Hash]
511
+ # @!attribute [rw] quota_project
512
+ # A separate project against which to charge quota.
513
+ # @return [::String]
514
+ #
515
+ class Configuration
516
+ extend ::Gapic::Config
517
+
518
+ config_attr :endpoint, "vision.googleapis.com", ::String
519
+ config_attr :credentials, nil do |value|
520
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
521
+ allowed.any? { |klass| klass === value }
522
+ end
523
+ config_attr :scope, nil, ::String, ::Array, nil
524
+ config_attr :lib_name, nil, ::String, nil
525
+ config_attr :lib_version, nil, ::String, nil
526
+ config_attr :timeout, nil, ::Numeric, nil
527
+ config_attr :metadata, nil, ::Hash, nil
528
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
529
+ config_attr :quota_project, nil, ::String, nil
530
+
531
+ # @private
532
+ def initialize parent_config = nil
533
+ @parent_config = parent_config unless parent_config.nil?
534
+
535
+ yield self if block_given?
536
+ end
537
+
538
+ ##
539
+ # Configurations for individual RPCs
540
+ # @return [Rpcs]
541
+ #
542
+ def rpcs
543
+ @rpcs ||= begin
544
+ parent_rpcs = nil
545
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
546
+ Rpcs.new parent_rpcs
547
+ end
548
+ end
549
+
550
+ ##
551
+ # Configuration RPC class for the ImageAnnotator API.
552
+ #
553
+ # Includes fields providing the configuration for each RPC in this service.
554
+ # Each configuration object is of type `Gapic::Config::Method` and includes
555
+ # the following configuration fields:
556
+ #
557
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
558
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
559
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
560
+ # include the following keys:
561
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
562
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
563
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
564
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
565
+ # trigger a retry.
566
+ #
567
+ class Rpcs
568
+ ##
569
+ # RPC-specific configuration for `batch_annotate_images`
570
+ # @return [::Gapic::Config::Method]
571
+ #
572
+ attr_reader :batch_annotate_images
573
+ ##
574
+ # RPC-specific configuration for `batch_annotate_files`
575
+ # @return [::Gapic::Config::Method]
576
+ #
577
+ attr_reader :batch_annotate_files
578
+ ##
579
+ # RPC-specific configuration for `async_batch_annotate_images`
580
+ # @return [::Gapic::Config::Method]
581
+ #
582
+ attr_reader :async_batch_annotate_images
583
+ ##
584
+ # RPC-specific configuration for `async_batch_annotate_files`
585
+ # @return [::Gapic::Config::Method]
586
+ #
587
+ attr_reader :async_batch_annotate_files
588
+
589
+ # @private
590
+ def initialize parent_rpcs = nil
591
+ batch_annotate_images_config = parent_rpcs.batch_annotate_images if parent_rpcs.respond_to? :batch_annotate_images
592
+ @batch_annotate_images = ::Gapic::Config::Method.new batch_annotate_images_config
593
+ batch_annotate_files_config = parent_rpcs.batch_annotate_files if parent_rpcs.respond_to? :batch_annotate_files
594
+ @batch_annotate_files = ::Gapic::Config::Method.new batch_annotate_files_config
595
+ async_batch_annotate_images_config = parent_rpcs.async_batch_annotate_images if parent_rpcs.respond_to? :async_batch_annotate_images
596
+ @async_batch_annotate_images = ::Gapic::Config::Method.new async_batch_annotate_images_config
597
+ async_batch_annotate_files_config = parent_rpcs.async_batch_annotate_files if parent_rpcs.respond_to? :async_batch_annotate_files
598
+ @async_batch_annotate_files = ::Gapic::Config::Method.new async_batch_annotate_files_config
599
+
600
+ yield self if block_given?
601
+ end
602
+ end
603
+ end
604
+ end
605
+ end
606
+ end
607
+ end
608
+ end
609
+ end
610
+ end