aws_sdk_textract/operation/analyze_document/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::analyze_document::_analyze_document_output::AnalyzeDocumentOutputBuilder;
3
4pub use crate::operation::analyze_document::_analyze_document_input::AnalyzeDocumentInputBuilder;
5
6impl crate::operation::analyze_document::builders::AnalyzeDocumentInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::analyze_document::AnalyzeDocumentOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::analyze_document::AnalyzeDocumentError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.analyze_document();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AnalyzeDocument`.
24///
25/// <p>Analyzes an input document for relationships between detected items.</p>
26/// <p>The types of information returned are as follows:</p>
27/// <ul>
28/// <li>
29/// <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>
30/// <li>
31/// <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>
32/// <li>
33/// <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>
34/// <li>
35/// <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>
36/// <li>
37/// <p>Query. A QUERY Block object contains the query text, alias and link to the associated Query results block object.</p></li>
38/// <li>
39/// <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>
40/// </ul>
41/// <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>
42/// <p>You can choose which type of analysis to perform by specifying the <code>FeatureTypes</code> list.</p>
43/// <p>The output is returned in a list of <code>Block</code> objects.</p>
44/// <p><code>AnalyzeDocument</code> is a synchronous operation. To analyze documents asynchronously, use <code>StartDocumentAnalysis</code>.</p>
45/// <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>
46#[derive(::std::clone::Clone, ::std::fmt::Debug)]
47pub struct AnalyzeDocumentFluentBuilder {
48    handle: ::std::sync::Arc<crate::client::Handle>,
49    inner: crate::operation::analyze_document::builders::AnalyzeDocumentInputBuilder,
50    config_override: ::std::option::Option<crate::config::Builder>,
51}
52impl
53    crate::client::customize::internal::CustomizableSend<
54        crate::operation::analyze_document::AnalyzeDocumentOutput,
55        crate::operation::analyze_document::AnalyzeDocumentError,
56    > for AnalyzeDocumentFluentBuilder
57{
58    fn send(
59        self,
60        config_override: crate::config::Builder,
61    ) -> crate::client::customize::internal::BoxFuture<
62        crate::client::customize::internal::SendResult<
63            crate::operation::analyze_document::AnalyzeDocumentOutput,
64            crate::operation::analyze_document::AnalyzeDocumentError,
65        >,
66    > {
67        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
68    }
69}
70impl AnalyzeDocumentFluentBuilder {
71    /// Creates a new `AnalyzeDocumentFluentBuilder`.
72    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
73        Self {
74            handle,
75            inner: ::std::default::Default::default(),
76            config_override: ::std::option::Option::None,
77        }
78    }
79    /// Access the AnalyzeDocument as a reference.
80    pub fn as_input(&self) -> &crate::operation::analyze_document::builders::AnalyzeDocumentInputBuilder {
81        &self.inner
82    }
83    /// Sends the request and returns the response.
84    ///
85    /// If an error occurs, an `SdkError` will be returned with additional details that
86    /// can be matched against.
87    ///
88    /// By default, any retryable failures will be retried twice. Retry behavior
89    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
90    /// set when configuring the client.
91    pub async fn send(
92        self,
93    ) -> ::std::result::Result<
94        crate::operation::analyze_document::AnalyzeDocumentOutput,
95        ::aws_smithy_runtime_api::client::result::SdkError<
96            crate::operation::analyze_document::AnalyzeDocumentError,
97            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
98        >,
99    > {
100        let input = self
101            .inner
102            .build()
103            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
104        let runtime_plugins = crate::operation::analyze_document::AnalyzeDocument::operation_runtime_plugins(
105            self.handle.runtime_plugins.clone(),
106            &self.handle.conf,
107            self.config_override,
108        );
109        crate::operation::analyze_document::AnalyzeDocument::orchestrate(&runtime_plugins, input).await
110    }
111
112    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
113    pub fn customize(
114        self,
115    ) -> crate::client::customize::CustomizableOperation<
116        crate::operation::analyze_document::AnalyzeDocumentOutput,
117        crate::operation::analyze_document::AnalyzeDocumentError,
118        Self,
119    > {
120        crate::client::customize::CustomizableOperation::new(self)
121    }
122    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
123        self.set_config_override(::std::option::Option::Some(config_override.into()));
124        self
125    }
126
127    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
128        self.config_override = config_override;
129        self
130    }
131    /// <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>
132    /// <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>
133    pub fn document(mut self, input: crate::types::Document) -> Self {
134        self.inner = self.inner.document(input);
135        self
136    }
137    /// <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>
138    /// <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>
139    pub fn set_document(mut self, input: ::std::option::Option<crate::types::Document>) -> Self {
140        self.inner = self.inner.set_document(input);
141        self
142    }
143    /// <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>
144    /// <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>
145    pub fn get_document(&self) -> &::std::option::Option<crate::types::Document> {
146        self.inner.get_document()
147    }
148    ///
149    /// Appends an item to `FeatureTypes`.
150    ///
151    /// To override the contents of this collection use [`set_feature_types`](Self::set_feature_types).
152    ///
153    /// <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. Add LAYOUT to the list to return information about the layout of the document. 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>
154    pub fn feature_types(mut self, input: crate::types::FeatureType) -> Self {
155        self.inner = self.inner.feature_types(input);
156        self
157    }
158    /// <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. Add LAYOUT to the list to return information about the layout of the document. 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>
159    pub fn set_feature_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FeatureType>>) -> Self {
160        self.inner = self.inner.set_feature_types(input);
161        self
162    }
163    /// <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. Add LAYOUT to the list to return information about the layout of the document. 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>
164    pub fn get_feature_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FeatureType>> {
165        self.inner.get_feature_types()
166    }
167    /// <p>Sets the configuration for the human in the loop workflow for analyzing documents.</p>
168    pub fn human_loop_config(mut self, input: crate::types::HumanLoopConfig) -> Self {
169        self.inner = self.inner.human_loop_config(input);
170        self
171    }
172    /// <p>Sets the configuration for the human in the loop workflow for analyzing documents.</p>
173    pub fn set_human_loop_config(mut self, input: ::std::option::Option<crate::types::HumanLoopConfig>) -> Self {
174        self.inner = self.inner.set_human_loop_config(input);
175        self
176    }
177    /// <p>Sets the configuration for the human in the loop workflow for analyzing documents.</p>
178    pub fn get_human_loop_config(&self) -> &::std::option::Option<crate::types::HumanLoopConfig> {
179        self.inner.get_human_loop_config()
180    }
181    /// <p>Contains Queries and the alias for those Queries, as determined by the input.</p>
182    pub fn queries_config(mut self, input: crate::types::QueriesConfig) -> Self {
183        self.inner = self.inner.queries_config(input);
184        self
185    }
186    /// <p>Contains Queries and the alias for those Queries, as determined by the input.</p>
187    pub fn set_queries_config(mut self, input: ::std::option::Option<crate::types::QueriesConfig>) -> Self {
188        self.inner = self.inner.set_queries_config(input);
189        self
190    }
191    /// <p>Contains Queries and the alias for those Queries, as determined by the input.</p>
192    pub fn get_queries_config(&self) -> &::std::option::Option<crate::types::QueriesConfig> {
193        self.inner.get_queries_config()
194    }
195    /// <p>Specifies the adapter to be used when analyzing a document.</p>
196    pub fn adapters_config(mut self, input: crate::types::AdaptersConfig) -> Self {
197        self.inner = self.inner.adapters_config(input);
198        self
199    }
200    /// <p>Specifies the adapter to be used when analyzing a document.</p>
201    pub fn set_adapters_config(mut self, input: ::std::option::Option<crate::types::AdaptersConfig>) -> Self {
202        self.inner = self.inner.set_adapters_config(input);
203        self
204    }
205    /// <p>Specifies the adapter to be used when analyzing a document.</p>
206    pub fn get_adapters_config(&self) -> &::std::option::Option<crate::types::AdaptersConfig> {
207        self.inner.get_adapters_config()
208    }
209}