google-cloud-vision-v1p3beta1 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) 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/v1p3beta1/image_annotator/client.rb +4 -4
  5. data/lib/google/cloud/vision/v1p3beta1/image_annotator/operations.rb +12 -14
  6. data/lib/google/cloud/vision/v1p3beta1/image_annotator/rest/client.rb +444 -0
  7. data/lib/google/cloud/vision/v1p3beta1/image_annotator/rest/operations.rb +793 -0
  8. data/lib/google/cloud/vision/v1p3beta1/image_annotator/rest/service_stub.rb +164 -0
  9. data/lib/google/cloud/vision/v1p3beta1/image_annotator/rest.rb +55 -0
  10. data/lib/google/cloud/vision/v1p3beta1/image_annotator.rb +7 -1
  11. data/lib/google/cloud/vision/v1p3beta1/product_search/client.rb +20 -28
  12. data/lib/google/cloud/vision/v1p3beta1/product_search/operations.rb +12 -14
  13. data/lib/google/cloud/vision/v1p3beta1/product_search/rest/client.rb +1879 -0
  14. data/lib/google/cloud/vision/v1p3beta1/product_search/rest/operations.rb +793 -0
  15. data/lib/google/cloud/vision/v1p3beta1/product_search/rest/service_stub.rb +1118 -0
  16. data/lib/google/cloud/vision/v1p3beta1/product_search/rest.rb +66 -0
  17. data/lib/google/cloud/vision/v1p3beta1/product_search.rb +7 -1
  18. data/lib/google/cloud/vision/v1p3beta1/rest.rb +38 -0
  19. data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +0 -1
  20. data/lib/google/cloud/vision/v1p3beta1/version.rb +1 -1
  21. data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +0 -2
  22. data/lib/google/cloud/vision/v1p3beta1.rb +7 -2
  23. data/proto_docs/google/api/client.rb +318 -0
  24. data/proto_docs/google/api/launch_stage.rb +71 -0
  25. data/proto_docs/google/cloud/vision/v1p3beta1/image_annotator.rb +2 -1
  26. data/proto_docs/google/rpc/status.rb +4 -2
  27. metadata +18 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24d1265cff30db0d7d68f63e85c91211010a2f1d5a019fa05442fd944f9f2d65
4
- data.tar.gz: 157a58fe7f9581ead0bfa093ef9039b565b7093ce1871c045dd32ad9a76daa44
3
+ metadata.gz: 58727ad5209d06786e10fceba2d0530764e403c411cfac4cde32bfca73e97995
4
+ data.tar.gz: 68a3036c3b04c2702d7349f22c076c7ed0f94527516bcd7bb07cebfe8810c0af
5
5
  SHA512:
6
- metadata.gz: e72f3dd7222e6f491b34d0f104160eb4a180006cfd27a3f9a14f7e12bc640e2703fab10d7df9f9aa745424b778a256131dc2d94a4a17712bd1ec76d8641c9777
7
- data.tar.gz: 97b9fe1dbfb8e16a4e7f5f20c4f289d4ba1db8e3a9a0e0939fd5ed756a3f50ec3b6204006e99b524a70301690288b8d79989b315259f93a6b24a8776999c1072
6
+ metadata.gz: 0a360fbe5a7624a46656c42ca58341bc9cacf21a8730b87cee4c438cc47806db268f74b3b4c89f6616dd80d17f64210b66b35c91e24b2b0e41275a715e901a66
7
+ data.tar.gz: 9eab6483b796683657342100a1a28c9820c889ca2e409dbe3e5f0dc477046e01d5f21e1b1c8bbe01577af5bcf69e891dad4bfcdd466eeaf5e6bdb77157383172
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
@@ -292,14 +292,14 @@ module Google
292
292
  # # Call the async_batch_annotate_files method.
293
293
  # result = client.async_batch_annotate_files request
294
294
  #
295
- # # The returned object is of type Gapic::Operation. You can use this
296
- # # object to check the status of an operation, cancel it, or wait
297
- # # for results. Here is how to block until completion:
295
+ # # The returned object is of type Gapic::Operation. You can use it to
296
+ # # check the status of an operation, cancel it, or wait for results.
297
+ # # Here is how to wait for a response.
298
298
  # result.wait_until_done! timeout: 60
299
299
  # if result.response?
300
300
  # p result.response
301
301
  # else
