google-cloud-document_ai-v1 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/document_ai/v1/bindings_override.rb +118 -0
  4. data/lib/google/cloud/document_ai/v1/document_processor_service/client.rb +470 -54
  5. data/lib/google/cloud/document_ai/v1/document_processor_service/operations.rb +12 -14
  6. data/lib/google/cloud/document_ai/v1/document_processor_service/paths.rb +23 -0
  7. data/lib/google/cloud/document_ai/v1/document_processor_service/rest/client.rb +1984 -0
  8. data/lib/google/cloud/document_ai/v1/document_processor_service/rest/operations.rb +820 -0
  9. data/lib/google/cloud/document_ai/v1/document_processor_service/rest/service_stub.rb +1373 -0
  10. data/lib/google/cloud/document_ai/v1/document_processor_service/rest.rb +57 -0
  11. data/lib/google/cloud/document_ai/v1/document_processor_service.rb +6 -0
  12. data/lib/google/cloud/document_ai/v1/rest.rb +38 -0
  13. data/lib/google/cloud/document_ai/v1/version.rb +1 -1
  14. data/lib/google/cloud/document_ai/v1.rb +5 -0
  15. data/lib/google/cloud/documentai/v1/document_pb.rb +1 -0
  16. data/lib/google/cloud/documentai/v1/document_processor_service_pb.rb +60 -0
  17. data/lib/google/cloud/documentai/v1/document_processor_service_services_pb.rb +11 -0
  18. data/lib/google/cloud/documentai/v1/evaluation_pb.rb +79 -0
  19. data/lib/google/cloud/documentai/v1/processor_pb.rb +2 -0
  20. data/proto_docs/google/cloud/documentai/v1/document.rb +16 -7
  21. data/proto_docs/google/cloud/documentai/v1/document_processor_service.rb +163 -0
  22. data/proto_docs/google/cloud/documentai/v1/document_schema.rb +14 -6
  23. data/proto_docs/google/cloud/documentai/v1/evaluation.rb +199 -0
  24. data/proto_docs/google/cloud/documentai/v1/processor.rb +3 -0
  25. metadata +19 -9
@@ -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
@@ -722,13 +720,11 @@ module Google
722
720
  # # Call the list_processors method.
723
721
  # result = client.list_processors request
724
722
  #
725
- # # The returned object is of type Gapic::PagedEnumerable. You can
726
- # # iterate over all elements by calling #each, and the enumerable
727
- # # will lazily make API calls to fetch subsequent pages. Other
728
- # # methods are also available for managing paging directly.
729
- # 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|
730
726
  # # Each element is of type ::Google::Cloud::DocumentAI::V1::Processor.
731
- # p response
727
+ # p item
732
728
  # end
733
729
  #
734
730
  def list_processors request, options = nil
@@ -858,6 +854,113 @@ module Google
858
854
  raise ::Google::Cloud::Error.from_error(e)
859
855
  end
860
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
+
861
964
  ##
862
965
  # Gets a processor version detail.
863
966
  #
@@ -993,13 +1096,11 @@ module Google
993
1096
  # # Call the list_processor_versions method.
994
1097
  # result = client.list_processor_versions request
995
1098
  #
996
- # # The returned object is of type Gapic::PagedEnumerable. You can
997
- # # iterate over all elements by calling #each, and the enumerable
998
- # # will lazily make API calls to fetch subsequent pages. Other
999
- # # methods are also available for managing paging directly.
1000
- # 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|
1001
1102
  # # Each element is of type ::Google::Cloud::DocumentAI::V1::ProcessorVersion.
1002
- # p response
1103
+ # p item
1003
1104
  # end
1004
1105
  #
1005
1106
  def list_processor_versions request, options = nil
@@ -1086,14 +1187,14 @@ module Google
1086
1187
  # # Call the delete_processor_version method.
1087
1188
  # result = client.delete_processor_version request
1088
1189
  #
1089
- # # The returned object is of type Gapic::Operation. You can use this
1090
- # # object to check the status of an operation, cancel it, or wait
1091
- # # 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.
1092
1193
  # result.wait_until_done! timeout: 60
1093
1194
  # if result.response?
1094
1195
  # p result.response
1095
1196
  # else
1096
- # puts "Error!"
1197
+ # puts "No response received."
1097
1198
  # end
1098
1199
  #
1099
1200
  def delete_processor_version request, options = nil
@@ -1179,14 +1280,14 @@ module Google
1179
1280
  # # Call the deploy_processor_version method.
1180
1281
  # result = client.deploy_processor_version request
1181
1282
  #
1182
- # # The returned object is of type Gapic::Operation. You can use this
1183
- # # object to check the status of an operation, cancel it, or wait
1184
- # # 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.
1185
1286
  # result.wait_until_done! timeout: 60
1186
1287
  # if result.response?
1187
1288
  # p result.response
1188
1289
  # else
1189
- # puts "Error!"
1290
+ # puts "No response received."
1190
1291
  # end
1191
1292
  #
1192
1293
  def deploy_processor_version request, options = nil
@@ -1272,14 +1373,14 @@ module Google
1272
1373
  # # Call the undeploy_processor_version method.
1273
1374
  # result = client.undeploy_processor_version request
1274
1375
  #
1275
- # # The returned object is of type Gapic::Operation. You can use this
1276
- # # object to check the status of an operation, cancel it, or wait
1277
- # # 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.
1278
1379
  # result.wait_until_done! timeout: 60
1279
1380
  # if result.response?
1280
1381
  # p result.response
