google-cloud-document_ai-v1 0.8.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -348,14 +348,14 @@ module Google
348
348
  # # Call the batch_process_documents method.
349
349
  # result = client.batch_process_documents request
350
350
  #
351
- # # The returned object is of type Gapic::Operation. You can use this
352
- # # object to check the status of an operation, cancel it, or wait
353
- # # for results. Here is how to block until completion:
351
+ # # The returned object is of type Gapic::Operation. You can use it to
352
+ # # check the status of an operation, cancel it, or wait for results.
353
+ # # Here is how to wait for a response.
354
354
  # result.wait_until_done! timeout: 60
355
355
  # if result.response?
356
356
  # p result.response
357
357
  # else
358
- # puts "Error!"
358
+ # puts "No response received."
359
359
  # end
360
360
  #
361
361
  def batch_process_documents request, options = nil
@@ -537,13 +537,11 @@ module Google
537
537
  # # Call the list_processor_types method.
538
538
  # result = client.list_processor_types request
539
539
  #
540
- # # The returned object is of type Gapic::PagedEnumerable. You can
541
- # # iterate over all elements by calling #each, and the enumerable
542
- # # will lazily make API calls to fetch subsequent pages. Other
543
- # # methods are also available for managing paging directly.
544
- # result.each do |response|
540
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
541
+ # # over elements, and API calls will be issued to fetch pages as needed.
542
+ # result.each do |item|
545
543
  # # Each element is of type ::Google::Cloud::DocumentAI::V1::ProcessorType.
546
- # p response
544
+ # p item
547
545
  # end
548
546
  #
549
547
  def list_processor_types request, options = nil
@@ -588,6 +586,91 @@ module Google
588
586
  raise ::Google::Cloud::Error.from_error(e)
589
587
  end
590
588
 
589
+ ##
590
+ # Gets a processor type detail.
591
+ #
592
+ # @overload get_processor_type(request, options = nil)
593
+ # Pass arguments to `get_processor_type` via a request object, either of type
594
+ # {::Google::Cloud::DocumentAI::V1::GetProcessorTypeRequest} or an equivalent Hash.
595
+ #
596
+ # @param request [::Google::Cloud::DocumentAI::V1::GetProcessorTypeRequest, ::Hash]
597
+ # A request object representing the call parameters. Required. To specify no
598
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
599
+ # @param options [::Gapic::CallOptions, ::Hash]
600
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
601
+ #
602
+ # @overload get_processor_type(name: nil)
603
+ # Pass arguments to `get_processor_type` via keyword arguments. Note that at
604
+ # least one keyword argument is required. To specify no parameters, or to keep all
605
+ # the default parameter values, pass an empty Hash as a request object (see above).
606
+ #
607
+ # @param name [::String]
608
+ # Required. The processor type resource name.
609
+ #
610
+ # @yield [response, operation] Access the result along with the RPC operation
611
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1::ProcessorType]
612
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
613
+ #
614
+ # @return [::Google::Cloud::DocumentAI::V1::ProcessorType]
615
+ #
616
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
617
+ #
618
+ # @example Basic example
619
+ # require "google/cloud/document_ai/v1"
620
+ #
621
+ # # Create a client object. The client can be reused for multiple calls.
622
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
623
+ #
624
+ # # Create a request. To set request fields, pass in keyword arguments.
625
+ # request = Google::Cloud::DocumentAI::V1::GetProcessorTypeRequest.new
626
+ #
627
+ # # Call the get_processor_type method.
628
+ # result = client.get_processor_type request
629
+ #
630
+ # # The returned object is of type Google::Cloud::DocumentAI::V1::ProcessorType.
631
+ # p result
632
+ #
633
+ def get_processor_type request, options = nil
634
+ raise ::ArgumentError, "request must be provided" if request.nil?
635
+
636
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::GetProcessorTypeRequest
637
+
638
+ # Converts hash and nil to an options object
639
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
640
+
641
+ # Customize the options with defaults
642
+ metadata = @config.rpcs.get_processor_type.metadata.to_h
643
+
644
+ # Set x-goog-api-client and x-goog-user-project headers
645
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
646
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
647
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
648
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
649
+
650
+ header_params = {}
651
+ if request.name
652
+ header_params["name"] = request.name
653
+ end
654
+
655
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
656
+ metadata[:"x-goog-request-params"] ||= request_params_header
657
+
658
+ options.apply_defaults timeout: @config.rpcs.get_processor_type.timeout,
659
+ metadata: metadata,
660
+ retry_policy: @config.rpcs.get_processor_type.retry_policy
661
+
662
+ options.apply_defaults timeout: @config.timeout,
663
+ metadata: @config.metadata,
664
+ retry_policy: @config.retry_policy
665
+
666
+ @document_processor_service_stub.call_rpc :get_processor_type, request, options: options do |response, operation|
667
+ yield response, operation if block_given?
668
+ return response
669
+ end
670
+ rescue ::GRPC::BadStatus => e
671
+ raise ::Google::Cloud::Error.from_error(e)
672
+ end
673
+
591
674
  ##
