google-cloud-document_ai-v1beta3 0.12.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/client.rb +1407 -153
- data/lib/google/cloud/document_ai/v1beta3/document_processor_service/paths.rb +44 -0
- data/lib/google/cloud/document_ai/v1beta3/version.rb +1 -1
- data/lib/google/cloud/documentai/v1beta3/barcode_pb.rb +24 -0
- data/lib/google/cloud/documentai/v1beta3/document_io_pb.rb +2 -1
- data/lib/google/cloud/documentai/v1beta3/document_pb.rb +25 -1
- data/lib/google/cloud/documentai/v1beta3/document_processor_service_pb.rb +142 -0
- data/lib/google/cloud/documentai/v1beta3/document_processor_service_services_pb.rb +32 -1
- data/lib/google/cloud/documentai/v1beta3/document_schema_pb.rb +60 -0
- data/lib/google/cloud/documentai/v1beta3/evaluation_pb.rb +72 -0
- data/lib/google/cloud/documentai/v1beta3/geometry_pb.rb +0 -2
- data/lib/google/cloud/documentai/v1beta3/operation_metadata_pb.rb +1 -1
- data/lib/google/cloud/documentai/v1beta3/processor_pb.rb +29 -2
- data/lib/google/cloud/documentai/v1beta3/processor_type_pb.rb +2 -1
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/cloud/documentai/v1beta3/barcode.rb +73 -0
- data/proto_docs/google/cloud/documentai/v1beta3/document.rb +162 -145
- data/proto_docs/google/cloud/documentai/v1beta3/document_io.rb +7 -2
- data/proto_docs/google/cloud/documentai/v1beta3/document_processor_service.rb +382 -10
- data/proto_docs/google/cloud/documentai/v1beta3/document_schema.rb +155 -0
- data/proto_docs/google/cloud/documentai/v1beta3/evaluation.rb +181 -0
- data/proto_docs/google/cloud/documentai/v1beta3/operation_metadata.rb +3 -0
- data/proto_docs/google/cloud/documentai/v1beta3/processor.rb +97 -9
- data/proto_docs/google/cloud/documentai/v1beta3/processor_type.rb +9 -6
- data/proto_docs/google/protobuf/empty.rb +0 -2
- metadata +32 -4
@@ -18,6 +18,7 @@
|
|
18
18
|
|
19
19
|
require "google/cloud/errors"
|
20
20
|
require "google/cloud/documentai/v1beta3/document_processor_service_pb"
|
21
|
+
require "google/cloud/location"
|
21
22
|
|
22
23
|
module Google
|
23
24
|
module Cloud
|
@@ -157,6 +158,12 @@ module Google
|
|
157
158
|
config.endpoint = @config.endpoint
|
158
159
|
end
|
159
160
|
|
161
|
+
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
162
|
+
config.credentials = credentials
|
163
|
+
config.quota_project = @quota_project_id
|
164
|
+
config.endpoint = @config.endpoint
|
165
|
+
end
|
166
|
+
|
160
167
|
@document_processor_service_stub = ::Gapic::ServiceStub.new(
|
161
168
|
::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Stub,
|
162
169
|
credentials: credentials,
|
@@ -173,6 +180,13 @@ module Google
|
|
173
180
|
#
|
174
181
|
attr_reader :operations_client
|
175
182
|
|
183
|
+
##
|
184
|
+
# Get the associated client for mix-in of the Locations.
|
185
|
+
#
|
186
|
+
# @return [Google::Cloud::Location::Locations::Client]
|
187
|
+
#
|
188
|
+
attr_reader :location_client
|
189
|
+
|
176
190
|
# Service calls
|
177
191
|
|
178
192
|
##
|
@@ -188,7 +202,7 @@ module Google
|
|
188
202
|
# @param options [::Gapic::CallOptions, ::Hash]
|
189
203
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
190
204
|
#
|
191
|
-
# @overload process_document(inline_document: nil, raw_document: nil, name: nil, document: nil, skip_human_review: nil)
|
205
|
+
# @overload process_document(inline_document: nil, raw_document: nil, name: nil, document: nil, skip_human_review: nil, field_mask: nil)
|
192
206
|
# Pass arguments to `process_document` via keyword arguments. Note that at
|
193
207
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
194
208
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -198,12 +212,21 @@ module Google
|
|
198
212
|
# @param raw_document [::Google::Cloud::DocumentAI::V1beta3::RawDocument, ::Hash]
|
199
213
|
# A raw document content (bytes).
|
200
214
|
# @param name [::String]
|
201
|
-
# Required. The
|
215
|
+
# Required. The resource name of the {::Google::Cloud::DocumentAI::V1beta3::Processor Processor} or
|
216
|
+
# {::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion ProcessorVersion}
|
217
|
+
# to use for processing. If a {::Google::Cloud::DocumentAI::V1beta3::Processor Processor} is specified, the server will use
|
218
|
+
# its {::Google::Cloud::DocumentAI::V1beta3::Processor#default_processor_version default version}. Format:
|
219
|
+
# `projects/{project}/locations/{location}/processors/{processor}`, or
|
220
|
+
# `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
|
202
221
|
# @param document [::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash]
|
203
222
|
# The document payload, the [content] and [mime_type] fields must be set.
|
204
223
|
# @param skip_human_review [::Boolean]
|
205
224
|
# Whether Human Review feature should be skipped for this request. Default to
|
206
225
|
# false.
|
226
|
+
# @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
|
227
|
+
# Specifies which fields to include in ProcessResponse's document.
|
228
|
+
# Only supports top level document and pages field so it must be in the form
|
229
|
+
# of `{document_field_name}` or `pages.{page_field_name}`.
|
207
230
|
#
|
208
231
|
# @yield [response, operation] Access the result along with the RPC operation
|
209
232
|
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::ProcessResponse]
|
@@ -289,7 +312,11 @@ module Google
|
|
289
312
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
290
313
|
#
|
291
314
|
# @param name [::String]
|
292
|
-
# Required. The
|
315
|
+
# Required. The resource name of {::Google::Cloud::DocumentAI::V1beta3::Processor Processor} or
|
316
|
+
# {::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion ProcessorVersion}.
|
317
|
+
# Format: `projects/{project}/locations/{location}/processors/{processor}`,
|
318
|
+
# or
|
319
|
+
# `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
|
293
320
|
# @param input_configs [::Array<::Google::Cloud::DocumentAI::V1beta3::BatchProcessRequest::BatchInputConfig, ::Hash>]
|
294
321
|
# The input config for each single document in the batch process.
|
295
322
|
# @param output_config [::Google::Cloud::DocumentAI::V1beta3::BatchProcessRequest::BatchOutputConfig, ::Hash]
|
@@ -375,7 +402,8 @@ module Google
|
|
375
402
|
end
|
376
403
|
|
377
404
|
##
|
378
|
-
# Fetches processor types.
|
405
|
+
# Fetches processor types. Note that we do not use ListProcessorTypes here
|
406
|
+
# because it is not paginated.
|
379
407
|
#
|
380
408
|
# @overload fetch_processor_types(request, options = nil)
|
381
409
|
# Pass arguments to `fetch_processor_types` via a request object, either of type
|
@@ -394,7 +422,8 @@ module Google
|
|
394
422
|
#
|
395
423
|
# @param parent [::String]
|
396
424
|
# Required. The project of processor type to list.
|
397
|
-
#
|
425
|
+
# The available processor types may depend on the allow-listing on projects.
|
426
|
+
# Format: `projects/{project}/locations/{location}`
|
398
427
|
#
|
399
428
|
# @yield [response, operation] Access the result along with the RPC operation
|
400
429
|
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::FetchProcessorTypesResponse]
|
@@ -460,6 +489,106 @@ module Google
|
|
460
489
|
raise ::Google::Cloud::Error.from_error(e)
|
461
490
|
end
|
462
491
|
|
492
|
+
##
|
493
|
+
# Lists the processor types that exist.
|
494
|
+
#
|
495
|
+
# @overload list_processor_types(request, options = nil)
|
496
|
+
# Pass arguments to `list_processor_types` via a request object, either of type
|
497
|
+
# {::Google::Cloud::DocumentAI::V1beta3::ListProcessorTypesRequest} or an equivalent Hash.
|
498
|
+
#
|
499
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::ListProcessorTypesRequest, ::Hash]
|
500
|
+
# A request object representing the call parameters. Required. To specify no
|
501
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
502
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
503
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
504
|
+
#
|
505
|
+
# @overload list_processor_types(parent: nil, page_size: nil, page_token: nil)
|
506
|
+
# Pass arguments to `list_processor_types` via keyword arguments. Note that at
|
507
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
508
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
509
|
+
#
|
510
|
+
# @param parent [::String]
|
511
|
+
# Required. The location of processor type to list.
|
512
|
+
# The available processor types may depend on the allow-listing on projects.
|
513
|
+
# Format: `projects/{project}/locations/{location}`
|
514
|
+
# @param page_size [::Integer]
|
515
|
+
# The maximum number of processor types to return.
|
516
|
+
# If unspecified, at most 100 processor types will be returned.
|
517
|
+
# The maximum value is 500; values above 500 will be coerced to 500.
|
518
|
+
# @param page_token [::String]
|
519
|
+
# Used to retrieve the next page of results, empty if at the end of the list.
|
520
|
+
#
|
521
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
522
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType>]
|
523
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
524
|
+
#
|
525
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorType>]
|
526
|
+
#
|
527
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
528
|
+
#
|
529
|
+
# @example Basic example
|
530
|
+
# require "google/cloud/document_ai/v1beta3"
|
531
|
+
#
|
532
|
+
# # Create a client object. The client can be reused for multiple calls.
|
533
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
534
|
+
#
|
535
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
536
|
+
# request = Google::Cloud::DocumentAI::V1beta3::ListProcessorTypesRequest.new
|
537
|
+
#
|
538
|
+
# # Call the list_processor_types method.
|
539
|
+
# result = client.list_processor_types request
|
540
|
+
#
|
541
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
542
|
+
# # iterate over all elements by calling #each, and the enumerable
|
543
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
544
|
+
# # methods are also available for managing paging directly.
|
545
|
+
# result.each do |response|
|
546
|
+
# # Each element is of type ::Google::Cloud::DocumentAI::V1beta3::ProcessorType.
|
547
|
+
# p response
|
548
|
+
# end
|
549
|
+
#
|
550
|
+
def list_processor_types request, options = nil
|
551
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
552
|
+
|
553
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListProcessorTypesRequest
|
554
|
+
|
555
|
+
# Converts hash and nil to an options object
|
556
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
557
|
+
|
558
|
+
# Customize the options with defaults
|
559
|
+
metadata = @config.rpcs.list_processor_types.metadata.to_h
|
560
|
+
|
561
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
562
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
563
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
564
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
565
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
566
|
+
|
567
|
+
header_params = {}
|
568
|
+
if request.parent
|
569
|
+
header_params["parent"] = request.parent
|
570
|
+
end
|
571
|
+
|
572
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
573
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
574
|
+
|
575
|
+
options.apply_defaults timeout: @config.rpcs.list_processor_types.timeout,
|
576
|
+
metadata: metadata,
|
577
|
+
retry_policy: @config.rpcs.list_processor_types.retry_policy
|
578
|
+
|
579
|
+
options.apply_defaults timeout: @config.timeout,
|
580
|
+
metadata: @config.metadata,
|
581
|
+
retry_policy: @config.retry_policy
|
582
|
+
|
583
|
+
@document_processor_service_stub.call_rpc :list_processor_types, request, options: options do |response, operation|
|
584
|
+
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processor_types, request, response, operation, options
|
585
|
+
yield response, operation if block_given?
|
586
|
+
return response
|
587
|
+
end
|
588
|
+
rescue ::GRPC::BadStatus => e
|
589
|
+
raise ::Google::Cloud::Error.from_error(e)
|
590
|
+
end
|
591
|
+
|
463
592
|
##
|
464
593
|
# Lists all processors which belong to this project.
|
465
594
|
#
|
@@ -480,7 +609,7 @@ module Google
|
|
480
609
|
#
|
481
610
|
# @param parent [::String]
|
482
611
|
# Required. The parent (project and location) which owns this collection of Processors.
|
483
|
-
# Format: projects
|
612
|
+
# Format: `projects/{project}/locations/{location}`
|
484
613
|
# @param page_size [::Integer]
|
485
614
|
# The maximum number of processors to return.
|
486
615
|
# If unspecified, at most 50 processors will be returned.
|
@@ -561,30 +690,25 @@ module Google
|
|
561
690
|
end
|
562
691
|
|
563
692
|
##
|
564
|
-
#
|
565
|
-
# The processor will be at "ENABLED" state by default after its creation.
|
693
|
+
# Gets a processor detail.
|
566
694
|
#
|
567
|
-
# @overload
|
568
|
-
# Pass arguments to `
|
569
|
-
# {::Google::Cloud::DocumentAI::V1beta3::
|
695
|
+
# @overload get_processor(request, options = nil)
|
696
|
+
# Pass arguments to `get_processor` via a request object, either of type
|
697
|
+
# {::Google::Cloud::DocumentAI::V1beta3::GetProcessorRequest} or an equivalent Hash.
|
570
698
|
#
|
571
|
-
# @param request [::Google::Cloud::DocumentAI::V1beta3::
|
699
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::GetProcessorRequest, ::Hash]
|
572
700
|
# A request object representing the call parameters. Required. To specify no
|
573
701
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
574
702
|
# @param options [::Gapic::CallOptions, ::Hash]
|
575
703
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
576
704
|
#
|
577
|
-
# @overload
|
578
|
-
# Pass arguments to `
|
705
|
+
# @overload get_processor(name: nil)
|
706
|
+
# Pass arguments to `get_processor` via keyword arguments. Note that at
|
579
707
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
580
708
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
581
709
|
#
|
582
|
-
# @param
|
583
|
-
# Required. The
|
584
|
-
# Format: projects/\\{project}/locations/\\{location}
|
585
|
-
# @param processor [::Google::Cloud::DocumentAI::V1beta3::Processor, ::Hash]
|
586
|
-
# Required. The processor to be created, requires [processor_type] and [display_name]
|
587
|
-
# to be set. Also, the processor is under CMEK if CMEK fields are set.
|
710
|
+
# @param name [::String]
|
711
|
+
# Required. The processor resource name.
|
588
712
|
#
|
589
713
|
# @yield [response, operation] Access the result along with the RPC operation
|
590
714
|
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
@@ -601,24 +725,24 @@ module Google
|
|
601
725
|
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
602
726
|
#
|
603
727
|
# # Create a request. To set request fields, pass in keyword arguments.
|
604
|
-
# request = Google::Cloud::DocumentAI::V1beta3::
|
728
|
+
# request = Google::Cloud::DocumentAI::V1beta3::GetProcessorRequest.new
|
605
729
|
#
|
606
|
-
# # Call the
|
607
|
-
# result = client.
|
730
|
+
# # Call the get_processor method.
|
731
|
+
# result = client.get_processor request
|
608
732
|
#
|
609
733
|
# # The returned object is of type Google::Cloud::DocumentAI::V1beta3::Processor.
|
610
734
|
# p result
|
611
735
|
#
|
612
|
-
def
|
736
|
+
def get_processor request, options = nil
|
613
737
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
614
738
|
|
615
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::
|
739
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetProcessorRequest
|
616
740
|
|
617
741
|
# Converts hash and nil to an options object
|
618
742
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
619
743
|
|
620
744
|
# Customize the options with defaults
|
621
|
-
metadata = @config.rpcs.
|
745
|
+
metadata = @config.rpcs.get_processor.metadata.to_h
|
622
746
|
|
623
747
|
# Set x-goog-api-client and x-goog-user-project headers
|
624
748
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -627,22 +751,22 @@ module Google
|
|
627
751
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
628
752
|
|
629
753
|
header_params = {}
|
630
|
-
if request.
|
631
|
-
header_params["
|
754
|
+
if request.name
|
755
|
+
header_params["name"] = request.name
|
632
756
|
end
|
633
757
|
|
634
758
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
635
759
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
636
760
|
|
637
|
-
options.apply_defaults timeout: @config.rpcs.
|
761
|
+
options.apply_defaults timeout: @config.rpcs.get_processor.timeout,
|
638
762
|
metadata: metadata,
|
639
|
-
retry_policy: @config.rpcs.
|
763
|
+
retry_policy: @config.rpcs.get_processor.retry_policy
|
640
764
|
|
641
765
|
options.apply_defaults timeout: @config.timeout,
|
642
766
|
metadata: @config.metadata,
|
643
767
|
retry_policy: @config.retry_policy
|
644
768
|
|
645
|
-
@document_processor_service_stub.call_rpc :
|
769
|
+
@document_processor_service_stub.call_rpc :get_processor, request, options: options do |response, operation|
|
646
770
|
yield response, operation if block_given?
|
647
771
|
return response
|
648
772
|
end
|
@@ -651,26 +775,38 @@ module Google
|
|
651
775
|
end
|
652
776
|
|
653
777
|
##
|
654
|
-
#
|
655
|
-
#
|
778
|
+
# Trains a new processor version.
|
779
|
+
# Operation metadata is returned as
|
780
|
+
# cloud_documentai_core.TrainProcessorVersionMetadata.
|
656
781
|
#
|
657
|
-
# @overload
|
658
|
-
# Pass arguments to `
|
659
|
-
# {::Google::Cloud::DocumentAI::V1beta3::
|
782
|
+
# @overload train_processor_version(request, options = nil)
|
783
|
+
# Pass arguments to `train_processor_version` via a request object, either of type
|
784
|
+
# {::Google::Cloud::DocumentAI::V1beta3::TrainProcessorVersionRequest} or an equivalent Hash.
|
660
785
|
#
|
661
|
-
# @param request [::Google::Cloud::DocumentAI::V1beta3::
|
786
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::TrainProcessorVersionRequest, ::Hash]
|
662
787
|
# A request object representing the call parameters. Required. To specify no
|
663
788
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
664
789
|
# @param options [::Gapic::CallOptions, ::Hash]
|
665
790
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
666
791
|
#
|
667
|
-
# @overload
|
668
|
-
# Pass arguments to `
|
792
|
+
# @overload train_processor_version(parent: nil, processor_version: nil, document_schema: nil, input_data: nil, base_processor_version: nil)
|
793
|
+
# Pass arguments to `train_processor_version` via keyword arguments. Note that at
|
669
794
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
670
795
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
671
796
|
#
|
672
|
-
# @param
|
673
|
-
# Required. The
|
797
|
+
# @param parent [::String]
|
798
|
+
# Required. The parent (project, location and processor) to create the new version for.
|
799
|
+
# Format: `projects/{project}/locations/{location}/processors/{processor}`.
|
800
|
+
# @param processor_version [::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion, ::Hash]
|
801
|
+
# Required. The processor version to be created.
|
802
|
+
# @param document_schema [::Google::Cloud::DocumentAI::V1beta3::DocumentSchema, ::Hash]
|
803
|
+
# Optional. The schema the processor version will be trained with.
|
804
|
+
# @param input_data [::Google::Cloud::DocumentAI::V1beta3::TrainProcessorVersionRequest::InputData, ::Hash]
|
805
|
+
# Optional. The input data used to train the `ProcessorVersion`.
|
806
|
+
# @param base_processor_version [::String]
|
807
|
+
# Optional. The processor version to use as a base for training. This processor version
|
808
|
+
# must be a child of `parent`. Format:
|
809
|
+
# `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
|
674
810
|
#
|
675
811
|
# @yield [response, operation] Access the result along with the RPC operation
|
676
812
|
# @yieldparam response [::Gapic::Operation]
|
@@ -687,10 +823,10 @@ module Google
|
|
687
823
|
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
688
824
|
#
|
689
825
|
# # Create a request. To set request fields, pass in keyword arguments.
|
690
|
-
# request = Google::Cloud::DocumentAI::V1beta3::
|
826
|
+
# request = Google::Cloud::DocumentAI::V1beta3::TrainProcessorVersionRequest.new
|
691
827
|
#
|
692
|
-
# # Call the
|
693
|
-
# result = client.
|
828
|
+
# # Call the train_processor_version method.
|
829
|
+
# result = client.train_processor_version request
|
694
830
|
#
|
695
831
|
# # The returned object is of type Gapic::Operation. You can use this
|
696
832
|
# # object to check the status of an operation, cancel it, or wait
|
@@ -702,16 +838,16 @@ module Google
|
|
702
838
|
# puts "Error!"
|
703
839
|
# end
|
704
840
|
#
|
705
|
-
def
|
841
|
+
def train_processor_version request, options = nil
|
706
842
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
707
843
|
|
708
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::
|
844
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::TrainProcessorVersionRequest
|
709
845
|
|
710
846
|
# Converts hash and nil to an options object
|
711
847
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
712
848
|
|
713
849
|
# Customize the options with defaults
|
714
|
-
metadata = @config.rpcs.
|
850
|
+
metadata = @config.rpcs.train_processor_version.metadata.to_h
|
715
851
|
|
716
852
|
# Set x-goog-api-client and x-goog-user-project headers
|
717
853
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -720,22 +856,22 @@ module Google
|
|
720
856
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
721
857
|
|
722
858
|
header_params = {}
|
723
|
-
if request.
|
724
|
-
header_params["
|
859
|
+
if request.parent
|
860
|
+
header_params["parent"] = request.parent
|
725
861
|
end
|
726
862
|
|
727
863
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
728
864
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
729
865
|
|
730
|
-
options.apply_defaults timeout: @config.rpcs.
|
866
|
+
options.apply_defaults timeout: @config.rpcs.train_processor_version.timeout,
|
731
867
|
metadata: metadata,
|
732
|
-
retry_policy: @config.rpcs.
|
868
|
+
retry_policy: @config.rpcs.train_processor_version.retry_policy
|
733
869
|
|
734
870
|
options.apply_defaults timeout: @config.timeout,
|
735
871
|
metadata: @config.metadata,
|
736
872
|
retry_policy: @config.retry_policy
|
737
873
|
|
738
|
-
@document_processor_service_stub.call_rpc :
|
874
|
+
@document_processor_service_stub.call_rpc :train_processor_version, request, options: options do |response, operation|
|
739
875
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
740
876
|
yield response, operation if block_given?
|
741
877
|
return response
|
@@ -745,31 +881,31 @@ module Google
|
|
745
881
|
end
|
746
882
|
|
747
883
|
##
|
748
|
-
#
|
884
|
+
# Gets a processor version detail.
|
749
885
|
#
|
750
|
-
# @overload
|
751
|
-
# Pass arguments to `
|
752
|
-
# {::Google::Cloud::DocumentAI::V1beta3::
|
886
|
+
# @overload get_processor_version(request, options = nil)
|
887
|
+
# Pass arguments to `get_processor_version` via a request object, either of type
|
888
|
+
# {::Google::Cloud::DocumentAI::V1beta3::GetProcessorVersionRequest} or an equivalent Hash.
|
753
889
|
#
|
754
|
-
# @param request [::Google::Cloud::DocumentAI::V1beta3::
|
890
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::GetProcessorVersionRequest, ::Hash]
|
755
891
|
# A request object representing the call parameters. Required. To specify no
|
756
892
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
757
893
|
# @param options [::Gapic::CallOptions, ::Hash]
|
758
894
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
759
895
|
#
|
760
|
-
# @overload
|
761
|
-
# Pass arguments to `
|
896
|
+
# @overload get_processor_version(name: nil)
|
897
|
+
# Pass arguments to `get_processor_version` via keyword arguments. Note that at
|
762
898
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
763
899
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
764
900
|
#
|
765
901
|
# @param name [::String]
|
766
|
-
# Required. The processor resource name
|
902
|
+
# Required. The processor resource name.
|
767
903
|
#
|
768
904
|
# @yield [response, operation] Access the result along with the RPC operation
|
769
|
-
# @yieldparam response [::
|
905
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion]
|
770
906
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
771
907
|
#
|
772
|
-
# @return [::
|
908
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion]
|
773
909
|
#
|
774
910
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
775
911
|
#
|
@@ -780,31 +916,24 @@ module Google
|
|
780
916
|
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
781
917
|
#
|
782
918
|
# # Create a request. To set request fields, pass in keyword arguments.
|
783
|
-
# request = Google::Cloud::DocumentAI::V1beta3::
|
919
|
+
# request = Google::Cloud::DocumentAI::V1beta3::GetProcessorVersionRequest.new
|
784
920
|
#
|
785
|
-
# # Call the
|
786
|
-
# result = client.
|
921
|
+
# # Call the get_processor_version method.
|
922
|
+
# result = client.get_processor_version request
|
787
923
|
#
|
788
|
-
# # The returned object is of type
|
789
|
-
#
|
790
|
-
# # for results. Here is how to block until completion:
|
791
|
-
# result.wait_until_done! timeout: 60
|
792
|
-
# if result.response?
|
793
|
-
# p result.response
|
794
|
-
# else
|
795
|
-
# puts "Error!"
|
796
|
-
# end
|
924
|
+
# # The returned object is of type Google::Cloud::DocumentAI::V1beta3::ProcessorVersion.
|
925
|
+
# p result
|
797
926
|
#
|
798
|
-
def
|
927
|
+
def get_processor_version request, options = nil
|
799
928
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
800
929
|
|
801
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::
|
930
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetProcessorVersionRequest
|
802
931
|
|
803
932
|
# Converts hash and nil to an options object
|
804
933
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
805
934
|
|
806
935
|
# Customize the options with defaults
|
807
|
-
metadata = @config.rpcs.
|
936
|
+
metadata = @config.rpcs.get_processor_version.metadata.to_h
|
808
937
|
|
809
938
|
# Set x-goog-api-client and x-goog-user-project headers
|
810
939
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -820,16 +949,15 @@ module Google
|
|
820
949
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
821
950
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
822
951
|
|
823
|
-
options.apply_defaults timeout: @config.rpcs.
|
952
|
+
options.apply_defaults timeout: @config.rpcs.get_processor_version.timeout,
|
824
953
|
metadata: metadata,
|
825
|
-
retry_policy: @config.rpcs.
|
954
|
+
retry_policy: @config.rpcs.get_processor_version.retry_policy
|
826
955
|
|
827
956
|
options.apply_defaults timeout: @config.timeout,
|
828
957
|
metadata: @config.metadata,
|
829
958
|
retry_policy: @config.retry_policy
|
830
959
|
|
831
|
-
@document_processor_service_stub.call_rpc :
|
832
|
-
response = ::Gapic::Operation.new response, @operations_client, options: options
|
960
|
+
@document_processor_service_stub.call_rpc :get_processor_version, request, options: options do |response, operation|
|
833
961
|
yield response, operation if block_given?
|
834
962
|
return response
|
835
963
|
end
|
@@ -838,31 +966,39 @@ module Google
|
|
838
966
|
end
|
839
967
|
|
840
968
|
##
|
841
|
-
#
|
969
|
+
# Lists all versions of a processor.
|
842
970
|
#
|
843
|
-
# @overload
|
844
|
-
# Pass arguments to `
|
845
|
-
# {::Google::Cloud::DocumentAI::V1beta3::
|
971
|
+
# @overload list_processor_versions(request, options = nil)
|
972
|
+
# Pass arguments to `list_processor_versions` via a request object, either of type
|
973
|
+
# {::Google::Cloud::DocumentAI::V1beta3::ListProcessorVersionsRequest} or an equivalent Hash.
|
846
974
|
#
|
847
|
-
# @param request [::Google::Cloud::DocumentAI::V1beta3::
|
975
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::ListProcessorVersionsRequest, ::Hash]
|
848
976
|
# A request object representing the call parameters. Required. To specify no
|
849
977
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
850
978
|
# @param options [::Gapic::CallOptions, ::Hash]
|
851
979
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
852
980
|
#
|
853
|
-
# @overload
|
854
|
-
# Pass arguments to `
|
981
|
+
# @overload list_processor_versions(parent: nil, page_size: nil, page_token: nil)
|
982
|
+
# Pass arguments to `list_processor_versions` via keyword arguments. Note that at
|
855
983
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
856
984
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
857
985
|
#
|
858
|
-
# @param
|
859
|
-
# Required. The
|
986
|
+
# @param parent [::String]
|
987
|
+
# Required. The parent (project, location and processor) to list all versions.
|
988
|
+
# Format: `projects/{project}/locations/{location}/processors/{processor}`
|
989
|
+
# @param page_size [::Integer]
|
990
|
+
# The maximum number of processor versions to return.
|
991
|
+
# If unspecified, at most 10 processor versions will be returned.
|
992
|
+
# The maximum value is 20; values above 20 will be coerced to 20.
|
993
|
+
# @param page_token [::String]
|
994
|
+
# We will return the processor versions sorted by creation time. The page
|
995
|
+
# token will point to the next processor version.
|
860
996
|
#
|
861
997
|
# @yield [response, operation] Access the result along with the RPC operation
|
862
|
-
# @yieldparam response [::Gapic::
|
998
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion>]
|
863
999
|
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
864
1000
|
#
|
865
|
-
# @return [::Gapic::
|
1001
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion>]
|
866
1002
|
#
|
867
1003
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
868
1004
|
#
|
@@ -873,31 +1009,30 @@ module Google
|
|
873
1009
|
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
874
1010
|
#
|
875
1011
|
# # Create a request. To set request fields, pass in keyword arguments.
|
876
|
-
# request = Google::Cloud::DocumentAI::V1beta3::
|
1012
|
+
# request = Google::Cloud::DocumentAI::V1beta3::ListProcessorVersionsRequest.new
|
877
1013
|
#
|
878
|
-
# # Call the
|
879
|
-
# result = client.
|
1014
|
+
# # Call the list_processor_versions method.
|
1015
|
+
# result = client.list_processor_versions request
|
880
1016
|
#
|
881
|
-
# # The returned object is of type Gapic::
|
882
|
-
# #
|
883
|
-
# #
|
884
|
-
#
|
885
|
-
#
|
886
|
-
#
|
887
|
-
#
|
888
|
-
# puts "Error!"
|
1017
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
1018
|
+
# # iterate over all elements by calling #each, and the enumerable
|
1019
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
1020
|
+
# # methods are also available for managing paging directly.
|
1021
|
+
# result.each do |response|
|
1022
|
+
# # Each element is of type ::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion.
|
1023
|
+
# p response
|
889
1024
|
# end
|
890
1025
|
#
|
891
|
-
def
|
1026
|
+
def list_processor_versions request, options = nil
|
892
1027
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
893
1028
|
|
894
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::
|
1029
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListProcessorVersionsRequest
|
895
1030
|
|
896
1031
|
# Converts hash and nil to an options object
|
897
1032
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
898
1033
|
|
899
1034
|
# Customize the options with defaults
|
900
|
-
metadata = @config.rpcs.
|
1035
|
+
metadata = @config.rpcs.list_processor_versions.metadata.to_h
|
901
1036
|
|
902
1037
|
# Set x-goog-api-client and x-goog-user-project headers
|
903
1038
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -906,23 +1041,23 @@ module Google
|
|
906
1041
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
907
1042
|
|
908
1043
|
header_params = {}
|
909
|
-
if request.
|
910
|
-
header_params["
|
1044
|
+
if request.parent
|
1045
|
+
header_params["parent"] = request.parent
|
911
1046
|
end
|
912
1047
|
|
913
1048
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
914
1049
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
915
1050
|
|
916
|
-
options.apply_defaults timeout: @config.rpcs.
|
1051
|
+
options.apply_defaults timeout: @config.rpcs.list_processor_versions.timeout,
|
917
1052
|
metadata: metadata,
|
918
|
-
retry_policy: @config.rpcs.
|
1053
|
+
retry_policy: @config.rpcs.list_processor_versions.retry_policy
|
919
1054
|
|
920
1055
|
options.apply_defaults timeout: @config.timeout,
|
921
1056
|
metadata: @config.metadata,
|
922
1057
|
retry_policy: @config.retry_policy
|
923
1058
|
|
924
|
-
@document_processor_service_stub.call_rpc :
|
925
|
-
response = ::Gapic::
|
1059
|
+
@document_processor_service_stub.call_rpc :list_processor_versions, request, options: options do |response, operation|
|
1060
|
+
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processor_versions, request, response, operation, options
|
926
1061
|
yield response, operation if block_given?
|
927
1062
|
return response
|
928
1063
|
end
|
@@ -931,35 +1066,26 @@ module Google
|
|
931
1066
|
end
|
932
1067
|
|
933
1068
|
##
|
934
|
-
#
|
935
|
-
#
|
1069
|
+
# Deletes the processor version, all artifacts under the processor version
|
1070
|
+
# will be deleted.
|
936
1071
|
#
|
937
|
-
# @overload
|
938
|
-
# Pass arguments to `
|
939
|
-
# {::Google::Cloud::DocumentAI::V1beta3::
|
1072
|
+
# @overload delete_processor_version(request, options = nil)
|
1073
|
+
# Pass arguments to `delete_processor_version` via a request object, either of type
|
1074
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorVersionRequest} or an equivalent Hash.
|
940
1075
|
#
|
941
|
-
# @param request [::Google::Cloud::DocumentAI::V1beta3::
|
1076
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorVersionRequest, ::Hash]
|
942
1077
|
# A request object representing the call parameters. Required. To specify no
|
943
1078
|
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
944
1079
|
# @param options [::Gapic::CallOptions, ::Hash]
|
945
1080
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
946
1081
|
#
|
947
|
-
# @overload
|
948
|
-
# Pass arguments to `
|
1082
|
+
# @overload delete_processor_version(name: nil)
|
1083
|
+
# Pass arguments to `delete_processor_version` via keyword arguments. Note that at
|
949
1084
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
950
1085
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
951
1086
|
#
|
952
|
-
# @param
|
953
|
-
#
|
954
|
-
# @param human_review_config [::String]
|
955
|
-
# Required. The resource name of the HumanReviewConfig that the document will be
|
956
|
-
# reviewed with.
|
957
|
-
# @param document [::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash]
|
958
|
-
# The document that needs human review.
|
959
|
-
# @param enable_schema_validation [::Boolean]
|
960
|
-
# Whether the validation should be performed on the ad-hoc review request.
|
961
|
-
# @param priority [::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest::Priority]
|
962
|
-
# The priority of the human review task.
|
1087
|
+
# @param name [::String]
|
1088
|
+
# Required. The processor version resource name to be deleted.
|
963
1089
|
#
|
964
1090
|
# @yield [response, operation] Access the result along with the RPC operation
|
965
1091
|
# @yieldparam response [::Gapic::Operation]
|
@@ -976,10 +1102,10 @@ module Google
|
|
976
1102
|
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
977
1103
|
#
|
978
1104
|
# # Create a request. To set request fields, pass in keyword arguments.
|
979
|
-
# request = Google::Cloud::DocumentAI::V1beta3::
|
1105
|
+
# request = Google::Cloud::DocumentAI::V1beta3::DeleteProcessorVersionRequest.new
|
980
1106
|
#
|
981
|
-
# # Call the
|
982
|
-
# result = client.
|
1107
|
+
# # Call the delete_processor_version method.
|
1108
|
+
# result = client.delete_processor_version request
|
983
1109
|
#
|
984
1110
|
# # The returned object is of type Gapic::Operation. You can use this
|
985
1111
|
# # object to check the status of an operation, cancel it, or wait
|
@@ -991,16 +1117,16 @@ module Google
|
|
991
1117
|
# puts "Error!"
|
992
1118
|
# end
|
993
1119
|
#
|
994
|
-
def
|
1120
|
+
def delete_processor_version request, options = nil
|
995
1121
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
996
1122
|
|
997
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::
|
1123
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorVersionRequest
|
998
1124
|
|
999
1125
|
# Converts hash and nil to an options object
|
1000
1126
|
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1001
1127
|
|
1002
1128
|
# Customize the options with defaults
|
1003
|
-
metadata = @config.rpcs.
|
1129
|
+
metadata = @config.rpcs.delete_processor_version.metadata.to_h
|
1004
1130
|
|
1005
1131
|
# Set x-goog-api-client and x-goog-user-project headers
|
1006
1132
|
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
@@ -1009,22 +1135,22 @@ module Google
|
|
1009
1135
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1010
1136
|
|
1011
1137
|
header_params = {}
|
1012
|
-
if request.
|
1013
|
-
header_params["
|
1138
|
+
if request.name
|
1139
|
+
header_params["name"] = request.name
|
1014
1140
|
end
|
1015
1141
|
|
1016
1142
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1017
1143
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1018
1144
|
|
1019
|
-
options.apply_defaults timeout: @config.rpcs.
|
1145
|
+
options.apply_defaults timeout: @config.rpcs.delete_processor_version.timeout,
|
1020
1146
|
metadata: metadata,
|
1021
|
-
retry_policy: @config.rpcs.
|
1147
|
+
retry_policy: @config.rpcs.delete_processor_version.retry_policy
|
1022
1148
|
|
1023
1149
|
options.apply_defaults timeout: @config.timeout,
|
1024
1150
|
metadata: @config.metadata,
|
1025
1151
|
retry_policy: @config.retry_policy
|
1026
1152
|
|
1027
|
-
@document_processor_service_stub.call_rpc :
|
1153
|
+
@document_processor_service_stub.call_rpc :delete_processor_version, request, options: options do |response, operation|
|
1028
1154
|
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1029
1155
|
yield response, operation if block_given?
|
1030
1156
|
return response
|
@@ -1034,19 +1160,1063 @@ module Google
|
|
1034
1160
|
end
|
1035
1161
|
|
1036
1162
|
##
|
1037
|
-
#
|
1038
|
-
#
|
1039
|
-
# This class represents the configuration for DocumentProcessorService,
|
1040
|
-
# providing control over timeouts, retry behavior, logging, transport
|
1041
|
-
# parameters, and other low-level controls. Certain parameters can also be
|
1042
|
-
# applied individually to specific RPCs. See
|
1043
|
-
# {::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client::Configuration::Rpcs}
|
1044
|
-
# for a list of RPCs that can be configured independently.
|
1163
|
+
# Deploys the processor version.
|
1045
1164
|
#
|
1046
|
-
#
|
1047
|
-
#
|
1165
|
+
# @overload deploy_processor_version(request, options = nil)
|
1166
|
+
# Pass arguments to `deploy_processor_version` via a request object, either of type
|
1167
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DeployProcessorVersionRequest} or an equivalent Hash.
|
1048
1168
|
#
|
1049
|
-
#
|
1169
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DeployProcessorVersionRequest, ::Hash]
|
1170
|
+
# A request object representing the call parameters. Required. To specify no
|
1171
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1172
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1173
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1174
|
+
#
|
1175
|
+
# @overload deploy_processor_version(name: nil)
|
1176
|
+
# Pass arguments to `deploy_processor_version` via keyword arguments. Note that at
|
1177
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1178
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1179
|
+
#
|
1180
|
+
# @param name [::String]
|
1181
|
+
# Required. The processor version resource name to be deployed.
|
1182
|
+
#
|
1183
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1184
|
+
# @yieldparam response [::Gapic::Operation]
|
1185
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1186
|
+
#
|
1187
|
+
# @return [::Gapic::Operation]
|
1188
|
+
#
|
1189
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1190
|
+
#
|
1191
|
+
# @example Basic example
|
1192
|
+
# require "google/cloud/document_ai/v1beta3"
|
1193
|
+
#
|
1194
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1195
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1196
|
+
#
|
1197
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1198
|
+
# request = Google::Cloud::DocumentAI::V1beta3::DeployProcessorVersionRequest.new
|
1199
|
+
#
|
1200
|
+
# # Call the deploy_processor_version method.
|
1201
|
+
# result = client.deploy_processor_version request
|
1202
|
+
#
|
1203
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1204
|
+
# # object to check the status of an operation, cancel it, or wait
|
1205
|
+
# # for results. Here is how to block until completion:
|
1206
|
+
# result.wait_until_done! timeout: 60
|
1207
|
+
# if result.response?
|
1208
|
+
# p result.response
|
1209
|
+
# else
|
1210
|
+
# puts "Error!"
|
1211
|
+
# end
|
1212
|
+
#
|
1213
|
+
def deploy_processor_version request, options = nil
|
1214
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1215
|
+
|
1216
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeployProcessorVersionRequest
|
1217
|
+
|
1218
|
+
# Converts hash and nil to an options object
|
1219
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1220
|
+
|
1221
|
+
# Customize the options with defaults
|
1222
|
+
metadata = @config.rpcs.deploy_processor_version.metadata.to_h
|
1223
|
+
|
1224
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1225
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1226
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1227
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1228
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1229
|
+
|
1230
|
+
header_params = {}
|
1231
|
+
if request.name
|
1232
|
+
header_params["name"] = request.name
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1236
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1237
|
+
|
1238
|
+
options.apply_defaults timeout: @config.rpcs.deploy_processor_version.timeout,
|
1239
|
+
metadata: metadata,
|
1240
|
+
retry_policy: @config.rpcs.deploy_processor_version.retry_policy
|
1241
|
+
|
1242
|
+
options.apply_defaults timeout: @config.timeout,
|
1243
|
+
metadata: @config.metadata,
|
1244
|
+
retry_policy: @config.retry_policy
|
1245
|
+
|
1246
|
+
@document_processor_service_stub.call_rpc :deploy_processor_version, request, options: options do |response, operation|
|
1247
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1248
|
+
yield response, operation if block_given?
|
1249
|
+
return response
|
1250
|
+
end
|
1251
|
+
rescue ::GRPC::BadStatus => e
|
1252
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
##
|
1256
|
+
# Undeploys the processor version.
|
1257
|
+
#
|
1258
|
+
# @overload undeploy_processor_version(request, options = nil)
|
1259
|
+
# Pass arguments to `undeploy_processor_version` via a request object, either of type
|
1260
|
+
# {::Google::Cloud::DocumentAI::V1beta3::UndeployProcessorVersionRequest} or an equivalent Hash.
|
1261
|
+
#
|
1262
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::UndeployProcessorVersionRequest, ::Hash]
|
1263
|
+
# A request object representing the call parameters. Required. To specify no
|
1264
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1265
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1266
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1267
|
+
#
|
1268
|
+
# @overload undeploy_processor_version(name: nil)
|
1269
|
+
# Pass arguments to `undeploy_processor_version` via keyword arguments. Note that at
|
1270
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1271
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1272
|
+
#
|
1273
|
+
# @param name [::String]
|
1274
|
+
# Required. The processor version resource name to be undeployed.
|
1275
|
+
#
|
1276
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1277
|
+
# @yieldparam response [::Gapic::Operation]
|
1278
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1279
|
+
#
|
1280
|
+
# @return [::Gapic::Operation]
|
1281
|
+
#
|
1282
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1283
|
+
#
|
1284
|
+
# @example Basic example
|
1285
|
+
# require "google/cloud/document_ai/v1beta3"
|
1286
|
+
#
|
1287
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1288
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1289
|
+
#
|
1290
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1291
|
+
# request = Google::Cloud::DocumentAI::V1beta3::UndeployProcessorVersionRequest.new
|
1292
|
+
#
|
1293
|
+
# # Call the undeploy_processor_version method.
|
1294
|
+
# result = client.undeploy_processor_version request
|
1295
|
+
#
|
1296
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1297
|
+
# # object to check the status of an operation, cancel it, or wait
|
1298
|
+
# # for results. Here is how to block until completion:
|
1299
|
+
# result.wait_until_done! timeout: 60
|
1300
|
+
# if result.response?
|
1301
|
+
# p result.response
|
1302
|
+
# else
|
1303
|
+
# puts "Error!"
|
1304
|
+
# end
|
1305
|
+
#
|
1306
|
+
def undeploy_processor_version request, options = nil
|
1307
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1308
|
+
|
1309
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::UndeployProcessorVersionRequest
|
1310
|
+
|
1311
|
+
# Converts hash and nil to an options object
|
1312
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1313
|
+
|
1314
|
+
# Customize the options with defaults
|
1315
|
+
metadata = @config.rpcs.undeploy_processor_version.metadata.to_h
|
1316
|
+
|
1317
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1318
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1319
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1320
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1321
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1322
|
+
|
1323
|
+
header_params = {}
|
1324
|
+
if request.name
|
1325
|
+
header_params["name"] = request.name
|
1326
|
+
end
|
1327
|
+
|
1328
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1329
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1330
|
+
|
1331
|
+
options.apply_defaults timeout: @config.rpcs.undeploy_processor_version.timeout,
|
1332
|
+
metadata: metadata,
|
1333
|
+
retry_policy: @config.rpcs.undeploy_processor_version.retry_policy
|
1334
|
+
|
1335
|
+
options.apply_defaults timeout: @config.timeout,
|
1336
|
+
metadata: @config.metadata,
|
1337
|
+
retry_policy: @config.retry_policy
|
1338
|
+
|
1339
|
+
@document_processor_service_stub.call_rpc :undeploy_processor_version, request, options: options do |response, operation|
|
1340
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1341
|
+
yield response, operation if block_given?
|
1342
|
+
return response
|
1343
|
+
end
|
1344
|
+
rescue ::GRPC::BadStatus => e
|
1345
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1346
|
+
end
|
1347
|
+
|
1348
|
+
##
|
1349
|
+
# Creates a processor from the type processor that the user chose.
|
1350
|
+
# The processor will be at "ENABLED" state by default after its creation.
|
1351
|
+
#
|
1352
|
+
# @overload create_processor(request, options = nil)
|
1353
|
+
# Pass arguments to `create_processor` via a request object, either of type
|
1354
|
+
# {::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest} or an equivalent Hash.
|
1355
|
+
#
|
1356
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest, ::Hash]
|
1357
|
+
# A request object representing the call parameters. Required. To specify no
|
1358
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1359
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1360
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1361
|
+
#
|
1362
|
+
# @overload create_processor(parent: nil, processor: nil)
|
1363
|
+
# Pass arguments to `create_processor` via keyword arguments. Note that at
|
1364
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1365
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1366
|
+
#
|
1367
|
+
# @param parent [::String]
|
1368
|
+
# Required. The parent (project and location) under which to create the processor.
|
1369
|
+
# Format: `projects/{project}/locations/{location}`
|
1370
|
+
# @param processor [::Google::Cloud::DocumentAI::V1beta3::Processor, ::Hash]
|
1371
|
+
# Required. The processor to be created, requires [processor_type] and [display_name]
|
1372
|
+
# to be set. Also, the processor is under CMEK if CMEK fields are set.
|
1373
|
+
#
|
1374
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1375
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
1376
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1377
|
+
#
|
1378
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::Processor]
|
1379
|
+
#
|
1380
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1381
|
+
#
|
1382
|
+
# @example Basic example
|
1383
|
+
# require "google/cloud/document_ai/v1beta3"
|
1384
|
+
#
|
1385
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1386
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1387
|
+
#
|
1388
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1389
|
+
# request = Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest.new
|
1390
|
+
#
|
1391
|
+
# # Call the create_processor method.
|
1392
|
+
# result = client.create_processor request
|
1393
|
+
#
|
1394
|
+
# # The returned object is of type Google::Cloud::DocumentAI::V1beta3::Processor.
|
1395
|
+
# p result
|
1396
|
+
#
|
1397
|
+
def create_processor request, options = nil
|
1398
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1399
|
+
|
1400
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::CreateProcessorRequest
|
1401
|
+
|
1402
|
+
# Converts hash and nil to an options object
|
1403
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1404
|
+
|
1405
|
+
# Customize the options with defaults
|
1406
|
+
metadata = @config.rpcs.create_processor.metadata.to_h
|
1407
|
+
|
1408
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1409
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1410
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1411
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1412
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1413
|
+
|
1414
|
+
header_params = {}
|
1415
|
+
if request.parent
|
1416
|
+
header_params["parent"] = request.parent
|
1417
|
+
end
|
1418
|
+
|
1419
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1420
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1421
|
+
|
1422
|
+
options.apply_defaults timeout: @config.rpcs.create_processor.timeout,
|
1423
|
+
metadata: metadata,
|
1424
|
+
retry_policy: @config.rpcs.create_processor.retry_policy
|
1425
|
+
|
1426
|
+
options.apply_defaults timeout: @config.timeout,
|
1427
|
+
metadata: @config.metadata,
|
1428
|
+
retry_policy: @config.retry_policy
|
1429
|
+
|
1430
|
+
@document_processor_service_stub.call_rpc :create_processor, request, options: options do |response, operation|
|
1431
|
+
yield response, operation if block_given?
|
1432
|
+
return response
|
1433
|
+
end
|
1434
|
+
rescue ::GRPC::BadStatus => e
|
1435
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1436
|
+
end
|
1437
|
+
|
1438
|
+
##
|
1439
|
+
# Deletes the processor, unloads all deployed model artifacts if it was
|
1440
|
+
# enabled and then deletes all artifacts associated with this processor.
|
1441
|
+
#
|
1442
|
+
# @overload delete_processor(request, options = nil)
|
1443
|
+
# Pass arguments to `delete_processor` via a request object, either of type
|
1444
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest} or an equivalent Hash.
|
1445
|
+
#
|
1446
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest, ::Hash]
|
1447
|
+
# A request object representing the call parameters. Required. To specify no
|
1448
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1449
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1450
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1451
|
+
#
|
1452
|
+
# @overload delete_processor(name: nil)
|
1453
|
+
# Pass arguments to `delete_processor` via keyword arguments. Note that at
|
1454
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1455
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1456
|
+
#
|
1457
|
+
# @param name [::String]
|
1458
|
+
# Required. The processor resource name to be deleted.
|
1459
|
+
#
|
1460
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1461
|
+
# @yieldparam response [::Gapic::Operation]
|
1462
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1463
|
+
#
|
1464
|
+
# @return [::Gapic::Operation]
|
1465
|
+
#
|
1466
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1467
|
+
#
|
1468
|
+
# @example Basic example
|
1469
|
+
# require "google/cloud/document_ai/v1beta3"
|
1470
|
+
#
|
1471
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1472
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1473
|
+
#
|
1474
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1475
|
+
# request = Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest.new
|
1476
|
+
#
|
1477
|
+
# # Call the delete_processor method.
|
1478
|
+
# result = client.delete_processor request
|
1479
|
+
#
|
1480
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1481
|
+
# # object to check the status of an operation, cancel it, or wait
|
1482
|
+
# # for results. Here is how to block until completion:
|
1483
|
+
# result.wait_until_done! timeout: 60
|
1484
|
+
# if result.response?
|
1485
|
+
# p result.response
|
1486
|
+
# else
|
1487
|
+
# puts "Error!"
|
1488
|
+
# end
|
1489
|
+
#
|
1490
|
+
def delete_processor request, options = nil
|
1491
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1492
|
+
|
1493
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DeleteProcessorRequest
|
1494
|
+
|
1495
|
+
# Converts hash and nil to an options object
|
1496
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1497
|
+
|
1498
|
+
# Customize the options with defaults
|
1499
|
+
metadata = @config.rpcs.delete_processor.metadata.to_h
|
1500
|
+
|
1501
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1502
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1503
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1504
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1505
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1506
|
+
|
1507
|
+
header_params = {}
|
1508
|
+
if request.name
|
1509
|
+
header_params["name"] = request.name
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1513
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1514
|
+
|
1515
|
+
options.apply_defaults timeout: @config.rpcs.delete_processor.timeout,
|
1516
|
+
metadata: metadata,
|
1517
|
+
retry_policy: @config.rpcs.delete_processor.retry_policy
|
1518
|
+
|
1519
|
+
options.apply_defaults timeout: @config.timeout,
|
1520
|
+
metadata: @config.metadata,
|
1521
|
+
retry_policy: @config.retry_policy
|
1522
|
+
|
1523
|
+
@document_processor_service_stub.call_rpc :delete_processor, request, options: options do |response, operation|
|
1524
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1525
|
+
yield response, operation if block_given?
|
1526
|
+
return response
|
1527
|
+
end
|
1528
|
+
rescue ::GRPC::BadStatus => e
|
1529
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1530
|
+
end
|
1531
|
+
|
1532
|
+
##
|
1533
|
+
# Enables a processor
|
1534
|
+
#
|
1535
|
+
# @overload enable_processor(request, options = nil)
|
1536
|
+
# Pass arguments to `enable_processor` via a request object, either of type
|
1537
|
+
# {::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest} or an equivalent Hash.
|
1538
|
+
#
|
1539
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest, ::Hash]
|
1540
|
+
# A request object representing the call parameters. Required. To specify no
|
1541
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1542
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1543
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1544
|
+
#
|
1545
|
+
# @overload enable_processor(name: nil)
|
1546
|
+
# Pass arguments to `enable_processor` via keyword arguments. Note that at
|
1547
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1548
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1549
|
+
#
|
1550
|
+
# @param name [::String]
|
1551
|
+
# Required. The processor resource name to be enabled.
|
1552
|
+
#
|
1553
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1554
|
+
# @yieldparam response [::Gapic::Operation]
|
1555
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1556
|
+
#
|
1557
|
+
# @return [::Gapic::Operation]
|
1558
|
+
#
|
1559
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1560
|
+
#
|
1561
|
+
# @example Basic example
|
1562
|
+
# require "google/cloud/document_ai/v1beta3"
|
1563
|
+
#
|
1564
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1565
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1566
|
+
#
|
1567
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1568
|
+
# request = Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest.new
|
1569
|
+
#
|
1570
|
+
# # Call the enable_processor method.
|
1571
|
+
# result = client.enable_processor request
|
1572
|
+
#
|
1573
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1574
|
+
# # object to check the status of an operation, cancel it, or wait
|
1575
|
+
# # for results. Here is how to block until completion:
|
1576
|
+
# result.wait_until_done! timeout: 60
|
1577
|
+
# if result.response?
|
1578
|
+
# p result.response
|
1579
|
+
# else
|
1580
|
+
# puts "Error!"
|
1581
|
+
# end
|
1582
|
+
#
|
1583
|
+
def enable_processor request, options = nil
|
1584
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1585
|
+
|
1586
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::EnableProcessorRequest
|
1587
|
+
|
1588
|
+
# Converts hash and nil to an options object
|
1589
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1590
|
+
|
1591
|
+
# Customize the options with defaults
|
1592
|
+
metadata = @config.rpcs.enable_processor.metadata.to_h
|
1593
|
+
|
1594
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1595
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1596
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1597
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1598
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1599
|
+
|
1600
|
+
header_params = {}
|
1601
|
+
if request.name
|
1602
|
+
header_params["name"] = request.name
|
1603
|
+
end
|
1604
|
+
|
1605
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1606
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1607
|
+
|
1608
|
+
options.apply_defaults timeout: @config.rpcs.enable_processor.timeout,
|
1609
|
+
metadata: metadata,
|
1610
|
+
retry_policy: @config.rpcs.enable_processor.retry_policy
|
1611
|
+
|
1612
|
+
options.apply_defaults timeout: @config.timeout,
|
1613
|
+
metadata: @config.metadata,
|
1614
|
+
retry_policy: @config.retry_policy
|
1615
|
+
|
1616
|
+
@document_processor_service_stub.call_rpc :enable_processor, request, options: options do |response, operation|
|
1617
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1618
|
+
yield response, operation if block_given?
|
1619
|
+
return response
|
1620
|
+
end
|
1621
|
+
rescue ::GRPC::BadStatus => e
|
1622
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1623
|
+
end
|
1624
|
+
|
1625
|
+
##
|
1626
|
+
# Disables a processor
|
1627
|
+
#
|
1628
|
+
# @overload disable_processor(request, options = nil)
|
1629
|
+
# Pass arguments to `disable_processor` via a request object, either of type
|
1630
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest} or an equivalent Hash.
|
1631
|
+
#
|
1632
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest, ::Hash]
|
1633
|
+
# A request object representing the call parameters. Required. To specify no
|
1634
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1635
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1636
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1637
|
+
#
|
1638
|
+
# @overload disable_processor(name: nil)
|
1639
|
+
# Pass arguments to `disable_processor` via keyword arguments. Note that at
|
1640
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1641
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1642
|
+
#
|
1643
|
+
# @param name [::String]
|
1644
|
+
# Required. The processor resource name to be disabled.
|
1645
|
+
#
|
1646
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1647
|
+
# @yieldparam response [::Gapic::Operation]
|
1648
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1649
|
+
#
|
1650
|
+
# @return [::Gapic::Operation]
|
1651
|
+
#
|
1652
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1653
|
+
#
|
1654
|
+
# @example Basic example
|
1655
|
+
# require "google/cloud/document_ai/v1beta3"
|
1656
|
+
#
|
1657
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1658
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1659
|
+
#
|
1660
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1661
|
+
# request = Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest.new
|
1662
|
+
#
|
1663
|
+
# # Call the disable_processor method.
|
1664
|
+
# result = client.disable_processor request
|
1665
|
+
#
|
1666
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1667
|
+
# # object to check the status of an operation, cancel it, or wait
|
1668
|
+
# # for results. Here is how to block until completion:
|
1669
|
+
# result.wait_until_done! timeout: 60
|
1670
|
+
# if result.response?
|
1671
|
+
# p result.response
|
1672
|
+
# else
|
1673
|
+
# puts "Error!"
|
1674
|
+
# end
|
1675
|
+
#
|
1676
|
+
def disable_processor request, options = nil
|
1677
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1678
|
+
|
1679
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::DisableProcessorRequest
|
1680
|
+
|
1681
|
+
# Converts hash and nil to an options object
|
1682
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1683
|
+
|
1684
|
+
# Customize the options with defaults
|
1685
|
+
metadata = @config.rpcs.disable_processor.metadata.to_h
|
1686
|
+
|
1687
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1688
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1689
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1690
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1691
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1692
|
+
|
1693
|
+
header_params = {}
|
1694
|
+
if request.name
|
1695
|
+
header_params["name"] = request.name
|
1696
|
+
end
|
1697
|
+
|
1698
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1699
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1700
|
+
|
1701
|
+
options.apply_defaults timeout: @config.rpcs.disable_processor.timeout,
|
1702
|
+
metadata: metadata,
|
1703
|
+
retry_policy: @config.rpcs.disable_processor.retry_policy
|
1704
|
+
|
1705
|
+
options.apply_defaults timeout: @config.timeout,
|
1706
|
+
metadata: @config.metadata,
|
1707
|
+
retry_policy: @config.retry_policy
|
1708
|
+
|
1709
|
+
@document_processor_service_stub.call_rpc :disable_processor, request, options: options do |response, operation|
|
1710
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1711
|
+
yield response, operation if block_given?
|
1712
|
+
return response
|
1713
|
+
end
|
1714
|
+
rescue ::GRPC::BadStatus => e
|
1715
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1716
|
+
end
|
1717
|
+
|
1718
|
+
##
|
1719
|
+
# Set the default (active) version of a {::Google::Cloud::DocumentAI::V1beta3::Processor Processor} that will be used in
|
1720
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client#process_document ProcessDocument} and
|
1721
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client#batch_process_documents BatchProcessDocuments}.
|
1722
|
+
#
|
1723
|
+
# @overload set_default_processor_version(request, options = nil)
|
1724
|
+
# Pass arguments to `set_default_processor_version` via a request object, either of type
|
1725
|
+
# {::Google::Cloud::DocumentAI::V1beta3::SetDefaultProcessorVersionRequest} or an equivalent Hash.
|
1726
|
+
#
|
1727
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::SetDefaultProcessorVersionRequest, ::Hash]
|
1728
|
+
# A request object representing the call parameters. Required. To specify no
|
1729
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1730
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1731
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1732
|
+
#
|
1733
|
+
# @overload set_default_processor_version(processor: nil, default_processor_version: nil)
|
1734
|
+
# Pass arguments to `set_default_processor_version` via keyword arguments. Note that at
|
1735
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1736
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1737
|
+
#
|
1738
|
+
# @param processor [::String]
|
1739
|
+
# Required. The resource name of the {::Google::Cloud::DocumentAI::V1beta3::Processor Processor} to change default version.
|
1740
|
+
# @param default_processor_version [::String]
|
1741
|
+
# Required. The resource name of child {::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion ProcessorVersion} to use as default.
|
1742
|
+
# Format:
|
1743
|
+
# `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
|
1744
|
+
#
|
1745
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1746
|
+
# @yieldparam response [::Gapic::Operation]
|
1747
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1748
|
+
#
|
1749
|
+
# @return [::Gapic::Operation]
|
1750
|
+
#
|
1751
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1752
|
+
#
|
1753
|
+
# @example Basic example
|
1754
|
+
# require "google/cloud/document_ai/v1beta3"
|
1755
|
+
#
|
1756
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1757
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1758
|
+
#
|
1759
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1760
|
+
# request = Google::Cloud::DocumentAI::V1beta3::SetDefaultProcessorVersionRequest.new
|
1761
|
+
#
|
1762
|
+
# # Call the set_default_processor_version method.
|
1763
|
+
# result = client.set_default_processor_version request
|
1764
|
+
#
|
1765
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1766
|
+
# # object to check the status of an operation, cancel it, or wait
|
1767
|
+
# # for results. Here is how to block until completion:
|
1768
|
+
# result.wait_until_done! timeout: 60
|
1769
|
+
# if result.response?
|
1770
|
+
# p result.response
|
1771
|
+
# else
|
1772
|
+
# puts "Error!"
|
1773
|
+
# end
|
1774
|
+
#
|
1775
|
+
def set_default_processor_version request, options = nil
|
1776
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1777
|
+
|
1778
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::SetDefaultProcessorVersionRequest
|
1779
|
+
|
1780
|
+
# Converts hash and nil to an options object
|
1781
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1782
|
+
|
1783
|
+
# Customize the options with defaults
|
1784
|
+
metadata = @config.rpcs.set_default_processor_version.metadata.to_h
|
1785
|
+
|
1786
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1787
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1788
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1789
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1790
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1791
|
+
|
1792
|
+
header_params = {}
|
1793
|
+
if request.processor
|
1794
|
+
header_params["processor"] = request.processor
|
1795
|
+
end
|
1796
|
+
|
1797
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1798
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1799
|
+
|
1800
|
+
options.apply_defaults timeout: @config.rpcs.set_default_processor_version.timeout,
|
1801
|
+
metadata: metadata,
|
1802
|
+
retry_policy: @config.rpcs.set_default_processor_version.retry_policy
|
1803
|
+
|
1804
|
+
options.apply_defaults timeout: @config.timeout,
|
1805
|
+
metadata: @config.metadata,
|
1806
|
+
retry_policy: @config.retry_policy
|
1807
|
+
|
1808
|
+
@document_processor_service_stub.call_rpc :set_default_processor_version, request, options: options do |response, operation|
|
1809
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1810
|
+
yield response, operation if block_given?
|
1811
|
+
return response
|
1812
|
+
end
|
1813
|
+
rescue ::GRPC::BadStatus => e
|
1814
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1815
|
+
end
|
1816
|
+
|
1817
|
+
##
|
1818
|
+
# Send a document for Human Review. The input document should be processed by
|
1819
|
+
# the specified processor.
|
1820
|
+
#
|
1821
|
+
# @overload review_document(request, options = nil)
|
1822
|
+
# Pass arguments to `review_document` via a request object, either of type
|
1823
|
+
# {::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest} or an equivalent Hash.
|
1824
|
+
#
|
1825
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest, ::Hash]
|
1826
|
+
# A request object representing the call parameters. Required. To specify no
|
1827
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1828
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1829
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1830
|
+
#
|
1831
|
+
# @overload review_document(inline_document: nil, human_review_config: nil, document: nil, enable_schema_validation: nil, priority: nil, document_schema: nil)
|
1832
|
+
# Pass arguments to `review_document` via keyword arguments. Note that at
|
1833
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1834
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1835
|
+
#
|
1836
|
+
# @param inline_document [::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash]
|
1837
|
+
# An inline document proto.
|
1838
|
+
# @param human_review_config [::String]
|
1839
|
+
# Required. The resource name of the HumanReviewConfig that the document will be
|
1840
|
+
# reviewed with.
|
1841
|
+
# @param document [::Google::Cloud::DocumentAI::V1beta3::Document, ::Hash]
|
1842
|
+
# The document that needs human review.
|
1843
|
+
# @param enable_schema_validation [::Boolean]
|
1844
|
+
# Whether the validation should be performed on the ad-hoc review request.
|
1845
|
+
# @param priority [::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest::Priority]
|
1846
|
+
# The priority of the human review task.
|
1847
|
+
# @param document_schema [::Google::Cloud::DocumentAI::V1beta3::DocumentSchema, ::Hash]
|
1848
|
+
# The document schema of the human review task.
|
1849
|
+
#
|
1850
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1851
|
+
# @yieldparam response [::Gapic::Operation]
|
1852
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1853
|
+
#
|
1854
|
+
# @return [::Gapic::Operation]
|
1855
|
+
#
|
1856
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1857
|
+
#
|
1858
|
+
# @example Basic example
|
1859
|
+
# require "google/cloud/document_ai/v1beta3"
|
1860
|
+
#
|
1861
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1862
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1863
|
+
#
|
1864
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1865
|
+
# request = Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest.new
|
1866
|
+
#
|
1867
|
+
# # Call the review_document method.
|
1868
|
+
# result = client.review_document request
|
1869
|
+
#
|
1870
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1871
|
+
# # object to check the status of an operation, cancel it, or wait
|
1872
|
+
# # for results. Here is how to block until completion:
|
1873
|
+
# result.wait_until_done! timeout: 60
|
1874
|
+
# if result.response?
|
1875
|
+
# p result.response
|
1876
|
+
# else
|
1877
|
+
# puts "Error!"
|
1878
|
+
# end
|
1879
|
+
#
|
1880
|
+
def review_document request, options = nil
|
1881
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1882
|
+
|
1883
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ReviewDocumentRequest
|
1884
|
+
|
1885
|
+
# Converts hash and nil to an options object
|
1886
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1887
|
+
|
1888
|
+
# Customize the options with defaults
|
1889
|
+
metadata = @config.rpcs.review_document.metadata.to_h
|
1890
|
+
|
1891
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1892
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1893
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1894
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1895
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1896
|
+
|
1897
|
+
header_params = {}
|
1898
|
+
if request.human_review_config
|
1899
|
+
header_params["human_review_config"] = request.human_review_config
|
1900
|
+
end
|
1901
|
+
|
1902
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1903
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1904
|
+
|
1905
|
+
options.apply_defaults timeout: @config.rpcs.review_document.timeout,
|
1906
|
+
metadata: metadata,
|
1907
|
+
retry_policy: @config.rpcs.review_document.retry_policy
|
1908
|
+
|
1909
|
+
options.apply_defaults timeout: @config.timeout,
|
1910
|
+
metadata: @config.metadata,
|
1911
|
+
retry_policy: @config.retry_policy
|
1912
|
+
|
1913
|
+
@document_processor_service_stub.call_rpc :review_document, request, options: options do |response, operation|
|
1914
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
1915
|
+
yield response, operation if block_given?
|
1916
|
+
return response
|
1917
|
+
end
|
1918
|
+
rescue ::GRPC::BadStatus => e
|
1919
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1920
|
+
end
|
1921
|
+
|
1922
|
+
##
|
1923
|
+
# Evaluates a ProcessorVersion against annotated documents, producing an
|
1924
|
+
# Evaluation.
|
1925
|
+
#
|
1926
|
+
# @overload evaluate_processor_version(request, options = nil)
|
1927
|
+
# Pass arguments to `evaluate_processor_version` via a request object, either of type
|
1928
|
+
# {::Google::Cloud::DocumentAI::V1beta3::EvaluateProcessorVersionRequest} or an equivalent Hash.
|
1929
|
+
#
|
1930
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::EvaluateProcessorVersionRequest, ::Hash]
|
1931
|
+
# A request object representing the call parameters. Required. To specify no
|
1932
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1933
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1934
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1935
|
+
#
|
1936
|
+
# @overload evaluate_processor_version(processor_version: nil, evaluation_documents: nil)
|
1937
|
+
# Pass arguments to `evaluate_processor_version` via keyword arguments. Note that at
|
1938
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1939
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1940
|
+
#
|
1941
|
+
# @param processor_version [::String]
|
1942
|
+
# Required. The resource name of the {::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion ProcessorVersion} to evaluate.
|
1943
|
+
# `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
|
1944
|
+
# @param evaluation_documents [::Google::Cloud::DocumentAI::V1beta3::BatchDocumentsInputConfig, ::Hash]
|
1945
|
+
# Optional. The documents used in the evaluation. If unspecified, use the processor's
|
1946
|
+
# dataset as evaluation input.
|
1947
|
+
#
|
1948
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1949
|
+
# @yieldparam response [::Gapic::Operation]
|
1950
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1951
|
+
#
|
1952
|
+
# @return [::Gapic::Operation]
|
1953
|
+
#
|
1954
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1955
|
+
#
|
1956
|
+
# @example Basic example
|
1957
|
+
# require "google/cloud/document_ai/v1beta3"
|
1958
|
+
#
|
1959
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1960
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
1961
|
+
#
|
1962
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1963
|
+
# request = Google::Cloud::DocumentAI::V1beta3::EvaluateProcessorVersionRequest.new
|
1964
|
+
#
|
1965
|
+
# # Call the evaluate_processor_version method.
|
1966
|
+
# result = client.evaluate_processor_version request
|
1967
|
+
#
|
1968
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
1969
|
+
# # object to check the status of an operation, cancel it, or wait
|
1970
|
+
# # for results. Here is how to block until completion:
|
1971
|
+
# result.wait_until_done! timeout: 60
|
1972
|
+
# if result.response?
|
1973
|
+
# p result.response
|
1974
|
+
# else
|
1975
|
+
# puts "Error!"
|
1976
|
+
# end
|
1977
|
+
#
|
1978
|
+
def evaluate_processor_version request, options = nil
|
1979
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1980
|
+
|
1981
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::EvaluateProcessorVersionRequest
|
1982
|
+
|
1983
|
+
# Converts hash and nil to an options object
|
1984
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1985
|
+
|
1986
|
+
# Customize the options with defaults
|
1987
|
+
metadata = @config.rpcs.evaluate_processor_version.metadata.to_h
|
1988
|
+
|
1989
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1990
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1991
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1992
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
1993
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1994
|
+
|
1995
|
+
header_params = {}
|
1996
|
+
if request.processor_version
|
1997
|
+
header_params["processor_version"] = request.processor_version
|
1998
|
+
end
|
1999
|
+
|
2000
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2001
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2002
|
+
|
2003
|
+
options.apply_defaults timeout: @config.rpcs.evaluate_processor_version.timeout,
|
2004
|
+
metadata: metadata,
|
2005
|
+
retry_policy: @config.rpcs.evaluate_processor_version.retry_policy
|
2006
|
+
|
2007
|
+
options.apply_defaults timeout: @config.timeout,
|
2008
|
+
metadata: @config.metadata,
|
2009
|
+
retry_policy: @config.retry_policy
|
2010
|
+
|
2011
|
+
@document_processor_service_stub.call_rpc :evaluate_processor_version, request, options: options do |response, operation|
|
2012
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
2013
|
+
yield response, operation if block_given?
|
2014
|
+
return response
|
2015
|
+
end
|
2016
|
+
rescue ::GRPC::BadStatus => e
|
2017
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2018
|
+
end
|
2019
|
+
|
2020
|
+
##
|
2021
|
+
# Retrieves a specific evaluation.
|
2022
|
+
#
|
2023
|
+
# @overload get_evaluation(request, options = nil)
|
2024
|
+
# Pass arguments to `get_evaluation` via a request object, either of type
|
2025
|
+
# {::Google::Cloud::DocumentAI::V1beta3::GetEvaluationRequest} or an equivalent Hash.
|
2026
|
+
#
|
2027
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::GetEvaluationRequest, ::Hash]
|
2028
|
+
# A request object representing the call parameters. Required. To specify no
|
2029
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2030
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2031
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2032
|
+
#
|
2033
|
+
# @overload get_evaluation(name: nil)
|
2034
|
+
# Pass arguments to `get_evaluation` via keyword arguments. Note that at
|
2035
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2036
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2037
|
+
#
|
2038
|
+
# @param name [::String]
|
2039
|
+
# Required. The resource name of the {::Google::Cloud::DocumentAI::V1beta3::Evaluation Evaluation} to get.
|
2040
|
+
# `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
|
2041
|
+
#
|
2042
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2043
|
+
# @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::Evaluation]
|
2044
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2045
|
+
#
|
2046
|
+
# @return [::Google::Cloud::DocumentAI::V1beta3::Evaluation]
|
2047
|
+
#
|
2048
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2049
|
+
#
|
2050
|
+
# @example Basic example
|
2051
|
+
# require "google/cloud/document_ai/v1beta3"
|
2052
|
+
#
|
2053
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2054
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
2055
|
+
#
|
2056
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2057
|
+
# request = Google::Cloud::DocumentAI::V1beta3::GetEvaluationRequest.new
|
2058
|
+
#
|
2059
|
+
# # Call the get_evaluation method.
|
2060
|
+
# result = client.get_evaluation request
|
2061
|
+
#
|
2062
|
+
# # The returned object is of type Google::Cloud::DocumentAI::V1beta3::Evaluation.
|
2063
|
+
# p result
|
2064
|
+
#
|
2065
|
+
def get_evaluation request, options = nil
|
2066
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2067
|
+
|
2068
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetEvaluationRequest
|
2069
|
+
|
2070
|
+
# Converts hash and nil to an options object
|
2071
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2072
|
+
|
2073
|
+
# Customize the options with defaults
|
2074
|
+
metadata = @config.rpcs.get_evaluation.metadata.to_h
|
2075
|
+
|
2076
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2077
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2078
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2079
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
2080
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2081
|
+
|
2082
|
+
header_params = {}
|
2083
|
+
if request.name
|
2084
|
+
header_params["name"] = request.name
|
2085
|
+
end
|
2086
|
+
|
2087
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2088
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2089
|
+
|
2090
|
+
options.apply_defaults timeout: @config.rpcs.get_evaluation.timeout,
|
2091
|
+
metadata: metadata,
|
2092
|
+
retry_policy: @config.rpcs.get_evaluation.retry_policy
|
2093
|
+
|
2094
|
+
options.apply_defaults timeout: @config.timeout,
|
2095
|
+
metadata: @config.metadata,
|
2096
|
+
retry_policy: @config.retry_policy
|
2097
|
+
|
2098
|
+
@document_processor_service_stub.call_rpc :get_evaluation, request, options: options do |response, operation|
|
2099
|
+
yield response, operation if block_given?
|
2100
|
+
return response
|
2101
|
+
end
|
2102
|
+
rescue ::GRPC::BadStatus => e
|
2103
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2104
|
+
end
|
2105
|
+
|
2106
|
+
##
|
2107
|
+
# Retrieves a set of evaluations for a given processor version.
|
2108
|
+
#
|
2109
|
+
# @overload list_evaluations(request, options = nil)
|
2110
|
+
# Pass arguments to `list_evaluations` via a request object, either of type
|
2111
|
+
# {::Google::Cloud::DocumentAI::V1beta3::ListEvaluationsRequest} or an equivalent Hash.
|
2112
|
+
#
|
2113
|
+
# @param request [::Google::Cloud::DocumentAI::V1beta3::ListEvaluationsRequest, ::Hash]
|
2114
|
+
# A request object representing the call parameters. Required. To specify no
|
2115
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
2116
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
2117
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
2118
|
+
#
|
2119
|
+
# @overload list_evaluations(parent: nil, page_size: nil, page_token: nil)
|
2120
|
+
# Pass arguments to `list_evaluations` via keyword arguments. Note that at
|
2121
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
2122
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
2123
|
+
#
|
2124
|
+
# @param parent [::String]
|
2125
|
+
# Required. The resource name of the {::Google::Cloud::DocumentAI::V1beta3::ProcessorVersion ProcessorVersion} to list evaluations for.
|
2126
|
+
# `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
|
2127
|
+
# @param page_size [::Integer]
|
2128
|
+
# The standard list page size.
|
2129
|
+
# If unspecified, at most 5 evaluations will be returned.
|
2130
|
+
# The maximum value is 100; values above 100 will be coerced to 100.
|
2131
|
+
# @param page_token [::String]
|
2132
|
+
# A page token, received from a previous `ListEvaluations` call.
|
2133
|
+
# Provide this to retrieve the subsequent page.
|
2134
|
+
#
|
2135
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
2136
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation>]
|
2137
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
2138
|
+
#
|
2139
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1beta3::Evaluation>]
|
2140
|
+
#
|
2141
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
2142
|
+
#
|
2143
|
+
# @example Basic example
|
2144
|
+
# require "google/cloud/document_ai/v1beta3"
|
2145
|
+
#
|
2146
|
+
# # Create a client object. The client can be reused for multiple calls.
|
2147
|
+
# client = Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client.new
|
2148
|
+
#
|
2149
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
2150
|
+
# request = Google::Cloud::DocumentAI::V1beta3::ListEvaluationsRequest.new
|
2151
|
+
#
|
2152
|
+
# # Call the list_evaluations method.
|
2153
|
+
# result = client.list_evaluations request
|
2154
|
+
#
|
2155
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
2156
|
+
# # iterate over all elements by calling #each, and the enumerable
|
2157
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
2158
|
+
# # methods are also available for managing paging directly.
|
2159
|
+
# result.each do |response|
|
2160
|
+
# # Each element is of type ::Google::Cloud::DocumentAI::V1beta3::Evaluation.
|
2161
|
+
# p response
|
2162
|
+
# end
|
2163
|
+
#
|
2164
|
+
def list_evaluations request, options = nil
|
2165
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
2166
|
+
|
2167
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ListEvaluationsRequest
|
2168
|
+
|
2169
|
+
# Converts hash and nil to an options object
|
2170
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
2171
|
+
|
2172
|
+
# Customize the options with defaults
|
2173
|
+
metadata = @config.rpcs.list_evaluations.metadata.to_h
|
2174
|
+
|
2175
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
2176
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
2177
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
2178
|
+
gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
|
2179
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
2180
|
+
|
2181
|
+
header_params = {}
|
2182
|
+
if request.parent
|
2183
|
+
header_params["parent"] = request.parent
|
2184
|
+
end
|
2185
|
+
|
2186
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
2187
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
2188
|
+
|
2189
|
+
options.apply_defaults timeout: @config.rpcs.list_evaluations.timeout,
|
2190
|
+
metadata: metadata,
|
2191
|
+
retry_policy: @config.rpcs.list_evaluations.retry_policy
|
2192
|
+
|
2193
|
+
options.apply_defaults timeout: @config.timeout,
|
2194
|
+
metadata: @config.metadata,
|
2195
|
+
retry_policy: @config.retry_policy
|
2196
|
+
|
2197
|
+
@document_processor_service_stub.call_rpc :list_evaluations, request, options: options do |response, operation|
|
2198
|
+
response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_evaluations, request, response, operation, options
|
2199
|
+
yield response, operation if block_given?
|
2200
|
+
return response
|
2201
|
+
end
|
2202
|
+
rescue ::GRPC::BadStatus => e
|
2203
|
+
raise ::Google::Cloud::Error.from_error(e)
|
2204
|
+
end
|
2205
|
+
|
2206
|
+
##
|
2207
|
+
# Configuration class for the DocumentProcessorService API.
|
2208
|
+
#
|
2209
|
+
# This class represents the configuration for DocumentProcessorService,
|
2210
|
+
# providing control over timeouts, retry behavior, logging, transport
|
2211
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
2212
|
+
# applied individually to specific RPCs. See
|
2213
|
+
# {::Google::Cloud::DocumentAI::V1beta3::DocumentProcessorService::Client::Configuration::Rpcs}
|
2214
|
+
# for a list of RPCs that can be configured independently.
|
2215
|
+
#
|
2216
|
+
# Configuration can be applied globally to all clients, or to a single client
|
2217
|
+
# on construction.
|
2218
|
+
#
|
2219
|
+
# @example
|
1050
2220
|
#
|
1051
2221
|
# # Modify the global config, setting the timeout for
|
1052
2222
|
# # process_document to 20 seconds,
|
@@ -1184,11 +2354,51 @@ module Google
|
|
1184
2354
|
#
|
1185
2355
|
attr_reader :fetch_processor_types
|
1186
2356
|
##
|
2357
|
+
# RPC-specific configuration for `list_processor_types`
|
2358
|
+
# @return [::Gapic::Config::Method]
|
2359
|
+
#
|
2360
|
+
attr_reader :list_processor_types
|
2361
|
+
##
|
1187
2362
|
# RPC-specific configuration for `list_processors`
|
1188
2363
|
# @return [::Gapic::Config::Method]
|
1189
2364
|
#
|
1190
2365
|
attr_reader :list_processors
|
1191
2366
|
##
|
2367
|
+
# RPC-specific configuration for `get_processor`
|
2368
|
+
# @return [::Gapic::Config::Method]
|
2369
|
+
#
|
2370
|
+
attr_reader :get_processor
|
2371
|
+
##
|
2372
|
+
# RPC-specific configuration for `train_processor_version`
|
2373
|
+
# @return [::Gapic::Config::Method]
|
2374
|
+
#
|
2375
|
+
attr_reader :train_processor_version
|
2376
|
+
##
|
2377
|
+
# RPC-specific configuration for `get_processor_version`
|
2378
|
+
# @return [::Gapic::Config::Method]
|
2379
|
+
#
|
2380
|
+
attr_reader :get_processor_version
|
2381
|
+
##
|
2382
|
+
# RPC-specific configuration for `list_processor_versions`
|
2383
|
+
# @return [::Gapic::Config::Method]
|
2384
|
+
#
|
2385
|
+
attr_reader :list_processor_versions
|
2386
|
+
##
|
2387
|
+
# RPC-specific configuration for `delete_processor_version`
|
2388
|
+
# @return [::Gapic::Config::Method]
|
2389
|
+
#
|
2390
|
+
attr_reader :delete_processor_version
|
2391
|
+
##
|
2392
|
+
# RPC-specific configuration for `deploy_processor_version`
|
2393
|
+
# @return [::Gapic::Config::Method]
|
2394
|
+
#
|
2395
|
+
attr_reader :deploy_processor_version
|
2396
|
+
##
|
2397
|
+
# RPC-specific configuration for `undeploy_processor_version`
|
2398
|
+
# @return [::Gapic::Config::Method]
|
2399
|
+
#
|
2400
|
+
attr_reader :undeploy_processor_version
|
2401
|
+
##
|
1192
2402
|
# RPC-specific configuration for `create_processor`
|
1193
2403
|
# @return [::Gapic::Config::Method]
|
1194
2404
|
#
|
@@ -1209,10 +2419,30 @@ module Google
|
|
1209
2419
|
#
|
1210
2420
|
attr_reader :disable_processor
|
1211
2421
|
##
|
2422
|
+
# RPC-specific configuration for `set_default_processor_version`
|
2423
|
+
# @return [::Gapic::Config::Method]
|
2424
|
+
#
|
2425
|
+
attr_reader :set_default_processor_version
|
2426
|
+
##
|
1212
2427
|
# RPC-specific configuration for `review_document`
|
1213
2428
|
# @return [::Gapic::Config::Method]
|
1214
2429
|
#
|
1215
2430
|
attr_reader :review_document
|
2431
|
+
##
|
2432
|
+
# RPC-specific configuration for `evaluate_processor_version`
|
2433
|
+
# @return [::Gapic::Config::Method]
|
2434
|
+
#
|
2435
|
+
attr_reader :evaluate_processor_version
|
2436
|
+
##
|
2437
|
+
# RPC-specific configuration for `get_evaluation`
|
2438
|
+
# @return [::Gapic::Config::Method]
|
2439
|
+
#
|
2440
|
+
attr_reader :get_evaluation
|
2441
|
+
##
|
2442
|
+
# RPC-specific configuration for `list_evaluations`
|
2443
|
+
# @return [::Gapic::Config::Method]
|
2444
|
+
#
|
2445
|
+
attr_reader :list_evaluations
|
1216
2446
|
|
1217
2447
|
# @private
|
1218
2448
|
def initialize parent_rpcs = nil
|
@@ -1222,8 +2452,24 @@ module Google
|
|
1222
2452
|
@batch_process_documents = ::Gapic::Config::Method.new batch_process_documents_config
|
1223
2453
|
fetch_processor_types_config = parent_rpcs.fetch_processor_types if parent_rpcs.respond_to? :fetch_processor_types
|
1224
2454
|
@fetch_processor_types = ::Gapic::Config::Method.new fetch_processor_types_config
|
2455
|
+
list_processor_types_config = parent_rpcs.list_processor_types if parent_rpcs.respond_to? :list_processor_types
|
2456
|
+
@list_processor_types = ::Gapic::Config::Method.new list_processor_types_config
|
1225
2457
|
list_processors_config = parent_rpcs.list_processors if parent_rpcs.respond_to? :list_processors
|
1226
2458
|
@list_processors = ::Gapic::Config::Method.new list_processors_config
|
2459
|
+
get_processor_config = parent_rpcs.get_processor if parent_rpcs.respond_to? :get_processor
|
2460
|
+
@get_processor = ::Gapic::Config::Method.new get_processor_config
|
2461
|
+
train_processor_version_config = parent_rpcs.train_processor_version if parent_rpcs.respond_to? :train_processor_version
|
2462
|
+
@train_processor_version = ::Gapic::Config::Method.new train_processor_version_config
|
2463
|
+
get_processor_version_config = parent_rpcs.get_processor_version if parent_rpcs.respond_to? :get_processor_version
|
2464
|
+
@get_processor_version = ::Gapic::Config::Method.new get_processor_version_config
|
2465
|
+
list_processor_versions_config = parent_rpcs.list_processor_versions if parent_rpcs.respond_to? :list_processor_versions
|
2466
|
+
@list_processor_versions = ::Gapic::Config::Method.new list_processor_versions_config
|
2467
|
+
delete_processor_version_config = parent_rpcs.delete_processor_version if parent_rpcs.respond_to? :delete_processor_version
|
2468
|
+
@delete_processor_version = ::Gapic::Config::Method.new delete_processor_version_config
|
2469
|
+
deploy_processor_version_config = parent_rpcs.deploy_processor_version if parent_rpcs.respond_to? :deploy_processor_version
|
2470
|
+
@deploy_processor_version = ::Gapic::Config::Method.new deploy_processor_version_config
|
2471
|
+
undeploy_processor_version_config = parent_rpcs.undeploy_processor_version if parent_rpcs.respond_to? :undeploy_processor_version
|
2472
|
+
@undeploy_processor_version = ::Gapic::Config::Method.new undeploy_processor_version_config
|
1227
2473
|
create_processor_config = parent_rpcs.create_processor if parent_rpcs.respond_to? :create_processor
|
1228
2474
|
@create_processor = ::Gapic::Config::Method.new create_processor_config
|
1229
2475
|
delete_processor_config = parent_rpcs.delete_processor if parent_rpcs.respond_to? :delete_processor
|
@@ -1232,8 +2478,16 @@ module Google
|
|
1232
2478
|
@enable_processor = ::Gapic::Config::Method.new enable_processor_config
|
1233
2479
|
disable_processor_config = parent_rpcs.disable_processor if parent_rpcs.respond_to? :disable_processor
|
1234
2480
|
@disable_processor = ::Gapic::Config::Method.new disable_processor_config
|
2481
|
+
set_default_processor_version_config = parent_rpcs.set_default_processor_version if parent_rpcs.respond_to? :set_default_processor_version
|
2482
|
+
@set_default_processor_version = ::Gapic::Config::Method.new set_default_processor_version_config
|
1235
2483
|
review_document_config = parent_rpcs.review_document if parent_rpcs.respond_to? :review_document
|
1236
2484
|
@review_document = ::Gapic::Config::Method.new review_document_config
|
2485
|
+
evaluate_processor_version_config = parent_rpcs.evaluate_processor_version if parent_rpcs.respond_to? :evaluate_processor_version
|
2486
|
+
@evaluate_processor_version = ::Gapic::Config::Method.new evaluate_processor_version_config
|
2487
|
+
get_evaluation_config = parent_rpcs.get_evaluation if parent_rpcs.respond_to? :get_evaluation
|
2488
|
+
@get_evaluation = ::Gapic::Config::Method.new get_evaluation_config
|
2489
|
+
list_evaluations_config = parent_rpcs.list_evaluations if parent_rpcs.respond_to? :list_evaluations
|
2490
|
+
@list_evaluations = ::Gapic::Config::Method.new list_evaluations_config
|
1237
2491
|
|
1238
2492
|
yield self if block_given?
|
1239
2493
|
end
|