google-cloud-document_ai-v1beta3 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb +54 -39
  3. data/lib/google/cloud/document_ai/v1beta3/document_processor_service/rest/client.rb +54 -39
  4. data/lib/google/cloud/document_ai/v1beta3/document_processor_service/rest.rb +1 -1
  5. data/lib/google/cloud/document_ai/v1beta3/document_processor_service.rb +1 -1
  6. data/lib/google/cloud/document_ai/v1beta3/document_service/client.rb +618 -0
  7. data/lib/google/cloud/document_ai/v1beta3/document_service/credentials.rb +51 -0
  8. data/lib/google/cloud/document_ai/v1beta3/document_service/operations.rb +770 -0
  9. data/lib/google/cloud/document_ai/v1beta3/document_service/paths.rb +90 -0
  10. data/lib/google/cloud/document_ai/v1beta3/document_service/rest/client.rb +530 -0
  11. data/lib/google/cloud/document_ai/v1beta3/document_service/rest/operations.rb +815 -0
  12. data/lib/google/cloud/document_ai/v1beta3/document_service/rest/service_stub.rb +227 -0
  13. data/lib/google/cloud/document_ai/v1beta3/document_service/rest.rb +54 -0
  14. data/lib/google/cloud/document_ai/v1beta3/document_service.rb +56 -0
  15. data/lib/google/cloud/document_ai/v1beta3/rest.rb +1 -0
  16. data/lib/google/cloud/document_ai/v1beta3/version.rb +1 -1
  17. data/lib/google/cloud/document_ai/v1beta3.rb +1 -0
  18. data/lib/google/cloud/documentai/v1beta3/dataset_pb.rb +55 -0
  19. data/lib/google/cloud/documentai/v1beta3/document_io_pb.rb +1 -1
  20. data/lib/google/cloud/documentai/v1beta3/document_pb.rb +2 -1
  21. data/lib/google/cloud/documentai/v1beta3/document_processor_service_pb.rb +4 -1
  22. data/lib/google/cloud/documentai/v1beta3/document_processor_service_services_pb.rb +8 -6
  23. data/lib/google/cloud/documentai/v1beta3/document_schema_pb.rb +3 -1
  24. data/lib/google/cloud/documentai/v1beta3/document_service_pb.rb +57 -0
  25. data/lib/google/cloud/documentai/v1beta3/document_service_services_pb.rb +49 -0
  26. data/lib/google/cloud/documentai/v1beta3/processor_pb.rb +1 -1
  27. data/proto_docs/google/cloud/documentai/v1beta3/dataset.rb +125 -0
  28. data/proto_docs/google/cloud/documentai/v1beta3/document.rb +88 -27
  29. data/proto_docs/google/cloud/documentai/v1beta3/document_io.rb +10 -1
  30. data/proto_docs/google/cloud/documentai/v1beta3/document_processor_service.rb +258 -123
  31. data/proto_docs/google/cloud/documentai/v1beta3/document_schema.rb +44 -13
  32. data/proto_docs/google/cloud/documentai/v1beta3/document_service.rb +73 -0
  33. data/proto_docs/google/cloud/documentai/v1beta3/processor.rb +11 -9
  34. data/proto_docs/google/cloud/documentai/v1beta3/processor_type.rb +3 -2
  35. metadata +16 -2