592
675
  # Lists all processors which belong to this project.
593
676
  #
@@ -637,13 +720,11 @@ module Google
637
720
  # # Call the list_processors method.
638
721
  # result = client.list_processors request
639
722
  #
640
- # # The returned object is of type Gapic::PagedEnumerable. You can
641
- # # iterate over all elements by calling #each, and the enumerable
642
- # # will lazily make API calls to fetch subsequent pages. Other
643
- # # methods are also available for managing paging directly.
644
- # result.each do |response|
723
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
724
+ # # over elements, and API calls will be issued to fetch pages as needed.
725
+ # result.each do |item|
645
726
  # # Each element is of type ::Google::Cloud::DocumentAI::V1::Processor.
646
- # p response
727
+ # p item
647
728
  # end
648
729
  #
649
730
  def list_processors request, options = nil
@@ -773,6 +854,113 @@ module Google
773
854
  raise ::Google::Cloud::Error.from_error(e)
774
855
  end
775
856
 
857
+ ##
858
+ # Trains a new processor version.
859
+ # Operation metadata is returned as
860
+ # cloud_documentai_core.TrainProcessorVersionMetadata.
861
+ #
862
+ # @overload train_processor_version(request, options = nil)
863
+ # Pass arguments to `train_processor_version` via a request object, either of type
864
+ # {::Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest} or an equivalent Hash.
865
+ #
866
+ # @param request [::Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest, ::Hash]
867
+ # A request object representing the call parameters. Required. To specify no
868
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
869
+ # @param options [::Gapic::CallOptions, ::Hash]
870
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
871
+ #
872
+ # @overload train_processor_version(parent: nil, processor_version: nil, document_schema: nil, input_data: nil, base_processor_version: nil)
873
+ # Pass arguments to `train_processor_version` via keyword arguments. Note that at
874
+ # least one keyword argument is required. To specify no parameters, or to keep all
875
+ # the default parameter values, pass an empty Hash as a request object (see above).
876
+ #
877
+ # @param parent [::String]
878
+ # Required. The parent (project, location and processor) to create the new
879
+ # version for. Format:
880
+ # `projects/{project}/locations/{location}/processors/{processor}`.
881
+ # @param processor_version [::Google::Cloud::DocumentAI::V1::ProcessorVersion, ::Hash]
882
+ # Required. The processor version to be created.
883
+ # @param document_schema [::Google::Cloud::DocumentAI::V1::DocumentSchema, ::Hash]
884
+ # Optional. The schema the processor version will be trained with.
885
+ # @param input_data [::Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest::InputData, ::Hash]
886
+ # Optional. The input data used to train the `ProcessorVersion`.
887
+ # @param base_processor_version [::String]
888
+ # Optional. The processor version to use as a base for training. This
889
+ # processor version must be a child of `parent`. Format:
890
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
891
+ #
892
+ # @yield [response, operation] Access the result along with the RPC operation
893
+ # @yieldparam response [::Gapic::Operation]
894
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
895
+ #
896
+ # @return [::Gapic::Operation]
897
+ #
898
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
899
+ #
900
+ # @example Basic example
901
+ # require "google/cloud/document_ai/v1"
902
+ #
903
+ # # Create a client object. The client can be reused for multiple calls.
904
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
905
+ #
906
+ # # Create a request. To set request fields, pass in keyword arguments.
907
+ # request = Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest.new
908
+ #
909
+ # # Call the train_processor_version method.
910
+ # result = client.train_processor_version request
911
+ #
912
+ # # The returned object is of type Gapic::Operation. You can use it to
913
+ # # check the status of an operation, cancel it, or wait for results.
914
+ # # Here is how to wait for a response.
915
+ # result.wait_until_done! timeout: 60
916
+ # if result.response?
917
+ # p result.response
918
+ # else
919
+ # puts "No response received."
920
+ # end
921
+ #
922
+ def train_processor_version request, options = nil
923
+ raise ::ArgumentError, "request must be provided" if request.nil?
924
+
925
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::TrainProcessorVersionRequest
926
+
927
+ # Converts hash and nil to an options object
928
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
929
+
930
+ # Customize the options with defaults
931
+ metadata = @config.rpcs.train_processor_version.metadata.to_h
932
+
933
+ # Set x-goog-api-client and x-goog-user-project headers
934
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
935
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
936
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
937
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
938
+
939
+ header_params = {}
940
+ if request.parent
941
+ header_params["parent"] = request.parent
942
+ end
943
+
944
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
945
+ metadata[:"x-goog-request-params"] ||= request_params_header
946
+
947
+ options.apply_defaults timeout: @config.rpcs.train_processor_version.timeout,
948
+ metadata: metadata,
949
+ retry_policy: @config.rpcs.train_processor_version.retry_policy
950
+
951
+ options.apply_defaults timeout: @config.timeout,
952
+ metadata: @config.metadata,
953
+ retry_policy: @config.retry_policy
954
+
955
+ @document_processor_service_stub.call_rpc :train_processor_version, request, options: options do |response, operation|
956
+ response = ::Gapic::Operation.new response, @operations_client, options: options
957
+ yield response, operation if block_given?
958
+ return response
959
+ end
960
+ rescue ::GRPC::BadStatus => e
961
+ raise ::Google::Cloud::Error.from_error(e)
962
+ end
963
+
776
964
  ##
