aws-sdk-textract 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e7a1a3416b1fe94432c0c713a826f55b40ca7cce
4
+ data.tar.gz: 03474fd12c96e61ce4413b1dcf5b2e2857482d62
5
+ SHA512:
6
+ metadata.gz: 005cd68d0d2ef459fe5036862267e830fc66eafb233b2a05905362d3f621d8a9e25cf1986dba5f99554f8c2d6ed4a34179507e1fcbdae11862cb2d434a5c2f22
7
+ data.tar.gz: cb2dce275eaf005caadc185f4786063ce5576bfec3eafdcab953a845b66f7ae3e8dae53838757146a3681f7c278f5a2e41c15e1456b576830a189360ece06bf5
@@ -0,0 +1,47 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing guide for more information:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ require 'aws-sdk-core'
9
+ require 'aws-sigv4'
10
+
11
+ require_relative 'aws-sdk-textract/types'
12
+ require_relative 'aws-sdk-textract/client_api'
13
+ require_relative 'aws-sdk-textract/client'
14
+ require_relative 'aws-sdk-textract/errors'
15
+ require_relative 'aws-sdk-textract/resource'
16
+ require_relative 'aws-sdk-textract/customizations'
17
+
18
+ # This module provides support for Amazon Textract. This module is available in the
19
+ # `aws-sdk-textract` gem.
20
+ #
21
+ # # Client
22
+ #
23
+ # The {Client} class provides one method for each API operation. Operation
24
+ # methods each accept a hash of request parameters and return a response
25
+ # structure.
26
+ #
27
+ # See {Client} for more information.
28
+ #
29
+ # # Errors
30
+ #
31
+ # Errors returned from Amazon Textract all
32
+ # extend {Errors::ServiceError}.
33
+ #
34
+ # begin
35
+ # # do stuff
36
+ # rescue Aws::Textract::Errors::ServiceError
37
+ # # rescues all service API errors
38
+ # end
39
+ #
40
+ # See {Errors} for more information.
41
+ #
42
+ # @service
43
+ module Aws::Textract
44
+
45
+ GEM_VERSION = '1.0.0'
46
+
47
+ end
@@ -0,0 +1,777 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing guide for more information:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ require 'seahorse/client/plugins/content_length.rb'
9
+ require 'aws-sdk-core/plugins/credentials_configuration.rb'
10
+ require 'aws-sdk-core/plugins/logging.rb'
11
+ require 'aws-sdk-core/plugins/param_converter.rb'
12
+ require 'aws-sdk-core/plugins/param_validator.rb'
13
+ require 'aws-sdk-core/plugins/user_agent.rb'
14
+ require 'aws-sdk-core/plugins/helpful_socket_errors.rb'
15
+ require 'aws-sdk-core/plugins/retry_errors.rb'
16
+ require 'aws-sdk-core/plugins/global_configuration.rb'
17
+ require 'aws-sdk-core/plugins/regional_endpoint.rb'
18
+ require 'aws-sdk-core/plugins/endpoint_discovery.rb'
19
+ require 'aws-sdk-core/plugins/endpoint_pattern.rb'
20
+ require 'aws-sdk-core/plugins/response_paging.rb'
21
+ require 'aws-sdk-core/plugins/stub_responses.rb'
22
+ require 'aws-sdk-core/plugins/idempotency_token.rb'
23
+ require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
24
+ require 'aws-sdk-core/plugins/client_metrics_plugin.rb'
25
+ require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb'
26
+ require 'aws-sdk-core/plugins/signature_v4.rb'
27
+ require 'aws-sdk-core/plugins/protocols/json_rpc.rb'
28
+
29
+ Aws::Plugins::GlobalConfiguration.add_identifier(:textract)
30
+
31
+ module Aws::Textract
32
+ class Client < Seahorse::Client::Base
33
+
34
+ include Aws::ClientStubs
35
+
36
+ @identifier = :textract
37
+
38
+ set_api(ClientApi::API)
39
+
40
+ add_plugin(Seahorse::Client::Plugins::ContentLength)
41
+ add_plugin(Aws::Plugins::CredentialsConfiguration)
42
+ add_plugin(Aws::Plugins::Logging)
43
+ add_plugin(Aws::Plugins::ParamConverter)
44
+ add_plugin(Aws::Plugins::ParamValidator)
45
+ add_plugin(Aws::Plugins::UserAgent)
46
+ add_plugin(Aws::Plugins::HelpfulSocketErrors)
47
+ add_plugin(Aws::Plugins::RetryErrors)
48
+ add_plugin(Aws::Plugins::GlobalConfiguration)
49
+ add_plugin(Aws::Plugins::RegionalEndpoint)
50
+ add_plugin(Aws::Plugins::EndpointDiscovery)
51
+ add_plugin(Aws::Plugins::EndpointPattern)
52
+ add_plugin(Aws::Plugins::ResponsePaging)
53
+ add_plugin(Aws::Plugins::StubResponses)
54
+ add_plugin(Aws::Plugins::IdempotencyToken)
55
+ add_plugin(Aws::Plugins::JsonvalueConverter)
56
+ add_plugin(Aws::Plugins::ClientMetricsPlugin)
57
+ add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
58
+ add_plugin(Aws::Plugins::SignatureV4)
59
+ add_plugin(Aws::Plugins::Protocols::JsonRpc)
60
+
61
+ # @overload initialize(options)
62
+ # @param [Hash] options
63
+ # @option options [required, Aws::CredentialProvider] :credentials
64
+ # Your AWS credentials. This can be an instance of any one of the
65
+ # following classes:
66
+ #
67
+ # * `Aws::Credentials` - Used for configuring static, non-refreshing
68
+ # credentials.
69
+ #
70
+ # * `Aws::InstanceProfileCredentials` - Used for loading credentials
71
+ # from an EC2 IMDS on an EC2 instance.
72
+ #
73
+ # * `Aws::SharedCredentials` - Used for loading credentials from a
74
+ # shared file, such as `~/.aws/config`.
75
+ #
76
+ # * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
77
+ #
78
+ # When `:credentials` are not configured directly, the following
79
+ # locations will be searched for credentials:
80
+ #
81
+ # * `Aws.config[:credentials]`
82
+ # * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
83
+ # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
84
+ # * `~/.aws/credentials`
85
+ # * `~/.aws/config`
86
+ # * EC2 IMDS instance profile - When used by default, the timeouts are
87
+ # very aggressive. Construct and pass an instance of
88
+ # `Aws::InstanceProfileCredentails` to enable retries and extended
89
+ # timeouts.
90
+ #
91
+ # @option options [required, String] :region
92
+ # The AWS region to connect to. The configured `:region` is
93
+ # used to determine the service `:endpoint`. When not passed,
94
+ # a default `:region` is search for in the following locations:
95
+ #
96
+ # * `Aws.config[:region]`
97
+ # * `ENV['AWS_REGION']`
98
+ # * `ENV['AMAZON_REGION']`
99
+ # * `ENV['AWS_DEFAULT_REGION']`
100
+ # * `~/.aws/credentials`
101
+ # * `~/.aws/config`
102
+ #
103
+ # @option options [String] :access_key_id
104
+ #
105
+ # @option options [Boolean] :active_endpoint_cache (false)
106
+ # When set to `true`, a thread polling for endpoints will be running in
107
+ # the background every 60 secs (default). Defaults to `false`.
108
+ #
109
+ # @option options [Boolean] :client_side_monitoring (false)
110
+ # When `true`, client-side metrics will be collected for all API requests from
111
+ # this client.
112
+ #
113
+ # @option options [String] :client_side_monitoring_client_id ("")
114
+ # Allows you to provide an identifier for this client which will be attached to
115
+ # all generated client side metrics. Defaults to an empty string.
116
+ #
117
+ # @option options [Integer] :client_side_monitoring_port (31000)
118
+ # Required for publishing client metrics. The port that the client side monitoring
119
+ # agent is running on, where client metrics will be published via UDP.
120
+ #
121
+ # @option options [Aws::ClientSideMonitoring::Publisher] :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher)
122
+ # Allows you to provide a custom client-side monitoring publisher class. By default,
123
+ # will use the Client Side Monitoring Agent Publisher.
124
+ #
125
+ # @option options [Boolean] :convert_params (true)
126
+ # When `true`, an attempt is made to coerce request parameters into
127
+ # the required types.
128
+ #
129
+ # @option options [Boolean] :disable_host_prefix_injection (false)
130
+ # Set to true to disable SDK automatically adding host prefix
131
+ # to default service endpoint when available.
132
+ #
133
+ # @option options [String] :endpoint
134
+ # The client endpoint is normally constructed from the `:region`
135
+ # option. You should only configure an `:endpoint` when connecting
136
+ # to test endpoints. This should be avalid HTTP(S) URI.
137
+ #
138
+ # @option options [Integer] :endpoint_cache_max_entries (1000)
139
+ # Used for the maximum size limit of the LRU cache storing endpoints data
140
+ # for endpoint discovery enabled operations. Defaults to 1000.
141
+ #
142
+ # @option options [Integer] :endpoint_cache_max_threads (10)
143
+ # Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.
144
+ #
145
+ # @option options [Integer] :endpoint_cache_poll_interval (60)
146
+ # When :endpoint_discovery and :active_endpoint_cache is enabled,
147
+ # Use this option to config the time interval in seconds for making
148
+ # requests fetching endpoints information. Defaults to 60 sec.
149
+ #
150
+ # @option options [Boolean] :endpoint_discovery (false)
151
+ # When set to `true`, endpoint discovery will be enabled for operations when available. Defaults to `false`.
152
+ #
153
+ # @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
154
+ # The log formatter.
155
+ #
156
+ # @option options [Symbol] :log_level (:info)
157
+ # The log level to send messages to the `:logger` at.
158
+ #
159
+ # @option options [Logger] :logger
160
+ # The Logger instance to send log messages to. If this option
161
+ # is not set, logging will be disabled.
162
+ #
163
+ # @option options [String] :profile ("default")
164
+ # Used when loading credentials from the shared credentials file
165
+ # at HOME/.aws/credentials. When not specified, 'default' is used.
166
+ #
167
+ # @option options [Float] :retry_base_delay (0.3)
168
+ # The base delay in seconds used by the default backoff function.
169
+ #
170
+ # @option options [Symbol] :retry_jitter (:none)
171
+ # A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number.
172
+ #
173
+ # @see https://www.awsarchitectureblog.com/2015/03/backoff.html
174
+ #
175
+ # @option options [Integer] :retry_limit (3)
176
+ # The maximum number of times to retry failed requests. Only
177
+ # ~ 500 level server errors and certain ~ 400 level client errors
178
+ # are retried. Generally, these are throttling errors, data
179
+ # checksum errors, networking errors, timeout errors and auth
180
+ # errors from expired credentials.
181
+ #
182
+ # @option options [Integer] :retry_max_delay (0)
183
+ # The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function.
184
+ #
185
+ # @option options [String] :secret_access_key
186
+ #
187
+ # @option options [String] :session_token
188
+ #
189
+ # @option options [Boolean] :simple_json (false)
190
+ # Disables request parameter conversion, validation, and formatting.
191
+ # Also disable response data type conversions. This option is useful
192
+ # when you want to ensure the highest level of performance by
193
+ # avoiding overhead of walking request parameters and response data
194
+ # structures.
195
+ #
196
+ # When `:simple_json` is enabled, the request parameters hash must
197
+ # be formatted exactly as the DynamoDB API expects.
198
+ #
199
+ # @option options [Boolean] :stub_responses (false)
200
+ # Causes the client to return stubbed responses. By default
201
+ # fake responses are generated and returned. You can specify
202
+ # the response data to return or errors to raise by calling
203
+ # {ClientStubs#stub_responses}. See {ClientStubs} for more information.
204
+ #
205
+ # ** Please note ** When response stubbing is enabled, no HTTP
206
+ # requests are made, and retries are disabled.
207
+ #
208
+ # @option options [Boolean] :validate_params (true)
209
+ # When `true`, request parameters are validated before
210
+ # sending the request.
211
+ #
212
+ def initialize(*args)
213
+ super
214
+ end
215
+
216
+ # @!group API Operations
217
+
218
+ # Analyzes an input document for relationships in the detected text and
219
+ # tables.
220
+ #
221
+ # Two types of information are returned:
222
+ #
223
+ # * Words and lines that are related to nearby lines and words. The
224
+ # related information is returned in two Block objects: a KEY Block
225
+ # object and a VALUE Block object. For example, *Name: Ana Silva
226
+ # Carolina* contains a key and value. *Name:* is the key. *Ana Silva
227
+ # Carolina* is the value.
228
+ #
229
+ # * Table and table cell data. A TABLE Block contains information about
230
+ # a detected table. A CELL block is returned for each cell in a table.
231
+ #
232
+ # You can choose which type of analysis to perform by specifying the
233
+ # `FeatureTypes` list.
234
+ #
235
+ # The output is returned in a list of `BLOCK` objects (Blocks). For more
236
+ # information, see how-it-works-analyzing.
237
+ #
238
+ # `AnalyzeDocument` is a synchronous operation. To analyze documents
239
+ # asynchronously, use StartDocumentAnalysis.
240
+ #
241
+ # @option params [required, Types::Document] :document
242
+ # The input document as base64-encoded bytes or an Amazon S3 object. If
243
+ # you use the AWS CLI to call Amazon Textract operations, you can't
244
+ # pass image bytes. The document must be an image in JPG or PNG format.
245
+ #
246
+ # @option params [required, Array<String>] :feature_types
247
+ # A list of the types of analysis to perform. Add TABLES to the list to
248
+ # return information about the tables detected in the input document.
249
+ # Add FORMS to return detected fields and the associated text. To
250
+ # perform both types of analysis, add TABLES and FORMS to
251
+ # `FeatureTypes`.
252
+ #
253
+ # @return [Types::AnalyzeDocumentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
254
+ #
255
+ # * {Types::AnalyzeDocumentResponse#document_metadata #document_metadata} => Types::DocumentMetadata
256
+ # * {Types::AnalyzeDocumentResponse#blocks #blocks} => Array&lt;Types::Block&gt;
257
+ #
258
+ # @example Request syntax with placeholder values
259
+ #
260
+ # resp = client.analyze_document({
261
+ # document: { # required
262
+ # bytes: "data",
263
+ # s3_object: {
264
+ # bucket: "S3Bucket",
265
+ # name: "S3ObjectName",
266
+ # version: "S3ObjectVersion",
267
+ # },
268
+ # },
269
+ # feature_types: ["TABLES"], # required, accepts TABLES, FORMS
270
+ # })
271
+ #
272
+ # @example Response structure
273
+ #
274
+ # resp.document_metadata.pages #=> Integer
275
+ # resp.blocks #=> Array
276
+ # resp.blocks[0].block_type #=> String, one of "KEY_VALUE_SET", "PAGE", "LINE", "WORD", "TABLE", "CELL"
277
+ # resp.blocks[0].confidence #=> Float
278
+ # resp.blocks[0].text #=> String
279
+ # resp.blocks[0].row_index #=> Integer
280
+ # resp.blocks[0].column_index #=> Integer
281
+ # resp.blocks[0].row_span #=> Integer
282
+ # resp.blocks[0].column_span #=> Integer
283
+ # resp.blocks[0].geometry.bounding_box.width #=> Float
284
+ # resp.blocks[0].geometry.bounding_box.height #=> Float
285
+ # resp.blocks[0].geometry.bounding_box.left #=> Float
286
+ # resp.blocks[0].geometry.bounding_box.top #=> Float
287
+ # resp.blocks[0].geometry.polygon #=> Array
288
+ # resp.blocks[0].geometry.polygon[0].x #=> Float
289
+ # resp.blocks[0].geometry.polygon[0].y #=> Float
290
+ # resp.blocks[0].id #=> String
291
+ # resp.blocks[0].relationships #=> Array
292
+ # resp.blocks[0].relationships[0].type #=> String, one of "VALUE", "CHILD"
293
+ # resp.blocks[0].relationships[0].ids #=> Array
294
+ # resp.blocks[0].relationships[0].ids[0] #=> String
295
+ # resp.blocks[0].entity_types #=> Array
296
+ # resp.blocks[0].entity_types[0] #=> String, one of "KEY", "VALUE"
297
+ # resp.blocks[0].page #=> Integer
298
+ #
299
+ # @see http://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/AnalyzeDocument AWS API Documentation
300
+ #
301
+ # @overload analyze_document(params = {})
302
+ # @param [Hash] params ({})
303
+ def analyze_document(params = {}, options = {})
304
+ req = build_request(:analyze_document, params)
305
+ req.send_request(options)
306
+ end
307
+
308
+ # Detects text in the input document. Amazon Textract can detect lines
309
+ # of text and the words that make up a line of text. The input document
310
+ # must be an image in JPG or PNG format. `DetectDocumentText` returns
311
+ # the detected text in an array of Block objects. For more information,
312
+ # see how-it-works-detecting.
313
+ #
314
+ # `DetectDocumentText` is a synchronous operation. To analyze documents
315
+ # asynchronously, use StartDocumentTextDetection.
316
+ #
317
+ # @option params [required, Types::Document] :document
318
+ # The input document as base64-encoded bytes or an Amazon S3 object. If
319
+ # you use the AWS CLI to call Amazon Textract operations, you can't
320
+ # pass image bytes. The document must be an image in JPG or PNG format.
321
+ #
322
+ # @return [Types::DetectDocumentTextResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
323
+ #
324
+ # * {Types::DetectDocumentTextResponse#document_metadata #document_metadata} => Types::DocumentMetadata
325
+ # * {Types::DetectDocumentTextResponse#blocks #blocks} => Array&lt;Types::Block&gt;
326
+ #
327
+ # @example Request syntax with placeholder values
328
+ #
329
+ # resp = client.detect_document_text({
330
+ # document: { # required
331
+ # bytes: "data",
332
+ # s3_object: {
333
+ # bucket: "S3Bucket",
334
+ # name: "S3ObjectName",
335
+ # version: "S3ObjectVersion",
336
+ # },
337
+ # },
338
+ # })
339
+ #
340
+ # @example Response structure
341
+ #
342
+ # resp.document_metadata.pages #=> Integer
343
+ # resp.blocks #=> Array
344
+ # resp.blocks[0].block_type #=> String, one of "KEY_VALUE_SET", "PAGE", "LINE", "WORD", "TABLE", "CELL"
345
+ # resp.blocks[0].confidence #=> Float
346
+ # resp.blocks[0].text #=> String
347
+ # resp.blocks[0].row_index #=> Integer
348
+ # resp.blocks[0].column_index #=> Integer
349
+ # resp.blocks[0].row_span #=> Integer
350
+ # resp.blocks[0].column_span #=> Integer
351
+ # resp.blocks[0].geometry.bounding_box.width #=> Float
352
+ # resp.blocks[0].geometry.bounding_box.height #=> Float
353
+ # resp.blocks[0].geometry.bounding_box.left #=> Float
354
+ # resp.blocks[0].geometry.bounding_box.top #=> Float
355
+ # resp.blocks[0].geometry.polygon #=> Array
356
+ # resp.blocks[0].geometry.polygon[0].x #=> Float
357
+ # resp.blocks[0].geometry.polygon[0].y #=> Float
358
+ # resp.blocks[0].id #=> String
359
+ # resp.blocks[0].relationships #=> Array
360
+ # resp.blocks[0].relationships[0].type #=> String, one of "VALUE", "CHILD"
361
+ # resp.blocks[0].relationships[0].ids #=> Array
362
+ # resp.blocks[0].relationships[0].ids[0] #=> String
363
+ # resp.blocks[0].entity_types #=> Array
364
+ # resp.blocks[0].entity_types[0] #=> String, one of "KEY", "VALUE"
365
+ # resp.blocks[0].page #=> Integer
366
+ #
367
+ # @see http://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/DetectDocumentText AWS API Documentation
368
+ #
369
+ # @overload detect_document_text(params = {})
370
+ # @param [Hash] params ({})
371
+ def detect_document_text(params = {}, options = {})
372
+ req = build_request(:detect_document_text, params)
373
+ req.send_request(options)
374
+ end
375
+
376
+ # Gets the results for an Amazon Textract asynchronous operation that
377
+ # analyzes text in a document image.
378
+ #
379
+ # You start asynchronous text analysis by calling StartDocumentAnalysis,
380
+ # which returns a job identifier (`JobId`). When the text analysis
381
+ # operation finishes, Amazon Textract publishes a completion status to
382
+ # the Amazon Simple Notification Service (Amazon SNS) topic that's
383
+ # registered in the initial call to `StartDocumentAnalysis`. To get the
384
+ # results of the text-detection operation, first check that the status
385
+ # value published to the Amazon SNS topic is `SUCCEEDED`. If so, call
386
+ # `GetDocumentAnalysis`, and pass the job identifier (`JobId`) from the
387
+ # initial call to `StartDocumentAnalysis`.
388
+ #
389
+ # `GetDocumentAnalysis` returns an array of Block objects. For more
390
+ # information, see how-it-works-analyzing.
391
+ #
392
+ # Use the `MaxResults` parameter to limit the number of blocks returned.
393
+ # If there are more results than specified in `MaxResults`, the value of
394
+ # `NextToken` in the operation response contains a pagination token for
395
+ # getting the next set of results. To get the next page of results, call
396
+ # `GetDocumentAnalysis`, and populate the `NextToken` request parameter
397
+ # with the token value that's returned from the previous call to
398
+ # `GetDocumentAnalysis`.
399
+ #
400
+ # @option params [required, String] :job_id
401
+ # A unique identifier for the text-detection job. The `JobId` is
402
+ # returned from `StartDocumentAnalysis`.
403
+ #
404
+ # @option params [Integer] :max_results
405
+ # The maximum number of results to return per paginated call. The
406
+ # largest value that you can specify is 1,000. If you specify a value
407
+ # greater than 1,000, a maximum of 1,000 results is returned. The
408
+ # default value is 1,000.
409
+ #
410
+ # @option params [String] :next_token
411
+ # If the previous response was incomplete (because there are more blocks
412
+ # to retrieve), Amazon Textract returns a pagination token in the
413
+ # response. You can use this pagination token to retrieve the next set
414
+ # of blocks.
415
+ #
416
+ # @return [Types::GetDocumentAnalysisResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
417
+ #
418
+ # * {Types::GetDocumentAnalysisResponse#document_metadata #document_metadata} => Types::DocumentMetadata
419
+ # * {Types::GetDocumentAnalysisResponse#job_status #job_status} => String
420
+ # * {Types::GetDocumentAnalysisResponse#next_token #next_token} => String
421
+ # * {Types::GetDocumentAnalysisResponse#blocks #blocks} => Array&lt;Types::Block&gt;
422
+ # * {Types::GetDocumentAnalysisResponse#warnings #warnings} => Array&lt;Types::Warning&gt;
423
+ # * {Types::GetDocumentAnalysisResponse#status_message #status_message} => String
424
+ #
425
+ # @example Request syntax with placeholder values
426
+ #
427
+ # resp = client.get_document_analysis({
428
+ # job_id: "JobId", # required
429
+ # max_results: 1,
430
+ # next_token: "PaginationToken",
431
+ # })
432
+ #
433
+ # @example Response structure
434
+ #
435
+ # resp.document_metadata.pages #=> Integer
436
+ # resp.job_status #=> String, one of "IN_PROGRESS", "SUCCEEDED", "FAILED", "PARTIAL_SUCCESS"
437
+ # resp.next_token #=> String
438
+ # resp.blocks #=> Array
439
+ # resp.blocks[0].block_type #=> String, one of "KEY_VALUE_SET", "PAGE", "LINE", "WORD", "TABLE", "CELL"
440
+ # resp.blocks[0].confidence #=> Float
441
+ # resp.blocks[0].text #=> String
442
+ # resp.blocks[0].row_index #=> Integer
443
+ # resp.blocks[0].column_index #=> Integer
444
+ # resp.blocks[0].row_span #=> Integer
445
+ # resp.blocks[0].column_span #=> Integer
446
+ # resp.blocks[0].geometry.bounding_box.width #=> Float
447
+ # resp.blocks[0].geometry.bounding_box.height #=> Float
448
+ # resp.blocks[0].geometry.bounding_box.left #=> Float
449
+ # resp.blocks[0].geometry.bounding_box.top #=> Float
450
+ # resp.blocks[0].geometry.polygon #=> Array
451
+ # resp.blocks[0].geometry.polygon[0].x #=> Float
452
+ # resp.blocks[0].geometry.polygon[0].y #=> Float
453
+ # resp.blocks[0].id #=> String
454
+ # resp.blocks[0].relationships #=> Array
455
+ # resp.blocks[0].relationships[0].type #=> String, one of "VALUE", "CHILD"
456
+ # resp.blocks[0].relationships[0].ids #=> Array
457
+ # resp.blocks[0].relationships[0].ids[0] #=> String
458
+ # resp.blocks[0].entity_types #=> Array
459
+ # resp.blocks[0].entity_types[0] #=> String, one of "KEY", "VALUE"
460
+ # resp.blocks[0].page #=> Integer
461
+ # resp.warnings #=> Array
462
+ # resp.warnings[0].error_code #=> String
463
+ # resp.warnings[0].pages #=> Array
464
+ # resp.warnings[0].pages[0] #=> Integer
465
+ # resp.status_message #=> String
466
+ #
467
+ # @see http://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/GetDocumentAnalysis AWS API Documentation
468
+ #
469
+ # @overload get_document_analysis(params = {})
470
+ # @param [Hash] params ({})
471
+ def get_document_analysis(params = {}, options = {})
472
+ req = build_request(:get_document_analysis, params)
473
+ req.send_request(options)
474
+ end
475
+
476
+ # Gets the results for an Amazon Textract asynchronous operation that
477
+ # detects text in a document image. Amazon Textract can detect lines of
478
+ # text and the words that make up a line of text.
479
+ #
480
+ # You start asynchronous text detection by calling
481
+ # StartDocumentTextDetection, which returns a job identifier (`JobId`).
482
+ # When the text detection operation finishes, Amazon Textract publishes
483
+ # a completion status to the Amazon Simple Notification Service (Amazon
484
+ # SNS) topic that's registered in the initial call to
485
+ # `StartDocumentTextDetection`. To get the results of the text-detection
486
+ # operation, first check that the status value published to the Amazon
487
+ # SNS topic is `SUCCEEDED`. If so, call `GetDocumentTextDetection`, and
488
+ # pass the job identifier (`JobId`) from the initial call to
489
+ # `StartDocumentTextDetection`.
490
+ #
491
+ # `GetDocumentTextDetection` returns an array of Block objects. For more
492
+ # information, see how-it-works-detecting.
493
+ #
494
+ # Use the MaxResults parameter to limit the number of blocks that are
495
+ # returned. If there are more results than specified in `MaxResults`,
496
+ # the value of `NextToken` in the operation response contains a
497
+ # pagination token for getting the next set of results. To get the next
498
+ # page of results, call `GetDocumentTextDetection`, and populate the
499
+ # `NextToken` request parameter with the token value that's returned
500
+ # from the previous call to `GetDocumentTextDetection`.
501
+ #
502
+ # For more information, see Document Text Detection in the Amazon
503
+ # Textract Developer Guide.
504
+ #
505
+ # @option params [required, String] :job_id
506
+ # A unique identifier for the text detection job. The `JobId` is
507
+ # returned from `StartDocumentTextDetection`.
508
+ #
509
+ # @option params [Integer] :max_results
510
+ # The maximum number of results to return per paginated call. The
511
+ # largest value you can specify is 1,000. If you specify a value greater
512
+ # than 1,000, a maximum of 1,000 results is returned. The default value
513
+ # is 1,000.
514
+ #
515
+ # @option params [String] :next_token
516
+ # If the previous response was incomplete (because there are more blocks
517
+ # to retrieve), Amazon Textract returns a pagination token in the
518
+ # response. You can use this pagination token to retrieve the next set
519
+ # of blocks.
520
+ #
521
+ # @return [Types::GetDocumentTextDetectionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
522
+ #
523
+ # * {Types::GetDocumentTextDetectionResponse#document_metadata #document_metadata} => Types::DocumentMetadata
524
+ # * {Types::GetDocumentTextDetectionResponse#job_status #job_status} => String
525
+ # * {Types::GetDocumentTextDetectionResponse#next_token #next_token} => String
526
+ # * {Types::GetDocumentTextDetectionResponse#blocks #blocks} => Array&lt;Types::Block&gt;
527
+ # * {Types::GetDocumentTextDetectionResponse#warnings #warnings} => Array&lt;Types::Warning&gt;
528
+ # * {Types::GetDocumentTextDetectionResponse#status_message #status_message} => String
529
+ #
530
+ # @example Request syntax with placeholder values
531
+ #
532
+ # resp = client.get_document_text_detection({
533
+ # job_id: "JobId", # required
534
+ # max_results: 1,
535
+ # next_token: "PaginationToken",
536
+ # })
537
+ #
538
+ # @example Response structure
539
+ #
540
+ # resp.document_metadata.pages #=> Integer
541
+ # resp.job_status #=> String, one of "IN_PROGRESS", "SUCCEEDED", "FAILED", "PARTIAL_SUCCESS"
542
+ # resp.next_token #=> String
543
+ # resp.blocks #=> Array
544
+ # resp.blocks[0].block_type #=> String, one of "KEY_VALUE_SET", "PAGE", "LINE", "WORD", "TABLE", "CELL"
545
+ # resp.blocks[0].confidence #=> Float
546
+ # resp.blocks[0].text #=> String
547
+ # resp.blocks[0].row_index #=> Integer
548
+ # resp.blocks[0].column_index #=> Integer
549
+ # resp.blocks[0].row_span #=> Integer
550
+ # resp.blocks[0].column_span #=> Integer
551
+ # resp.blocks[0].geometry.bounding_box.width #=> Float
552
+ # resp.blocks[0].geometry.bounding_box.height #=> Float
553
+ # resp.blocks[0].geometry.bounding_box.left #=> Float
554
+ # resp.blocks[0].geometry.bounding_box.top #=> Float
555
+ # resp.blocks[0].geometry.polygon #=> Array
556
+ # resp.blocks[0].geometry.polygon[0].x #=> Float
557
+ # resp.blocks[0].geometry.polygon[0].y #=> Float
558
+ # resp.blocks[0].id #=> String
559
+ # resp.blocks[0].relationships #=> Array
560
+ # resp.blocks[0].relationships[0].type #=> String, one of "VALUE", "CHILD"
561
+ # resp.blocks[0].relationships[0].ids #=> Array
562
+ # resp.blocks[0].relationships[0].ids[0] #=> String
563
+ # resp.blocks[0].entity_types #=> Array
564
+ # resp.blocks[0].entity_types[0] #=> String, one of "KEY", "VALUE"
565
+ # resp.blocks[0].page #=> Integer
566
+ # resp.warnings #=> Array
567
+ # resp.warnings[0].error_code #=> String
568
+ # resp.warnings[0].pages #=> Array
569
+ # resp.warnings[0].pages[0] #=> Integer
570
+ # resp.status_message #=> String
571
+ #
572
+ # @see http://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/GetDocumentTextDetection AWS API Documentation
573
+ #
574
+ # @overload get_document_text_detection(params = {})
575
+ # @param [Hash] params ({})
576
+ def get_document_text_detection(params = {}, options = {})
577
+ req = build_request(:get_document_text_detection, params)
578
+ req.send_request(options)
579
+ end
580
+
581
+ # Starts asynchronous analysis of text for relationships in the text and
582
+ # tables that are detected in a document. Amazon Textract returns for
583
+ # two types of information:
584
+ #
585
+ # * Words and lines that are related to nearby lines and words. The
586
+ # related information is returned in two Block objects: A KEY Block
587
+ # object and a VALUE Block object. For example, *Name: Ana Silva
588
+ # Carolina* contains a key and value. *Name:* is the key. *Ana Silva
589
+ # Carolina* is the value.
590
+ #
591
+ # * Table and table cell data. A TABLE block contains information about
592
+ # a detected table. A CELL block is returned for each cell in a table.
593
+ #
594
+ # Amazon Textract can analyze text in document images and PDF files that
595
+ # are stored in an Amazon S3 bucket. Use DocumentLocation to specify the
596
+ # bucket name and file name of the document image.
597
+ #
598
+ # `StartDocumentAnalysis` returns a job identifier (`JobId`) that you
599
+ # use to get the results of the operation. When text analysis is
600
+ # finished, Amazon Textract publishes a completion status to the Amazon
601
+ # Simple Notification Service (Amazon SNS) topic that you specify in
602
+ # `NotificationChannel`. To get the results of the text analysis
603
+ # operation, first check that the status value published to the Amazon
604
+ # SNS topic is `SUCCEEDED`. If so, call GetDocumentAnalysis, and pass
605
+ # the job identifier (`JobId`) from the initial call to
606
+ # `StartDocumentAnalysis`.
607
+ #
608
+ # @option params [required, Types::DocumentLocation] :document_location
609
+ # The location of the document to be processed.
610
+ #
611
+ # @option params [required, Array<String>] :feature_types
612
+ # A list of the types of analysis to perform. Add TABLES to the list to
613
+ # return information about the tables that are detected in the input
614
+ # document. Add FORMS to return detected fields and the associated text.
615
+ # To perform both types of analysis, add TABLES and FORMS to
616
+ # `FeatureTypes`.
617
+ #
618
+ # @option params [String] :client_request_token
619
+ # The idempotent token that you use to identify the start request. If
620
+ # you use the same token with multiple `StartDocumentAnalysis` requests,
621
+ # the same `JobId` is returned. Use `ClientRequestToken` to prevent the
622
+ # same job from being accidentally started more than once.
623
+ #
624
+ # @option params [String] :job_tag
625
+ # The unique identifier you specify to identify the job in the
626
+ # completion status that's published to the Amazon SNS topic.
627
+ #
628
+ # @option params [Types::NotificationChannel] :notification_channel
629
+ # The Amazon SNS topic ARN that you want Amazon Textract to publish the
630
+ # completion status of the operation to.
631
+ #
632
+ # @return [Types::StartDocumentAnalysisResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
633
+ #
634
+ # * {Types::StartDocumentAnalysisResponse#job_id #job_id} => String
635
+ #
636
+ # @example Request syntax with placeholder values
637
+ #
638
+ # resp = client.start_document_analysis({
639
+ # document_location: { # required
640
+ # s3_object: {
641
+ # bucket: "S3Bucket",
642
+ # name: "S3ObjectName",
643
+ # version: "S3ObjectVersion",
644
+ # },
645
+ # },
646
+ # feature_types: ["TABLES"], # required, accepts TABLES, FORMS
647
+ # client_request_token: "ClientRequestToken",
648
+ # job_tag: "JobTag",
649
+ # notification_channel: {
650
+ # sns_topic_arn: "SNSTopicArn", # required
651
+ # role_arn: "RoleArn", # required
652
+ # },
653
+ # })
654
+ #
655
+ # @example Response structure
656
+ #
657
+ # resp.job_id #=> String
658
+ #
659
+ # @see http://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/StartDocumentAnalysis AWS API Documentation
660
+ #
661
+ # @overload start_document_analysis(params = {})
662
+ # @param [Hash] params ({})
663
+ def start_document_analysis(params = {}, options = {})
664
+ req = build_request(:start_document_analysis, params)
665
+ req.send_request(options)
666
+ end
667
+
668
+ # Starts the asynchronous detection of text in a document. Amazon
669
+ # Textract can detect lines of text and the words that make up a line of
670
+ # text.
671
+ #
672
+ # Amazon Textract can detect text in document images and PDF files that
673
+ # are stored in an Amazon S3 bucket. Use DocumentLocation to specify the
674
+ # bucket name and the file name of the document image.
675
+ #
676
+ # `StartTextDetection` returns a job identifier (`JobId`) that you use
677
+ # to get the results of the operation. When text detection is finished,
678
+ # Amazon Textract publishes a completion status to the Amazon Simple
679
+ # Notification Service (Amazon SNS) topic that you specify in
680
+ # `NotificationChannel`. To get the results of the text detection
681
+ # operation, first check that the status value published to the Amazon
682
+ # SNS topic is `SUCCEEDED`. If so, call GetDocumentTextDetection, and
683
+ # pass the job identifier (`JobId`) from the initial call to
684
+ # `StartDocumentTextDetection`.
685
+ #
686
+ # For more information, see Document Text Detection in the Amazon
687
+ # Textract Developer Guide.
688
+ #
689
+ # @option params [required, Types::DocumentLocation] :document_location
690
+ # The location of the document to be processed.
691
+ #
692
+ # @option params [String] :client_request_token
693
+ # The idempotent token that's used to identify the start request. If
694
+ # you use the same token with multiple `StartDocumentTextDetection`
695
+ # requests, the same `JobId` is returned. Use `ClientRequestToken` to
696
+ # prevent the same job from being accidentally started more than once.
697
+ #
698
+ # @option params [String] :job_tag
699
+ # A unique identifier you specify to identify the job in the completion
700
+ # status that's published to the Amazon Simple Notification Service
701
+ # (Amazon SNS) topic.
702
+ #
703
+ # @option params [Types::NotificationChannel] :notification_channel
704
+ # The Amazon SNS topic ARN that you want Amazon Textract to publish the
705
+ # completion status of the operation to.
706
+ #
707
+ # @return [Types::StartDocumentTextDetectionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
708
+ #
709
+ # * {Types::StartDocumentTextDetectionResponse#job_id #job_id} => String
710
+ #
711
+ # @example Request syntax with placeholder values
712
+ #
713
+ # resp = client.start_document_text_detection({
714
+ # document_location: { # required
715
+ # s3_object: {
716
+ # bucket: "S3Bucket",
717
+ # name: "S3ObjectName",
718
+ # version: "S3ObjectVersion",
719
+ # },
720
+ # },
721
+ # client_request_token: "ClientRequestToken",
722
+ # job_tag: "JobTag",
723
+ # notification_channel: {
724
+ # sns_topic_arn: "SNSTopicArn", # required
725
+ # role_arn: "RoleArn", # required
726
+ # },
727
+ # })
728
+ #
729
+ # @example Response structure
730
+ #
731
+ # resp.job_id #=> String
732
+ #
733
+ # @see http://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/StartDocumentTextDetection AWS API Documentation
734
+ #
735
+ # @overload start_document_text_detection(params = {})
736
+ # @param [Hash] params ({})
737
+ def start_document_text_detection(params = {}, options = {})
738
+ req = build_request(:start_document_text_detection, params)
739
+ req.send_request(options)
740
+ end
741
+
742
+ # @!endgroup
743
+
744
+ # @param params ({})
745
+ # @api private
746
+ def build_request(operation_name, params = {})
747
+ handlers = @handlers.for(operation_name)
748
+ context = Seahorse::Client::RequestContext.new(
749
+ operation_name: operation_name,
750
+ operation: config.api.operation(operation_name),
751
+ client: self,
752
+ params: params,
753
+ config: config)
754
+ context[:gem_name] = 'aws-sdk-textract'
755
+ context[:gem_version] = '1.0.0'
756
+ Seahorse::Client::Request.new(handlers, context)
757
+ end
758
+
759
+ # @api private
760
+ # @deprecated
761
+ def waiter_names
762
+ []
763
+ end
764
+
765
+ class << self
766
+
767
+ # @api private
768
+ attr_reader :identifier
769
+
770
+ # @api private
771
+ def errors_module
772
+ Errors
773
+ end
774
+
775
+ end
776
+ end
777
+ end