google-cloud-document_ai-v1beta3 0.7.0 → 0.9.2
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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/README.md +1 -1
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb +516 -53
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/operations.rb +34 -25
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/paths.rb +17 -0
- data/lib/google/cloud/document_ai/v1beta3/version.rb +1 -1
- data/lib/google/cloud/documentai/v1beta3/document_pb.rb +4 -0
- data/lib/google/cloud/documentai/v1beta3/document_processor_service_pb.rb +64 -16
- data/lib/google/cloud/documentai/v1beta3/document_processor_service_services_pb.rb +14 -0
- data/lib/google/cloud/documentai/v1beta3/operation_metadata_pb.rb +36 -0
- data/lib/google/cloud/documentai/v1beta3/processor_pb.rb +45 -0
- data/lib/google/cloud/documentai/v1beta3/processor_type_pb.rb +32 -0
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/cloud/documentai/v1beta3/document.rb +15 -0
- data/proto_docs/google/cloud/documentai/v1beta3/document_processor_service.rb +149 -39
- data/proto_docs/google/cloud/documentai/v1beta3/geometry.rb +2 -2
- data/proto_docs/google/cloud/documentai/v1beta3/operation_metadata.rb +65 -0
- data/proto_docs/google/cloud/documentai/v1beta3/processor.rb +86 -0
- data/proto_docs/google/cloud/documentai/v1beta3/processor_type.rb +59 -0
- data/proto_docs/google/type/color.rb +16 -11
- data/proto_docs/google/type/date.rb +14 -11
- data/proto_docs/google/type/datetime.rb +9 -1
- data/proto_docs/google/type/money.rb +1 -1
- metadata +19 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a71f4d5ede64b7ca5b82d04afb6bf47725ce75ea72ac6515a0ec585eb39e5aea
|
4
|
+
data.tar.gz: c0fa5d14d6927f6f8d28cb0020c0218f38449a2e82b2a2da208527b9c30d7ecd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d94f1cfcfbaf22c26d3adb0ce927647f86c693d19a576776d3d48a2cc7e4e913aebd88bd9fb267e09afd6e515d454984e83244552b697b4727fcbdf362abe4a1
|
7
|
+
data.tar.gz: 3b90ef2fa4403cdf0694040a3d07943b3b5987602ec91a2cef4e32f878fffd22d8174d0166f7c2201831048c778a7af170c4a95d84854440172932d5d6c18091
|
data/AUTHENTICATION.md
CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-document_ai-v1beta3
|
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
67
67
|
{::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Credentials}):
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
* `DOCUMENT_AI_CREDENTIALS` - Path to JSON file, or JSON contents
|
70
|
+
* `DOCUMENT_AI_KEYFILE` - Path to JSON file, or JSON contents
|
71
|
+
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
72
|
+
* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
|
73
|
+
* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
|
74
74
|
|
75
75
|
```ruby
|
76
76
|
require "google/cloud/document_ai/v1beta3"
|
@@ -82,8 +82,8 @@ client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.
|
|
82
82
|
|
83
83
|
### Configuration
|
84
84
|
|
85
|
-
The **Credentials JSON** can be configured instead of
|
86
|
-
environment
|
85
|
+
The path to the **Credentials JSON** file can be configured instead of storing
|
86
|
+
it in an environment variable. Either on an individual client initialization:
|
87
87
|
|
88
88
|
```ruby
|
89
89
|
require "google/cloud/document_ai/v1beta3"
|
@@ -93,7 +93,7 @@ client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.
|
|
93
93
|
end
|
94
94
|
```
|
95
95
|
|
96
|
-
Or
|
96
|
+
Or globally for all clients:
|
97
97
|
|
98
98
|
```ruby
|
99
99
|
require "google/cloud/document_ai/v1beta3"
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
|
|
33
33
|
require "google/cloud/document_ai/v1beta3"
|
34
34
|
|
35
35
|
client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
36
|
-
request =
|
36
|
+
request = ::Google::Cloud::DocumentAI::V1beta3::ProcessRequest.new # (request fields as keyword arguments...)
|
37
37
|
response = client.process_document request
|
38
38
|
```
|
39
39
|
|
@@ -44,13 +44,12 @@ module Google
|
|
44
44
|
# See {::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client::Configuration}
|
45
45
|
# for a description of the configuration fields.
|
46
46
|
#
|
47
|
-
#
|
47
|
+
# @example
|
48
48
|
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# end
|
49
|
+
# # Modify the configuration for all DocumentProcessorService clients
|
50
|
+
# ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
54
53
|
#
|
55
54
|
# @yield [config] Configure the Client client.
|
56
55
|
# @yieldparam config [Client::Configuration]
|
@@ -70,26 +69,17 @@ module Google
|
|
70
69
|
|
71
70
|
default_config.rpcs.process_document.timeout = 120.0
|
72
71
|
default_config.rpcs.process_document.retry_policy = {
|
73
|
-
initial_delay: 0.1,
|
74
|
-
max_delay: 60.0,
|
75
|
-
multiplier: 1.3,
|
76
|
-
retry_codes: [4, 14]
|
72
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
77
73
|
}
|
78
74
|
|
79
75
|
default_config.rpcs.batch_process_documents.timeout = 120.0
|
80
76
|
default_config.rpcs.batch_process_documents.retry_policy = {
|
81
|
-
initial_delay: 0.1,
|
82
|
-
max_delay: 60.0,
|
83
|
-
multiplier: 1.3,
|
84
|
-
retry_codes: [4, 14]
|
77
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
85
78
|
}
|
86
79
|
|
87
80
|
default_config.rpcs.review_document.timeout = 120.0
|
88
81
|
default_config.rpcs.review_document.retry_policy = {
|
89
|
-
initial_delay: 0.1,
|
90
|
-
max_delay: 60.0,
|
91
|
-
multiplier: 1.3,
|
92
|
-
retry_codes: [4, 14]
|
82
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
93
83
|
}
|
94
84
|
|
95
85
|
default_config
|
@@ -121,19 +111,15 @@ module Google
|
|
121
111
|
##
|
122
112
|
# Create a new DocumentProcessorService client object.
|
123
113
|
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
# To create a new DocumentProcessorService client with the default
|
127
|
-
# configuration:
|
128
|
-
#
|
129
|
-
# client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
114
|
+
# @example
|
130
115
|
#
|
131
|
-
#
|
132
|
-
#
|
116
|
+
# # Create a client using the default configuration
|
117
|
+
# client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
133
118
|
#
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
119
|
+
# # Create a client using a custom configuration
|
120
|
+
# client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new do |config|
|
121
|
+
# config.timeout = 10.0
|
122
|
+
# end
|
137
123
|
#
|
138
124
|
# @yield [config] Configure the DocumentProcessorService client.
|
139
125
|
# @yieldparam config [Client::Configuration]
|
@@ -153,14 +139,13 @@ module Google
|
|
153
139
|
|
154
140
|
# Create credentials
|
155
141
|
credentials = @config.credentials
|
156
|
-
# Use self-signed JWT if the
|
142
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
157
143
|
# but only if the default endpoint does not have a region prefix.
|
158
|
-
enable_self_signed_jwt = @config.
|
159
|
-
@config.endpoint == Client.configure.endpoint &&
|
144
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
160
145
|
!@config.endpoint.split(".").first.include?("-")
|
161
146
|
credentials ||= Credentials.default scope: @config.scope,
|
162
147
|
enable_self_signed_jwt: enable_self_signed_jwt
|
163
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
148
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
164
149
|
credentials = Credentials.new credentials, scope: @config.scope
|
165
150
|
end
|
166
151
|
@quota_project_id = @config.quota_project
|
@@ -253,7 +238,9 @@ module Google
|
|
253
238
|
options.apply_defaults timeout: @config.rpcs.process_document.timeout,
|
254
239
|
metadata: metadata,
|
255
240
|
retry_policy: @config.rpcs.process_document.retry_policy
|
256
|
-
|
241
|
+
|
242
|
+
options.apply_defaults timeout: @config.timeout,
|
243
|
+
metadata: @config.metadata,
|
257
244
|
retry_policy: @config.retry_policy
|
258
245
|
|
259
246
|
@document_processor_service_stub.call_rpc :process_document, request, options: options do |response, operation|
|
@@ -331,7 +318,9 @@ module Google
|
|
331
318
|
options.apply_defaults timeout: @config.rpcs.batch_process_documents.timeout,
|
332
319
|
metadata: metadata,
|
333
320
|
retry_policy: @config.rpcs.batch_process_documents.retry_policy
|
334
|
-
|
321
|
+
|
322
|
+
options.apply_defaults timeout: @config.timeout,
|
323
|
+
metadata: @config.metadata,
|
335
324
|
retry_policy: @config.retry_policy
|
336
325
|
|
337
326
|
@document_processor_service_stub.call_rpc :batch_process_documents, request, options: options do |response, operation|
|
@@ -343,6 +332,433 @@ module Google
|
|
343
332
|
raise ::Google::Cloud::Error.from_error(e)
|
344
333
|
end
|
345
334
|
|
335
|
+
##
|
336
|
+
# Fetches processor types.
|
337
|
+
#
|
338
|
+
# @overload fetch_processor_types(request, options = nil)
|
339
|
+
# Pass arguments to `fetch_processor_types` via a request object, either of type
|
340
|
+
# {::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest} or an equivalent Hash.
|
341
|
+
#
|
342
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest, ::Hash]
|
343
|
+
# A request object representing the call parameters. Required. To specify no
|
344
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
345
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
346
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
347
|
+
#
|
348
|
+
# @overload fetch_processor_types(parent: nil)
|
349
|
+
# Pass arguments to `fetch_processor_types` via keyword arguments. Note that at
|
350
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
351
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
352
|
+
#
|
353
|
+
# @param parent [::String]
|
354
|
+
# Required. The project of processor type to list.
|
355
|
+
# Format: projects/\\{project}/locations/\\{location}
|
356
|
+
#
|
357
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
358
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse]
|
359
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
360
|
+
#
|
361
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse]
|
362
|
+
#
|
363
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
364
|
+
#
|
365
|
+
def fetch_processor_types request, options = nil
|
366
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
367
|
+
|
368
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest
|
369
|
+
|
370
|
+
# Converts hash and nil to an options object
|
371
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
372
|
+
|
373
|
+
# Customize the options with defaults
|
374
|
+
metadata = @config.rpcs.fetch_processor_types.metadata.to_h
|
375
|
+
|
376
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
377
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
378
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
379
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
380
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
381
|
+
|
382
|
+
header_params = {
|
383
|
+
"parent" => request.parent
|
384
|
+
}
|
385
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
386
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
387
|
+
|
388
|
+
options.apply_defaults timeout: @config.rpcs.fetch_processor_types.timeout,
|
389
|
+
metadata: metadata,
|
390
|
+
retry_policy: @config.rpcs.fetch_processor_types.retry_policy
|
391
|
+
|
392
|
+
options.apply_defaults timeout: @config.timeout,
|
393
|
+
metadata: @config.metadata,
|
394
|
+
retry_policy: @config.retry_policy
|
395
|
+
|
396
|
+
@document_processor_service_stub.call_rpc :fetch_processor_types, request, options: options do |response, operation|
|
397
|
+
yield response, operation if block_given?
|
398
|
+
return response
|
399
|
+
end
|
400
|
+
rescue ::GRPC::BadStatus => e
|
401
|
+
raise ::Google::Cloud::Error.from_error(e)
|
402
|
+
end
|
403
|
+
|
404
|
+
##
|
405
|
+
# Lists all processors which belong to this project.
|
406
|
+
#
|
407
|
+
# @overload list_processors(request, options = nil)
|
408
|
+
# Pass arguments to `list_processors` via a request object, either of type
|
409
|
+
# {::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest} or an equivalent Hash.
|
410
|
+
#
|
411
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest, ::Hash]
|
412
|
+
# A request object representing the call parameters. Required. To specify no
|
413
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
414
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
415
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
416
|
+
#
|
417
|
+
# @overload list_processors(parent: nil, page_size: nil, page_token: nil)
|
418
|
+
# Pass arguments to `list_processors` via keyword arguments. Note that at
|
419
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
420
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
421
|
+
#
|
422
|
+
# @param parent [::String]
|
423
|
+
# Required. The parent (project and location) which owns this collection of Processors.
|
424
|
+
# Format: projects/\\{project}/locations/\\{location}
|
425
|
+
# @param page_size [::Integer]
|
426
|
+
# The maximum number of processors to return.
|
427
|
+
# If unspecified, at most 50 processors will be returned.
|
428
|
+
# The maximum value is 100; values above 100 will be coerced to 100.
|
429
|
+
# @param page_token [::String]
|
430
|
+
# We will return the processors sorted by creation time. The page token
|
431
|
+
# will point to the next processor.
|
432
|
+
#
|
433
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
434
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>]
|
435
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
436
|
+
#
|
437
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Processor>]
|
438
|
+
#
|
439
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
440
|
+
#
|
441
|
+
def list_processors request, options = nil
|
442
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
443
|
+
|
444
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListProcessorsRequest
|
445
|
+
|
446
|
+
# Converts hash and nil to an options object
|
447
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
448
|
+
|
449
|
+
# Customize the options with defaults
|
450
|
+
metadata = @config.rpcs.list_processors.metadata.to_h
|
451
|
+
|
452
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
453
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
454
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
455
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
456
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
457
|
+
|
458
|
+
header_params = {
|
459
|
+
"parent" => request.parent
|
460
|
+
}
|
461
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
462
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
463
|
+
|
464
|
+
options.apply_defaults timeout: @config.rpcs.list_processors.timeout,
|
465
|
+
metadata: metadata,
|
466
|
+
retry_policy: @config.rpcs.list_processors.retry_policy
|
467
|
+
|
468
|
+
options.apply_defaults timeout: @config.timeout,
|
469
|
+
metadata: @config.metadata,
|
470
|
+
retry_policy: @config.retry_policy
|
471
|
+
|
472
|
+
@document_processor_service_stub.call_rpc :list_processors, request, options: options do |response, operation|
|
473
|
+
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processors, request, response, operation, options
|
474
|
+
yield response, operation if block_given?
|
475
|
+
return response
|
476
|
+
end
|
477
|
+
rescue ::GRPC::BadStatus => e
|
478
|
+
raise ::Google::Cloud::Error.from_error(e)
|
479
|
+
end
|
480
|
+
|
481
|
+
##
|
482
|
+
# Creates a processor from the type processor that the user chose.
|
483
|
+
# The processor will be at "ENABLED" state by default after its creation.
|
484
|
+
#
|
485
|
+
# @overload create_processor(request, options = nil)
|
486
|
+
# Pass arguments to `create_processor` via a request object, either of type
|
487
|
+
# {::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest} or an equivalent Hash.
|
488
|
+
#
|
489
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest, ::Hash]
|
490
|
+
# A request object representing the call parameters. Required. To specify no
|
491
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
492
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
493
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
494
|
+
#
|
495
|
+
# @overload create_processor(parent: nil, processor: nil)
|
496
|
+
# Pass arguments to `create_processor` via keyword arguments. Note that at
|
497
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
498
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
499
|
+
#
|
500
|
+
# @param parent [::String]
|
501
|
+
# Required. The parent (project and location) under which to create the processor.
|
502
|
+
# Format: projects/\\{project}/locations/\\{location}
|
503
|
+
# @param processor [::Google::Cloud::DocumentAI::V1beta3::Processor, ::Hash]
|
504
|
+
# Required. The processor to be created, requires [processor_type] and [display_name]
|
505
|
+
# to be set. Also, the processor is under CMEK if CMEK fields are set.
|
506
|
+
#
|
507
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
508
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
509
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
510
|
+
#
|
511
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
512
|
+
#
|
513
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
514
|
+
#
|
515
|
+
def create_processor request, options = nil
|
516
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
517
|
+
|
518
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest
|
519
|
+
|
520
|
+
# Converts hash and nil to an options object
|
521
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
522
|
+
|
523
|
+
# Customize the options with defaults
|
524
|
+
metadata = @config.rpcs.create_processor.metadata.to_h
|
525
|
+
|
526
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
527
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
528
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
529
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
530
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
531
|
+
|
532
|
+
header_params = {
|
533
|
+
"parent" => request.parent
|
534
|
+
}
|
535
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
536
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
537
|
+
|
538
|
+
options.apply_defaults timeout: @config.rpcs.create_processor.timeout,
|
539
|
+
metadata: metadata,
|
540
|
+
retry_policy: @config.rpcs.create_processor.retry_policy
|
541
|
+
|
542
|
+
options.apply_defaults timeout: @config.timeout,
|
543
|
+
metadata: @config.metadata,
|
544
|
+
retry_policy: @config.retry_policy
|
545
|
+
|
546
|
+
@document_processor_service_stub.call_rpc :create_processor, request, options: options do |response, operation|
|
547
|
+
yield response, operation if block_given?
|
548
|
+
return response
|
549
|
+
end
|
550
|
+
rescue ::GRPC::BadStatus => e
|
551
|
+
raise ::Google::Cloud::Error.from_error(e)
|
552
|
+
end
|
553
|
+
|
554
|
+
##
|
555
|
+
# Deletes the processor, unloads all deployed model artifacts if it was
|
556
|
+
# enabled and then deletes all artifacts associated with this processor.
|
557
|
+
#
|
558
|
+
# @overload delete_processor(request, options = nil)
|
559
|
+
# Pass arguments to `delete_processor` via a request object, either of type
|
560
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest} or an equivalent Hash.
|
561
|
+
#
|
562
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest, ::Hash]
|
563
|
+
# A request object representing the call parameters. Required. To specify no
|
564
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
565
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
566
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
567
|
+
#
|
568
|
+
# @overload delete_processor(name: nil)
|
569
|
+
# Pass arguments to `delete_processor` via keyword arguments. Note that at
|
570
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
571
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
572
|
+
#
|
573
|
+
# @param name [::String]
|
574
|
+
# Required. The processor resource name to be deleted.
|
575
|
+
#
|
576
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
577
|
+
# @yieldparam response [::Gapic::Operation]
|
578
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
579
|
+
#
|
580
|
+
# @return [::Gapic::Operation]
|
581
|
+
#
|
582
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
583
|
+
#
|
584
|
+
def delete_processor request, options = nil
|
585
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
586
|
+
|
587
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest
|
588
|
+
|
589
|
+
# Converts hash and nil to an options object
|
590
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
591
|
+
|
592
|
+
# Customize the options with defaults
|
593
|
+
metadata = @config.rpcs.delete_processor.metadata.to_h
|
594
|
+
|
595
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
596
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
597
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
598
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
599
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
600
|
+
|
601
|
+
header_params = {
|
602
|
+
"name" => request.name
|
603
|
+
}
|
604
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
605
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
606
|
+
|
607
|
+
options.apply_defaults timeout: @config.rpcs.delete_processor.timeout,
|
608
|
+
metadata: metadata,
|
609
|
+
retry_policy: @config.rpcs.delete_processor.retry_policy
|
610
|
+
|
611
|
+
options.apply_defaults timeout: @config.timeout,
|
612
|
+
metadata: @config.metadata,
|
613
|
+
retry_policy: @config.retry_policy
|
614
|
+
|
615
|
+
@document_processor_service_stub.call_rpc :delete_processor, request, options: options do |response, operation|
|
616
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
617
|
+
yield response, operation if block_given?
|
618
|
+
return response
|
619
|
+
end
|
620
|
+
rescue ::GRPC::BadStatus => e
|
621
|
+
raise ::Google::Cloud::Error.from_error(e)
|
622
|
+
end
|
623
|
+
|
624
|
+
##
|
625
|
+
# Enables a processor
|
626
|
+
#
|
627
|
+
# @overload enable_processor(request, options = nil)
|
628
|
+
# Pass arguments to `enable_processor` via a request object, either of type
|
629
|
+
# {::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest} or an equivalent Hash.
|
630
|
+
#
|
631
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest, ::Hash]
|
632
|
+
# A request object representing the call parameters. Required. To specify no
|
633
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
634
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
635
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
636
|
+
#
|
637
|
+
# @overload enable_processor(name: nil)
|
638
|
+
# Pass arguments to `enable_processor` via keyword arguments. Note that at
|
639
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
640
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
641
|
+
#
|
642
|
+
# @param name [::String]
|
643
|
+
# Required. The processor resource name to be enabled.
|
644
|
+
#
|
645
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
646
|
+
# @yieldparam response [::Gapic::Operation]
|
647
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
648
|
+
#
|
649
|
+
# @return [::Gapic::Operation]
|
650
|
+
#
|
651
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
652
|
+
#
|
653
|
+
def enable_processor request, options = nil
|
654
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
655
|
+
|
656
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest
|
657
|
+
|
658
|
+
# Converts hash and nil to an options object
|
659
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
660
|
+
|
661
|
+
# Customize the options with defaults
|
662
|
+
metadata = @config.rpcs.enable_processor.metadata.to_h
|
663
|
+
|
664
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
665
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
666
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
667
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
668
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
669
|
+
|
670
|
+
header_params = {
|
671
|
+
"name" => request.name
|
672
|
+
}
|
673
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
674
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
675
|
+
|
676
|
+
options.apply_defaults timeout: @config.rpcs.enable_processor.timeout,
|
677
|
+
metadata: metadata,
|
678
|
+
retry_policy: @config.rpcs.enable_processor.retry_policy
|
679
|
+
|
680
|
+
options.apply_defaults timeout: @config.timeout,
|
681
|
+
metadata: @config.metadata,
|
682
|
+
retry_policy: @config.retry_policy
|
683
|
+
|
684
|
+
@document_processor_service_stub.call_rpc :enable_processor, request, options: options do |response, operation|
|
685
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
686
|
+
yield response, operation if block_given?
|
687
|
+
return response
|
688
|
+
end
|
689
|
+
rescue ::GRPC::BadStatus => e
|
690
|
+
raise ::Google::Cloud::Error.from_error(e)
|
691
|
+
end
|
692
|
+
|
693
|
+
##
|
694
|
+
# Disables a processor
|
695
|
+
#
|
696
|
+
# @overload disable_processor(request, options = nil)
|
697
|
+
# Pass arguments to `disable_processor` via a request object, either of type
|
698
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest} or an equivalent Hash.
|
699
|
+
#
|
700
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest, ::Hash]
|
701
|
+
# A request object representing the call parameters. Required. To specify no
|
702
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
703
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
704
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
705
|
+
#
|
706
|
+
# @overload disable_processor(name: nil)
|
707
|
+
# Pass arguments to `disable_processor` via keyword arguments. Note that at
|
708
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
709
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
710
|
+
#
|
711
|
+
# @param name [::String]
|
712
|
+
# Required. The processor resource name to be disabled.
|
713
|
+
#
|
714
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
715
|
+
# @yieldparam response [::Gapic::Operation]
|
716
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
717
|
+
#
|
718
|
+
# @return [::Gapic::Operation]
|
719
|
+
#
|
720
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
721
|
+
#
|
722
|
+
def disable_processor request, options = nil
|
723
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
724
|
+
|
725
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest
|
726
|
+
|
727
|
+
# Converts hash and nil to an options object
|
728
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
729
|
+
|
730
|
+
# Customize the options with defaults
|
731
|
+
metadata = @config.rpcs.disable_processor.metadata.to_h
|
732
|
+
|
733
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
734
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
735
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
736
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
737
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
738
|
+
|
739
|
+
header_params = {
|
740
|
+
"name" => request.name
|
741
|
+
}
|
742
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
743
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
744
|
+
|
745
|
+
options.apply_defaults timeout: @config.rpcs.disable_processor.timeout,
|
746
|
+
metadata: metadata,
|
747
|
+
retry_policy: @config.rpcs.disable_processor.retry_policy
|
748
|
+
|
749
|
+
options.apply_defaults timeout: @config.timeout,
|
750
|
+
metadata: @config.metadata,
|
751
|
+
retry_policy: @config.retry_policy
|
752
|
+
|
753
|
+
@document_processor_service_stub.call_rpc :disable_processor, request, options: options do |response, operation|
|
754
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
755
|
+
yield response, operation if block_given?
|
756
|
+
return response
|
757
|
+
end
|
758
|
+
rescue ::GRPC::BadStatus => e
|
759
|
+
raise ::Google::Cloud::Error.from_error(e)
|
760
|
+
end
|
761
|
+
|
346
762
|
##
|
347
763
|
# Send a document for Human Review. The input document should be processed by
|
348
764
|
# the specified processor.
|
@@ -357,7 +773,7 @@ module Google
|
|
357
773
|
# @param options [::Gapic::CallOptions, ::Hash]
|
358
774
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
359
775
|
#
|
360
|
-
# @overload review_document(inline_document: nil, human_review_config: nil, document: nil)
|
776
|
+
# @overload review_document(inline_document: nil, human_review_config: nil, document: nil, enable_schema_validation: nil, priority: nil)
|
361
777
|
# Pass arguments to `review_document` via keyword arguments. Note that at
|
362
778
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
363
779
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -369,6 +785,10 @@ module Google
|
|
369
785
|
# reviewed with.
|
370
786
|
# @param document [::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash]
|
371
787
|
# The document that needs human review.
|
788
|
+
# @param enable_schema_validation [::Boolean]
|
789
|
+
# Whether the validation should be performed on the ad-hoc review request.
|
790
|
+
# @param priority [::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest::Priority]
|
791
|
+
# The priority of the human review task.
|
372
792
|
#
|
373
793
|
# @yield [response, operation] Access the result along with the RPC operation
|
374
794
|
# @yieldparam response [::Gapic::Operation]
|
@@ -404,7 +824,9 @@ module Google
|
|
404
824
|
options.apply_defaults timeout: @config.rpcs.review_document.timeout,
|
405
825
|
metadata: metadata,
|
406
826
|
retry_policy: @config.rpcs.review_document.retry_policy
|
407
|
-
|
827
|
+
|
828
|
+
options.apply_defaults timeout: @config.timeout,
|
829
|
+
metadata: @config.metadata,
|
408
830
|
retry_policy: @config.retry_policy
|
409
831
|
|
410
832
|
@document_processor_service_stub.call_rpc :review_document, request, options: options do |response, operation|
|
@@ -429,26 +851,25 @@ module Google
|
|
429
851
|
# Configuration can be applied globally to all clients, or to a single client
|
430
852
|
# on construction.
|
431
853
|
#
|
432
|
-
#
|
854
|
+
# @example
|
433
855
|
#
|
434
|
-
#
|
435
|
-
# to 20 seconds,
|
856
|
+
# # Modify the global config, setting the timeout for
|
857
|
+
# # process_document to 20 seconds,
|
858
|
+
# # and all remaining timeouts to 10 seconds.
|
859
|
+
# ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.configure do |config|
|
860
|
+
# config.timeout = 10.0
|
861
|
+
# config.rpcs.process_document.timeout = 20.0
|
862
|
+
# end
|
436
863
|
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
#
|
441
|
-
#
|
442
|
-
# To apply the above configuration only to a new client:
|
443
|
-
#
|
444
|
-
# client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new do |config|
|
445
|
-
# config.timeout = 10.0
|
446
|
-
# config.rpcs.process_document.timeout = 20.0
|
447
|
-
# end
|
864
|
+
# # Apply the above configuration only to a new client.
|
865
|
+
# client = ::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new do |config|
|
866
|
+
# config.timeout = 10.0
|
867
|
+
# config.rpcs.process_document.timeout = 20.0
|
868
|
+
# end
|
448
869
|
#
|
449
870
|
# @!attribute [rw] endpoint
|
450
871
|
# The hostname or hostname:port of the service endpoint.
|
451
|
-
# Defaults to `"
|
872
|
+
# Defaults to `"documentai.googleapis.com"`.
|
452
873
|
# @return [::String]
|
453
874
|
# @!attribute [rw] credentials
|
454
875
|
# Credentials to send with calls. You may provide any of the following types:
|
@@ -499,7 +920,7 @@ module Google
|
|
499
920
|
class Configuration
|
500
921
|
extend ::Gapic::Config
|
501
922
|
|
502
|
-
config_attr :endpoint, "
|
923
|
+
config_attr :endpoint, "documentai.googleapis.com", ::String
|
503
924
|
config_attr :credentials, nil do |value|
|
504
925
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
505
926
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -563,6 +984,36 @@ module Google
|
|
563
984
|
#
|
564
985
|
attr_reader :batch_process_documents
|
565
986
|
##
|
987
|
+
# RPC-specific configuration for `fetch_processor_types`
|
988
|
+
# @return [::Gapic::Config::Method]
|
989
|
+
#
|
990
|
+
attr_reader :fetch_processor_types
|
991
|
+
##
|
992
|
+
# RPC-specific configuration for `list_processors`
|
993
|
+
# @return [::Gapic::Config::Method]
|
994
|
+
#
|
995
|
+
attr_reader :list_processors
|
996
|
+
##
|
997
|
+
# RPC-specific configuration for `create_processor`
|
998
|
+
# @return [::Gapic::Config::Method]
|
999
|
+
#
|
1000
|
+
attr_reader :create_processor
|
1001
|
+
##
|
1002
|
+
# RPC-specific configuration for `delete_processor`
|
1003
|
+
# @return [::Gapic::Config::Method]
|
1004
|
+
#
|
1005
|
+
attr_reader :delete_processor
|
1006
|
+
##
|
1007
|
+
# RPC-specific configuration for `enable_processor`
|
1008
|
+
# @return [::Gapic::Config::Method]
|
1009
|
+
#
|
1010
|
+
attr_reader :enable_processor
|
1011
|
+
##
|
1012
|
+
# RPC-specific configuration for `disable_processor`
|
1013
|
+
# @return [::Gapic::Config::Method]
|
1014
|
+
#
|
1015
|
+
attr_reader :disable_processor
|
1016
|
+
##
|
566
1017
|
# RPC-specific configuration for `review_document`
|
567
1018
|
# @return [::Gapic::Config::Method]
|
568
1019
|
#
|
@@ -574,6 +1025,18 @@ module Google
|
|
574
1025
|
@process_document = ::Gapic::Config::Method.new process_document_config
|
575
1026
|
batch_process_documents_config = parent_rpcs.batch_process_documents if parent_rpcs.respond_to? :batch_process_documents
|
576
1027
|
@batch_process_documents = ::Gapic::Config::Method.new batch_process_documents_config
|
1028
|
+
fetch_processor_types_config = parent_rpcs.fetch_processor_types if parent_rpcs.respond_to? :fetch_processor_types
|
1029
|
+
@fetch_processor_types = ::Gapic::Config::Method.new fetch_processor_types_config
|
1030
|
+
list_processors_config = parent_rpcs.list_processors if parent_rpcs.respond_to? :list_processors
|
1031
|
+
@list_processors = ::Gapic::Config::Method.new list_processors_config
|
1032
|
+
create_processor_config = parent_rpcs.create_processor if parent_rpcs.respond_to? :create_processor
|
1033
|
+
@create_processor = ::Gapic::Config::Method.new create_processor_config
|
1034
|
+
delete_processor_config = parent_rpcs.delete_processor if parent_rpcs.respond_to? :delete_processor
|
1035
|
+
@delete_processor = ::Gapic::Config::Method.new delete_processor_config
|
1036
|
+
enable_processor_config = parent_rpcs.enable_processor if parent_rpcs.respond_to? :enable_processor
|
1037
|
+
@enable_processor = ::Gapic::Config::Method.new enable_processor_config
|
1038
|
+
disable_processor_config = parent_rpcs.disable_processor if parent_rpcs.respond_to? :disable_processor
|
1039
|
+
@disable_processor = ::Gapic::Config::Method.new disable_processor_config
|
577
1040
|
review_document_config = parent_rpcs.review_document if parent_rpcs.respond_to? :review_document
|
578
1041
|
@review_document = ::Gapic::Config::Method.new review_document_config
|
579
1042
|
|