777
965
  # Gets a processor version detail.
778
966
  #
@@ -908,13 +1096,11 @@ module Google
908
1096
  # # Call the list_processor_versions method.
909
1097
  # result = client.list_processor_versions request
910
1098
  #
911
- # # The returned object is of type Gapic::PagedEnumerable. You can
912
- # # iterate over all elements by calling #each, and the enumerable
913
- # # will lazily make API calls to fetch subsequent pages. Other
914
- # # methods are also available for managing paging directly.
915
- # result.each do |response|
1099
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1100
+ # # over elements, and API calls will be issued to fetch pages as needed.
1101
+ # result.each do |item|
916
1102
  # # Each element is of type ::Google::Cloud::DocumentAI::V1::ProcessorVersion.
917
- # p response
1103
+ # p item
918
1104
  # end
919
1105
  #
920
1106
  def list_processor_versions request, options = nil
@@ -1001,14 +1187,14 @@ module Google
1001
1187
  # # Call the delete_processor_version method.
1002
1188
  # result = client.delete_processor_version request
1003
1189
  #
1004
- # # The returned object is of type Gapic::Operation. You can use this
1005
- # # object to check the status of an operation, cancel it, or wait
1006
- # # for results. Here is how to block until completion:
1190
+ # # The returned object is of type Gapic::Operation. You can use it to
1191
+ # # check the status of an operation, cancel it, or wait for results.
1192
+ # # Here is how to wait for a response.
1007
1193
  # result.wait_until_done! timeout: 60
1008
1194
  # if result.response?
1009
1195
  # p result.response
1010
1196
  # else
1011
- # puts "Error!"
1197
+ # puts "No response received."
1012
1198
  # end
1013
1199
  #
1014
1200
  def delete_processor_version request, options = nil
@@ -1094,14 +1280,14 @@ module Google
1094
1280
  # # Call the deploy_processor_version method.
1095
1281
  # result = client.deploy_processor_version request
1096
1282
  #
1097
- # # The returned object is of type Gapic::Operation. You can use this
1098
- # # object to check the status of an operation, cancel it, or wait
1099
- # # for results. Here is how to block until completion:
1283
+ # # The returned object is of type Gapic::Operation. You can use it to
1284
+ # # check the status of an operation, cancel it, or wait for results.
1285
+ # # Here is how to wait for a response.
1100
1286
  # result.wait_until_done! timeout: 60
1101
1287
  # if result.response?
1102
1288
  # p result.response
1103
1289
  # else
1104
- # puts "Error!"
1290
+ # puts "No response received."
1105
1291
  # end