1281
1382
  # else
1282
- # puts "Error!"
1383
+ # puts "No response received."
1283
1384
  # end
1284
1385
  #
1285
1386
  def undeploy_processor_version request, options = nil
@@ -1457,14 +1558,14 @@ module Google
1457
1558
  # # Call the delete_processor method.
1458
1559
  # result = client.delete_processor request
1459
1560
  #
1460
- # # The returned object is of type Gapic::Operation. You can use this
1461
- # # object to check the status of an operation, cancel it, or wait
1462
- # # 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.
1463
1564
  # result.wait_until_done! timeout: 60
1464
1565
  # if result.response?
1465
1566
  # p result.response
1466
1567
  # else
1467
- # puts "Error!"
1568
+ # puts "No response received."
1468
1569
  # end
1469
1570
  #
1470
1571
  def delete_processor request, options = nil
@@ -1550,14 +1651,14 @@ module Google
1550
1651
  # # Call the enable_processor method.
1551
1652
  # result = client.enable_processor request
1552
1653
  #
1553
- # # The returned object is of type Gapic::Operation. You can use this
1554
- # # object to check the status of an operation, cancel it, or wait
1555
- # # 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.
1556
1657
  # result.wait_until_done! timeout: 60
1557
1658
  # if result.response?
1558
1659
  # p result.response
1559
1660
  # else
1560
- # puts "Error!"
1661
+ # puts "No response received."
1561
1662
  # end
1562
1663
  #
1563
1664
  def enable_processor request, options = nil
@@ -1643,14 +1744,14 @@ module Google
1643
1744
  # # Call the disable_processor method.
1644
1745
  # result = client.disable_processor request
1645
1746
  #
1646
- # # The returned object is of type Gapic::Operation. You can use this
1647
- # # object to check the status of an operation, cancel it, or wait
1648
- # # 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.
1649
1750
  # result.wait_until_done! timeout: 60
1650
1751
  # if result.response?
1651
1752
  # p result.response
1652
1753
  # else
1653
- # puts "Error!"
1754
+ # puts "No response received."
1654
1755
  # end
1655
1756
  #
1656
1757
  def disable_processor request, options = nil
@@ -1747,14 +1848,14 @@ module Google
1747
1848
  # # Call the set_default_processor_version method.
1748
1849
  # result = client.set_default_processor_version request
1749
1850
  #
1750
- # # The returned object is of type Gapic::Operation. You can use this
1751
- # # object to check the status of an operation, cancel it, or wait
1752
- # # 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.
1753
1854
  # result.wait_until_done! timeout: 60
1754
1855
  # if result.response?
1755
1856
  # p result.response
1756
1857
  # else
1757
- # puts "Error!"
1858
+ # puts "No response received."
1758
1859
  # end
1759
1860
  #
1760
1861
  def set_default_processor_version request, options = nil
@@ -1850,14 +1951,14 @@ module Google
1850
1951
  # # Call the review_document method.
1851
1952
  # result = client.review_document request
1852
1953
  #
1853
- # # The returned object is of type Gapic::Operation. You can use this
1854
- # # object to check the status of an operation, cancel it, or wait
1855
- # # 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.
1856
1957
  # result.wait_until_done! timeout: 60
1857
1958
  # if result.response?
1858
1959
  # p result.response
1859
1960
  # else
1860
- # puts "Error!"
1961
+ # puts "No response received."
1861
1962
  # end
1862
1963
  #
1863
1964
  def review_document request, options = nil
@@ -1902,6 +2003,293 @@ module Google
1902
2003
  raise ::Google::Cloud::Error.from_error(e)
1903
2004
  end
1904
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
+
1905
2293
  ##
1906
2294
  # Configuration class for the DocumentProcessorService API.
1907
2295
  #
@@ -2073,6 +2461,11 @@ module Google
2073
2461
  #
2074
2462
  attr_reader :get_processor
2075
2463
  ##
2464
+ # RPC-specific configuration for `train_processor_version`
2465
+ # @return [::Gapic::Config::Method]
2466
+ #
2467
+ attr_reader :train_processor_version
2468
+ ##
2076
2469
  # RPC-specific configuration for `get_processor_version`
2077
2470
  # @return [::Gapic::Config::Method]
2078
2471
  #
@@ -2127,6 +2520,21 @@ module Google
2127
2520
  # @return [::Gapic::Config::Method]
2128
2521
  #
2129
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
2130
2538
 
2131
2539
  # @private
2132
2540
  def initialize parent_rpcs = nil
@@ -2144,6 +2552,8 @@ module Google
2144
2552
  @list_processors = ::Gapic::Config::Method.new list_processors_config
2145
2553
  get_processor_config = parent_rpcs.get_processor if parent_rpcs.respond_to? :get_processor
2146
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
2147
2557
  get_processor_version_config = parent_rpcs.get_processor_version if parent_rpcs.respond_to? :get_processor_version
2148
2558
  @get_processor_version = ::Gapic::Config::Method.new get_processor_version_config
2149
2559
  list_processor_versions_config = parent_rpcs.list_processor_versions if parent_rpcs.respond_to? :list_processor_versions
@@ -2166,6 +2576,12 @@ module Google
2166
2576
  @set_default_processor_version = ::Gapic::Config::Method.new set_default_processor_version_config
2167
2577
  review_document_config = parent_rpcs.review_document if parent_rpcs.respond_to? :review_document
2168
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
2169
2585
 
2170
2586
  yield self if block_given?
2171
2587
  end