google-cloud-document_ai-v1beta3 0.6.0 → 0.9.1
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 +468 -16
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/operations.rb +6 -6
- 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 +5 -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 +30 -20
- 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: b3d3ec1b0a579c0f9cd3c746d04f134df4d220b34b68ee4ee08818d3823a3814
|
4
|
+
data.tar.gz: 2e2c22303302e83f35bf2fe12c9a136adb4a60f1c8b5590a83b6f71a39b1192e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfd5af612a18543e5a7c91b93bc412a447d498dbf32d9a13873375beae37912471f37c37683ae222d535bd165eac638307772f67f9acd504ca5e78392d365627
|
7
|
+
data.tar.gz: a581b6dd97f6542639367ba8bd74cbc4e851808171fe0ed24286259a5b66552c61cd7ac6fb2d942f243069761c865429d963e635a2a61880cdd0dc157e441f4b
|
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
|
|
@@ -70,26 +70,17 @@ module Google
|
|
70
70
|
|
71
71
|
default_config.rpcs.process_document.timeout = 120.0
|
72
72
|
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]
|
73
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
77
74
|
}
|
78
75
|
|
79
76
|
default_config.rpcs.batch_process_documents.timeout = 120.0
|
80
77
|
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]
|
78
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
85
79
|
}
|
86
80
|
|
87
81
|
default_config.rpcs.review_document.timeout = 120.0
|
88
82
|
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]
|
83
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
93
84
|
}
|
94
85
|
|
95
86
|
default_config
|
@@ -160,7 +151,7 @@ module Google
|
|
160
151
|
!@config.endpoint.split(".").first.include?("-")
|
161
152
|
credentials ||= Credentials.default scope: @config.scope,
|
162
153
|
enable_self_signed_jwt: enable_self_signed_jwt
|
163
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
154
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
164
155
|
credentials = Credentials.new credentials, scope: @config.scope
|
165
156
|
end
|
166
157
|
@quota_project_id = @config.quota_project
|
@@ -343,6 +334,421 @@ module Google
|
|
343
334
|
raise ::Google::Cloud::Error.from_error(e)
|
344
335
|
end
|
345
336
|
|
337
|
+
##
|
338
|
+
# Fetches processor types.
|
339
|
+
#
|
340
|
+
# @overload fetch_processor_types(request, options = nil)
|
341
|
+
# Pass arguments to `fetch_processor_types` via a request object, either of type
|
342
|
+
# {::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest} or an equivalent Hash.
|
343
|
+
#
|
344
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest, ::Hash]
|
345
|
+
# A request object representing the call parameters. Required. To specify no
|
346
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
347
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
348
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
349
|
+
#
|
350
|
+
# @overload fetch_processor_types(parent: nil)
|
351
|
+
# Pass arguments to `fetch_processor_types` via keyword arguments. Note that at
|
352
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
353
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
354
|
+
#
|
355
|
+
# @param parent [::String]
|
356
|
+
# Required. The project of processor type to list.
|
357
|
+
# Format: projects/\\{project}/locations/\\{location}
|
358
|
+
#
|
359
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
360
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse]
|
361
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
362
|
+
#
|
363
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse]
|
364
|
+
#
|
365
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
366
|
+
#
|
367
|
+
def fetch_processor_types request, options = nil
|
368
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
369
|
+
|
370
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesRequest
|
371
|
+
|
372
|
+
# Converts hash and nil to an options object
|
373
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
374
|
+
|
375
|
+
# Customize the options with defaults
|
376
|
+
metadata = @config.rpcs.fetch_processor_types.metadata.to_h
|
377
|
+
|
378
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
379
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
380
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
381
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
382
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
383
|
+
|
384
|
+
header_params = {
|
385
|
+
"parent" => request.parent
|
386
|
+
}
|
387
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
388
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
389
|
+
|
390
|
+
options.apply_defaults timeout: @config.rpcs.fetch_processor_types.timeout,
|
391
|
+
metadata: metadata,
|
392
|
+
retry_policy: @config.rpcs.fetch_processor_types.retry_policy
|
393
|
+
options.apply_defaults 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
|
+
options.apply_defaults metadata: @config.metadata,
|
468
|
+
retry_policy: @config.retry_policy
|
469
|
+
|
470
|
+
@document_processor_service_stub.call_rpc :list_processors, request, options: options do |response, operation|
|
471
|
+
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processors, request, response, operation, options
|
472
|
+
yield response, operation if block_given?
|
473
|
+
return response
|
474
|
+
end
|
475
|
+
rescue ::GRPC::BadStatus => e
|
476
|
+
raise ::Google::Cloud::Error.from_error(e)
|
477
|
+
end
|
478
|
+
|
479
|
+
##
|
480
|
+
# Creates a processor from the type processor that the user chose.
|
481
|
+
# The processor will be at "ENABLED" state by default after its creation.
|
482
|
+
#
|
483
|
+
# @overload create_processor(request, options = nil)
|
484
|
+
# Pass arguments to `create_processor` via a request object, either of type
|
485
|
+
# {::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest} or an equivalent Hash.
|
486
|
+
#
|
487
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest, ::Hash]
|
488
|
+
# A request object representing the call parameters. Required. To specify no
|
489
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
490
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
491
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
492
|
+
#
|
493
|
+
# @overload create_processor(parent: nil, processor: nil)
|
494
|
+
# Pass arguments to `create_processor` via keyword arguments. Note that at
|
495
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
496
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
497
|
+
#
|
498
|
+
# @param parent [::String]
|
499
|
+
# Required. The parent (project and location) under which to create the processor.
|
500
|
+
# Format: projects/\\{project}/locations/\\{location}
|
501
|
+
# @param processor [::Google::Cloud::DocumentAI::V1beta3::Processor, ::Hash]
|
502
|
+
# Required. The processor to be created, requires [processor_type] and [display_name]
|
503
|
+
# to be set. Also, the processor is under CMEK if CMEK fields are set.
|
504
|
+
#
|
505
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
506
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
507
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
508
|
+
#
|
509
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
510
|
+
#
|
511
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
512
|
+
#
|
513
|
+
def create_processor request, options = nil
|
514
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
515
|
+
|
516
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest
|
517
|
+
|
518
|
+
# Converts hash and nil to an options object
|
519
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
520
|
+
|
521
|
+
# Customize the options with defaults
|
522
|
+
metadata = @config.rpcs.create_processor.metadata.to_h
|
523
|
+
|
524
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
525
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
526
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
527
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
528
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
529
|
+
|
530
|
+
header_params = {
|
531
|
+
"parent" => request.parent
|
532
|
+
}
|
533
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
534
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
535
|
+
|
536
|
+
options.apply_defaults timeout: @config.rpcs.create_processor.timeout,
|
537
|
+
metadata: metadata,
|
538
|
+
retry_policy: @config.rpcs.create_processor.retry_policy
|
539
|
+
options.apply_defaults metadata: @config.metadata,
|
540
|
+
retry_policy: @config.retry_policy
|
541
|
+
|
542
|
+
@document_processor_service_stub.call_rpc :create_processor, request, options: options do |response, operation|
|
543
|
+
yield response, operation if block_given?
|
544
|
+
return response
|
545
|
+
end
|
546
|
+
rescue ::GRPC::BadStatus => e
|
547
|
+
raise ::Google::Cloud::Error.from_error(e)
|
548
|
+
end
|
549
|
+
|
550
|
+
##
|
551
|
+
# Deletes the processor, unloads all deployed model artifacts if it was
|
552
|
+
# enabled and then deletes all artifacts associated with this processor.
|
553
|
+
#
|
554
|
+
# @overload delete_processor(request, options = nil)
|
555
|
+
# Pass arguments to `delete_processor` via a request object, either of type
|
556
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest} or an equivalent Hash.
|
557
|
+
#
|
558
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest, ::Hash]
|
559
|
+
# A request object representing the call parameters. Required. To specify no
|
560
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
561
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
562
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
563
|
+
#
|
564
|
+
# @overload delete_processor(name: nil)
|
565
|
+
# Pass arguments to `delete_processor` via keyword arguments. Note that at
|
566
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
567
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
568
|
+
#
|
569
|
+
# @param name [::String]
|
570
|
+
# Required. The processor resource name to be deleted.
|
571
|
+
#
|
572
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
573
|
+
# @yieldparam response [::Gapic::Operation]
|
574
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
575
|
+
#
|
576
|
+
# @return [::Gapic::Operation]
|
577
|
+
#
|
578
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
579
|
+
#
|
580
|
+
def delete_processor request, options = nil
|
581
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
582
|
+
|
583
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest
|
584
|
+
|
585
|
+
# Converts hash and nil to an options object
|
586
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
587
|
+
|
588
|
+
# Customize the options with defaults
|
589
|
+
metadata = @config.rpcs.delete_processor.metadata.to_h
|
590
|
+
|
591
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
592
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
593
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
594
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
595
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
596
|
+
|
597
|
+
header_params = {
|
598
|
+
"name" => request.name
|
599
|
+
}
|
600
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
601
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
602
|
+
|
603
|
+
options.apply_defaults timeout: @config.rpcs.delete_processor.timeout,
|
604
|
+
metadata: metadata,
|
605
|
+
retry_policy: @config.rpcs.delete_processor.retry_policy
|
606
|
+
options.apply_defaults metadata: @config.metadata,
|
607
|
+
retry_policy: @config.retry_policy
|
608
|
+
|
609
|
+
@document_processor_service_stub.call_rpc :delete_processor, request, options: options do |response, operation|
|
610
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
611
|
+
yield response, operation if block_given?
|
612
|
+
return response
|
613
|
+
end
|
614
|
+
rescue ::GRPC::BadStatus => e
|
615
|
+
raise ::Google::Cloud::Error.from_error(e)
|
616
|
+
end
|
617
|
+
|
618
|
+
##
|
619
|
+
# Enables a processor
|
620
|
+
#
|
621
|
+
# @overload enable_processor(request, options = nil)
|
622
|
+
# Pass arguments to `enable_processor` via a request object, either of type
|
623
|
+
# {::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest} or an equivalent Hash.
|
624
|
+
#
|
625
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest, ::Hash]
|
626
|
+
# A request object representing the call parameters. Required. To specify no
|
627
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
628
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
629
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
630
|
+
#
|
631
|
+
# @overload enable_processor(name: nil)
|
632
|
+
# Pass arguments to `enable_processor` via keyword arguments. Note that at
|
633
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
634
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
635
|
+
#
|
636
|
+
# @param name [::String]
|
637
|
+
# Required. The processor resource name to be enabled.
|
638
|
+
#
|
639
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
640
|
+
# @yieldparam response [::Gapic::Operation]
|
641
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
642
|
+
#
|
643
|
+
# @return [::Gapic::Operation]
|
644
|
+
#
|
645
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
646
|
+
#
|
647
|
+
def enable_processor request, options = nil
|
648
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
649
|
+
|
650
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest
|
651
|
+
|
652
|
+
# Converts hash and nil to an options object
|
653
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
654
|
+
|
655
|
+
# Customize the options with defaults
|
656
|
+
metadata = @config.rpcs.enable_processor.metadata.to_h
|
657
|
+
|
658
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
659
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
660
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
661
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
662
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
663
|
+
|
664
|
+
header_params = {
|
665
|
+
"name" => request.name
|
666
|
+
}
|
667
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
668
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
669
|
+
|
670
|
+
options.apply_defaults timeout: @config.rpcs.enable_processor.timeout,
|
671
|
+
metadata: metadata,
|
672
|
+
retry_policy: @config.rpcs.enable_processor.retry_policy
|
673
|
+
options.apply_defaults metadata: @config.metadata,
|
674
|
+
retry_policy: @config.retry_policy
|
675
|
+
|
676
|
+
@document_processor_service_stub.call_rpc :enable_processor, request, options: options do |response, operation|
|
677
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
678
|
+
yield response, operation if block_given?
|
679
|
+
return response
|
680
|
+
end
|
681
|
+
rescue ::GRPC::BadStatus => e
|
682
|
+
raise ::Google::Cloud::Error.from_error(e)
|
683
|
+
end
|
684
|
+
|
685
|
+
##
|
686
|
+
# Disables a processor
|
687
|
+
#
|
688
|
+
# @overload disable_processor(request, options = nil)
|
689
|
+
# Pass arguments to `disable_processor` via a request object, either of type
|
690
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest} or an equivalent Hash.
|
691
|
+
#
|
692
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest, ::Hash]
|
693
|
+
# A request object representing the call parameters. Required. To specify no
|
694
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
695
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
696
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
697
|
+
#
|
698
|
+
# @overload disable_processor(name: nil)
|
699
|
+
# Pass arguments to `disable_processor` via keyword arguments. Note that at
|
700
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
701
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
702
|
+
#
|
703
|
+
# @param name [::String]
|
704
|
+
# Required. The processor resource name to be disabled.
|
705
|
+
#
|
706
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
707
|
+
# @yieldparam response [::Gapic::Operation]
|
708
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
709
|
+
#
|
710
|
+
# @return [::Gapic::Operation]
|
711
|
+
#
|
712
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
713
|
+
#
|
714
|
+
def disable_processor request, options = nil
|
715
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
716
|
+
|
717
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest
|
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
|
+
metadata = @config.rpcs.disable_processor.metadata.to_h
|
724
|
+
|
725
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
726
|
+
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::V1beta3::VERSION
|
729
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
730
|
+
|
731
|
+
header_params = {
|
732
|
+
"name" => request.name
|
733
|
+
}
|
734
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
735
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
736
|
+
|
737
|
+
options.apply_defaults timeout: @config.rpcs.disable_processor.timeout,
|
738
|
+
metadata: metadata,
|
739
|
+
retry_policy: @config.rpcs.disable_processor.retry_policy
|
740
|
+
options.apply_defaults metadata: @config.metadata,
|
741
|
+
retry_policy: @config.retry_policy
|
742
|
+
|
743
|
+
@document_processor_service_stub.call_rpc :disable_processor, request, options: options do |response, operation|
|
744
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
745
|
+
yield response, operation if block_given?
|
746
|
+
return response
|
747
|
+
end
|
748
|
+
rescue ::GRPC::BadStatus => e
|
749
|
+
raise ::Google::Cloud::Error.from_error(e)
|
750
|
+
end
|
751
|
+
|
346
752
|
##
|
347
753
|
# Send a document for Human Review. The input document should be processed by
|
348
754
|
# the specified processor.
|
@@ -357,7 +763,7 @@ module Google
|
|
357
763
|
# @param options [::Gapic::CallOptions, ::Hash]
|
358
764
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
359
765
|
#
|
360
|
-
# @overload review_document(inline_document: nil, human_review_config: nil, document: nil)
|
766
|
+
# @overload review_document(inline_document: nil, human_review_config: nil, document: nil, enable_schema_validation: nil, priority: nil)
|
361
767
|
# Pass arguments to `review_document` via keyword arguments. Note that at
|
362
768
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
363
769
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -369,6 +775,10 @@ module Google
|
|
369
775
|
# reviewed with.
|
370
776
|
# @param document [::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash]
|
371
777
|
# The document that needs human review.
|
778
|
+
# @param enable_schema_validation [::Boolean]
|
779
|
+
# Whether the validation should be performed on the ad-hoc review request.
|
780
|
+
# @param priority [::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest::Priority]
|
781
|
+
# The priority of the human review task.
|
372
782
|
#
|
373
783
|
# @yield [response, operation] Access the result along with the RPC operation
|
374
784
|
# @yieldparam response [::Gapic::Operation]
|
@@ -448,7 +858,7 @@ module Google
|
|
448
858
|
#
|
449
859
|
# @!attribute [rw] endpoint
|
450
860
|
# The hostname or hostname:port of the service endpoint.
|
451
|
-
# Defaults to `"
|
861
|
+
# Defaults to `"documentai.googleapis.com"`.
|
452
862
|
# @return [::String]
|
453
863
|
# @!attribute [rw] credentials
|
454
864
|
# Credentials to send with calls. You may provide any of the following types:
|
@@ -499,7 +909,7 @@ module Google
|
|
499
909
|
class Configuration
|
500
910
|
extend ::Gapic::Config
|
501
911
|
|
502
|
-
config_attr :endpoint, "
|
912
|
+
config_attr :endpoint, "documentai.googleapis.com", ::String
|
503
913
|
config_attr :credentials, nil do |value|
|
504
914
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
505
915
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -563,6 +973,36 @@ module Google
|
|
563
973
|
#
|
564
974
|
attr_reader :batch_process_documents
|
565
975
|
##
|
976
|
+
# RPC-specific configuration for `fetch_processor_types`
|
977
|
+
# @return [::Gapic::Config::Method]
|
978
|
+
#
|
979
|
+
attr_reader :fetch_processor_types
|
980
|
+
##
|
981
|
+
# RPC-specific configuration for `list_processors`
|
982
|
+
# @return [::Gapic::Config::Method]
|
983
|
+
#
|
984
|
+
attr_reader :list_processors
|
985
|
+
##
|
986
|
+
# RPC-specific configuration for `create_processor`
|
987
|
+
# @return [::Gapic::Config::Method]
|
988
|
+
#
|
989
|
+
attr_reader :create_processor
|
990
|
+
##
|
991
|
+
# RPC-specific configuration for `delete_processor`
|
992
|
+
# @return [::Gapic::Config::Method]
|
993
|
+
#
|
994
|
+
attr_reader :delete_processor
|
995
|
+
##
|
996
|
+
# RPC-specific configuration for `enable_processor`
|
997
|
+
# @return [::Gapic::Config::Method]
|
998
|
+
#
|
999
|
+
attr_reader :enable_processor
|
1000
|
+
##
|
1001
|
+
# RPC-specific configuration for `disable_processor`
|
1002
|
+
# @return [::Gapic::Config::Method]
|
1003
|
+
#
|
1004
|
+
attr_reader :disable_processor
|
1005
|
+
##
|
566
1006
|
# RPC-specific configuration for `review_document`
|
567
1007
|
# @return [::Gapic::Config::Method]
|
568
1008
|
#
|
@@ -574,6 +1014,18 @@ module Google
|
|
574
1014
|
@process_document = ::Gapic::Config::Method.new process_document_config
|
575
1015
|
batch_process_documents_config = parent_rpcs.batch_process_documents if parent_rpcs.respond_to? :batch_process_documents
|
576
1016
|
@batch_process_documents = ::Gapic::Config::Method.new batch_process_documents_config
|
1017
|
+
fetch_processor_types_config = parent_rpcs.fetch_processor_types if parent_rpcs.respond_to? :fetch_processor_types
|
1018
|
+
@fetch_processor_types = ::Gapic::Config::Method.new fetch_processor_types_config
|
1019
|
+
list_processors_config = parent_rpcs.list_processors if parent_rpcs.respond_to? :list_processors
|
1020
|
+
@list_processors = ::Gapic::Config::Method.new list_processors_config
|
1021
|
+
create_processor_config = parent_rpcs.create_processor if parent_rpcs.respond_to? :create_processor
|
1022
|
+
@create_processor = ::Gapic::Config::Method.new create_processor_config
|
1023
|
+
delete_processor_config = parent_rpcs.delete_processor if parent_rpcs.respond_to? :delete_processor
|
1024
|
+
@delete_processor = ::Gapic::Config::Method.new delete_processor_config
|
1025
|
+
enable_processor_config = parent_rpcs.enable_processor if parent_rpcs.respond_to? :enable_processor
|
1026
|
+
@enable_processor = ::Gapic::Config::Method.new enable_processor_config
|
1027
|
+
disable_processor_config = parent_rpcs.disable_processor if parent_rpcs.respond_to? :disable_processor
|
1028
|
+
@disable_processor = ::Gapic::Config::Method.new disable_processor_config
|
577
1029
|
review_document_config = parent_rpcs.review_document if parent_rpcs.respond_to? :review_document
|
578
1030
|
@review_document = ::Gapic::Config::Method.new review_document_config
|
579
1031
|
|