1106
1292
  #
1107
1293
  def deploy_processor_version request, options = nil
@@ -1187,14 +1373,14 @@ module Google
1187
1373
  # # Call the undeploy_processor_version method.
1188
1374
  # result = client.undeploy_processor_version request
1189
1375
  #
1190
- # # The returned object is of type Gapic::Operation. You can use this
1191
- # # object to check the status of an operation, cancel it, or wait
1192
- # # for results. Here is how to block until completion:
1376
+ # # The returned object is of type Gapic::Operation. You can use it to
1377
+ # # check the status of an operation, cancel it, or wait for results.
1378
+ # # Here is how to wait for a response.
1193
1379
  # result.wait_until_done! timeout: 60
1194
1380
  # if result.response?
1195
1381
  # p result.response
1196
1382
  # else
1197
- # puts "Error!"
1383
+ # puts "No response received."
1198
1384
  # end
1199
1385
  #
1200
1386
  def undeploy_processor_version request, options = nil
@@ -1372,14 +1558,14 @@ module Google
1372
1558
  # # Call the delete_processor method.
1373
1559
  # result = client.delete_processor request
1374
1560
  #
1375
- # # The returned object is of type Gapic::Operation. You can use this
1376
- # # object to check the status of an operation, cancel it, or wait
1377
- # # for results. Here is how to block until completion:
1561
+ # # The returned object is of type Gapic::Operation. You can use it to
1562
+ # # check the status of an operation, cancel it, or wait for results.
1563
+ # # Here is how to wait for a response.
1378
1564
  # result.wait_until_done! timeout: 60
1379
1565
  # if result.response?
1380
1566
  # p result.response
1381
1567
  # else
1382
- # puts "Error!"
1568
+ # puts "No response received."
1383
1569
  # end
1384
1570
  #
1385
1571
  def delete_processor request, options = nil
@@ -1465,14 +1651,14 @@ module Google
1465
1651
  # # Call the enable_processor method.
1466
1652
  # result = client.enable_processor request
1467
1653
  #
1468
- # # The returned object is of type Gapic::Operation. You can use this
1469
- # # object to check the status of an operation, cancel it, or wait
1470
- # # for results. Here is how to block until completion:
1654
+ # # The returned object is of type Gapic::Operation. You can use it to
1655
+ # # check the status of an operation, cancel it, or wait for results.
1656
+ # # Here is how to wait for a response.
1471
1657
  # result.wait_until_done! timeout: 60
1472
1658
  # if result.response?
1473
1659
  # p result.response
1474
1660
  # else
1475
- # puts "Error!"
1661
+ # puts "No response received."
1476
1662
  # end
1477
1663
  #
1478
1664
  def enable_processor request, options = nil
@@ -1558,14 +1744,14 @@ module Google
1558
1744
  # # Call the disable_processor method.
1559
1745
  # result = client.disable_processor request
1560
1746
  #
1561
- # # The returned object is of type Gapic::Operation. You can use this
1562
- # # object to check the status of an operation, cancel it, or wait
1563
- # # for results. Here is how to block until completion:
1747
+ # # The returned object is of type Gapic::Operation. You can use it to
1748
+ # # check the status of an operation, cancel it, or wait for results.
1749
+ # # Here is how to wait for a response.
1564
1750
  # result.wait_until_done! timeout: 60
1565
1751
  # if result.response?
1566
1752
  # p result.response
1567
1753
  # else
1568
- # puts "Error!"
1754
+ # puts "No response received."
1569
1755
  # end
1570
1756
  #
1571
1757
  def disable_processor request, options = nil
@@ -1662,14 +1848,14 @@ module Google
1662
1848
  # # Call the set_default_processor_version method.
1663
1849
  # result = client.set_default_processor_version request
1664
1850
  #
1665
- # # The returned object is of type Gapic::Operation. You can use this
1666
- # # object to check the status of an operation, cancel it, or wait
1667
- # # for results. Here is how to block until completion:
1851
+ # # The returned object is of type Gapic::Operation. You can use it to
1852
+ # # check the status of an operation, cancel it, or wait for results.
1853
+ # # Here is how to wait for a response.
1668
1854
  # result.wait_until_done! timeout: 60
1669
1855
  # if result.response?
1670
1856
  # p result.response
1671
1857
  # else