302
- # puts "Error!"
302
+ # puts "No response received."
303
303
  # end
304
304
  #
305
305
  def async_batch_annotate_files request, options = nil
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil
@@ -0,0 +1,444 @@
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/v1p3beta1/image_annotator_pb"
21
+ require "google/cloud/vision/v1p3beta1/image_annotator/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Vision
26
+ module V1p3beta1
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::V1p3beta1::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::V1p3beta1::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", "V1p3beta1"]
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: [14, 4]
74
+ }
75
+
76
+ default_config.rpcs.async_batch_annotate_files.timeout = 600.0
77
+ default_config.rpcs.async_batch_annotate_files.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: []
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the ImageAnnotator Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # Create a new ImageAnnotator REST client object.
109
+ #
110
+ # @example
111
+ #
112
+ # # Create a client using the default configuration
113
+ # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::Client.new
114
+ #
115
+ # # Create a client using a custom configuration
116
+ # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the ImageAnnotator client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # Create the configuration object
125
+ @config = Configuration.new Client.configure
126
+
127
+ # Yield the configuration if needed
128
+ yield @config if block_given?
129
+
130
+ # Create credentials
131
+ credentials = @config.credentials
132
+ # Use self-signed JWT if the endpoint is unchanged from default,
133
+ # but only if the default endpoint does not have a region prefix.
134
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
135
+ !@config.endpoint.split(".").first.include?("-")
136
+ credentials ||= Credentials.default scope: @config.scope,
137
+ enable_self_signed_jwt: enable_self_signed_jwt
138
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
139
+ credentials = Credentials.new credentials, scope: @config.scope
140
+ end
141
+
142
+ @quota_project_id = @config.quota_project
143
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
144
+
145
+ @operations_client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::Operations.new do |config|
146
+ config.credentials = credentials
147
+ config.quota_project = @quota_project_id
148
+ config.endpoint = @config.endpoint
149
+ end
150
+
151
+ @image_annotator_stub = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
152
+ end
153
+
154
+ ##
155
+ # Get the associated client for long-running operations.
156
+ #
157
+ # @return [::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::Operations]
158
+ #
159
+ attr_reader :operations_client
160
+
161
+ # Service calls
162
+
163
+ ##
164
+ # Run image detection and annotation for a batch of images.
165
+ #
166
+ # @overload batch_annotate_images(request, options = nil)
167
+ # Pass arguments to `batch_annotate_images` via a request object, either of type
168
+ # {::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest} or an equivalent Hash.
169
+ #
170
+ # @param request [::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest, ::Hash]
171
+ # A request object representing the call parameters. Required. To specify no
172
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
173
+ # @param options [::Gapic::CallOptions, ::Hash]
174
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
175
+ #
176
+ # @overload batch_annotate_images(requests: nil)
177
+ # Pass arguments to `batch_annotate_images` via keyword arguments. Note that at
178
+ # least one keyword argument is required. To specify no parameters, or to keep all
179
+ # the default parameter values, pass an empty Hash as a request object (see above).
180
+ #
181
+ # @param requests [::Array<::Google::Cloud::Vision::V1p3beta1::AnnotateImageRequest, ::Hash>]
182
+ # Individual image annotation requests for this batch.
183
+ # @yield [result, operation] Access the result along with the TransportOperation object
184
+ # @yieldparam result [::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
185
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
186
+ #
187
+ # @return [::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
188
+ #
189
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
190
+ def batch_annotate_images request, options = nil
191
+ raise ::ArgumentError, "request must be provided" if request.nil?
192
+
193
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest
194
+
195
+ # Converts hash and nil to an options object
196
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
197
+
198
+ # Customize the options with defaults
199
+ call_metadata = @config.rpcs.batch_annotate_images.metadata.to_h
200
+
201
+ # Set x-goog-api-client and x-goog-user-project headers
202
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
203
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
204
+ gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION,
205
+ transports_version_send: [:rest]
206
+
207
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
208
+
209
+ options.apply_defaults timeout: @config.rpcs.batch_annotate_images.timeout,
210
+ metadata: call_metadata,
211
+ retry_policy: @config.rpcs.batch_annotate_images.retry_policy
212
+
213
+ options.apply_defaults timeout: @config.timeout,
214
+ metadata: @config.metadata,
215
+ retry_policy: @config.retry_policy
216
+
217
+ @image_annotator_stub.batch_annotate_images request, options do |result, operation|
218
+ yield result, operation if block_given?
219
+ return result
220
+ end
221
+ rescue ::Gapic::Rest::Error => e
222
+ raise ::Google::Cloud::Error.from_error(e)
223
+ end
224
+
225
+ ##
226
+ # Run asynchronous image detection and annotation for a list of generic
227
+ # files, such as PDF files, which may contain multiple pages and multiple
228
+ # images per page. Progress and results can be retrieved through the
229
+ # `google.longrunning.Operations` interface.
230
+ # `Operation.metadata` contains `OperationMetadata` (metadata).
231
+ # `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
232
+ #
233
+ # @overload async_batch_annotate_files(request, options = nil)
234
+ # Pass arguments to `async_batch_annotate_files` via a request object, either of type
235
+ # {::Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest} or an equivalent Hash.
236
+ #
237
+ # @param request [::Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest, ::Hash]
238
+ # A request object representing the call parameters. Required. To specify no
239
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
240
+ # @param options [::Gapic::CallOptions, ::Hash]
241
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
242
+ #
243
+ # @overload async_batch_annotate_files(requests: nil)
244
+ # Pass arguments to `async_batch_annotate_files` via keyword arguments. Note that at
245
+ # least one keyword argument is required. To specify no parameters, or to keep all
246
+ # the default parameter values, pass an empty Hash as a request object (see above).
247
+ #
248
+ # @param requests [::Array<::Google::Cloud::Vision::V1p3beta1::AsyncAnnotateFileRequest, ::Hash>]
249
+ # Required. Individual async file annotation requests for this batch.
250
+ # @yield [result, operation] Access the result along with the TransportOperation object
251
+ # @yieldparam result [::Gapic::Operation]
252
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
253
+ #
254
+ # @return [::Gapic::Operation]
255
+ #
256
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
257
+ def async_batch_annotate_files request, options = nil
258
+ raise ::ArgumentError, "request must be provided" if request.nil?
259
+
260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest
261
+
262
+ # Converts hash and nil to an options object
263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
264
+
265
+ # Customize the options with defaults
266
+ call_metadata = @config.rpcs.async_batch_annotate_files.metadata.to_h
267
+
268
+ # Set x-goog-api-client and x-goog-user-project headers
269
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
271
+ gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION,
272
+ transports_version_send: [:rest]
273
+
274
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
275
+
276
+ options.apply_defaults timeout: @config.rpcs.async_batch_annotate_files.timeout,
277
+ metadata: call_metadata,
278
+ retry_policy: @config.rpcs.async_batch_annotate_files.retry_policy
279
+
280
+ options.apply_defaults timeout: @config.timeout,
281
+ metadata: @config.metadata,
282
+ retry_policy: @config.retry_policy
283
+
284
+ @image_annotator_stub.async_batch_annotate_files request, options do |result, operation|
285
+ result = ::Gapic::Operation.new result, @operations_client, options: options
286
+ yield result, operation if block_given?
287
+ return result
288
+ end
289
+ rescue ::Gapic::Rest::Error => e
290
+ raise ::Google::Cloud::Error.from_error(e)
291
+ end
292
+
293
+ ##
294
+ # Configuration class for the ImageAnnotator REST API.
295
+ #
296
+ # This class represents the configuration for ImageAnnotator REST,
297
+ # providing control over timeouts, retry behavior, logging, transport
298
+ # parameters, and other low-level controls. Certain parameters can also be
299
+ # applied individually to specific RPCs. See
300
+ # {::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::Client::Configuration::Rpcs}
301
+ # for a list of RPCs that can be configured independently.
302
+ #
303
+ # Configuration can be applied globally to all clients, or to a single client
304
+ # on construction.
305
+ #
306
+ # @example
307
+ #
308
+ # # Modify the global config, setting the timeout for
309
+ # # batch_annotate_images to 20 seconds,
310
+ # # and all remaining timeouts to 10 seconds.
311
+ # ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::Client.configure do |config|
312
+ # config.timeout = 10.0
313
+ # config.rpcs.batch_annotate_images.timeout = 20.0
314
+ # end
315
+ #
316
+ # # Apply the above configuration only to a new client.
317
+ # client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Rest::Client.new do |config|
318
+ # config.timeout = 10.0
319
+ # config.rpcs.batch_annotate_images.timeout = 20.0
320
+ # end
321
+ #
322
+ # @!attribute [rw] endpoint
323
+ # The hostname or hostname:port of the service endpoint.
324
+ # Defaults to `"vision.googleapis.com"`.
325
+ # @return [::String]
326
+ # @!attribute [rw] credentials
327
+ # Credentials to send with calls. You may provide any of the following types:
328
+ # * (`String`) The path to a service account key file in JSON format
329
+ # * (`Hash`) A service account key as a Hash
330
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
331
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
332
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
333
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
334
+ # * (`nil`) indicating no credentials
335
+ # @return [::Object]
336
+ # @!attribute [rw] scope
337
+ # The OAuth scopes
338
+ # @return [::Array<::String>]
339
+ # @!attribute [rw] lib_name
340
+ # The library name as recorded in instrumentation and logging
341
+ # @return [::String]
342
+ # @!attribute [rw] lib_version
343
+ # The library version as recorded in instrumentation and logging
344
+ # @return [::String]
345
+ # @!attribute [rw] timeout
346
+ # The call timeout in seconds.
347
+ # @return [::Numeric]
348
+ # @!attribute [rw] metadata
349
+ # Additional headers to be sent with the call.
350
+ # @return [::Hash{::Symbol=>::String}]
351
+ # @!attribute [rw] retry_policy
352
+ # The retry policy. The value is a hash with the following keys:
353
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
354
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
355
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
356
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
357
+ # trigger a retry.
358
+ # @return [::Hash]
359
+ # @!attribute [rw] quota_project
360
+ # A separate project against which to charge quota.
361
+ # @return [::String]
362
+ #
363
+ class Configuration
364
+ extend ::Gapic::Config
365
+
366
+ config_attr :endpoint, "vision.googleapis.com", ::String
367
+ config_attr :credentials, nil do |value|
368
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
369
+ allowed.any? { |klass| klass === value }
370
+ end
371
+ config_attr :scope, nil, ::String, ::Array, nil
372
+ config_attr :lib_name, nil, ::String, nil
373
+ config_attr :lib_version, nil, ::String, nil
374
+ config_attr :timeout, nil, ::Numeric, nil
375
+ config_attr :metadata, nil, ::Hash, nil
376
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
377
+ config_attr :quota_project, nil, ::String, nil
378
+
379
+ # @private
380
+ def initialize parent_config = nil
381
+ @parent_config = parent_config unless parent_config.nil?
382
+
383
+ yield self if block_given?
384
+ end
385
+
386
+ ##
387
+ # Configurations for individual RPCs
388
+ # @return [Rpcs]
389
+ #
390
+ def rpcs
391
+ @rpcs ||= begin
392
+ parent_rpcs = nil
393
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
394
+ Rpcs.new parent_rpcs
395
+ end
396
+ end
397
+
398
+ ##
399
+ # Configuration RPC class for the ImageAnnotator API.
400
+ #
401
+ # Includes fields providing the configuration for each RPC in this service.
402
+ # Each configuration object is of type `Gapic::Config::Method` and includes
403
+ # the following configuration fields:
404
+ #
405
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
406
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
407
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
408
+ # include the following keys:
409
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
410
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
411
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
412
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
413
+ # trigger a retry.
414
+ #
415
+ class Rpcs
416
+ ##
417
+ # RPC-specific configuration for `batch_annotate_images`
418
+ # @return [::Gapic::Config::Method]
419
+ #
420
+ attr_reader :batch_annotate_images
421
+ ##
422
+ # RPC-specific configuration for `async_batch_annotate_files`
423
+ # @return [::Gapic::Config::Method]
424
+ #
425
+ attr_reader :async_batch_annotate_files
426
+
427
+ # @private
428
+ def initialize parent_rpcs = nil
429
+ batch_annotate_images_config = parent_rpcs.batch_annotate_images if parent_rpcs.respond_to? :batch_annotate_images
430
+ @batch_annotate_images = ::Gapic::Config::Method.new batch_annotate_images_config
431
+ async_batch_annotate_files_config = parent_rpcs.async_batch_annotate_files if parent_rpcs.respond_to? :async_batch_annotate_files
432
+ @async_batch_annotate_files = ::Gapic::Config::Method.new async_batch_annotate_files_config
433
+
434
+ yield self if block_given?
435
+ end
436
+ end
437
+ end
438
+ end
439
+ end
440
+ end
441
+ end
442
+ end
443
+ end
444
+ end