@@ -0,0 +1,90 @@
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
+
20
+ module Google
21
+ module Cloud
22
+ module DocumentAI
23
+ module V1beta3
24
+ module DocumentService
25
+ # Path helper methods for the DocumentService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified Dataset resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/processors/{processor}/dataset`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param processor [String]
37
+ #
38
+ # @return [::String]
39
+ def dataset_path project:, location:, processor:
40
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
41
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
42
+
43
+ "projects/#{project}/locations/#{location}/processors/#{processor}/dataset"
44
+ end
45
+
46
+ ##
47
+ # Create a fully-qualified DatasetSchema resource string.
48
+ #
49
+ # The resource will be in the following format:
50
+ #
51
+ # `projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema`
52
+ #
53
+ # @param project [String]
54
+ # @param location [String]
55
+ # @param processor [String]
56
+ #
57
+ # @return [::String]
58
+ def dataset_schema_path project:, location:, processor:
59
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
60
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
61
+
62
+ "projects/#{project}/locations/#{location}/processors/#{processor}/dataset/datasetSchema"
63
+ end
64
+
65
+ ##
66
+ # Create a fully-qualified Schema resource string.
67
+ #
68
+ # The resource will be in the following format:
69
+ #
70
+ # `projects/{project}/locations/{location}/schemas/{schema}`
71
+ #
72
+ # @param project [String]
73
+ # @param location [String]
74
+ # @param schema [String]
75
+ #
76
+ # @return [::String]
77
+ def schema_path project:, location:, schema:
78
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
79
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
80
+
81
+ "projects/#{project}/locations/#{location}/schemas/#{schema}"
82
+ end
83
+
84
+ extend self
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,530 @@
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/documentai/v1beta3/document_service_pb"
21
+ require "google/cloud/document_ai/v1beta3/document_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module DocumentAI
27
+ module V1beta3
28
+ module DocumentService
29
+ module Rest
30
+ ##
31
+ # REST client for the DocumentService service.
32
+ #
33
+ # Service to call Cloud DocumentAI to manage document collection (dataset).
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :document_service_stub
40
+
41
+ ##
42
+ # Configure the DocumentService Client class.
43
+ #
44
+ # See {::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all DocumentService clients
50
+ # ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "DocumentAI", "V1beta3"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config
71
+ end
72
+ yield @configure if block_given?
73
+ @configure
74
+ end
75
+
76
+ ##
77
+ # Configure the DocumentService Client instance.
78
+ #
79
+ # The configuration is set to the derived mode, meaning that values can be changed,
80
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
81
+ # should be made on {Client.configure}.
82
+ #
83
+ # See {::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Client::Configuration}
84
+ # for a description of the configuration fields.
85
+ #
86
+ # @yield [config] Configure the Client client.
87
+ # @yieldparam config [Client::Configuration]
88
+ #
89
+ # @return [Client::Configuration]
90
+ #
91
+ def configure
92
+ yield @config if block_given?
93
+ @config
94
+ end
95
+
96
+ ##
97
+ # Create a new DocumentService REST client object.
98
+ #
99
+ # @example
100
+ #
101
+ # # Create a client using the default configuration
102
+ # client = ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Client.new
103
+ #
104
+ # # Create a client using a custom configuration
105
+ # client = ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Client.new do |config|
106
+ # config.timeout = 10.0
107
+ # end
108
+ #
109
+ # @yield [config] Configure the DocumentService client.
110
+ # @yieldparam config [Client::Configuration]
111
+ #
112
+ def initialize
113
+ # Create the configuration object
114
+ @config = Configuration.new Client.configure
115
+
116
+ # Yield the configuration if needed
117
+ yield @config if block_given?
118
+
119
+ # Create credentials
120
+ credentials = @config.credentials
121
+ # Use self-signed JWT if the endpoint is unchanged from default,
122
+ # but only if the default endpoint does not have a region prefix.
123
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
124
+ !@config.endpoint.split(".").first.include?("-")
125
+ credentials ||= Credentials.default scope: @config.scope,
126
+ enable_self_signed_jwt: enable_self_signed_jwt
127
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
128
+ credentials = Credentials.new credentials, scope: @config.scope
129
+ end
130
+
131
+ @quota_project_id = @config.quota_project
132
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
133
+
134
+ @operations_client = ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Operations.new do |config|
135
+ config.credentials = credentials
136
+ config.quota_project = @quota_project_id
137
+ config.endpoint = @config.endpoint
138
+ end
139
+
140
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
141
+ config.credentials = credentials
142
+ config.quota_project = @quota_project_id
143
+ config.endpoint = @config.endpoint
144
+ config.bindings_override = @config.bindings_override
145
+ end
146
+
147
+ @document_service_stub = ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
148
+ end
149
+
150
+ ##
151
+ # Get the associated client for long-running operations.
152
+ #
153
+ # @return [::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Operations]
154
+ #
155
+ attr_reader :operations_client
156
+
157
+ ##
158
+ # Get the associated client for mix-in of the Locations.
159
+ #
160
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
161
+ #
162
+ attr_reader :location_client
163
+
164
+ # Service calls
165
+
166
+ ##
167
+ # Updates metadata associated with a dataset.
168
+ #
169
+ # @overload update_dataset(request, options = nil)
170
+ # Pass arguments to `update_dataset` via a request object, either of type
171
+ # {::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetRequest} or an equivalent Hash.
172
+ #
173
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetRequest, ::Hash]
174
+ # A request object representing the call parameters. Required. To specify no
175
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
176
+ # @param options [::Gapic::CallOptions, ::Hash]
177
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
178
+ #
179
+ # @overload update_dataset(dataset: nil, update_mask: nil)
180
+ # Pass arguments to `update_dataset` via keyword arguments. Note that at
181
+ # least one keyword argument is required. To specify no parameters, or to keep all
182
+ # the default parameter values, pass an empty Hash as a request object (see above).
183
+ #
184
+ # @param dataset [::Google::Cloud::DocumentAI::V1beta3::Dataset, ::Hash]
185
+ # Required. The `name` field of the `Dataset` is used to identify the
186
+ # resource to be updated.
187
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
188
+ # The update mask applies to the resource.
189
+ # @yield [result, operation] Access the result along with the TransportOperation object
190
+ # @yieldparam result [::Gapic::Operation]
191
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
192
+ #
193
+ # @return [::Gapic::Operation]
194
+ #
195
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
196
+ def update_dataset request, options = nil
197
+ raise ::ArgumentError, "request must be provided" if request.nil?
198
+
199
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetRequest
200
+
201
+ # Converts hash and nil to an options object
202
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
203
+
204
+ # Customize the options with defaults
205
+ call_metadata = @config.rpcs.update_dataset.metadata.to_h
206
+
207
+ # Set x-goog-api-client and x-goog-user-project headers
208
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
209
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
210
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION,
211
+ transports_version_send: [:rest]
212
+
213
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
214
+
215
+ options.apply_defaults timeout: @config.rpcs.update_dataset.timeout,
216
+ metadata: call_metadata,
217
+ retry_policy: @config.rpcs.update_dataset.retry_policy
218
+
219
+ options.apply_defaults timeout: @config.timeout,
220
+ metadata: @config.metadata,
221
+ retry_policy: @config.retry_policy
222
+
223
+ @document_service_stub.update_dataset request, options do |result, operation|
224
+ result = ::Gapic::Operation.new result, @operations_client, options: options
225
+ yield result, operation if block_given?
226
+ return result
227
+ end
228
+ rescue ::Gapic::Rest::Error => e
229
+ raise ::Google::Cloud::Error.from_error(e)
230
+ end
231
+
232
+ ##
233
+ # Gets the `DatasetSchema` of a `Dataset`.
234
+ #
235
+ # @overload get_dataset_schema(request, options = nil)
236
+ # Pass arguments to `get_dataset_schema` via a request object, either of type
237
+ # {::Google::Cloud::DocumentAI::V1beta3::GetDatasetSchemaRequest} or an equivalent Hash.
238
+ #
239
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::GetDatasetSchemaRequest, ::Hash]
240
+ # A request object representing the call parameters. Required. To specify no
241
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
242
+ # @param options [::Gapic::CallOptions, ::Hash]
243
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
244
+ #
245
+ # @overload get_dataset_schema(name: nil, visible_fields_only: nil)
246
+ # Pass arguments to `get_dataset_schema` via keyword arguments. Note that at
247
+ # least one keyword argument is required. To specify no parameters, or to keep all
248
+ # the default parameter values, pass an empty Hash as a request object (see above).
249
+ #
250
+ # @param name [::String]
251
+ # Required. The dataset schema resource name.
252
+ # Format:
253
+ # projects/\\{project}/locations/\\{location}/processors/\\{processor}/dataset/datasetSchema
254
+ # @param visible_fields_only [::Boolean]
255
+ # If set, only returns the visible fields of the schema.
256
+ # @yield [result, operation] Access the result along with the TransportOperation object
257
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema]
258
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
259
+ #
260
+ # @return [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema]
261
+ #
262
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
263
+ def get_dataset_schema request, options = nil
264
+ raise ::ArgumentError, "request must be provided" if request.nil?
265
+
266
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetDatasetSchemaRequest
267
+
268
+ # Converts hash and nil to an options object
269
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
270
+
271
+ # Customize the options with defaults
272
+ call_metadata = @config.rpcs.get_dataset_schema.metadata.to_h
273
+
274
+ # Set x-goog-api-client and x-goog-user-project headers
275
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
276
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
277
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION,
278
+ transports_version_send: [:rest]
279
+
280
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
281
+
282
+ options.apply_defaults timeout: @config.rpcs.get_dataset_schema.timeout,
283
+ metadata: call_metadata,
284
+ retry_policy: @config.rpcs.get_dataset_schema.retry_policy
285
+
286
+ options.apply_defaults timeout: @config.timeout,
287
+ metadata: @config.metadata,
288
+ retry_policy: @config.retry_policy
289
+
290
+ @document_service_stub.get_dataset_schema request, options do |result, operation|
291
+ yield result, operation if block_given?
292
+ return result
293
+ end
294
+ rescue ::Gapic::Rest::Error => e
295
+ raise ::Google::Cloud::Error.from_error(e)
296
+ end
297
+
298
+ ##
299
+ # Updates a `DatasetSchema`.
300
+ #
301
+ # @overload update_dataset_schema(request, options = nil)
302
+ # Pass arguments to `update_dataset_schema` via a request object, either of type
303
+ # {::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetSchemaRequest} or an equivalent Hash.
304
+ #
305
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetSchemaRequest, ::Hash]
306
+ # A request object representing the call parameters. Required. To specify no
307
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
308
+ # @param options [::Gapic::CallOptions, ::Hash]
309
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
310
+ #
311
+ # @overload update_dataset_schema(dataset_schema: nil, update_mask: nil)
312
+ # Pass arguments to `update_dataset_schema` via keyword arguments. Note that at
313
+ # least one keyword argument is required. To specify no parameters, or to keep all
314
+ # the default parameter values, pass an empty Hash as a request object (see above).
315
+ #
316
+ # @param dataset_schema [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema, ::Hash]
317
+ # Required. The name field of the `DatasetSchema` is used to identify the
318
+ # resource to be updated.
319
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
320
+ # The update mask applies to the resource.
321
+ # @yield [result, operation] Access the result along with the TransportOperation object
322
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema]
323
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
324
+ #
325
+ # @return [::Google::Cloud::DocumentAI::V1beta3::DatasetSchema]
326
+ #
327
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
328
+ def update_dataset_schema request, options = nil
329
+ raise ::ArgumentError, "request must be provided" if request.nil?
330
+
331
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::UpdateDatasetSchemaRequest
332
+
333
+ # Converts hash and nil to an options object
334
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
335
+
336
+ # Customize the options with defaults
337
+ call_metadata = @config.rpcs.update_dataset_schema.metadata.to_h
338
+
339
+ # Set x-goog-api-client and x-goog-user-project headers
340
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
341
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
342
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION,
343
+ transports_version_send: [:rest]
344
+
345
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
346
+
347
+ options.apply_defaults timeout: @config.rpcs.update_dataset_schema.timeout,
348
+ metadata: call_metadata,
349
+ retry_policy: @config.rpcs.update_dataset_schema.retry_policy
350
+
351
+ options.apply_defaults timeout: @config.timeout,
352
+ metadata: @config.metadata,
353
+ retry_policy: @config.retry_policy
354
+
355
+ @document_service_stub.update_dataset_schema request, options do |result, operation|
356
+ yield result, operation if block_given?
357
+ return result
358
+ end
359
+ rescue ::Gapic::Rest::Error => e
360
+ raise ::Google::Cloud::Error.from_error(e)
361
+ end
362
+
363
+ ##
364
+ # Configuration class for the DocumentService REST API.
365
+ #
366
+ # This class represents the configuration for DocumentService REST,
367
+ # providing control over timeouts, retry behavior, logging, transport
368
+ # parameters, and other low-level controls. Certain parameters can also be
369
+ # applied individually to specific RPCs. See
370
+ # {::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Client::Configuration::Rpcs}
371
+ # for a list of RPCs that can be configured independently.
372
+ #
373
+ # Configuration can be applied globally to all clients, or to a single client
374
+ # on construction.
375
+ #
376
+ # @example
377
+ #
378
+ # # Modify the global config, setting the timeout for
379
+ # # update_dataset to 20 seconds,
380
+ # # and all remaining timeouts to 10 seconds.
381
+ # ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Client.configure do |config|
382
+ # config.timeout = 10.0
383
+ # config.rpcs.update_dataset.timeout = 20.0
384
+ # end
385
+ #
386
+ # # Apply the above configuration only to a new client.
387
+ # client = ::Google::Cloud::DocumentAI::V1beta3::DocumentService::Rest::Client.new do |config|
388
+ # config.timeout = 10.0
389
+ # config.rpcs.update_dataset.timeout = 20.0
390
+ # end
391
+ #
392
+ # @!attribute [rw] endpoint
393
+ # The hostname or hostname:port of the service endpoint.
394
+ # Defaults to `"documentai.googleapis.com"`.
395
+ # @return [::String]
396
+ # @!attribute [rw] credentials
397
+ # Credentials to send with calls. You may provide any of the following types:
398
+ # * (`String`) The path to a service account key file in JSON format
399
+ # * (`Hash`) A service account key as a Hash
400
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
401
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
402
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
403
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
404
+ # * (`nil`) indicating no credentials
405
+ # @return [::Object]
406
+ # @!attribute [rw] scope
407
+ # The OAuth scopes
408
+ # @return [::Array<::String>]
409
+ # @!attribute [rw] lib_name
410
+ # The library name as recorded in instrumentation and logging
411
+ # @return [::String]
412
+ # @!attribute [rw] lib_version
413
+ # The library version as recorded in instrumentation and logging
414
+ # @return [::String]
415
+ # @!attribute [rw] timeout
416
+ # The call timeout in seconds.
417
+ # @return [::Numeric]
418
+ # @!attribute [rw] metadata
419
+ # Additional headers to be sent with the call.
420
+ # @return [::Hash{::Symbol=>::String}]
421
+ # @!attribute [rw] retry_policy
422
+ # The retry policy. The value is a hash with the following keys:
423
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
424
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
425
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
426
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
427
+ # trigger a retry.
428
+ # @return [::Hash]
429
+ # @!attribute [rw] quota_project
430
+ # A separate project against which to charge quota.
431
+ # @return [::String]
432
+ #
433
+ class Configuration
434
+ extend ::Gapic::Config
435
+
436
+ DEFAULT_ENDPOINT = "documentai.googleapis.com"
437
+
438
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
439
+ config_attr :credentials, nil do |value|
440
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
441
+ allowed.any? { |klass| klass === value }
442
+ end
443
+ config_attr :scope, nil, ::String, ::Array, nil
444
+ config_attr :lib_name, nil, ::String, nil
445
+ config_attr :lib_version, nil, ::String, nil
446
+ config_attr :timeout, nil, ::Numeric, nil
447
+ config_attr :metadata, nil, ::Hash, nil
448
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
449
+ config_attr :quota_project, nil, ::String, nil
450
+
451
+ # @private
452
+ # Overrides for http bindings for the RPCs of this service
453
+ # are only used when this service is used as mixin, and only
454
+ # by the host service.
455
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
456
+ config_attr :bindings_override, {}, ::Hash, nil
457
+
458
+ # @private
459
+ def initialize parent_config = nil
460
+ @parent_config = parent_config unless parent_config.nil?
461
+
462
+ yield self if block_given?
463
+ end
464
+
465
+ ##
466
+ # Configurations for individual RPCs
467
+ # @return [Rpcs]
468
+ #
469
+ def rpcs
470
+ @rpcs ||= begin
471
+ parent_rpcs = nil
472
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
473
+ Rpcs.new parent_rpcs
474
+ end
475
+ end
476
+
477
+ ##
478
+ # Configuration RPC class for the DocumentService API.
479
+ #
480
+ # Includes fields providing the configuration for each RPC in this service.
481
+ # Each configuration object is of type `Gapic::Config::Method` and includes
482
+ # the following configuration fields:
483
+ #
484
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
485
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
486
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
487
+ # include the following keys:
488
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
489
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
490
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
491
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
492
+ # trigger a retry.
493
+ #
494
+ class Rpcs
495
+ ##
496
+ # RPC-specific configuration for `update_dataset`
497
+ # @return [::Gapic::Config::Method]
498
+ #
499
+ attr_reader :update_dataset
500
+ ##
501
+ # RPC-specific configuration for `get_dataset_schema`
502
+ # @return [::Gapic::Config::Method]
503
+ #
504
+ attr_reader :get_dataset_schema
505
+ ##
506
+ # RPC-specific configuration for `update_dataset_schema`
507
+ # @return [::Gapic::Config::Method]
508
+ #
509
+ attr_reader :update_dataset_schema
510
+
511
+ # @private
512
+ def initialize parent_rpcs = nil
513
+ update_dataset_config = parent_rpcs.update_dataset if parent_rpcs.respond_to? :update_dataset
514
+ @update_dataset = ::Gapic::Config::Method.new update_dataset_config
515
+ get_dataset_schema_config = parent_rpcs.get_dataset_schema if parent_rpcs.respond_to? :get_dataset_schema
516
+ @get_dataset_schema = ::Gapic::Config::Method.new get_dataset_schema_config
517
+ update_dataset_schema_config = parent_rpcs.update_dataset_schema if parent_rpcs.respond_to? :update_dataset_schema
518
+ @update_dataset_schema = ::Gapic::Config::Method.new update_dataset_schema_config
519
+
520
+ yield self if block_given?
521
+ end
522
+ end
523
+ end
524
+ end
525
+ end
526
+ end
527
+ end
528
+ end
529
+ end
530
+ end