1672
- # puts "Error!"
1858
+ # puts "No response received."
1673
1859
  # end
1674
1860
  #
1675
1861
  def set_default_processor_version request, options = nil
@@ -1765,14 +1951,14 @@ module Google
1765
1951
  # # Call the review_document method.
1766
1952
  # result = client.review_document request
1767
1953
  #
1768
- # # The returned object is of type Gapic::Operation. You can use this
1769
- # # object to check the status of an operation, cancel it, or wait
1770
- # # for results. Here is how to block until completion:
1954
+ # # The returned object is of type Gapic::Operation. You can use it to
1955
+ # # check the status of an operation, cancel it, or wait for results.
1956
+ # # Here is how to wait for a response.
1771
1957
  # result.wait_until_done! timeout: 60
1772
1958
  # if result.response?
1773
1959
  # p result.response
1774
1960
  # else
1775
- # puts "Error!"
1961
+ # puts "No response received."
1776
1962
  # end
1777
1963
  #
1778
1964
  def review_document request, options = nil
@@ -1817,6 +2003,293 @@ module Google
1817
2003
  raise ::Google::Cloud::Error.from_error(e)
1818
2004
  end
1819
2005
 
2006
+ ##
2007
+ # Evaluates a ProcessorVersion against annotated documents, producing an
2008
+ # Evaluation.
2009
+ #
2010
+ # @overload evaluate_processor_version(request, options = nil)
2011
+ # Pass arguments to `evaluate_processor_version` via a request object, either of type
2012
+ # {::Google::Cloud::DocumentAI::V1::EvaluateProcessorVersionRequest} or an equivalent Hash.
2013
+ #
2014
+ # @param request [::Google::Cloud::DocumentAI::V1::EvaluateProcessorVersionRequest, ::Hash]
2015
+ # A request object representing the call parameters. Required. To specify no
2016
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2017
+ # @param options [::Gapic::CallOptions, ::Hash]
2018
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2019
+ #
2020
+ # @overload evaluate_processor_version(processor_version: nil, evaluation_documents: nil)
2021
+ # Pass arguments to `evaluate_processor_version` via keyword arguments. Note that at
2022
+ # least one keyword argument is required. To specify no parameters, or to keep all
2023
+ # the default parameter values, pass an empty Hash as a request object (see above).
2024
+ #
2025
+ # @param processor_version [::String]
2026
+ # Required. The resource name of the
2027
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion} to
2028
+ # evaluate.
2029
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
2030
+ # @param evaluation_documents [::Google::Cloud::DocumentAI::V1::BatchDocumentsInputConfig, ::Hash]
2031
+ # Optional. The documents used in the evaluation. If unspecified, use the
2032
+ # processor's dataset as evaluation input.
2033
+ #
2034
+ # @yield [response, operation] Access the result along with the RPC operation
2035
+ # @yieldparam response [::Gapic::Operation]
2036
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2037
+ #
2038
+ # @return [::Gapic::Operation]
2039
+ #
2040
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2041
+ #
2042
+ # @example Basic example
2043
+ # require "google/cloud/document_ai/v1"
2044
+ #
2045
+ # # Create a client object. The client can be reused for multiple calls.
2046
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
2047
+ #
2048
+ # # Create a request. To set request fields, pass in keyword arguments.
2049
+ # request = Google::Cloud::DocumentAI::V1::EvaluateProcessorVersionRequest.new
2050
+ #
2051
+ # # Call the evaluate_processor_version method.
2052
+ # result = client.evaluate_processor_version request
2053
+ #
2054
+ # # The returned object is of type Gapic::Operation. You can use it to
2055
+ # # check the status of an operation, cancel it, or wait for results.
2056
+ # # Here is how to wait for a response.
2057
+ # result.wait_until_done! timeout: 60
2058
+ # if result.response?
2059
+ # p result.response
2060
+ # else
2061
+ # puts "No response received."
2062
+ # end
2063
+ #
2064
+ def evaluate_processor_version request, options = nil
2065
+ raise ::ArgumentError, "request must be provided" if request.nil?
2066
+
2067
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::EvaluateProcessorVersionRequest
2068
+
2069
+ # Converts hash and nil to an options object
2070
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2071
+
2072
+ # Customize the options with defaults
2073
+ metadata = @config.rpcs.evaluate_processor_version.metadata.to_h
2074
+
2075
+ # Set x-goog-api-client and x-goog-user-project headers
2076
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2077
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2078
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
2079
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2080
+
2081
+ header_params = {}
2082
+ if request.processor_version
2083
+ header_params["processor_version"] = request.processor_version
2084
+ end
2085
+
2086
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2087
+ metadata[:"x-goog-request-params"] ||= request_params_header
2088
+
2089
+ options.apply_defaults timeout: @config.rpcs.evaluate_processor_version.timeout,
2090
+ metadata: metadata,
2091
+ retry_policy: @config.rpcs.evaluate_processor_version.retry_policy
2092
+
2093
+ options.apply_defaults timeout: @config.timeout,
2094
+ metadata: @config.metadata,
2095
+ retry_policy: @config.retry_policy
2096
+
2097
+ @document_processor_service_stub.call_rpc :evaluate_processor_version, request, options: options do |response, operation|
2098
+ response = ::Gapic::Operation.new response, @operations_client, options: options
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 specific evaluation.
2108
+ #
2109
+ # @overload get_evaluation(request, options = nil)
2110
+ # Pass arguments to `get_evaluation` via a request object, either of type
2111
+ # {::Google::Cloud::DocumentAI::V1::GetEvaluationRequest} or an equivalent Hash.
2112
+ #
2113
+ # @param request [::Google::Cloud::DocumentAI::V1::GetEvaluationRequest, ::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 get_evaluation(name: nil)
2120
+ # Pass arguments to `get_evaluation` 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 name [::String]
2125
+ # Required. The resource name of the
2126
+ # {::Google::Cloud::DocumentAI::V1::Evaluation Evaluation} to get.
2127
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
2128
+ #
2129
+ # @yield [response, operation] Access the result along with the RPC operation
2130
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1::Evaluation]
2131
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2132
+ #
2133
+ # @return [::Google::Cloud::DocumentAI::V1::Evaluation]
2134
+ #
2135
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2136
+ #
2137
+ # @example Basic example
2138
+ # require "google/cloud/document_ai/v1"
2139
+ #
2140
+ # # Create a client object. The client can be reused for multiple calls.
2141
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
2142
+ #
2143
+ # # Create a request. To set request fields, pass in keyword arguments.
2144
+ # request = Google::Cloud::DocumentAI::V1::GetEvaluationRequest.new
2145
+ #
2146
+ # # Call the get_evaluation method.
2147
+ # result = client.get_evaluation request
2148
+ #
2149
+ # # The returned object is of type Google::Cloud::DocumentAI::V1::Evaluation.
2150
+ # p result
2151
+ #
2152
+ def get_evaluation request, options = nil
2153
+ raise ::ArgumentError, "request must be provided" if request.nil?
2154
+
2155
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::GetEvaluationRequest
2156
+
2157
+ # Converts hash and nil to an options object
2158
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2159
+
2160
+ # Customize the options with defaults
2161
+ metadata = @config.rpcs.get_evaluation.metadata.to_h
2162
+
2163
+ # Set x-goog-api-client and x-goog-user-project headers
2164
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2165
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2166
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
2167
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2168
+
2169
+ header_params = {}
2170
+ if request.name
2171
+ header_params["name"] = request.name
2172
+ end
2173
+
2174
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2175
+ metadata[:"x-goog-request-params"] ||= request_params_header
2176
+
2177
+ options.apply_defaults timeout: @config.rpcs.get_evaluation.timeout,
2178
+ metadata: metadata,
2179
+ retry_policy: @config.rpcs.get_evaluation.retry_policy
2180
+
2181
+ options.apply_defaults timeout: @config.timeout,
2182
+ metadata: @config.metadata,
2183
+ retry_policy: @config.retry_policy
2184
+
2185
+ @document_processor_service_stub.call_rpc :get_evaluation, request, options: options do |response, operation|
2186
+ yield response, operation if block_given?
2187
+ return response
2188
+ end
2189
+ rescue ::GRPC::BadStatus => e
2190
+ raise ::Google::Cloud::Error.from_error(e)
2191
+ end
2192
+
2193
+ ##
2194
+ # Retrieves a set of evaluations for a given processor version.
2195
+ #
2196
+ # @overload list_evaluations(request, options = nil)
2197
+ # Pass arguments to `list_evaluations` via a request object, either of type
2198
+ # {::Google::Cloud::DocumentAI::V1::ListEvaluationsRequest} or an equivalent Hash.
2199
+ #
2200
+ # @param request [::Google::Cloud::DocumentAI::V1::ListEvaluationsRequest, ::Hash]
2201
+ # A request object representing the call parameters. Required. To specify no
2202
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2203
+ # @param options [::Gapic::CallOptions, ::Hash]
2204
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2205
+ #
2206
+ # @overload list_evaluations(parent: nil, page_size: nil, page_token: nil)
2207
+ # Pass arguments to `list_evaluations` via keyword arguments. Note that at
2208
+ # least one keyword argument is required. To specify no parameters, or to keep all
2209
+ # the default parameter values, pass an empty Hash as a request object (see above).
2210
+ #
2211
+ # @param parent [::String]
2212
+ # Required. The resource name of the
2213
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion} to list
2214
+ # evaluations for.
2215
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
2216
+ # @param page_size [::Integer]
2217
+ # The standard list page size.
2218
+ # If unspecified, at most 5 evaluations will be returned.
2219
+ # The maximum value is 100; values above 100 will be coerced to 100.
2220
+ # @param page_token [::String]
2221
+ # A page token, received from a previous `ListEvaluations` call.
2222
+ # Provide this to retrieve the subsequent page.
2223
+ #
2224
+ # @yield [response, operation] Access the result along with the RPC operation
2225
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1::Evaluation>]
2226
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2227
+ #
2228
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1::Evaluation>]
2229
+ #
2230
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2231
+ #
2232
+ # @example Basic example
2233
+ # require "google/cloud/document_ai/v1"
2234
+ #
2235
+ # # Create a client object. The client can be reused for multiple calls.
2236
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
2237
+ #
2238
+ # # Create a request. To set request fields, pass in keyword arguments.
2239
+ # request = Google::Cloud::DocumentAI::V1::ListEvaluationsRequest.new
2240
+ #
2241
+ # # Call the list_evaluations method.
2242
+ # result = client.list_evaluations request
2243
+ #
2244
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2245
+ # # over elements, and API calls will be issued to fetch pages as needed.
2246
+ # result.each do |item|
2247
+ # # Each element is of type ::Google::Cloud::DocumentAI::V1::Evaluation.
2248
+ # p item
2249
+ # end
2250
+ #
2251
+ def list_evaluations request, options = nil
2252
+ raise ::ArgumentError, "request must be provided" if request.nil?
2253
+
2254
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ListEvaluationsRequest
2255
+
2256
+ # Converts hash and nil to an options object
2257
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2258
+
2259
+ # Customize the options with defaults
2260
+ metadata = @config.rpcs.list_evaluations.metadata.to_h
2261
+
2262
+ # Set x-goog-api-client and x-goog-user-project headers
2263
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2264
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2265
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
2266
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2267
+
2268
+ header_params = {}
2269
+ if request.parent
2270
+ header_params["parent"] = request.parent
2271
+ end
2272
+
2273
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2274
+ metadata[:"x-goog-request-params"] ||= request_params_header
2275
+
2276
+ options.apply_defaults timeout: @config.rpcs.list_evaluations.timeout,
2277
+ metadata: metadata,
2278
+ retry_policy: @config.rpcs.list_evaluations.retry_policy
2279
+
2280
+ options.apply_defaults timeout: @config.timeout,
2281
+ metadata: @config.metadata,
2282
+ retry_policy: @config.retry_policy
2283
+
2284
+ @document_processor_service_stub.call_rpc :list_evaluations, request, options: options do |response, operation|
2285
+ response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_evaluations, request, response, operation, options
2286
+ yield response, operation if block_given?
2287
+ return response
2288
+ end
2289
+ rescue ::GRPC::BadStatus => e
2290
+ raise ::Google::Cloud::Error.from_error(e)
2291
+ end
2292
+
1820
2293
  ##
