google-cloud-document_ai-v1 0.10.0 → 0.12.0

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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/google/cloud/document_ai/v1/bindings_override.rb +118 -0
  4. data/lib/google/cloud/document_ai/v1/document_processor_service/client.rb +6 -4
  5. data/lib/google/cloud/document_ai/v1/document_processor_service/operations.rb +5 -3
  6. data/lib/google/cloud/document_ai/v1/document_processor_service/rest/client.rb +1986 -0
  7. data/lib/google/cloud/document_ai/v1/document_processor_service/rest/operations.rb +822 -0
  8. data/lib/google/cloud/document_ai/v1/document_processor_service/rest/service_stub.rb +1373 -0
  9. data/lib/google/cloud/document_ai/v1/document_processor_service/rest.rb +57 -0
  10. data/lib/google/cloud/document_ai/v1/document_processor_service.rb +6 -0
  11. data/lib/google/cloud/document_ai/v1/rest.rb +38 -0
  12. data/lib/google/cloud/document_ai/v1/version.rb +1 -1
  13. data/lib/google/cloud/document_ai/v1.rb +5 -0
  14. data/lib/google/cloud/documentai/v1/barcode_pb.rb +24 -6
  15. data/lib/google/cloud/documentai/v1/document_io_pb.rb +25 -35
  16. data/lib/google/cloud/documentai/v1/document_pb.rb +33 -265
  17. data/lib/google/cloud/documentai/v1/document_processor_service_pb.rb +34 -229
  18. data/lib/google/cloud/documentai/v1/document_schema_pb.rb +24 -37
  19. data/lib/google/cloud/documentai/v1/evaluation_pb.rb +25 -52
  20. data/lib/google/cloud/documentai/v1/geometry_pb.rb +24 -13
  21. data/lib/google/cloud/documentai/v1/operation_metadata_pb.rb +25 -16
  22. data/lib/google/cloud/documentai/v1/processor_pb.rb +27 -47
  23. data/lib/google/cloud/documentai/v1/processor_type_pb.rb +24 -13
  24. data/proto_docs/google/api/client.rb +67 -4
  25. data/proto_docs/google/protobuf/any.rb +7 -4
  26. data/proto_docs/google/protobuf/timestamp.rb +1 -3
  27. metadata +13 -5
