1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::analyze_document::_analyze_document_output::AnalyzeDocumentOutputBuilder;
pub use crate::operation::analyze_document::_analyze_document_input::AnalyzeDocumentInputBuilder;
/// Fluent builder constructing a request to `AnalyzeDocument`.
///
/// <p>Analyzes an input document for relationships between detected items. </p>
/// <p>The types of information returned are as follows: </p>
/// <ul>
/// <li> <p>Form data (key-value pairs). The related information is returned in two <code>Block</code> objects, each of type <code>KEY_VALUE_SET</code>: a KEY <code>Block</code> object and a VALUE <code>Block</code> object. For example, <i>Name: Ana Silva Carolina</i> contains a key and value. <i>Name:</i> is the key. <i>Ana Silva Carolina</i> is the value.</p> </li>
/// <li> <p>Table and table cell data. A TABLE <code>Block</code> object contains information about a detected table. A CELL <code>Block</code> object is returned for each cell in a table.</p> </li>
/// <li> <p>Lines and words of text. A LINE <code>Block</code> object contains one or more WORD <code>Block</code> objects. All lines and words that are detected in the document are returned (including text that doesn't have a relationship with the value of <code>FeatureTypes</code>). </p> </li>
/// <li> <p>Signatures. A SIGNATURE <code>Block</code> object contains the location information of a signature in a document. If used in conjunction with forms or tables, a signature can be given a Key-Value pairing or be detected in the cell of a table.</p> </li>
/// <li> <p>Query. A QUERY Block object contains the query text, alias and link to the associated Query results block object.</p> </li>
/// <li> <p>Query Result. A QUERY_RESULT Block object contains the answer to the query and an ID that connects it to the query asked. This Block also contains a confidence score.</p> </li>
/// </ul>
/// <p>Selection elements such as check boxes and option buttons (radio buttons) can be detected in form data and in tables. A SELECTION_ELEMENT <code>Block</code> object contains information about a selection element, including the selection status.</p>
/// <p>You can choose which type of analysis to perform by specifying the <code>FeatureTypes</code> list. </p>
/// <p>The output is returned in a list of <code>Block</code> objects.</p>
/// <p> <code>AnalyzeDocument</code> is a synchronous operation. To analyze documents asynchronously, use <code>StartDocumentAnalysis</code>.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html">Document Text Analysis</a>.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct AnalyzeDocumentFluentBuilder {
handle: std::sync::Arc<crate::client::Handle>,
inner: crate::operation::analyze_document::builders::AnalyzeDocumentInputBuilder,
}
impl AnalyzeDocumentFluentBuilder {
/// Creates a new `AnalyzeDocument`.
pub(crate) fn new(handle: std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::analyze_document::AnalyzeDocument,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::result::SdkError<crate::operation::analyze_document::AnalyzeDocumentError>,
> {
let handle = self.handle.clone();
let operation = self
.inner
.build()
.map_err(aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&handle.conf)
.await
.map_err(aws_smithy_http::result::SdkError::construction_failure)?;
Ok(crate::client::customize::CustomizableOperation { handle, operation })
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::operation::analyze_document::AnalyzeDocumentOutput,
aws_smithy_http::result::SdkError<crate::operation::analyze_document::AnalyzeDocumentError>,
> {
let op = self
.inner
.build()
.map_err(aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&self.handle.conf)
.await
.map_err(aws_smithy_http::result::SdkError::construction_failure)?;
self.handle.client.call(op).await
}
/// <p>The input document as base64-encoded bytes or an Amazon S3 object. If you use the AWS CLI to call Amazon Textract operations, you can't pass image bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format.</p>
/// <p>If you're using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes that are passed using the <code>Bytes</code> field. </p>
pub fn document(mut self, input: crate::types::Document) -> Self {
self.inner = self.inner.document(input);
self
}
/// <p>The input document as base64-encoded bytes or an Amazon S3 object. If you use the AWS CLI to call Amazon Textract operations, you can't pass image bytes. The document must be an image in JPEG, PNG, PDF, or TIFF format.</p>
/// <p>If you're using an AWS SDK to call Amazon Textract, you might not need to base64-encode image bytes that are passed using the <code>Bytes</code> field. </p>
pub fn set_document(mut self, input: std::option::Option<crate::types::Document>) -> Self {
self.inner = self.inner.set_document(input);
self
}
/// Appends an item to `FeatureTypes`.
///
/// To override the contents of this collection use [`set_feature_types`](Self::set_feature_types).
///
/// <p>A list of the types of analysis to perform. Add TABLES to the list to return information about the tables that are detected in the input document. Add FORMS to return detected form data. Add SIGNATURES to return the locations of detected signatures. To perform both forms and table analysis, add TABLES and FORMS to <code>FeatureTypes</code>. To detect signatures within form data and table data, add SIGNATURES to either TABLES or FORMS. All lines and words detected in the document are included in the response (including text that isn't related to the value of <code>FeatureTypes</code>). </p>
pub fn feature_types(mut self, input: crate::types::FeatureType) -> Self {
self.inner = self.inner.feature_types(input);
self
}
/// <p>A list of the types of analysis to perform. Add TABLES to the list to return information about the tables that are detected in the input document. Add FORMS to return detected form data. Add SIGNATURES to return the locations of detected signatures. To perform both forms and table analysis, add TABLES and FORMS to <code>FeatureTypes</code>. To detect signatures within form data and table data, add SIGNATURES to either TABLES or FORMS. All lines and words detected in the document are included in the response (including text that isn't related to the value of <code>FeatureTypes</code>). </p>
pub fn set_feature_types(
mut self,
input: std::option::Option<std::vec::Vec<crate::types::FeatureType>>,
) -> Self {
self.inner = self.inner.set_feature_types(input);
self
}
/// <p>Sets the configuration for the human in the loop workflow for analyzing documents.</p>
pub fn human_loop_config(mut self, input: crate::types::HumanLoopConfig) -> Self {
self.inner = self.inner.human_loop_config(input);
self
}
/// <p>Sets the configuration for the human in the loop workflow for analyzing documents.</p>
pub fn set_human_loop_config(
mut self,
input: std::option::Option<crate::types::HumanLoopConfig>,
) -> Self {
self.inner = self.inner.set_human_loop_config(input);
self
}
/// <p>Contains Queries and the alias for those Queries, as determined by the input. </p>
pub fn queries_config(mut self, input: crate::types::QueriesConfig) -> Self {
self.inner = self.inner.queries_config(input);
self
}
/// <p>Contains Queries and the alias for those Queries, as determined by the input. </p>
pub fn set_queries_config(
mut self,
input: std::option::Option<crate::types::QueriesConfig>,
) -> Self {
self.inner = self.inner.set_queries_config(input);
self
}
}