1821
2294
  # Configuration class for the DocumentProcessorService API.
1822
2295
  #
@@ -1973,6 +2446,11 @@ module Google
1973
2446
  #
1974
2447
  attr_reader :list_processor_types
1975
2448
  ##
2449
+ # RPC-specific configuration for `get_processor_type`
2450
+ # @return [::Gapic::Config::Method]
2451
+ #
2452
+ attr_reader :get_processor_type
2453
+ ##
1976
2454
  # RPC-specific configuration for `list_processors`
1977
2455
  # @return [::Gapic::Config::Method]
1978
2456
  #
@@ -1983,6 +2461,11 @@ module Google
1983
2461
  #
1984
2462
  attr_reader :get_processor
1985
2463
  ##
2464
+ # RPC-specific configuration for `train_processor_version`
2465
+ # @return [::Gapic::Config::Method]
2466
+ #
2467
+ attr_reader :train_processor_version
2468
+ ##
1986
2469
  # RPC-specific configuration for `get_processor_version`
1987
2470
  # @return [::Gapic::Config::Method]
1988
2471
  #
@@ -2037,6 +2520,21 @@ module Google
2037
2520
  # @return [::Gapic::Config::Method]
2038
2521
  #
2039
2522
  attr_reader :review_document
2523
+ ##
2524
+ # RPC-specific configuration for `evaluate_processor_version`
2525
+ # @return [::Gapic::Config::Method]
2526
+ #
2527
+ attr_reader :evaluate_processor_version
2528
+ ##
2529
+ # RPC-specific configuration for `get_evaluation`
2530
+ # @return [::Gapic::Config::Method]
2531
+ #
2532
+ attr_reader :get_evaluation
2533
+ ##
2534
+ # RPC-specific configuration for `list_evaluations`
2535
+ # @return [::Gapic::Config::Method]
2536
+ #
2537
+ attr_reader :list_evaluations
2040
2538
 
