cloudmersive-documentai-api-client 2.2.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.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/README.md +140 -0
- data/Rakefile +8 -0
- data/cloudmersive-documentai-api-client.gemspec +45 -0
- data/docs/AdvancedExtractClassificationRequest.md +10 -0
- data/docs/AdvancedExtractFieldsRequest.md +10 -0
- data/docs/AnalyzeApi.md +64 -0
- data/docs/DocumentAdvancedClassificationResult.md +9 -0
- data/docs/DocumentCategories.md +9 -0
- data/docs/DocumentClassificationResult.md +9 -0
- data/docs/DocumentPolicyRequest.md +9 -0
- data/docs/DocumentPolicyResult.md +10 -0
- data/docs/ExtractApi.md +534 -0
- data/docs/ExtractBarcodesAiResponse.md +9 -0
- data/docs/ExtractDocumentBatchJobResult.md +9 -0
- data/docs/ExtractDocumentJobStatusResult.md +15 -0
- data/docs/ExtractFieldsAndTablesResponse.md +10 -0
- data/docs/ExtractFieldsResponse.md +9 -0
- data/docs/ExtractTablesResponse.md +9 -0
- data/docs/ExtractTextResponse.md +9 -0
- data/docs/ExtractedBarcodeItem.md +9 -0
- data/docs/ExtractedTextPage.md +9 -0
- data/docs/FieldToExtract.md +11 -0
- data/docs/FieldValue.md +9 -0
- data/docs/PolicyRule.md +10 -0
- data/docs/PolicyRuleViolation.md +10 -0
- data/docs/RunBatchJobApi.md +298 -0
- data/docs/SummarizeDocumentResponse.md +9 -0
- data/docs/TableResult.md +9 -0
- data/docs/TableResultCell.md +9 -0
- data/docs/TableResultRow.md +8 -0
- data/git_push.sh +55 -0
- data/lib/cloudmersive-documentai-api-client/api/analyze_api.rb +73 -0
- data/lib/cloudmersive-documentai-api-client/api/extract_api.rb +513 -0
- data/lib/cloudmersive-documentai-api-client/api/run_batch_job_api.rb +290 -0
- data/lib/cloudmersive-documentai-api-client/api_client.rb +391 -0
- data/lib/cloudmersive-documentai-api-client/api_error.rb +38 -0
- data/lib/cloudmersive-documentai-api-client/configuration.rb +209 -0
- data/lib/cloudmersive-documentai-api-client/models/advanced_extract_classification_request.rb +223 -0
- data/lib/cloudmersive-documentai-api-client/models/advanced_extract_fields_request.rb +223 -0
- data/lib/cloudmersive-documentai-api-client/models/document_advanced_classification_result.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/document_categories.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/document_classification_result.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/document_policy_request.rb +213 -0
- data/lib/cloudmersive-documentai-api-client/models/document_policy_result.rb +208 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_barcodes_ai_response.rb +198 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_document_batch_job_result.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_document_job_status_result.rb +252 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_fields_and_tables_response.rb +210 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_fields_response.rb +198 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_tables_response.rb +198 -0
- data/lib/cloudmersive-documentai-api-client/models/extract_text_response.rb +198 -0
- data/lib/cloudmersive-documentai-api-client/models/extracted_barcode_item.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/extracted_text_page.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/field_to_extract.rb +216 -0
- data/lib/cloudmersive-documentai-api-client/models/field_value.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/policy_rule.rb +205 -0
- data/lib/cloudmersive-documentai-api-client/models/policy_rule_violation.rb +206 -0
- data/lib/cloudmersive-documentai-api-client/models/summarize_document_response.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/table_result.rb +198 -0
- data/lib/cloudmersive-documentai-api-client/models/table_result_cell.rb +196 -0
- data/lib/cloudmersive-documentai-api-client/models/table_result_row.rb +188 -0
- data/lib/cloudmersive-documentai-api-client/version.rb +15 -0
- data/lib/cloudmersive-documentai-api-client.rb +66 -0
- data/spec/api/analyze_api_spec.rb +47 -0
- data/spec/api/extract_api_spec.rb +154 -0
- data/spec/api/run_batch_job_api_spec.rb +100 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/advanced_extract_classification_request_spec.rb +53 -0
- data/spec/models/advanced_extract_fields_request_spec.rb +53 -0
- data/spec/models/document_advanced_classification_result_spec.rb +47 -0
- data/spec/models/document_categories_spec.rb +47 -0
- data/spec/models/document_classification_result_spec.rb +47 -0
- data/spec/models/document_policy_request_spec.rb +47 -0
- data/spec/models/document_policy_result_spec.rb +53 -0
- data/spec/models/extract_barcodes_ai_response_spec.rb +47 -0
- data/spec/models/extract_document_batch_job_result_spec.rb +47 -0
- data/spec/models/extract_document_job_status_result_spec.rb +83 -0
- data/spec/models/extract_fields_and_tables_response_spec.rb +53 -0
- data/spec/models/extract_fields_response_spec.rb +47 -0
- data/spec/models/extract_tables_response_spec.rb +47 -0
- data/spec/models/extract_text_response_spec.rb +47 -0
- data/spec/models/extracted_barcode_item_spec.rb +47 -0
- data/spec/models/extracted_text_page_spec.rb +47 -0
- data/spec/models/field_to_extract_spec.rb +59 -0
- data/spec/models/field_value_spec.rb +47 -0
- data/spec/models/policy_rule_spec.rb +53 -0
- data/spec/models/policy_rule_violation_spec.rb +53 -0
- data/spec/models/summarize_document_response_spec.rb +47 -0
- data/spec/models/table_result_cell_spec.rb +47 -0
- data/spec/models/table_result_row_spec.rb +41 -0
- data/spec/models/table_result_spec.rb +47 -0
- data/spec/spec_helper.rb +111 -0
- metadata +319 -0
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Document AI API
|
|
3
|
+
|
|
4
|
+
#Use next-generation AI to extract data, fields, insights and text from documents. Instantly.
|
|
5
|
+
|
|
6
|
+
OpenAPI spec version: v1
|
|
7
|
+
|
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
9
|
+
Swagger Codegen version: 2.4.14
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'uri'
|
|
14
|
+
|
|
15
|
+
module CloudmersiveDocumentaiApiClient
|
|
16
|
+
class ExtractApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Extract All Fields and Tables of Data from a Document using AI
|
|
23
|
+
# Extract all Fields and Tables, comprised of rows and columns of data, from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
26
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
27
|
+
# @return [ExtractFieldsAndTablesResponse]
|
|
28
|
+
def extract_all_fields_and_tables(opts = {})
|
|
29
|
+
data, _status_code, _headers = extract_all_fields_and_tables_with_http_info(opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Extract All Fields and Tables of Data from a Document using AI
|
|
34
|
+
# Extract all Fields and Tables, comprised of rows and columns of data, from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
35
|
+
# @param [Hash] opts the optional parameters
|
|
36
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
37
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
38
|
+
# @return [Array<(ExtractFieldsAndTablesResponse, Fixnum, Hash)>] ExtractFieldsAndTablesResponse data, response status code and response headers
|
|
39
|
+
def extract_all_fields_and_tables_with_http_info(opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_all_fields_and_tables ...'
|
|
42
|
+
end
|
|
43
|
+
# resource path
|
|
44
|
+
local_var_path = '/document-ai/document/extract/all'
|
|
45
|
+
|
|
46
|
+
# query parameters
|
|
47
|
+
query_params = {}
|
|
48
|
+
|
|
49
|
+
# header parameters
|
|
50
|
+
header_params = {}
|
|
51
|
+
# HTTP header 'Accept' (if needed)
|
|
52
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
53
|
+
# HTTP header 'Content-Type'
|
|
54
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
|
55
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
56
|
+
|
|
57
|
+
# form parameters
|
|
58
|
+
form_params = {}
|
|
59
|
+
form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
|
|
60
|
+
|
|
61
|
+
# http body (model)
|
|
62
|
+
post_body = nil
|
|
63
|
+
auth_names = ['Apikey']
|
|
64
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
65
|
+
:header_params => header_params,
|
|
66
|
+
:query_params => query_params,
|
|
67
|
+
:form_params => form_params,
|
|
68
|
+
:body => post_body,
|
|
69
|
+
:auth_names => auth_names,
|
|
70
|
+
:return_type => 'ExtractFieldsAndTablesResponse')
|
|
71
|
+
if @api_client.config.debugging
|
|
72
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_all_fields_and_tables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
73
|
+
end
|
|
74
|
+
return data, status_code, headers
|
|
75
|
+
end
|
|
76
|
+
# Extract Barcodes of from a Document using AI
|
|
77
|
+
# Extract all barcodes from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
78
|
+
# @param [Hash] opts the optional parameters
|
|
79
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
80
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
81
|
+
# @return [ExtractBarcodesAiResponse]
|
|
82
|
+
def extract_barcodes(opts = {})
|
|
83
|
+
data, _status_code, _headers = extract_barcodes_with_http_info(opts)
|
|
84
|
+
data
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Extract Barcodes of from a Document using AI
|
|
88
|
+
# Extract all barcodes from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
89
|
+
# @param [Hash] opts the optional parameters
|
|
90
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
91
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
92
|
+
# @return [Array<(ExtractBarcodesAiResponse, Fixnum, Hash)>] ExtractBarcodesAiResponse data, response status code and response headers
|
|
93
|
+
def extract_barcodes_with_http_info(opts = {})
|
|
94
|
+
if @api_client.config.debugging
|
|
95
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_barcodes ...'
|
|
96
|
+
end
|
|
97
|
+
# resource path
|
|
98
|
+
local_var_path = '/document-ai/document/extract/barcodes'
|
|
99
|
+
|
|
100
|
+
# query parameters
|
|
101
|
+
query_params = {}
|
|
102
|
+
|
|
103
|
+
# header parameters
|
|
104
|
+
header_params = {}
|
|
105
|
+
# HTTP header 'Accept' (if needed)
|
|
106
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
107
|
+
# HTTP header 'Content-Type'
|
|
108
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
|
109
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
110
|
+
|
|
111
|
+
# form parameters
|
|
112
|
+
form_params = {}
|
|
113
|
+
form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
|
|
114
|
+
|
|
115
|
+
# http body (model)
|
|
116
|
+
post_body = nil
|
|
117
|
+
auth_names = ['Apikey']
|
|
118
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
119
|
+
:header_params => header_params,
|
|
120
|
+
:query_params => query_params,
|
|
121
|
+
:form_params => form_params,
|
|
122
|
+
:body => post_body,
|
|
123
|
+
:auth_names => auth_names,
|
|
124
|
+
:return_type => 'ExtractBarcodesAiResponse')
|
|
125
|
+
if @api_client.config.debugging
|
|
126
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_barcodes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
127
|
+
end
|
|
128
|
+
return data, status_code, headers
|
|
129
|
+
end
|
|
130
|
+
# Extract Classification or Category from a Document using AI
|
|
131
|
+
# Extract Classification or Category (e.g. Invoice, Receipt, Tax Form, or Form 1040, Form 1040 EZ, etc.) from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
132
|
+
# @param [Hash] opts the optional parameters
|
|
133
|
+
# @option opts [String] :categories Desired classification to extract
|
|
134
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
135
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
136
|
+
# @return [DocumentClassificationResult]
|
|
137
|
+
def extract_classification(opts = {})
|
|
138
|
+
data, _status_code, _headers = extract_classification_with_http_info(opts)
|
|
139
|
+
data
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Extract Classification or Category from a Document using AI
|
|
143
|
+
# Extract Classification or Category (e.g. Invoice, Receipt, Tax Form, or Form 1040, Form 1040 EZ, etc.) from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
144
|
+
# @param [Hash] opts the optional parameters
|
|
145
|
+
# @option opts [String] :categories Desired classification to extract
|
|
146
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
147
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
148
|
+
# @return [Array<(DocumentClassificationResult, Fixnum, Hash)>] DocumentClassificationResult data, response status code and response headers
|
|
149
|
+
def extract_classification_with_http_info(opts = {})
|
|
150
|
+
if @api_client.config.debugging
|
|
151
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_classification ...'
|
|
152
|
+
end
|
|
153
|
+
# resource path
|
|
154
|
+
local_var_path = '/document-ai/document/extract/classify'
|
|
155
|
+
|
|
156
|
+
# query parameters
|
|
157
|
+
query_params = {}
|
|
158
|
+
|
|
159
|
+
# header parameters
|
|
160
|
+
header_params = {}
|
|
161
|
+
# HTTP header 'Accept' (if needed)
|
|
162
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
163
|
+
# HTTP header 'Content-Type'
|
|
164
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
|
165
|
+
header_params[:'Categories'] = opts[:'categories'] if !opts[:'categories'].nil?
|
|
166
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
167
|
+
|
|
168
|
+
# form parameters
|
|
169
|
+
form_params = {}
|
|
170
|
+
form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
|
|
171
|
+
|
|
172
|
+
# http body (model)
|
|
173
|
+
post_body = nil
|
|
174
|
+
auth_names = ['Apikey']
|
|
175
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
176
|
+
:header_params => header_params,
|
|
177
|
+
:query_params => query_params,
|
|
178
|
+
:form_params => form_params,
|
|
179
|
+
:body => post_body,
|
|
180
|
+
:auth_names => auth_names,
|
|
181
|
+
:return_type => 'DocumentClassificationResult')
|
|
182
|
+
if @api_client.config.debugging
|
|
183
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_classification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
184
|
+
end
|
|
185
|
+
return data, status_code, headers
|
|
186
|
+
end
|
|
187
|
+
# Extract Classification or Category from a Document using Advanced AI
|
|
188
|
+
# Extract Classification or Category (e.g. Invoice, Receipt, Tax Form, or Form 1040, Form 1040 EZ, etc.) from a document using Advanced AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
189
|
+
# @param [Hash] opts the optional parameters
|
|
190
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
191
|
+
# @option opts [AdvancedExtractClassificationRequest] :body Input request to perform the classification on
|
|
192
|
+
# @return [DocumentAdvancedClassificationResult]
|
|
193
|
+
def extract_classification_advanced(opts = {})
|
|
194
|
+
data, _status_code, _headers = extract_classification_advanced_with_http_info(opts)
|
|
195
|
+
data
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Extract Classification or Category from a Document using Advanced AI
|
|
199
|
+
# Extract Classification or Category (e.g. Invoice, Receipt, Tax Form, or Form 1040, Form 1040 EZ, etc.) from a document using Advanced AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
200
|
+
# @param [Hash] opts the optional parameters
|
|
201
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
202
|
+
# @option opts [AdvancedExtractClassificationRequest] :body Input request to perform the classification on
|
|
203
|
+
# @return [Array<(DocumentAdvancedClassificationResult, Fixnum, Hash)>] DocumentAdvancedClassificationResult data, response status code and response headers
|
|
204
|
+
def extract_classification_advanced_with_http_info(opts = {})
|
|
205
|
+
if @api_client.config.debugging
|
|
206
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_classification_advanced ...'
|
|
207
|
+
end
|
|
208
|
+
# resource path
|
|
209
|
+
local_var_path = '/document-ai/document/extract/classify/advanced'
|
|
210
|
+
|
|
211
|
+
# query parameters
|
|
212
|
+
query_params = {}
|
|
213
|
+
|
|
214
|
+
# header parameters
|
|
215
|
+
header_params = {}
|
|
216
|
+
# HTTP header 'Accept' (if needed)
|
|
217
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
218
|
+
# HTTP header 'Content-Type'
|
|
219
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/*+json'])
|
|
220
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
221
|
+
|
|
222
|
+
# form parameters
|
|
223
|
+
form_params = {}
|
|
224
|
+
|
|
225
|
+
# http body (model)
|
|
226
|
+
post_body = @api_client.object_to_http_body(opts[:'body'])
|
|
227
|
+
auth_names = ['Apikey']
|
|
228
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
229
|
+
:header_params => header_params,
|
|
230
|
+
:query_params => query_params,
|
|
231
|
+
:form_params => form_params,
|
|
232
|
+
:body => post_body,
|
|
233
|
+
:auth_names => auth_names,
|
|
234
|
+
:return_type => 'DocumentAdvancedClassificationResult')
|
|
235
|
+
if @api_client.config.debugging
|
|
236
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_classification_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
237
|
+
end
|
|
238
|
+
return data, status_code, headers
|
|
239
|
+
end
|
|
240
|
+
# Extract Field Values from a Document using AI
|
|
241
|
+
# Extract Field Values (e.g. Invoice Number, Invoice Date, Business Card Phone Number, etc.) from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
242
|
+
# @param [Hash] opts the optional parameters
|
|
243
|
+
# @option opts [String] :field_names Desired fields to extract, comma separated
|
|
244
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
245
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
246
|
+
# @return [ExtractFieldsResponse]
|
|
247
|
+
def extract_fields(opts = {})
|
|
248
|
+
data, _status_code, _headers = extract_fields_with_http_info(opts)
|
|
249
|
+
data
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Extract Field Values from a Document using AI
|
|
253
|
+
# Extract Field Values (e.g. Invoice Number, Invoice Date, Business Card Phone Number, etc.) from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
254
|
+
# @param [Hash] opts the optional parameters
|
|
255
|
+
# @option opts [String] :field_names Desired fields to extract, comma separated
|
|
256
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
257
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
258
|
+
# @return [Array<(ExtractFieldsResponse, Fixnum, Hash)>] ExtractFieldsResponse data, response status code and response headers
|
|
259
|
+
def extract_fields_with_http_info(opts = {})
|
|
260
|
+
if @api_client.config.debugging
|
|
261
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_fields ...'
|
|
262
|
+
end
|
|
263
|
+
# resource path
|
|
264
|
+
local_var_path = '/document-ai/document/extract/fields'
|
|
265
|
+
|
|
266
|
+
# query parameters
|
|
267
|
+
query_params = {}
|
|
268
|
+
|
|
269
|
+
# header parameters
|
|
270
|
+
header_params = {}
|
|
271
|
+
# HTTP header 'Accept' (if needed)
|
|
272
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
273
|
+
# HTTP header 'Content-Type'
|
|
274
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
|
275
|
+
header_params[:'FieldNames'] = opts[:'field_names'] if !opts[:'field_names'].nil?
|
|
276
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
277
|
+
|
|
278
|
+
# form parameters
|
|
279
|
+
form_params = {}
|
|
280
|
+
form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
|
|
281
|
+
|
|
282
|
+
# http body (model)
|
|
283
|
+
post_body = nil
|
|
284
|
+
auth_names = ['Apikey']
|
|
285
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
286
|
+
:header_params => header_params,
|
|
287
|
+
:query_params => query_params,
|
|
288
|
+
:form_params => form_params,
|
|
289
|
+
:body => post_body,
|
|
290
|
+
:auth_names => auth_names,
|
|
291
|
+
:return_type => 'ExtractFieldsResponse')
|
|
292
|
+
if @api_client.config.debugging
|
|
293
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
294
|
+
end
|
|
295
|
+
return data, status_code, headers
|
|
296
|
+
end
|
|
297
|
+
# Extract Field Values from a Document using Advanced AI
|
|
298
|
+
# Extract Field Values (e.g. Invoice Number, Invoice Date, Business Card Phone Number, etc.) from a document using Advanced AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
299
|
+
# @param [Hash] opts the optional parameters
|
|
300
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
301
|
+
# @option opts [AdvancedExtractFieldsRequest] :body Input request, including document file as byte array, and information on which fields to extract
|
|
302
|
+
# @return [ExtractFieldsResponse]
|
|
303
|
+
def extract_fields_advanced(opts = {})
|
|
304
|
+
data, _status_code, _headers = extract_fields_advanced_with_http_info(opts)
|
|
305
|
+
data
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Extract Field Values from a Document using Advanced AI
|
|
309
|
+
# Extract Field Values (e.g. Invoice Number, Invoice Date, Business Card Phone Number, etc.) from a document using Advanced AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
310
|
+
# @param [Hash] opts the optional parameters
|
|
311
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
312
|
+
# @option opts [AdvancedExtractFieldsRequest] :body Input request, including document file as byte array, and information on which fields to extract
|
|
313
|
+
# @return [Array<(ExtractFieldsResponse, Fixnum, Hash)>] ExtractFieldsResponse data, response status code and response headers
|
|
314
|
+
def extract_fields_advanced_with_http_info(opts = {})
|
|
315
|
+
if @api_client.config.debugging
|
|
316
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_fields_advanced ...'
|
|
317
|
+
end
|
|
318
|
+
# resource path
|
|
319
|
+
local_var_path = '/document-ai/document/extract/fields/advanced'
|
|
320
|
+
|
|
321
|
+
# query parameters
|
|
322
|
+
query_params = {}
|
|
323
|
+
|
|
324
|
+
# header parameters
|
|
325
|
+
header_params = {}
|
|
326
|
+
# HTTP header 'Accept' (if needed)
|
|
327
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
328
|
+
# HTTP header 'Content-Type'
|
|
329
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/*+json'])
|
|
330
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
331
|
+
|
|
332
|
+
# form parameters
|
|
333
|
+
form_params = {}
|
|
334
|
+
|
|
335
|
+
# http body (model)
|
|
336
|
+
post_body = @api_client.object_to_http_body(opts[:'body'])
|
|
337
|
+
auth_names = ['Apikey']
|
|
338
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
339
|
+
:header_params => header_params,
|
|
340
|
+
:query_params => query_params,
|
|
341
|
+
:form_params => form_params,
|
|
342
|
+
:body => post_body,
|
|
343
|
+
:auth_names => auth_names,
|
|
344
|
+
:return_type => 'ExtractFieldsResponse')
|
|
345
|
+
if @api_client.config.debugging
|
|
346
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_fields_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
347
|
+
end
|
|
348
|
+
return data, status_code, headers
|
|
349
|
+
end
|
|
350
|
+
# Extract Summary from a Document using AI
|
|
351
|
+
# Creates a 1 paragraph summary of the input document using Artificial Intelligence. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
352
|
+
# @param [Hash] opts the optional parameters
|
|
353
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
354
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
355
|
+
# @return [SummarizeDocumentResponse]
|
|
356
|
+
def extract_summary(opts = {})
|
|
357
|
+
data, _status_code, _headers = extract_summary_with_http_info(opts)
|
|
358
|
+
data
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# Extract Summary from a Document using AI
|
|
362
|
+
# Creates a 1 paragraph summary of the input document using Artificial Intelligence. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
363
|
+
# @param [Hash] opts the optional parameters
|
|
364
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
365
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
366
|
+
# @return [Array<(SummarizeDocumentResponse, Fixnum, Hash)>] SummarizeDocumentResponse data, response status code and response headers
|
|
367
|
+
def extract_summary_with_http_info(opts = {})
|
|
368
|
+
if @api_client.config.debugging
|
|
369
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_summary ...'
|
|
370
|
+
end
|
|
371
|
+
# resource path
|
|
372
|
+
local_var_path = '/document-ai/document/extract/summary'
|
|
373
|
+
|
|
374
|
+
# query parameters
|
|
375
|
+
query_params = {}
|
|
376
|
+
|
|
377
|
+
# header parameters
|
|
378
|
+
header_params = {}
|
|
379
|
+
# HTTP header 'Accept' (if needed)
|
|
380
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
381
|
+
# HTTP header 'Content-Type'
|
|
382
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
|
383
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
384
|
+
|
|
385
|
+
# form parameters
|
|
386
|
+
form_params = {}
|
|
387
|
+
form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
|
|
388
|
+
|
|
389
|
+
# http body (model)
|
|
390
|
+
post_body = nil
|
|
391
|
+
auth_names = ['Apikey']
|
|
392
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
393
|
+
:header_params => header_params,
|
|
394
|
+
:query_params => query_params,
|
|
395
|
+
:form_params => form_params,
|
|
396
|
+
:body => post_body,
|
|
397
|
+
:auth_names => auth_names,
|
|
398
|
+
:return_type => 'SummarizeDocumentResponse')
|
|
399
|
+
if @api_client.config.debugging
|
|
400
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
401
|
+
end
|
|
402
|
+
return data, status_code, headers
|
|
403
|
+
end
|
|
404
|
+
# Extract Tables of Data from a Document using AI
|
|
405
|
+
# Extract Tables, comprised of rows and columns of data, from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
406
|
+
# @param [Hash] opts the optional parameters
|
|
407
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
408
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
409
|
+
# @return [ExtractTablesResponse]
|
|
410
|
+
def extract_tables(opts = {})
|
|
411
|
+
data, _status_code, _headers = extract_tables_with_http_info(opts)
|
|
412
|
+
data
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
# Extract Tables of Data from a Document using AI
|
|
416
|
+
# Extract Tables, comprised of rows and columns of data, from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG.
|
|
417
|
+
# @param [Hash] opts the optional parameters
|
|
418
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
419
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
420
|
+
# @return [Array<(ExtractTablesResponse, Fixnum, Hash)>] ExtractTablesResponse data, response status code and response headers
|
|
421
|
+
def extract_tables_with_http_info(opts = {})
|
|
422
|
+
if @api_client.config.debugging
|
|
423
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_tables ...'
|
|
424
|
+
end
|
|
425
|
+
# resource path
|
|
426
|
+
local_var_path = '/document-ai/document/extract/tables'
|
|
427
|
+
|
|
428
|
+
# query parameters
|
|
429
|
+
query_params = {}
|
|
430
|
+
|
|
431
|
+
# header parameters
|
|
432
|
+
header_params = {}
|
|
433
|
+
# HTTP header 'Accept' (if needed)
|
|
434
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
435
|
+
# HTTP header 'Content-Type'
|
|
436
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
|
437
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
438
|
+
|
|
439
|
+
# form parameters
|
|
440
|
+
form_params = {}
|
|
441
|
+
form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
|
|
442
|
+
|
|
443
|
+
# http body (model)
|
|
444
|
+
post_body = nil
|
|
445
|
+
auth_names = ['Apikey']
|
|
446
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
447
|
+
:header_params => header_params,
|
|
448
|
+
:query_params => query_params,
|
|
449
|
+
:form_params => form_params,
|
|
450
|
+
:body => post_body,
|
|
451
|
+
:auth_names => auth_names,
|
|
452
|
+
:return_type => 'ExtractTablesResponse')
|
|
453
|
+
if @api_client.config.debugging
|
|
454
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_tables\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
455
|
+
end
|
|
456
|
+
return data, status_code, headers
|
|
457
|
+
end
|
|
458
|
+
# Extract Text from a Document using AI
|
|
459
|
+
# Extract raw text from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG. Supports a wide range of languages.
|
|
460
|
+
# @param [Hash] opts the optional parameters
|
|
461
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
462
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
463
|
+
# @return [ExtractTextResponse]
|
|
464
|
+
def extract_text(opts = {})
|
|
465
|
+
data, _status_code, _headers = extract_text_with_http_info(opts)
|
|
466
|
+
data
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
# Extract Text from a Document using AI
|
|
470
|
+
# Extract raw text from a document using AI. Input document formats supported include DOCX, PDF, PNG and JPG. Supports a wide range of languages.
|
|
471
|
+
# @param [Hash] opts the optional parameters
|
|
472
|
+
# @option opts [String] :recognition_mode Optional; Recognition mode - Advanced (default) provides the highest accuracy but slower speed, while Normal provides faster response but lower accuracy for low quality images
|
|
473
|
+
# @option opts [File] :input_file Input document, or photos of a document, to extract data from
|
|
474
|
+
# @return [Array<(ExtractTextResponse, Fixnum, Hash)>] ExtractTextResponse data, response status code and response headers
|
|
475
|
+
def extract_text_with_http_info(opts = {})
|
|
476
|
+
if @api_client.config.debugging
|
|
477
|
+
@api_client.config.logger.debug 'Calling API: ExtractApi.extract_text ...'
|
|
478
|
+
end
|
|
479
|
+
# resource path
|
|
480
|
+
local_var_path = '/document-ai/document/extract/text'
|
|
481
|
+
|
|
482
|
+
# query parameters
|
|
483
|
+
query_params = {}
|
|
484
|
+
|
|
485
|
+
# header parameters
|
|
486
|
+
header_params = {}
|
|
487
|
+
# HTTP header 'Accept' (if needed)
|
|
488
|
+
header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
|
|
489
|
+
# HTTP header 'Content-Type'
|
|
490
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
|
491
|
+
header_params[:'recognitionMode'] = opts[:'recognition_mode'] if !opts[:'recognition_mode'].nil?
|
|
492
|
+
|
|
493
|
+
# form parameters
|
|
494
|
+
form_params = {}
|
|
495
|
+
form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
|
|
496
|
+
|
|
497
|
+
# http body (model)
|
|
498
|
+
post_body = nil
|
|
499
|
+
auth_names = ['Apikey']
|
|
500
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
|
501
|
+
:header_params => header_params,
|
|
502
|
+
:query_params => query_params,
|
|
503
|
+
:form_params => form_params,
|
|
504
|
+
:body => post_body,
|
|
505
|
+
:auth_names => auth_names,
|
|
506
|
+
:return_type => 'ExtractTextResponse')
|
|
507
|
+
if @api_client.config.debugging
|
|
508
|
+
@api_client.config.logger.debug "API called: ExtractApi#extract_text\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
509
|
+
end
|
|
510
|
+
return data, status_code, headers
|
|
511
|
+
end
|
|
512
|
+
end
|
|
513
|
+
end
|