@@ -0,0 +1,1986 @@
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/v1/document_processor_service_pb"
21
+ require "google/cloud/document_ai/v1/document_processor_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module DocumentAI
27
+ module V1
28
+ module DocumentProcessorService
29
+ module Rest
30
+ ##
31
+ # REST client for the DocumentProcessorService service.
32
+ #
33
+ # Service to call Cloud DocumentAI to process documents according to the
34
+ # processor's definition. Processors are built using state-of-the-art Google
35
+ # AI such as natural language, computer vision, and translation to extract
36
+ # structured information from unstructured or semi-structured documents.
37
+ #
38
+ class Client
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :document_processor_service_stub
43
+
44
+ ##
45
+ # Configure the DocumentProcessorService Client class.
46
+ #
47
+ # See {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all DocumentProcessorService clients
53
+ # ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Cloud", "DocumentAI", "V1"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config.rpcs.process_document.timeout = 120.0
74
+ default_config.rpcs.process_document.retry_policy = {
75
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
76
+ }
77
+
78
+ default_config.rpcs.batch_process_documents.timeout = 120.0
79
+ default_config.rpcs.batch_process_documents.retry_policy = {
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
81
+ }
82
+
83
+ default_config.rpcs.review_document.timeout = 120.0
84
+ default_config.rpcs.review_document.retry_policy = {
85
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
86
+ }
87
+
88
+ default_config
89
+ end
90
+ yield @configure if block_given?
91
+ @configure
92
+ end
93
+
94
+ ##
95
+ # Configure the DocumentProcessorService Client instance.
96
+ #
97
+ # The configuration is set to the derived mode, meaning that values can be changed,
98
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
99
+ # should be made on {Client.configure}.
100
+ #
101
+ # See {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client::Configuration}
102
+ # for a description of the configuration fields.
103
+ #
104
+ # @yield [config] Configure the Client client.
105
+ # @yieldparam config [Client::Configuration]
106
+ #
107
+ # @return [Client::Configuration]
108
+ #
109
+ def configure
110
+ yield @config if block_given?
111
+ @config
112
+ end
113
+
114
+ ##
115
+ # Create a new DocumentProcessorService REST client object.
116
+ #
117
+ # @example
118
+ #
119
+ # # Create a client using the default configuration
120
+ # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client.new
121
+ #
122
+ # # Create a client using a custom configuration
123
+ # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client.new do |config|
124
+ # config.timeout = 10.0
125
+ # end
126
+ #
127
+ # @yield [config] Configure the DocumentProcessorService client.
128
+ # @yieldparam config [Client::Configuration]
129
+ #
130
+ def initialize
131
+ # Create the configuration object
132
+ @config = Configuration.new Client.configure
133
+
134
+ # Yield the configuration if needed
135
+ yield @config if block_given?
136
+
137
+ # Create credentials
138
+ credentials = @config.credentials
139
+ # Use self-signed JWT if the endpoint is unchanged from default,
140
+ # but only if the default endpoint does not have a region prefix.
141
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-")
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+
149
+ @quota_project_id = @config.quota_project
150
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
151
+
152
+ @operations_client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Operations.new do |config|
153
+ config.credentials = credentials
154
+ config.quota_project = @quota_project_id
155
+ config.endpoint = @config.endpoint
156
+ end
157
+
158
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
159
+ config.credentials = credentials
160
+ config.quota_project = @quota_project_id
161
+ config.endpoint = @config.endpoint
162
+ config.bindings_override = @config.bindings_override
163
+ end
164
+
165
+ @document_processor_service_stub = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
166
+ end
167
+
168
+ ##
169
+ # Get the associated client for long-running operations.
170
+ #
171
+ # @return [::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Operations]
172
+ #
173
+ attr_reader :operations_client
174
+
175
+ ##
176
+ # Get the associated client for mix-in of the Locations.
177
+ #
178
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
179
+ #
180
+ attr_reader :location_client
181
+
182
+ # Service calls
183
+
184
+ ##
185
+ # Processes a single document.
186
+ #
187
+ # @overload process_document(request, options = nil)
188
+ # Pass arguments to `process_document` via a request object, either of type
189
+ # {::Google::Cloud::DocumentAI::V1::ProcessRequest} or an equivalent Hash.
190
+ #
191
+ # @param request [::Google::Cloud::DocumentAI::V1::ProcessRequest, ::Hash]
192
+ # A request object representing the call parameters. Required. To specify no
193
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
194
+ # @param options [::Gapic::CallOptions, ::Hash]
195
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
196
+ #
197
+ # @overload process_document(inline_document: nil, raw_document: nil, name: nil, skip_human_review: nil, field_mask: nil)
198
+ # Pass arguments to `process_document` via keyword arguments. Note that at
199
+ # least one keyword argument is required. To specify no parameters, or to keep all
200
+ # the default parameter values, pass an empty Hash as a request object (see above).
201
+ #
202
+ # @param inline_document [::Google::Cloud::DocumentAI::V1::Document, ::Hash]
203
+ # An inline document proto.
204
+ # @param raw_document [::Google::Cloud::DocumentAI::V1::RawDocument, ::Hash]
205
+ # A raw document content (bytes).
206
+ # @param name [::String]
207
+ # Required. The resource name of the
208
+ # {::Google::Cloud::DocumentAI::V1::Processor Processor} or
209
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion}
210
+ # to use for processing. If a
211
+ # {::Google::Cloud::DocumentAI::V1::Processor Processor} is specified, the server
212
+ # will use its [default
213
+ # version][google.cloud.documentai.v1.Processor.default_processor_version].
214
+ # Format: `projects/{project}/locations/{location}/processors/{processor}`,
215
+ # or
216
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
217
+ # @param skip_human_review [::Boolean]
218
+ # Whether Human Review feature should be skipped for this request. Default to
219
+ # false.
220
+ # @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
221
+ # Specifies which fields to include in ProcessResponse's document.
222
+ # Only supports top level document and pages field so it must be in the form
223
+ # of `{document_field_name}` or `pages.{page_field_name}`.
224
+ # @yield [result, operation] Access the result along with the TransportOperation object
225
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1::ProcessResponse]
226
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
227
+ #
228
+ # @return [::Google::Cloud::DocumentAI::V1::ProcessResponse]
229
+ #
230
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
231
+ def process_document request, options = nil
232
+ raise ::ArgumentError, "request must be provided" if request.nil?
233
+
234
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ProcessRequest
235
+
236
+ # Converts hash and nil to an options object
237
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
238
+
239
+ # Customize the options with defaults
240
+ call_metadata = @config.rpcs.process_document.metadata.to_h
241
+
242
+ # Set x-goog-api-client and x-goog-user-project headers
243
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
244
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
245
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
246
+ transports_version_send: [:rest]
247
+
248
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
249
+
250
+ options.apply_defaults timeout: @config.rpcs.process_document.timeout,
251
+ metadata: call_metadata,
252
+ retry_policy: @config.rpcs.process_document.retry_policy
253
+
254
+ options.apply_defaults timeout: @config.timeout,
255
+ metadata: @config.metadata,
256
+ retry_policy: @config.retry_policy
257
+
258
+ @document_processor_service_stub.process_document request, options do |result, operation|
259
+ yield result, operation if block_given?
260
+ return result
261
+ end
262
+ rescue ::Gapic::Rest::Error => e
263
+ raise ::Google::Cloud::Error.from_error(e)
264
+ end
265
+
266
+ ##
267
+ # LRO endpoint to batch process many documents. The output is written
268
+ # to Cloud Storage as JSON in the [Document] format.
269
+ #
270
+ # @overload batch_process_documents(request, options = nil)
271
+ # Pass arguments to `batch_process_documents` via a request object, either of type
272
+ # {::Google::Cloud::DocumentAI::V1::BatchProcessRequest} or an equivalent Hash.
273
+ #
274
+ # @param request [::Google::Cloud::DocumentAI::V1::BatchProcessRequest, ::Hash]
275
+ # A request object representing the call parameters. Required. To specify no
276
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
277
+ # @param options [::Gapic::CallOptions, ::Hash]
278
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
279
+ #
280
+ # @overload batch_process_documents(name: nil, input_documents: nil, document_output_config: nil, skip_human_review: nil)
281
+ # Pass arguments to `batch_process_documents` via keyword arguments. Note that at
282
+ # least one keyword argument is required. To specify no parameters, or to keep all
283
+ # the default parameter values, pass an empty Hash as a request object (see above).
284
+ #
285
+ # @param name [::String]
286
+ # Required. The resource name of
287
+ # {::Google::Cloud::DocumentAI::V1::Processor Processor} or
288
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion}.
289
+ # Format: `projects/{project}/locations/{location}/processors/{processor}`,
290
+ # or
291
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
292
+ # @param input_documents [::Google::Cloud::DocumentAI::V1::BatchDocumentsInputConfig, ::Hash]
293
+ # The input documents for batch process.
294
+ # @param document_output_config [::Google::Cloud::DocumentAI::V1::DocumentOutputConfig, ::Hash]
295
+ # The overall output config for batch process.
296
+ # @param skip_human_review [::Boolean]
297
+ # Whether Human Review feature should be skipped for this request. Default to
298
+ # false.
299
+ # @yield [result, operation] Access the result along with the TransportOperation object
300
+ # @yieldparam result [::Gapic::Operation]
301
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
302
+ #
303
+ # @return [::Gapic::Operation]
304
+ #
305
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
306
+ def batch_process_documents request, options = nil
307
+ raise ::ArgumentError, "request must be provided" if request.nil?
308
+
309
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::BatchProcessRequest
310
+
311
+ # Converts hash and nil to an options object
312
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
313
+
314
+ # Customize the options with defaults
315
+ call_metadata = @config.rpcs.batch_process_documents.metadata.to_h
316
+
317
+ # Set x-goog-api-client and x-goog-user-project headers
318
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
319
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
320
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
321
+ transports_version_send: [:rest]
322
+
323
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
324
+
325
+ options.apply_defaults timeout: @config.rpcs.batch_process_documents.timeout,
326
+ metadata: call_metadata,
327
+ retry_policy: @config.rpcs.batch_process_documents.retry_policy
328
+
329
+ options.apply_defaults timeout: @config.timeout,
330
+ metadata: @config.metadata,
331
+ retry_policy: @config.retry_policy
332
+
333
+ @document_processor_service_stub.batch_process_documents request, options do |result, operation|
334
+ result = ::Gapic::Operation.new result, @operations_client, options: options
335
+ yield result, operation if block_given?
336
+ return result
337
+ end
338
+ rescue ::Gapic::Rest::Error => e
339
+ raise ::Google::Cloud::Error.from_error(e)
340
+ end
341
+
342
+ ##
343
+ # Fetches processor types. Note that we do not use ListProcessorTypes here
344
+ # because it is not paginated.
345
+ #
346
+ # @overload fetch_processor_types(request, options = nil)
347
+ # Pass arguments to `fetch_processor_types` via a request object, either of type
348
+ # {::Google::Cloud::DocumentAI::V1::FetchProcessorTypesRequest} or an equivalent Hash.
349
+ #
350
+ # @param request [::Google::Cloud::DocumentAI::V1::FetchProcessorTypesRequest, ::Hash]
351
+ # A request object representing the call parameters. Required. To specify no
352
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
353
+ # @param options [::Gapic::CallOptions, ::Hash]
354
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
355
+ #
356
+ # @overload fetch_processor_types(parent: nil)
357
+ # Pass arguments to `fetch_processor_types` via keyword arguments. Note that at
358
+ # least one keyword argument is required. To specify no parameters, or to keep all
359
+ # the default parameter values, pass an empty Hash as a request object (see above).
360
+ #
361
+ # @param parent [::String]
362
+ # Required. The project of processor type to list.
363
+ # The available processor types may depend on the allow-listing on projects.
364
+ # Format: `projects/{project}/locations/{location}`
365
+ # @yield [result, operation] Access the result along with the TransportOperation object
366
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1::FetchProcessorTypesResponse]
367
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
368
+ #
369
+ # @return [::Google::Cloud::DocumentAI::V1::FetchProcessorTypesResponse]
370
+ #
371
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
372
+ def fetch_processor_types request, options = nil
373
+ raise ::ArgumentError, "request must be provided" if request.nil?
374
+
375
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::FetchProcessorTypesRequest
376
+
377
+ # Converts hash and nil to an options object
378
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
379
+
380
+ # Customize the options with defaults
381
+ call_metadata = @config.rpcs.fetch_processor_types.metadata.to_h
382
+
383
+ # Set x-goog-api-client and x-goog-user-project headers
384
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
385
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
386
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
387
+ transports_version_send: [:rest]
388
+
389
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
390
+
391
+ options.apply_defaults timeout: @config.rpcs.fetch_processor_types.timeout,
392
+ metadata: call_metadata,
393
+ retry_policy: @config.rpcs.fetch_processor_types.retry_policy
394
+
395
+ options.apply_defaults timeout: @config.timeout,
396
+ metadata: @config.metadata,
397
+ retry_policy: @config.retry_policy
398
+
399
+ @document_processor_service_stub.fetch_processor_types request, options do |result, operation|
400
+ yield result, operation if block_given?
401
+ return result
402
+ end
403
+ rescue ::Gapic::Rest::Error => e
404
+ raise ::Google::Cloud::Error.from_error(e)
405
+ end
406
+
407
+ ##
408
+ # Lists the processor types that exist.
409
+ #
410
+ # @overload list_processor_types(request, options = nil)
411
+ # Pass arguments to `list_processor_types` via a request object, either of type
412
+ # {::Google::Cloud::DocumentAI::V1::ListProcessorTypesRequest} or an equivalent Hash.
413
+ #
414
+ # @param request [::Google::Cloud::DocumentAI::V1::ListProcessorTypesRequest, ::Hash]
415
+ # A request object representing the call parameters. Required. To specify no
416
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
417
+ # @param options [::Gapic::CallOptions, ::Hash]
418
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
419
+ #
420
+ # @overload list_processor_types(parent: nil, page_size: nil, page_token: nil)
421
+ # Pass arguments to `list_processor_types` via keyword arguments. Note that at
422
+ # least one keyword argument is required. To specify no parameters, or to keep all
423
+ # the default parameter values, pass an empty Hash as a request object (see above).
424
+ #
425
+ # @param parent [::String]
426
+ # Required. The location of processor type to list.
427
+ # The available processor types may depend on the allow-listing on projects.
428
+ # Format: `projects/{project}/locations/{location}`
429
+ # @param page_size [::Integer]
430
+ # The maximum number of processor types to return.
431
+ # If unspecified, at most 100 processor types will be returned.
432
+ # The maximum value is 500; values above 500 will be coerced to 500.
433
+ # @param page_token [::String]
434
+ # Used to retrieve the next page of results, empty if at the end of the list.
435
+ # @yield [result, operation] Access the result along with the TransportOperation object
436
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1::ProcessorType>]
437
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
438
+ #
439
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1::ProcessorType>]
440
+ #
441
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
442
+ def list_processor_types request, options = nil
443
+ raise ::ArgumentError, "request must be provided" if request.nil?
444
+
445
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ListProcessorTypesRequest
446
+
447
+ # Converts hash and nil to an options object
448
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
449
+
450
+ # Customize the options with defaults
451
+ call_metadata = @config.rpcs.list_processor_types.metadata.to_h
452
+
453
+ # Set x-goog-api-client and x-goog-user-project headers
454
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
455
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
456
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
457
+ transports_version_send: [:rest]
458
+
459
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
460
+
461
+ options.apply_defaults timeout: @config.rpcs.list_processor_types.timeout,
462
+ metadata: call_metadata,
463
+ retry_policy: @config.rpcs.list_processor_types.retry_policy
464
+
465
+ options.apply_defaults timeout: @config.timeout,
466
+ metadata: @config.metadata,
467
+ retry_policy: @config.retry_policy
468
+
469
+ @document_processor_service_stub.list_processor_types request, options do |result, operation|
470
+ result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processor_types, "processor_types", request, result, options
471
+ yield result, operation if block_given?
472
+ return result
473
+ end
474
+ rescue ::Gapic::Rest::Error => e
475
+ raise ::Google::Cloud::Error.from_error(e)
476
+ end
477
+
478
+ ##
479
+ # Gets a processor type detail.
480
+ #
481
+ # @overload get_processor_type(request, options = nil)
482
+ # Pass arguments to `get_processor_type` via a request object, either of type
483
+ # {::Google::Cloud::DocumentAI::V1::GetProcessorTypeRequest} or an equivalent Hash.
484
+ #
485
+ # @param request [::Google::Cloud::DocumentAI::V1::GetProcessorTypeRequest, ::Hash]
486
+ # A request object representing the call parameters. Required. To specify no
487
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
488
+ # @param options [::Gapic::CallOptions, ::Hash]
489
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
490
+ #
491
+ # @overload get_processor_type(name: nil)
492
+ # Pass arguments to `get_processor_type` via keyword arguments. Note that at
493
+ # least one keyword argument is required. To specify no parameters, or to keep all
494
+ # the default parameter values, pass an empty Hash as a request object (see above).
495
+ #
496
+ # @param name [::String]
497
+ # Required. The processor type resource name.
498
+ # @yield [result, operation] Access the result along with the TransportOperation object
499
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1::ProcessorType]
500
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
501
+ #
502
+ # @return [::Google::Cloud::DocumentAI::V1::ProcessorType]
503
+ #
504
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
505
+ def get_processor_type request, options = nil
506
+ raise ::ArgumentError, "request must be provided" if request.nil?
507
+
508
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::GetProcessorTypeRequest
509
+
510
+ # Converts hash and nil to an options object
511
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
512
+
513
+ # Customize the options with defaults
514
+ call_metadata = @config.rpcs.get_processor_type.metadata.to_h
515
+
516
+ # Set x-goog-api-client and x-goog-user-project headers
517
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
518
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
519
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
520
+ transports_version_send: [:rest]
521
+
522
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
523
+
524
+ options.apply_defaults timeout: @config.rpcs.get_processor_type.timeout,
525
+ metadata: call_metadata,
526
+ retry_policy: @config.rpcs.get_processor_type.retry_policy
527
+
528
+ options.apply_defaults timeout: @config.timeout,
529
+ metadata: @config.metadata,
530
+ retry_policy: @config.retry_policy
531
+
532
+ @document_processor_service_stub.get_processor_type request, options do |result, operation|
533
+ yield result, operation if block_given?
534
+ return result
535
+ end
536
+ rescue ::Gapic::Rest::Error => e
537
+ raise ::Google::Cloud::Error.from_error(e)
538
+ end
539
+
540
+ ##
541
+ # Lists all processors which belong to this project.
542
+ #
543
+ # @overload list_processors(request, options = nil)
544
+ # Pass arguments to `list_processors` via a request object, either of type
545
+ # {::Google::Cloud::DocumentAI::V1::ListProcessorsRequest} or an equivalent Hash.
546
+ #
547
+ # @param request [::Google::Cloud::DocumentAI::V1::ListProcessorsRequest, ::Hash]
548
+ # A request object representing the call parameters. Required. To specify no
549
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
550
+ # @param options [::Gapic::CallOptions, ::Hash]
551
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
552
+ #
553
+ # @overload list_processors(parent: nil, page_size: nil, page_token: nil)
554
+ # Pass arguments to `list_processors` via keyword arguments. Note that at
555
+ # least one keyword argument is required. To specify no parameters, or to keep all
556
+ # the default parameter values, pass an empty Hash as a request object (see above).
557
+ #
558
+ # @param parent [::String]
559
+ # Required. The parent (project and location) which owns this collection of
560
+ # Processors. Format: `projects/{project}/locations/{location}`
561
+ # @param page_size [::Integer]
562
+ # The maximum number of processors to return.
563
+ # If unspecified, at most 50 processors will be returned.
564
+ # The maximum value is 100; values above 100 will be coerced to 100.
565
+ # @param page_token [::String]
566
+ # We will return the processors sorted by creation time. The page token
567
+ # will point to the next processor.
568
+ # @yield [result, operation] Access the result along with the TransportOperation object
569
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1::Processor>]
570
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
571
+ #
572
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1::Processor>]
573
+ #
574
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
575
+ def list_processors request, options = nil
576
+ raise ::ArgumentError, "request must be provided" if request.nil?
577
+
578
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ListProcessorsRequest
579
+
580
+ # Converts hash and nil to an options object
581
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
582
+
583
+ # Customize the options with defaults
584
+ call_metadata = @config.rpcs.list_processors.metadata.to_h
585
+
586
+ # Set x-goog-api-client and x-goog-user-project headers
587
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
588
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
589
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
590
+ transports_version_send: [:rest]
591
+
592
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
593
+
594
+ options.apply_defaults timeout: @config.rpcs.list_processors.timeout,
595
+ metadata: call_metadata,
596
+ retry_policy: @config.rpcs.list_processors.retry_policy
597
+
598
+ options.apply_defaults timeout: @config.timeout,
599
+ metadata: @config.metadata,
600
+ retry_policy: @config.retry_policy
601
+
602
+ @document_processor_service_stub.list_processors request, options do |result, operation|
603
+ result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processors, "processors", request, result, options
604
+ yield result, operation if block_given?
605
+ return result
606
+ end
607
+ rescue ::Gapic::Rest::Error => e
608
+ raise ::Google::Cloud::Error.from_error(e)
609
+ end
610
+
611
+ ##
612
+ # Gets a processor detail.
613
+ #
614
+ # @overload get_processor(request, options = nil)
615
+ # Pass arguments to `get_processor` via a request object, either of type
616
+ # {::Google::Cloud::DocumentAI::V1::GetProcessorRequest} or an equivalent Hash.
617
+ #
618
+ # @param request [::Google::Cloud::DocumentAI::V1::GetProcessorRequest, ::Hash]
619
+ # A request object representing the call parameters. Required. To specify no
620
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
621
+ # @param options [::Gapic::CallOptions, ::Hash]
622
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
623
+ #
624
+ # @overload get_processor(name: nil)
625
+ # Pass arguments to `get_processor` via keyword arguments. Note that at
626
+ # least one keyword argument is required. To specify no parameters, or to keep all
627
+ # the default parameter values, pass an empty Hash as a request object (see above).
628
+ #
629
+ # @param name [::String]
630
+ # Required. The processor resource name.
631
+ # @yield [result, operation] Access the result along with the TransportOperation object
632
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1::Processor]
633
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
634
+ #
635
+ # @return [::Google::Cloud::DocumentAI::V1::Processor]
636
+ #
637
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
638
+ def get_processor request, options = nil
639
+ raise ::ArgumentError, "request must be provided" if request.nil?
640
+
641
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::GetProcessorRequest
642
+
643
+ # Converts hash and nil to an options object
644
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
645
+
646
+ # Customize the options with defaults
647
+ call_metadata = @config.rpcs.get_processor.metadata.to_h
648
+
649
+ # Set x-goog-api-client and x-goog-user-project headers
650
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
651
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
652
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
653
+ transports_version_send: [:rest]
654
+
655
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
656
+
657
+ options.apply_defaults timeout: @config.rpcs.get_processor.timeout,
658
+ metadata: call_metadata,
659
+ retry_policy: @config.rpcs.get_processor.retry_policy
660
+
661
+ options.apply_defaults timeout: @config.timeout,
662
+ metadata: @config.metadata,
663
+ retry_policy: @config.retry_policy
664
+
665
+ @document_processor_service_stub.get_processor request, options do |result, operation|
666
+ yield result, operation if block_given?
667
+ return result
668
+ end
669
+ rescue ::Gapic::Rest::Error => e
670
+ raise ::Google::Cloud::Error.from_error(e)
671
+ end
672
+
673
+ ##
674
+ # Trains a new processor version.
675
+ # Operation metadata is returned as
676
+ # cloud_documentai_core.TrainProcessorVersionMetadata.
677
+ #
678
+ # @overload train_processor_version(request, options = nil)
679
+ # Pass arguments to `train_processor_version` via a request object, either of type
680
+ # {::Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest} or an equivalent Hash.
681
+ #
682
+ # @param request [::Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest, ::Hash]
683
+ # A request object representing the call parameters. Required. To specify no
684
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
685
+ # @param options [::Gapic::CallOptions, ::Hash]
686
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
687
+ #
688
+ # @overload train_processor_version(parent: nil, processor_version: nil, document_schema: nil, input_data: nil, base_processor_version: nil)
689
+ # Pass arguments to `train_processor_version` via keyword arguments. Note that at
690
+ # least one keyword argument is required. To specify no parameters, or to keep all
691
+ # the default parameter values, pass an empty Hash as a request object (see above).
692
+ #
693
+ # @param parent [::String]
694
+ # Required. The parent (project, location and processor) to create the new
695
+ # version for. Format:
696
+ # `projects/{project}/locations/{location}/processors/{processor}`.
697
+ # @param processor_version [::Google::Cloud::DocumentAI::V1::ProcessorVersion, ::Hash]
698
+ # Required. The processor version to be created.
699
+ # @param document_schema [::Google::Cloud::DocumentAI::V1::DocumentSchema, ::Hash]
700
+ # Optional. The schema the processor version will be trained with.
701
+ # @param input_data [::Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest::InputData, ::Hash]
702
+ # Optional. The input data used to train the `ProcessorVersion`.
703
+ # @param base_processor_version [::String]
704
+ # Optional. The processor version to use as a base for training. This
705
+ # processor version must be a child of `parent`. Format:
706
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
707
+ # @yield [result, operation] Access the result along with the TransportOperation object
708
+ # @yieldparam result [::Gapic::Operation]
709
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
710
+ #
711
+ # @return [::Gapic::Operation]
712
+ #
713
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
714
+ def train_processor_version request, options = nil
715
+ raise ::ArgumentError, "request must be provided" if request.nil?
716
+
717
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest
718
+
719
+ # Converts hash and nil to an options object
720
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
721
+
722
+ # Customize the options with defaults
723
+ call_metadata = @config.rpcs.train_processor_version.metadata.to_h
724
+
725
+ # Set x-goog-api-client and x-goog-user-project headers
726
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
727
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
728
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
729
+ transports_version_send: [:rest]
730
+
731
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
732
+
733
+ options.apply_defaults timeout: @config.rpcs.train_processor_version.timeout,
734
+ metadata: call_metadata,
735
+ retry_policy: @config.rpcs.train_processor_version.retry_policy
736
+
737
+ options.apply_defaults timeout: @config.timeout,
738
+ metadata: @config.metadata,
739
+ retry_policy: @config.retry_policy
740
+
741
+ @document_processor_service_stub.train_processor_version request, options do |result, operation|
742
+ result = ::Gapic::Operation.new result, @operations_client, options: options
743
+ yield result, operation if block_given?
744
+ return result
745
+ end
746
+ rescue ::Gapic::Rest::Error => e
747
+ raise ::Google::Cloud::Error.from_error(e)
748
+ end
749
+
750
+ ##
751
+ # Gets a processor version detail.
752
+ #
753
+ # @overload get_processor_version(request, options = nil)
754
+ # Pass arguments to `get_processor_version` via a request object, either of type
755
+ # {::Google::Cloud::DocumentAI::V1::GetProcessorVersionRequest} or an equivalent Hash.
756
+ #
757
+ # @param request [::Google::Cloud::DocumentAI::V1::GetProcessorVersionRequest, ::Hash]
758
+ # A request object representing the call parameters. Required. To specify no
759
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
760
+ # @param options [::Gapic::CallOptions, ::Hash]
761
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
762
+ #
763
+ # @overload get_processor_version(name: nil)
764
+ # Pass arguments to `get_processor_version` via keyword arguments. Note that at
765
+ # least one keyword argument is required. To specify no parameters, or to keep all
766
+ # the default parameter values, pass an empty Hash as a request object (see above).
767
+ #
768
+ # @param name [::String]
769
+ # Required. The processor resource name.
770
+ # @yield [result, operation] Access the result along with the TransportOperation object
771
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1::ProcessorVersion]
772
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
773
+ #
774
+ # @return [::Google::Cloud::DocumentAI::V1::ProcessorVersion]
775
+ #
776
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
777
+ def get_processor_version request, options = nil
778
+ raise ::ArgumentError, "request must be provided" if request.nil?
779
+
780
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::GetProcessorVersionRequest
781
+
782
+ # Converts hash and nil to an options object
783
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
784
+
785
+ # Customize the options with defaults
786
+ call_metadata = @config.rpcs.get_processor_version.metadata.to_h
787
+
788
+ # Set x-goog-api-client and x-goog-user-project headers
789
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
790
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
791
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
792
+ transports_version_send: [:rest]
793
+
794
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
795
+
796
+ options.apply_defaults timeout: @config.rpcs.get_processor_version.timeout,
797
+ metadata: call_metadata,
798
+ retry_policy: @config.rpcs.get_processor_version.retry_policy
799
+
800
+ options.apply_defaults timeout: @config.timeout,
801
+ metadata: @config.metadata,
802
+ retry_policy: @config.retry_policy
803
+
804
+ @document_processor_service_stub.get_processor_version request, options do |result, operation|
805
+ yield result, operation if block_given?
806
+ return result
807
+ end
808
+ rescue ::Gapic::Rest::Error => e
809
+ raise ::Google::Cloud::Error.from_error(e)
810
+ end
811
+
812
+ ##
813
+ # Lists all versions of a processor.
814
+ #
815
+ # @overload list_processor_versions(request, options = nil)
816
+ # Pass arguments to `list_processor_versions` via a request object, either of type
817
+ # {::Google::Cloud::DocumentAI::V1::ListProcessorVersionsRequest} or an equivalent Hash.
818
+ #
819
+ # @param request [::Google::Cloud::DocumentAI::V1::ListProcessorVersionsRequest, ::Hash]
820
+ # A request object representing the call parameters. Required. To specify no
821
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
822
+ # @param options [::Gapic::CallOptions, ::Hash]
823
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
824
+ #
825
+ # @overload list_processor_versions(parent: nil, page_size: nil, page_token: nil)
826
+ # Pass arguments to `list_processor_versions` via keyword arguments. Note that at
827
+ # least one keyword argument is required. To specify no parameters, or to keep all
828
+ # the default parameter values, pass an empty Hash as a request object (see above).
829
+ #
830
+ # @param parent [::String]
831
+ # Required. The parent (project, location and processor) to list all
832
+ # versions. Format:
833
+ # `projects/{project}/locations/{location}/processors/{processor}`
834
+ # @param page_size [::Integer]
835
+ # The maximum number of processor versions to return.
836
+ # If unspecified, at most 10 processor versions will be returned.
837
+ # The maximum value is 20; values above 20 will be coerced to 20.
838
+ # @param page_token [::String]
839
+ # We will return the processor versions sorted by creation time. The page
840
+ # token will point to the next processor version.
841
+ # @yield [result, operation] Access the result along with the TransportOperation object
842
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1::ProcessorVersion>]
843
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
844
+ #
845
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1::ProcessorVersion>]
846
+ #
847
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
848
+ def list_processor_versions request, options = nil
849
+ raise ::ArgumentError, "request must be provided" if request.nil?
850
+
851
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ListProcessorVersionsRequest
852
+
853
+ # Converts hash and nil to an options object
854
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
855
+
856
+ # Customize the options with defaults
857
+ call_metadata = @config.rpcs.list_processor_versions.metadata.to_h
858
+
859
+ # Set x-goog-api-client and x-goog-user-project headers
860
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
861
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
862
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
863
+ transports_version_send: [:rest]
864
+
865
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
866
+
867
+ options.apply_defaults timeout: @config.rpcs.list_processor_versions.timeout,
868
+ metadata: call_metadata,
869
+ retry_policy: @config.rpcs.list_processor_versions.retry_policy
870
+
871
+ options.apply_defaults timeout: @config.timeout,
872
+ metadata: @config.metadata,
873
+ retry_policy: @config.retry_policy
874
+
875
+ @document_processor_service_stub.list_processor_versions request, options do |result, operation|
876
+ result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_processor_versions, "processor_versions", request, result, options
877
+ yield result, operation if block_given?
878
+ return result
879
+ end
880
+ rescue ::Gapic::Rest::Error => e
881
+ raise ::Google::Cloud::Error.from_error(e)
882
+ end
883
+
884
+ ##
885
+ # Deletes the processor version, all artifacts under the processor version
886
+ # will be deleted.
887
+ #
888
+ # @overload delete_processor_version(request, options = nil)
889
+ # Pass arguments to `delete_processor_version` via a request object, either of type
890
+ # {::Google::Cloud::DocumentAI::V1::DeleteProcessorVersionRequest} or an equivalent Hash.
891
+ #
892
+ # @param request [::Google::Cloud::DocumentAI::V1::DeleteProcessorVersionRequest, ::Hash]
893
+ # A request object representing the call parameters. Required. To specify no
894
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
895
+ # @param options [::Gapic::CallOptions, ::Hash]
896
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
897
+ #
898
+ # @overload delete_processor_version(name: nil)
899
+ # Pass arguments to `delete_processor_version` via keyword arguments. Note that at
900
+ # least one keyword argument is required. To specify no parameters, or to keep all
901
+ # the default parameter values, pass an empty Hash as a request object (see above).
902
+ #
903
+ # @param name [::String]
904
+ # Required. The processor version resource name to be deleted.
905
+ # @yield [result, operation] Access the result along with the TransportOperation object
906
+ # @yieldparam result [::Gapic::Operation]
907
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
908
+ #
909
+ # @return [::Gapic::Operation]
910
+ #
911
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
912
+ def delete_processor_version request, options = nil
913
+ raise ::ArgumentError, "request must be provided" if request.nil?
914
+
915
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::DeleteProcessorVersionRequest
916
+
917
+ # Converts hash and nil to an options object
918
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
919
+
920
+ # Customize the options with defaults
921
+ call_metadata = @config.rpcs.delete_processor_version.metadata.to_h
922
+
923
+ # Set x-goog-api-client and x-goog-user-project headers
924
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
925
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
926
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
927
+ transports_version_send: [:rest]
928
+
929
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
930
+
931
+ options.apply_defaults timeout: @config.rpcs.delete_processor_version.timeout,
932
+ metadata: call_metadata,
933
+ retry_policy: @config.rpcs.delete_processor_version.retry_policy
934
+
935
+ options.apply_defaults timeout: @config.timeout,
936
+ metadata: @config.metadata,
937
+ retry_policy: @config.retry_policy
938
+
939
+ @document_processor_service_stub.delete_processor_version request, options do |result, operation|
940
+ result = ::Gapic::Operation.new result, @operations_client, options: options
941
+ yield result, operation if block_given?
942
+ return result
943
+ end
944
+ rescue ::Gapic::Rest::Error => e
945
+ raise ::Google::Cloud::Error.from_error(e)
946
+ end
947
+
948
+ ##
949
+ # Deploys the processor version.
950
+ #
951
+ # @overload deploy_processor_version(request, options = nil)
952
+ # Pass arguments to `deploy_processor_version` via a request object, either of type
953
+ # {::Google::Cloud::DocumentAI::V1::DeployProcessorVersionRequest} or an equivalent Hash.
954
+ #
955
+ # @param request [::Google::Cloud::DocumentAI::V1::DeployProcessorVersionRequest, ::Hash]
956
+ # A request object representing the call parameters. Required. To specify no
957
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
958
+ # @param options [::Gapic::CallOptions, ::Hash]
959
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
960
+ #
961
+ # @overload deploy_processor_version(name: nil)
962
+ # Pass arguments to `deploy_processor_version` via keyword arguments. Note that at
963
+ # least one keyword argument is required. To specify no parameters, or to keep all
964
+ # the default parameter values, pass an empty Hash as a request object (see above).
965
+ #
966
+ # @param name [::String]
967
+ # Required. The processor version resource name to be deployed.
968
+ # @yield [result, operation] Access the result along with the TransportOperation object
969
+ # @yieldparam result [::Gapic::Operation]
970
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
971
+ #
972
+ # @return [::Gapic::Operation]
973
+ #
974
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
975
+ def deploy_processor_version request, options = nil
976
+ raise ::ArgumentError, "request must be provided" if request.nil?
977
+
978
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::DeployProcessorVersionRequest
979
+
980
+ # Converts hash and nil to an options object
981
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
982
+
983
+ # Customize the options with defaults
984
+ call_metadata = @config.rpcs.deploy_processor_version.metadata.to_h
985
+
986
+ # Set x-goog-api-client and x-goog-user-project headers
987
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
988
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
989
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
990
+ transports_version_send: [:rest]
991
+
992
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
993
+
994
+ options.apply_defaults timeout: @config.rpcs.deploy_processor_version.timeout,
995
+ metadata: call_metadata,
996
+ retry_policy: @config.rpcs.deploy_processor_version.retry_policy
997
+
998
+ options.apply_defaults timeout: @config.timeout,
999
+ metadata: @config.metadata,
1000
+ retry_policy: @config.retry_policy
1001
+
1002
+ @document_processor_service_stub.deploy_processor_version request, options do |result, operation|
1003
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1004
+ yield result, operation if block_given?
1005
+ return result
1006
+ end
1007
+ rescue ::Gapic::Rest::Error => e
1008
+ raise ::Google::Cloud::Error.from_error(e)
1009
+ end
1010
+
1011
+ ##
1012
+ # Undeploys the processor version.
1013
+ #
1014
+ # @overload undeploy_processor_version(request, options = nil)
1015
+ # Pass arguments to `undeploy_processor_version` via a request object, either of type
1016
+ # {::Google::Cloud::DocumentAI::V1::UndeployProcessorVersionRequest} or an equivalent Hash.
1017
+ #
1018
+ # @param request [::Google::Cloud::DocumentAI::V1::UndeployProcessorVersionRequest, ::Hash]
1019
+ # A request object representing the call parameters. Required. To specify no
1020
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1021
+ # @param options [::Gapic::CallOptions, ::Hash]
1022
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1023
+ #
1024
+ # @overload undeploy_processor_version(name: nil)
1025
+ # Pass arguments to `undeploy_processor_version` via keyword arguments. Note that at
1026
+ # least one keyword argument is required. To specify no parameters, or to keep all
1027
+ # the default parameter values, pass an empty Hash as a request object (see above).
1028
+ #
1029
+ # @param name [::String]
1030
+ # Required. The processor version resource name to be undeployed.
1031
+ # @yield [result, operation] Access the result along with the TransportOperation object
1032
+ # @yieldparam result [::Gapic::Operation]
1033
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1034
+ #
1035
+ # @return [::Gapic::Operation]
1036
+ #
1037
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1038
+ def undeploy_processor_version request, options = nil
1039
+ raise ::ArgumentError, "request must be provided" if request.nil?
1040
+
1041
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::UndeployProcessorVersionRequest
1042
+
1043
+ # Converts hash and nil to an options object
1044
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1045
+
1046
+ # Customize the options with defaults
1047
+ call_metadata = @config.rpcs.undeploy_processor_version.metadata.to_h
1048
+
1049
+ # Set x-goog-api-client and x-goog-user-project headers
1050
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1051
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1052
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1053
+ transports_version_send: [:rest]
1054
+
1055
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1056
+
1057
+ options.apply_defaults timeout: @config.rpcs.undeploy_processor_version.timeout,
1058
+ metadata: call_metadata,
1059
+ retry_policy: @config.rpcs.undeploy_processor_version.retry_policy
1060
+
1061
+ options.apply_defaults timeout: @config.timeout,
1062
+ metadata: @config.metadata,
1063
+ retry_policy: @config.retry_policy
1064
+
1065
+ @document_processor_service_stub.undeploy_processor_version request, options do |result, operation|
1066
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1067
+ yield result, operation if block_given?
1068
+ return result
1069
+ end
1070
+ rescue ::Gapic::Rest::Error => e
1071
+ raise ::Google::Cloud::Error.from_error(e)
1072
+ end
1073
+
1074
+ ##
1075
+ # Creates a processor from the type processor that the user chose.
1076
+ # The processor will be at "ENABLED" state by default after its creation.
1077
+ #
1078
+ # @overload create_processor(request, options = nil)
1079
+ # Pass arguments to `create_processor` via a request object, either of type
1080
+ # {::Google::Cloud::DocumentAI::V1::CreateProcessorRequest} or an equivalent Hash.
1081
+ #
1082
+ # @param request [::Google::Cloud::DocumentAI::V1::CreateProcessorRequest, ::Hash]
1083
+ # A request object representing the call parameters. Required. To specify no
1084
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1085
+ # @param options [::Gapic::CallOptions, ::Hash]
1086
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1087
+ #
1088
+ # @overload create_processor(parent: nil, processor: nil)
1089
+ # Pass arguments to `create_processor` via keyword arguments. Note that at
1090
+ # least one keyword argument is required. To specify no parameters, or to keep all
1091
+ # the default parameter values, pass an empty Hash as a request object (see above).
1092
+ #
1093
+ # @param parent [::String]
1094
+ # Required. The parent (project and location) under which to create the
1095
+ # processor. Format: `projects/{project}/locations/{location}`
1096
+ # @param processor [::Google::Cloud::DocumentAI::V1::Processor, ::Hash]
1097
+ # Required. The processor to be created, requires [processor_type] and
1098
+ # [display_name] to be set. Also, the processor is under CMEK if CMEK fields
1099
+ # are set.
1100
+ # @yield [result, operation] Access the result along with the TransportOperation object
1101
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1::Processor]
1102
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1103
+ #
1104
+ # @return [::Google::Cloud::DocumentAI::V1::Processor]
1105
+ #
1106
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1107
+ def create_processor request, options = nil
1108
+ raise ::ArgumentError, "request must be provided" if request.nil?
1109
+
1110
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::CreateProcessorRequest
1111
+
1112
+ # Converts hash and nil to an options object
1113
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1114
+
1115
+ # Customize the options with defaults
1116
+ call_metadata = @config.rpcs.create_processor.metadata.to_h
1117
+
1118
+ # Set x-goog-api-client and x-goog-user-project headers
1119
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1120
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1121
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1122
+ transports_version_send: [:rest]
1123
+
1124
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1125
+
1126
+ options.apply_defaults timeout: @config.rpcs.create_processor.timeout,
1127
+ metadata: call_metadata,
1128
+ retry_policy: @config.rpcs.create_processor.retry_policy
1129
+
1130
+ options.apply_defaults timeout: @config.timeout,
1131
+ metadata: @config.metadata,
1132
+ retry_policy: @config.retry_policy
1133
+
1134
+ @document_processor_service_stub.create_processor request, options do |result, operation|
1135
+ yield result, operation if block_given?
1136
+ return result
1137
+ end
1138
+ rescue ::Gapic::Rest::Error => e
1139
+ raise ::Google::Cloud::Error.from_error(e)
1140
+ end
1141
+
1142
+ ##
1143
+ # Deletes the processor, unloads all deployed model artifacts if it was
1144
+ # enabled and then deletes all artifacts associated with this processor.
1145
+ #
1146
+ # @overload delete_processor(request, options = nil)
1147
+ # Pass arguments to `delete_processor` via a request object, either of type
1148
+ # {::Google::Cloud::DocumentAI::V1::DeleteProcessorRequest} or an equivalent Hash.
1149
+ #
1150
+ # @param request [::Google::Cloud::DocumentAI::V1::DeleteProcessorRequest, ::Hash]
1151
+ # A request object representing the call parameters. Required. To specify no
1152
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1153
+ # @param options [::Gapic::CallOptions, ::Hash]
1154
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1155
+ #
1156
+ # @overload delete_processor(name: nil)
1157
+ # Pass arguments to `delete_processor` via keyword arguments. Note that at
1158
+ # least one keyword argument is required. To specify no parameters, or to keep all
1159
+ # the default parameter values, pass an empty Hash as a request object (see above).
1160
+ #
1161
+ # @param name [::String]
1162
+ # Required. The processor resource name to be deleted.
1163
+ # @yield [result, operation] Access the result along with the TransportOperation object
1164
+ # @yieldparam result [::Gapic::Operation]
1165
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1166
+ #
1167
+ # @return [::Gapic::Operation]
1168
+ #
1169
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1170
+ def delete_processor request, options = nil
1171
+ raise ::ArgumentError, "request must be provided" if request.nil?
1172
+
1173
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::DeleteProcessorRequest
1174
+
1175
+ # Converts hash and nil to an options object
1176
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1177
+
1178
+ # Customize the options with defaults
1179
+ call_metadata = @config.rpcs.delete_processor.metadata.to_h
1180
+
1181
+ # Set x-goog-api-client and x-goog-user-project headers
1182
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1183
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1184
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1185
+ transports_version_send: [:rest]
1186
+
1187
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1188
+
1189
+ options.apply_defaults timeout: @config.rpcs.delete_processor.timeout,
1190
+ metadata: call_metadata,
1191
+ retry_policy: @config.rpcs.delete_processor.retry_policy
1192
+
1193
+ options.apply_defaults timeout: @config.timeout,
1194
+ metadata: @config.metadata,
1195
+ retry_policy: @config.retry_policy
1196
+
1197
+ @document_processor_service_stub.delete_processor request, options do |result, operation|
1198
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1199
+ yield result, operation if block_given?
1200
+ return result
1201
+ end
1202
+ rescue ::Gapic::Rest::Error => e
1203
+ raise ::Google::Cloud::Error.from_error(e)
1204
+ end
1205
+
1206
+ ##
1207
+ # Enables a processor
1208
+ #
1209
+ # @overload enable_processor(request, options = nil)
1210
+ # Pass arguments to `enable_processor` via a request object, either of type
1211
+ # {::Google::Cloud::DocumentAI::V1::EnableProcessorRequest} or an equivalent Hash.
1212
+ #
1213
+ # @param request [::Google::Cloud::DocumentAI::V1::EnableProcessorRequest, ::Hash]
1214
+ # A request object representing the call parameters. Required. To specify no
1215
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1216
+ # @param options [::Gapic::CallOptions, ::Hash]
1217
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1218
+ #
1219
+ # @overload enable_processor(name: nil)
1220
+ # Pass arguments to `enable_processor` via keyword arguments. Note that at
1221
+ # least one keyword argument is required. To specify no parameters, or to keep all
1222
+ # the default parameter values, pass an empty Hash as a request object (see above).
1223
+ #
1224
+ # @param name [::String]
1225
+ # Required. The processor resource name to be enabled.
1226
+ # @yield [result, operation] Access the result along with the TransportOperation object
1227
+ # @yieldparam result [::Gapic::Operation]
1228
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1229
+ #
1230
+ # @return [::Gapic::Operation]
1231
+ #
1232
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1233
+ def enable_processor request, options = nil
1234
+ raise ::ArgumentError, "request must be provided" if request.nil?
1235
+
1236
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::EnableProcessorRequest
1237
+
1238
+ # Converts hash and nil to an options object
1239
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1240
+
1241
+ # Customize the options with defaults
1242
+ call_metadata = @config.rpcs.enable_processor.metadata.to_h
1243
+
1244
+ # Set x-goog-api-client and x-goog-user-project headers
1245
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1246
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1247
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1248
+ transports_version_send: [:rest]
1249
+
1250
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1251
+
1252
+ options.apply_defaults timeout: @config.rpcs.enable_processor.timeout,
1253
+ metadata: call_metadata,
1254
+ retry_policy: @config.rpcs.enable_processor.retry_policy
1255
+
1256
+ options.apply_defaults timeout: @config.timeout,
1257
+ metadata: @config.metadata,
1258
+ retry_policy: @config.retry_policy
1259
+
1260
+ @document_processor_service_stub.enable_processor request, options do |result, operation|
1261
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1262
+ yield result, operation if block_given?
1263
+ return result
1264
+ end
1265
+ rescue ::Gapic::Rest::Error => e
1266
+ raise ::Google::Cloud::Error.from_error(e)
1267
+ end
1268
+
1269
+ ##
1270
+ # Disables a processor
1271
+ #
1272
+ # @overload disable_processor(request, options = nil)
1273
+ # Pass arguments to `disable_processor` via a request object, either of type
1274
+ # {::Google::Cloud::DocumentAI::V1::DisableProcessorRequest} or an equivalent Hash.
1275
+ #
1276
+ # @param request [::Google::Cloud::DocumentAI::V1::DisableProcessorRequest, ::Hash]
1277
+ # A request object representing the call parameters. Required. To specify no
1278
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1279
+ # @param options [::Gapic::CallOptions, ::Hash]
1280
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1281
+ #
1282
+ # @overload disable_processor(name: nil)
1283
+ # Pass arguments to `disable_processor` via keyword arguments. Note that at
1284
+ # least one keyword argument is required. To specify no parameters, or to keep all
1285
+ # the default parameter values, pass an empty Hash as a request object (see above).
1286
+ #
1287
+ # @param name [::String]
1288
+ # Required. The processor resource name to be disabled.
1289
+ # @yield [result, operation] Access the result along with the TransportOperation object
1290
+ # @yieldparam result [::Gapic::Operation]
1291
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1292
+ #
1293
+ # @return [::Gapic::Operation]
1294
+ #
1295
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1296
+ def disable_processor request, options = nil
1297
+ raise ::ArgumentError, "request must be provided" if request.nil?
1298
+
1299
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::DisableProcessorRequest
1300
+
1301
+ # Converts hash and nil to an options object
1302
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1303
+
1304
+ # Customize the options with defaults
1305
+ call_metadata = @config.rpcs.disable_processor.metadata.to_h
1306
+
1307
+ # Set x-goog-api-client and x-goog-user-project headers
1308
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1309
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1310
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1311
+ transports_version_send: [:rest]
1312
+
1313
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1314
+
1315
+ options.apply_defaults timeout: @config.rpcs.disable_processor.timeout,
1316
+ metadata: call_metadata,
1317
+ retry_policy: @config.rpcs.disable_processor.retry_policy
1318
+
1319
+ options.apply_defaults timeout: @config.timeout,
1320
+ metadata: @config.metadata,
1321
+ retry_policy: @config.retry_policy
1322
+
1323
+ @document_processor_service_stub.disable_processor request, options do |result, operation|
1324
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1325
+ yield result, operation if block_given?
1326
+ return result
1327
+ end
1328
+ rescue ::Gapic::Rest::Error => e
1329
+ raise ::Google::Cloud::Error.from_error(e)
1330
+ end
1331
+
1332
+ ##
1333
+ # Set the default (active) version of a
1334
+ # {::Google::Cloud::DocumentAI::V1::Processor Processor} that will be used in
1335
+ # {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client#process_document ProcessDocument}
1336
+ # and
1337
+ # {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client#batch_process_documents BatchProcessDocuments}.
1338
+ #
1339
+ # @overload set_default_processor_version(request, options = nil)
1340
+ # Pass arguments to `set_default_processor_version` via a request object, either of type
1341
+ # {::Google::Cloud::DocumentAI::V1::SetDefaultProcessorVersionRequest} or an equivalent Hash.
1342
+ #
1343
+ # @param request [::Google::Cloud::DocumentAI::V1::SetDefaultProcessorVersionRequest, ::Hash]
1344
+ # A request object representing the call parameters. Required. To specify no
1345
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1346
+ # @param options [::Gapic::CallOptions, ::Hash]
1347
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1348
+ #
1349
+ # @overload set_default_processor_version(processor: nil, default_processor_version: nil)
1350
+ # Pass arguments to `set_default_processor_version` via keyword arguments. Note that at
1351
+ # least one keyword argument is required. To specify no parameters, or to keep all
1352
+ # the default parameter values, pass an empty Hash as a request object (see above).
1353
+ #
1354
+ # @param processor [::String]
1355
+ # Required. The resource name of the
1356
+ # {::Google::Cloud::DocumentAI::V1::Processor Processor} to change default
1357
+ # version.
1358
+ # @param default_processor_version [::String]
1359
+ # Required. The resource name of child
1360
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion} to use as
1361
+ # default. Format:
1362
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
1363
+ # @yield [result, operation] Access the result along with the TransportOperation object
1364
+ # @yieldparam result [::Gapic::Operation]
1365
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1366
+ #
1367
+ # @return [::Gapic::Operation]
1368
+ #
1369
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1370
+ def set_default_processor_version request, options = nil
1371
+ raise ::ArgumentError, "request must be provided" if request.nil?
1372
+
1373
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::SetDefaultProcessorVersionRequest
1374
+
1375
+ # Converts hash and nil to an options object
1376
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1377
+
1378
+ # Customize the options with defaults
1379
+ call_metadata = @config.rpcs.set_default_processor_version.metadata.to_h
1380
+
1381
+ # Set x-goog-api-client and x-goog-user-project headers
1382
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1383
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1384
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1385
+ transports_version_send: [:rest]
1386
+
1387
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1388
+
1389
+ options.apply_defaults timeout: @config.rpcs.set_default_processor_version.timeout,
1390
+ metadata: call_metadata,
1391
+ retry_policy: @config.rpcs.set_default_processor_version.retry_policy
1392
+
1393
+ options.apply_defaults timeout: @config.timeout,
1394
+ metadata: @config.metadata,
1395
+ retry_policy: @config.retry_policy
1396
+
1397
+ @document_processor_service_stub.set_default_processor_version request, options do |result, operation|
1398
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1399
+ yield result, operation if block_given?
1400
+ return result
1401
+ end
1402
+ rescue ::Gapic::Rest::Error => e
1403
+ raise ::Google::Cloud::Error.from_error(e)
1404
+ end
1405
+
1406
+ ##
1407
+ # Send a document for Human Review. The input document should be processed by
1408
+ # the specified processor.
1409
+ #
1410
+ # @overload review_document(request, options = nil)
1411
+ # Pass arguments to `review_document` via a request object, either of type
1412
+ # {::Google::Cloud::DocumentAI::V1::ReviewDocumentRequest} or an equivalent Hash.
1413
+ #
1414
+ # @param request [::Google::Cloud::DocumentAI::V1::ReviewDocumentRequest, ::Hash]
1415
+ # A request object representing the call parameters. Required. To specify no
1416
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1417
+ # @param options [::Gapic::CallOptions, ::Hash]
1418
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1419
+ #
1420
+ # @overload review_document(inline_document: nil, human_review_config: nil, enable_schema_validation: nil, priority: nil, document_schema: nil)
1421
+ # Pass arguments to `review_document` via keyword arguments. Note that at
1422
+ # least one keyword argument is required. To specify no parameters, or to keep all
1423
+ # the default parameter values, pass an empty Hash as a request object (see above).
1424
+ #
1425
+ # @param inline_document [::Google::Cloud::DocumentAI::V1::Document, ::Hash]
1426
+ # An inline document proto.
1427
+ # @param human_review_config [::String]
1428
+ # Required. The resource name of the HumanReviewConfig that the document will
1429
+ # be reviewed with.
1430
+ # @param enable_schema_validation [::Boolean]
1431
+ # Whether the validation should be performed on the ad-hoc review request.
1432
+ # @param priority [::Google::Cloud::DocumentAI::V1::ReviewDocumentRequest::Priority]
1433
+ # The priority of the human review task.
1434
+ # @param document_schema [::Google::Cloud::DocumentAI::V1::DocumentSchema, ::Hash]
1435
+ # The document schema of the human review task.
1436
+ # @yield [result, operation] Access the result along with the TransportOperation object
1437
+ # @yieldparam result [::Gapic::Operation]
1438
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1439
+ #
1440
+ # @return [::Gapic::Operation]
1441
+ #
1442
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1443
+ def review_document request, options = nil
1444
+ raise ::ArgumentError, "request must be provided" if request.nil?
1445
+
1446
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ReviewDocumentRequest
1447
+
1448
+ # Converts hash and nil to an options object
1449
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1450
+
1451
+ # Customize the options with defaults
1452
+ call_metadata = @config.rpcs.review_document.metadata.to_h
1453
+
1454
+ # Set x-goog-api-client and x-goog-user-project headers
1455
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1456
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1457
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1458
+ transports_version_send: [:rest]
1459
+
1460
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1461
+
1462
+ options.apply_defaults timeout: @config.rpcs.review_document.timeout,
1463
+ metadata: call_metadata,
1464
+ retry_policy: @config.rpcs.review_document.retry_policy
1465
+
1466
+ options.apply_defaults timeout: @config.timeout,
1467
+ metadata: @config.metadata,
1468
+ retry_policy: @config.retry_policy
1469
+
1470
+ @document_processor_service_stub.review_document request, options do |result, operation|
1471
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1472
+ yield result, operation if block_given?
1473
+ return result
1474
+ end
1475
+ rescue ::Gapic::Rest::Error => e
1476
+ raise ::Google::Cloud::Error.from_error(e)
1477
+ end
1478
+
1479
+ ##
1480
+ # Evaluates a ProcessorVersion against annotated documents, producing an
1481
+ # Evaluation.
1482
+ #
1483
+ # @overload evaluate_processor_version(request, options = nil)
1484
+ # Pass arguments to `evaluate_processor_version` via a request object, either of type
1485
+ # {::Google::Cloud::DocumentAI::V1::EvaluateProcessorVersionRequest} or an equivalent Hash.
1486
+ #
1487
+ # @param request [::Google::Cloud::DocumentAI::V1::EvaluateProcessorVersionRequest, ::Hash]
1488
+ # A request object representing the call parameters. Required. To specify no
1489
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1490
+ # @param options [::Gapic::CallOptions, ::Hash]
1491
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1492
+ #
1493
+ # @overload evaluate_processor_version(processor_version: nil, evaluation_documents: nil)
1494
+ # Pass arguments to `evaluate_processor_version` via keyword arguments. Note that at
1495
+ # least one keyword argument is required. To specify no parameters, or to keep all
1496
+ # the default parameter values, pass an empty Hash as a request object (see above).
1497
+ #
1498
+ # @param processor_version [::String]
1499
+ # Required. The resource name of the
1500
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion} to
1501
+ # evaluate.
1502
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
1503
+ # @param evaluation_documents [::Google::Cloud::DocumentAI::V1::BatchDocumentsInputConfig, ::Hash]
1504
+ # Optional. The documents used in the evaluation. If unspecified, use the
1505
+ # processor's dataset as evaluation input.
1506
+ # @yield [result, operation] Access the result along with the TransportOperation object
1507
+ # @yieldparam result [::Gapic::Operation]
1508
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1509
+ #
1510
+ # @return [::Gapic::Operation]
1511
+ #
1512
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1513
+ def evaluate_processor_version request, options = nil
1514
+ raise ::ArgumentError, "request must be provided" if request.nil?
1515
+
1516
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::EvaluateProcessorVersionRequest
1517
+
1518
+ # Converts hash and nil to an options object
1519
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1520
+
1521
+ # Customize the options with defaults
1522
+ call_metadata = @config.rpcs.evaluate_processor_version.metadata.to_h
1523
+
1524
+ # Set x-goog-api-client and x-goog-user-project headers
1525
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1526
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1527
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1528
+ transports_version_send: [:rest]
1529
+
1530
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1531
+
1532
+ options.apply_defaults timeout: @config.rpcs.evaluate_processor_version.timeout,
1533
+ metadata: call_metadata,
1534
+ retry_policy: @config.rpcs.evaluate_processor_version.retry_policy
1535
+
1536
+ options.apply_defaults timeout: @config.timeout,
1537
+ metadata: @config.metadata,
1538
+ retry_policy: @config.retry_policy
1539
+
1540
+ @document_processor_service_stub.evaluate_processor_version request, options do |result, operation|
1541
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1542
+ yield result, operation if block_given?
1543
+ return result
1544
+ end
1545
+ rescue ::Gapic::Rest::Error => e
1546
+ raise ::Google::Cloud::Error.from_error(e)
1547
+ end
1548
+
1549
+ ##
1550
+ # Retrieves a specific evaluation.
1551
+ #
1552
+ # @overload get_evaluation(request, options = nil)
1553
+ # Pass arguments to `get_evaluation` via a request object, either of type
1554
+ # {::Google::Cloud::DocumentAI::V1::GetEvaluationRequest} or an equivalent Hash.
1555
+ #
1556
+ # @param request [::Google::Cloud::DocumentAI::V1::GetEvaluationRequest, ::Hash]
1557
+ # A request object representing the call parameters. Required. To specify no
1558
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1559
+ # @param options [::Gapic::CallOptions, ::Hash]
1560
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1561
+ #
1562
+ # @overload get_evaluation(name: nil)
1563
+ # Pass arguments to `get_evaluation` via keyword arguments. Note that at
1564
+ # least one keyword argument is required. To specify no parameters, or to keep all
1565
+ # the default parameter values, pass an empty Hash as a request object (see above).
1566
+ #
1567
+ # @param name [::String]
1568
+ # Required. The resource name of the
1569
+ # {::Google::Cloud::DocumentAI::V1::Evaluation Evaluation} to get.
1570
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
1571
+ # @yield [result, operation] Access the result along with the TransportOperation object
1572
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1::Evaluation]
1573
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1574
+ #
1575
+ # @return [::Google::Cloud::DocumentAI::V1::Evaluation]
1576
+ #
1577
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1578
+ def get_evaluation request, options = nil
1579
+ raise ::ArgumentError, "request must be provided" if request.nil?
1580
+
1581
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::GetEvaluationRequest
1582
+
1583
+ # Converts hash and nil to an options object
1584
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1585
+
1586
+ # Customize the options with defaults
1587
+ call_metadata = @config.rpcs.get_evaluation.metadata.to_h
1588
+
1589
+ # Set x-goog-api-client and x-goog-user-project headers
1590
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1591
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1592
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1593
+ transports_version_send: [:rest]
1594
+
1595
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1596
+
1597
+ options.apply_defaults timeout: @config.rpcs.get_evaluation.timeout,
1598
+ metadata: call_metadata,
1599
+ retry_policy: @config.rpcs.get_evaluation.retry_policy
1600
+
1601
+ options.apply_defaults timeout: @config.timeout,
1602
+ metadata: @config.metadata,
1603
+ retry_policy: @config.retry_policy
1604
+
1605
+ @document_processor_service_stub.get_evaluation request, options do |result, operation|
1606
+ yield result, operation if block_given?
1607
+ return result
1608
+ end
1609
+ rescue ::Gapic::Rest::Error => e
1610
+ raise ::Google::Cloud::Error.from_error(e)
1611
+ end
1612
+
1613
+ ##
1614
+ # Retrieves a set of evaluations for a given processor version.
1615
+ #
1616
+ # @overload list_evaluations(request, options = nil)
1617
+ # Pass arguments to `list_evaluations` via a request object, either of type
1618
+ # {::Google::Cloud::DocumentAI::V1::ListEvaluationsRequest} or an equivalent Hash.
1619
+ #
1620
+ # @param request [::Google::Cloud::DocumentAI::V1::ListEvaluationsRequest, ::Hash]
1621
+ # A request object representing the call parameters. Required. To specify no
1622
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1623
+ # @param options [::Gapic::CallOptions, ::Hash]
1624
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1625
+ #
1626
+ # @overload list_evaluations(parent: nil, page_size: nil, page_token: nil)
1627
+ # Pass arguments to `list_evaluations` via keyword arguments. Note that at
1628
+ # least one keyword argument is required. To specify no parameters, or to keep all
1629
+ # the default parameter values, pass an empty Hash as a request object (see above).
1630
+ #
1631
+ # @param parent [::String]
1632
+ # Required. The resource name of the
1633
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion} to list
1634
+ # evaluations for.
1635
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
1636
+ # @param page_size [::Integer]
1637
+ # The standard list page size.
1638
+ # If unspecified, at most 5 evaluations will be returned.
1639
+ # The maximum value is 100; values above 100 will be coerced to 100.
1640
+ # @param page_token [::String]
1641
+ # A page token, received from a previous `ListEvaluations` call.
1642
+ # Provide this to retrieve the subsequent page.
1643
+ # @yield [result, operation] Access the result along with the TransportOperation object
1644
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1::Evaluation>]
1645
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1646
+ #
1647
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DocumentAI::V1::Evaluation>]
1648
+ #
1649
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1650
+ def list_evaluations request, options = nil
1651
+ raise ::ArgumentError, "request must be provided" if request.nil?
1652
+
1653
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ListEvaluationsRequest
1654
+
1655
+ # Converts hash and nil to an options object
1656
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1657
+
1658
+ # Customize the options with defaults
1659
+ call_metadata = @config.rpcs.list_evaluations.metadata.to_h
1660
+
1661
+ # Set x-goog-api-client and x-goog-user-project headers
1662
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1663
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1664
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION,
1665
+ transports_version_send: [:rest]
1666
+
1667
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1668
+
1669
+ options.apply_defaults timeout: @config.rpcs.list_evaluations.timeout,
1670
+ metadata: call_metadata,
1671
+ retry_policy: @config.rpcs.list_evaluations.retry_policy
1672
+
1673
+ options.apply_defaults timeout: @config.timeout,
1674
+ metadata: @config.metadata,
1675
+ retry_policy: @config.retry_policy
1676
+
1677
+ @document_processor_service_stub.list_evaluations request, options do |result, operation|
1678
+ result = ::Gapic::Rest::PagedEnumerable.new @document_processor_service_stub, :list_evaluations, "evaluations", request, result, options
1679
+ yield result, operation if block_given?
1680
+ return result
1681
+ end
1682
+ rescue ::Gapic::Rest::Error => e
1683
+ raise ::Google::Cloud::Error.from_error(e)
1684
+ end
1685
+
1686
+ ##
1687
+ # Configuration class for the DocumentProcessorService REST API.
1688
+ #
1689
+ # This class represents the configuration for DocumentProcessorService REST,
1690
+ # providing control over timeouts, retry behavior, logging, transport
1691
+ # parameters, and other low-level controls. Certain parameters can also be
1692
+ # applied individually to specific RPCs. See
1693
+ # {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client::Configuration::Rpcs}
1694
+ # for a list of RPCs that can be configured independently.
1695
+ #
1696
+ # Configuration can be applied globally to all clients, or to a single client
1697
+ # on construction.
1698
+ #
1699
+ # @example
1700
+ #
1701
+ # # Modify the global config, setting the timeout for
1702
+ # # process_document to 20 seconds,
1703
+ # # and all remaining timeouts to 10 seconds.
1704
+ # ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client.configure do |config|
1705
+ # config.timeout = 10.0
1706
+ # config.rpcs.process_document.timeout = 20.0
1707
+ # end
1708
+ #
1709
+ # # Apply the above configuration only to a new client.
1710
+ # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Rest::Client.new do |config|
1711
+ # config.timeout = 10.0
1712
+ # config.rpcs.process_document.timeout = 20.0
1713
+ # end
1714
+ #
1715
+ # @!attribute [rw] endpoint
1716
+ # The hostname or hostname:port of the service endpoint.
1717
+ # Defaults to `"documentai.googleapis.com"`.
1718
+ # @return [::String]
1719
+ # @!attribute [rw] credentials
1720
+ # Credentials to send with calls. You may provide any of the following types:
1721
+ # * (`String`) The path to a service account key file in JSON format
1722
+ # * (`Hash`) A service account key as a Hash
1723
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1724
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1725
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1726
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1727
+ # * (`nil`) indicating no credentials
1728
+ # @return [::Object]
1729
+ # @!attribute [rw] scope
1730
+ # The OAuth scopes
1731
+ # @return [::Array<::String>]
1732
+ # @!attribute [rw] lib_name
1733
+ # The library name as recorded in instrumentation and logging
1734
+ # @return [::String]
1735
+ # @!attribute [rw] lib_version
1736
+ # The library version as recorded in instrumentation and logging
1737
+ # @return [::String]
1738
+ # @!attribute [rw] timeout
1739
+ # The call timeout in seconds.
1740
+ # @return [::Numeric]
1741
+ # @!attribute [rw] metadata
1742
+ # Additional headers to be sent with the call.
1743
+ # @return [::Hash{::Symbol=>::String}]
1744
+ # @!attribute [rw] retry_policy
1745
+ # The retry policy. The value is a hash with the following keys:
1746
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1747
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1748
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1749
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1750
+ # trigger a retry.
1751
+ # @return [::Hash]
1752
+ # @!attribute [rw] quota_project
1753
+ # A separate project against which to charge quota.
1754
+ # @return [::String]
1755
+ #
1756
+ class Configuration
1757
+ extend ::Gapic::Config
1758
+
1759
+ DEFAULT_ENDPOINT = "documentai.googleapis.com"
1760
+
1761
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1762
+ config_attr :credentials, nil do |value|
1763
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1764
+ allowed.any? { |klass| klass === value }
1765
+ end
1766
+ config_attr :scope, nil, ::String, ::Array, nil
1767
+ config_attr :lib_name, nil, ::String, nil
1768
+ config_attr :lib_version, nil, ::String, nil
1769
+ config_attr :timeout, nil, ::Numeric, nil
1770
+ config_attr :metadata, nil, ::Hash, nil
1771
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1772
+ config_attr :quota_project, nil, ::String, nil
1773
+
1774
+ # @private
1775
+ # Overrides for http bindings for the RPCs of this service
1776
+ # are only used when this service is used as mixin, and only
1777
+ # by the host service.
1778
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1779
+ config_attr :bindings_override, {}, ::Hash, nil
1780
+
1781
+ # @private
1782
+ def initialize parent_config = nil
1783
+ @parent_config = parent_config unless parent_config.nil?
1784
+
1785
+ yield self if block_given?
1786
+ end
1787
+
1788
+ ##
1789
+ # Configurations for individual RPCs
1790
+ # @return [Rpcs]
1791
+ #
1792
+ def rpcs
1793
+ @rpcs ||= begin
1794
+ parent_rpcs = nil
1795
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1796
+ Rpcs.new parent_rpcs
1797
+ end
1798
+ end
1799
+
1800
+ ##
1801
+ # Configuration RPC class for the DocumentProcessorService API.
1802
+ #
1803
+ # Includes fields providing the configuration for each RPC in this service.
1804
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1805
+ # the following configuration fields:
1806
+ #
1807
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1808
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1809
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1810
+ # include the following keys:
1811
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1812
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1813
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1814
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1815
+ # trigger a retry.
1816
+ #
1817
+ class Rpcs
1818
+ ##
1819
+ # RPC-specific configuration for `process_document`
1820
+ # @return [::Gapic::Config::Method]
1821
+ #
1822
+ attr_reader :process_document
1823
+ ##
1824
+ # RPC-specific configuration for `batch_process_documents`
1825
+ # @return [::Gapic::Config::Method]
1826
+ #
1827
+ attr_reader :batch_process_documents
1828
+ ##
1829
+ # RPC-specific configuration for `fetch_processor_types`
1830
+ # @return [::Gapic::Config::Method]
1831
+ #
1832
+ attr_reader :fetch_processor_types
1833
+ ##
1834
+ # RPC-specific configuration for `list_processor_types`
1835
+ # @return [::Gapic::Config::Method]
1836
+ #
1837
+ attr_reader :list_processor_types
1838
+ ##
1839
+ # RPC-specific configuration for `get_processor_type`
1840
+ # @return [::Gapic::Config::Method]
1841
+ #
1842
+ attr_reader :get_processor_type
1843
+ ##
1844
+ # RPC-specific configuration for `list_processors`
1845
+ # @return [::Gapic::Config::Method]
1846
+ #
1847
+ attr_reader :list_processors
1848
+ ##
1849
+ # RPC-specific configuration for `get_processor`
1850
+ # @return [::Gapic::Config::Method]
1851
+ #
1852
+ attr_reader :get_processor
1853
+ ##
1854
+ # RPC-specific configuration for `train_processor_version`
1855
+ # @return [::Gapic::Config::Method]
1856
+ #
1857
+ attr_reader :train_processor_version
1858
+ ##
1859
+ # RPC-specific configuration for `get_processor_version`
1860
+ # @return [::Gapic::Config::Method]
1861
+ #
1862
+ attr_reader :get_processor_version
1863
+ ##
1864
+ # RPC-specific configuration for `list_processor_versions`
1865
+ # @return [::Gapic::Config::Method]
1866
+ #
1867
+ attr_reader :list_processor_versions
1868
+ ##
1869
+ # RPC-specific configuration for `delete_processor_version`
1870
+ # @return [::Gapic::Config::Method]
1871
+ #
1872
+ attr_reader :delete_processor_version
1873
+ ##
1874
+ # RPC-specific configuration for `deploy_processor_version`
1875
+ # @return [::Gapic::Config::Method]
1876
+ #
1877
+ attr_reader :deploy_processor_version
1878
+ ##
1879
+ # RPC-specific configuration for `undeploy_processor_version`
1880
+ # @return [::Gapic::Config::Method]
1881
+ #
1882
+ attr_reader :undeploy_processor_version
1883
+ ##
1884
+ # RPC-specific configuration for `create_processor`
1885
+ # @return [::Gapic::Config::Method]
1886
+ #
1887
+ attr_reader :create_processor
1888
+ ##
1889
+ # RPC-specific configuration for `delete_processor`
1890
+ # @return [::Gapic::Config::Method]
1891
+ #
1892
+ attr_reader :delete_processor
1893
+ ##
1894
+ # RPC-specific configuration for `enable_processor`
1895
+ # @return [::Gapic::Config::Method]
1896
+ #
1897
+ attr_reader :enable_processor
1898
+ ##
1899
+ # RPC-specific configuration for `disable_processor`
1900
+ # @return [::Gapic::Config::Method]
1901
+ #
1902
+ attr_reader :disable_processor
1903
+ ##
1904
+ # RPC-specific configuration for `set_default_processor_version`
1905
+ # @return [::Gapic::Config::Method]
1906
+ #
1907
+ attr_reader :set_default_processor_version
1908
+ ##
1909
+ # RPC-specific configuration for `review_document`
1910
+ # @return [::Gapic::Config::Method]
1911
+ #
1912
+ attr_reader :review_document
1913
+ ##
1914
+ # RPC-specific configuration for `evaluate_processor_version`
1915
+ # @return [::Gapic::Config::Method]
1916
+ #
1917
+ attr_reader :evaluate_processor_version
1918
+ ##
1919
+ # RPC-specific configuration for `get_evaluation`
1920
+ # @return [::Gapic::Config::Method]
1921
+ #
1922
+ attr_reader :get_evaluation
1923
+ ##
1924
+ # RPC-specific configuration for `list_evaluations`
1925
+ # @return [::Gapic::Config::Method]
1926
+ #
1927
+ attr_reader :list_evaluations
1928
+
1929
+ # @private
1930
+ def initialize parent_rpcs = nil
1931
+ process_document_config = parent_rpcs.process_document if parent_rpcs.respond_to? :process_document
1932
+ @process_document = ::Gapic::Config::Method.new process_document_config
1933
+ batch_process_documents_config = parent_rpcs.batch_process_documents if parent_rpcs.respond_to? :batch_process_documents
1934
+ @batch_process_documents = ::Gapic::Config::Method.new batch_process_documents_config
1935
+ fetch_processor_types_config = parent_rpcs.fetch_processor_types if parent_rpcs.respond_to? :fetch_processor_types
1936
+ @fetch_processor_types = ::Gapic::Config::Method.new fetch_processor_types_config
1937
+ list_processor_types_config = parent_rpcs.list_processor_types if parent_rpcs.respond_to? :list_processor_types
1938
+ @list_processor_types = ::Gapic::Config::Method.new list_processor_types_config
1939
+ get_processor_type_config = parent_rpcs.get_processor_type if parent_rpcs.respond_to? :get_processor_type
1940
+ @get_processor_type = ::Gapic::Config::Method.new get_processor_type_config
1941
+ list_processors_config = parent_rpcs.list_processors if parent_rpcs.respond_to? :list_processors
1942
+ @list_processors = ::Gapic::Config::Method.new list_processors_config
1943
+ get_processor_config = parent_rpcs.get_processor if parent_rpcs.respond_to? :get_processor
1944
+ @get_processor = ::Gapic::Config::Method.new get_processor_config
1945
+ train_processor_version_config = parent_rpcs.train_processor_version if parent_rpcs.respond_to? :train_processor_version
1946
+ @train_processor_version = ::Gapic::Config::Method.new train_processor_version_config
1947
+ get_processor_version_config = parent_rpcs.get_processor_version if parent_rpcs.respond_to? :get_processor_version
1948
+ @get_processor_version = ::Gapic::Config::Method.new get_processor_version_config
1949
+ list_processor_versions_config = parent_rpcs.list_processor_versions if parent_rpcs.respond_to? :list_processor_versions
1950
+ @list_processor_versions = ::Gapic::Config::Method.new list_processor_versions_config
1951
+ delete_processor_version_config = parent_rpcs.delete_processor_version if parent_rpcs.respond_to? :delete_processor_version
1952
+ @delete_processor_version = ::Gapic::Config::Method.new delete_processor_version_config
1953
+ deploy_processor_version_config = parent_rpcs.deploy_processor_version if parent_rpcs.respond_to? :deploy_processor_version
1954
+ @deploy_processor_version = ::Gapic::Config::Method.new deploy_processor_version_config
1955
+ undeploy_processor_version_config = parent_rpcs.undeploy_processor_version if parent_rpcs.respond_to? :undeploy_processor_version
1956
+ @undeploy_processor_version = ::Gapic::Config::Method.new undeploy_processor_version_config
1957
+ create_processor_config = parent_rpcs.create_processor if parent_rpcs.respond_to? :create_processor
1958
+ @create_processor = ::Gapic::Config::Method.new create_processor_config
1959
+ delete_processor_config = parent_rpcs.delete_processor if parent_rpcs.respond_to? :delete_processor
1960
+ @delete_processor = ::Gapic::Config::Method.new delete_processor_config
1961
+ enable_processor_config = parent_rpcs.enable_processor if parent_rpcs.respond_to? :enable_processor
1962
+ @enable_processor = ::Gapic::Config::Method.new enable_processor_config
1963
+ disable_processor_config = parent_rpcs.disable_processor if parent_rpcs.respond_to? :disable_processor
1964
+ @disable_processor = ::Gapic::Config::Method.new disable_processor_config
1965
+ set_default_processor_version_config = parent_rpcs.set_default_processor_version if parent_rpcs.respond_to? :set_default_processor_version
1966
+ @set_default_processor_version = ::Gapic::Config::Method.new set_default_processor_version_config
1967
+ review_document_config = parent_rpcs.review_document if parent_rpcs.respond_to? :review_document
1968
+ @review_document = ::Gapic::Config::Method.new review_document_config
1969
+ evaluate_processor_version_config = parent_rpcs.evaluate_processor_version if parent_rpcs.respond_to? :evaluate_processor_version
1970
+ @evaluate_processor_version = ::Gapic::Config::Method.new evaluate_processor_version_config
1971
+ get_evaluation_config = parent_rpcs.get_evaluation if parent_rpcs.respond_to? :get_evaluation
1972
+ @get_evaluation = ::Gapic::Config::Method.new get_evaluation_config
1973
+ list_evaluations_config = parent_rpcs.list_evaluations if parent_rpcs.respond_to? :list_evaluations
1974
+ @list_evaluations = ::Gapic::Config::Method.new list_evaluations_config
1975
+
1976
+ yield self if block_given?
1977
+ end
1978
+ end
1979
+ end
1980
+ end
1981
+ end
1982
+ end
1983
+ end
1984
+ end
1985
+ end
1986
+ end