2041
2539
  # @private
2042
2540
  def initialize parent_rpcs = nil
@@ -2048,10 +2546,14 @@ module Google
2048
2546
  @fetch_processor_types = ::Gapic::Config::Method.new fetch_processor_types_config
2049
2547
  list_processor_types_config = parent_rpcs.list_processor_types if parent_rpcs.respond_to? :list_processor_types
2050
2548
  @list_processor_types = ::Gapic::Config::Method.new list_processor_types_config
2549
+ get_processor_type_config = parent_rpcs.get_processor_type if parent_rpcs.respond_to? :get_processor_type
2550
+ @get_processor_type = ::Gapic::Config::Method.new get_processor_type_config
2051
2551
  list_processors_config = parent_rpcs.list_processors if parent_rpcs.respond_to? :list_processors
2052
2552
  @list_processors = ::Gapic::Config::Method.new list_processors_config
2053
2553
  get_processor_config = parent_rpcs.get_processor if parent_rpcs.respond_to? :get_processor
2054
2554
  @get_processor = ::Gapic::Config::Method.new get_processor_config
2555
+ train_processor_version_config = parent_rpcs.train_processor_version if parent_rpcs.respond_to? :train_processor_version
2556
+ @train_processor_version = ::Gapic::Config::Method.new train_processor_version_config
2055
2557
  get_processor_version_config = parent_rpcs.get_processor_version if parent_rpcs.respond_to? :get_processor_version
2056
2558
  @get_processor_version = ::Gapic::Config::Method.new get_processor_version_config
2057
2559
  list_processor_versions_config = parent_rpcs.list_processor_versions if parent_rpcs.respond_to? :list_processor_versions
@@ -2074,6 +2576,12 @@ module Google
2074
2576
  @set_default_processor_version = ::Gapic::Config::Method.new set_default_processor_version_config
2075
2577
  review_document_config = parent_rpcs.review_document if parent_rpcs.respond_to? :review_document
2076
2578
  @review_document = ::Gapic::Config::Method.new review_document_config
2579
+ evaluate_processor_version_config = parent_rpcs.evaluate_processor_version if parent_rpcs.respond_to? :evaluate_processor_version
2580
+ @evaluate_processor_version = ::Gapic::Config::Method.new evaluate_processor_version_config
2581
+ get_evaluation_config = parent_rpcs.get_evaluation if parent_rpcs.respond_to? :get_evaluation
2582
+ @get_evaluation = ::Gapic::Config::Method.new get_evaluation_config
2583
+ list_evaluations_config = parent_rpcs.list_evaluations if parent_rpcs.respond_to? :list_evaluations
2584
+ @list_evaluations = ::Gapic::Config::Method.new list_evaluations_config
2077
2585
 
2078
2586
  yield self if block_given?
2079
2587
  end