aws_sdk_textract/operation/analyze_expense/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::analyze_expense::_analyze_expense_output::AnalyzeExpenseOutputBuilder;
3
4pub use crate::operation::analyze_expense::_analyze_expense_input::AnalyzeExpenseInputBuilder;
5
6impl crate::operation::analyze_expense::builders::AnalyzeExpenseInputBuilder {
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_expense::AnalyzeExpenseOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::analyze_expense::AnalyzeExpenseError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.analyze_expense();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `AnalyzeExpense`.
24///
25/// <p><code>AnalyzeExpense</code> synchronously analyzes an input document for financially related relationships between text.</p>
26/// <p>Information is returned as <code>ExpenseDocuments</code> and seperated as follows:</p>
27/// <ul>
28/// <li>
29/// <p><code>LineItemGroups</code>- A data set containing <code>LineItems</code> which store information about the lines of text, such as an item purchased and its price on a receipt.</p></li>
30/// <li>
31/// <p><code>SummaryFields</code>- Contains all other information a receipt, such as header information or the vendors name.</p></li>
32/// </ul>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct AnalyzeExpenseFluentBuilder {
35 handle: ::std::sync::Arc<crate::client::Handle>,
36 inner: crate::operation::analyze_expense::builders::AnalyzeExpenseInputBuilder,
37 config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40 crate::client::customize::internal::CustomizableSend<
41 crate::operation::analyze_expense::AnalyzeExpenseOutput,
42 crate::operation::analyze_expense::AnalyzeExpenseError,
43 > for AnalyzeExpenseFluentBuilder
44{
45 fn send(
46 self,
47 config_override: crate::config::Builder,
48 ) -> crate::client::customize::internal::BoxFuture<
49 crate::client::customize::internal::SendResult<
50 crate::operation::analyze_expense::AnalyzeExpenseOutput,
51 crate::operation::analyze_expense::AnalyzeExpenseError,
52 >,
53 > {
54 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55 }
56}
57impl AnalyzeExpenseFluentBuilder {
58 /// Creates a new `AnalyzeExpenseFluentBuilder`.
59 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60 Self {
61 handle,
62 inner: ::std::default::Default::default(),
63 config_override: ::std::option::Option::None,
64 }
65 }
66 /// Access the AnalyzeExpense as a reference.
67 pub fn as_input(&self) -> &crate::operation::analyze_expense::builders::AnalyzeExpenseInputBuilder {
68 &self.inner
69 }
70 /// Sends the request and returns the response.
71 ///
72 /// If an error occurs, an `SdkError` will be returned with additional details that
73 /// can be matched against.
74 ///
75 /// By default, any retryable failures will be retried twice. Retry behavior
76 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77 /// set when configuring the client.
78 pub async fn send(
79 self,
80 ) -> ::std::result::Result<
81 crate::operation::analyze_expense::AnalyzeExpenseOutput,
82 ::aws_smithy_runtime_api::client::result::SdkError<
83 crate::operation::analyze_expense::AnalyzeExpenseError,
84 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85 >,
86 > {
87 let input = self
88 .inner
89 .build()
90 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91 let runtime_plugins = crate::operation::analyze_expense::AnalyzeExpense::operation_runtime_plugins(
92 self.handle.runtime_plugins.clone(),
93 &self.handle.conf,
94 self.config_override,
95 );
96 crate::operation::analyze_expense::AnalyzeExpense::orchestrate(&runtime_plugins, input).await
97 }
98
99 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100 pub fn customize(
101 self,
102 ) -> crate::client::customize::CustomizableOperation<
103 crate::operation::analyze_expense::AnalyzeExpenseOutput,
104 crate::operation::analyze_expense::AnalyzeExpenseError,
105 Self,
106 > {
107 crate::client::customize::CustomizableOperation::new(self)
108 }
109 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110 self.set_config_override(::std::option::Option::Some(config_override.into()));
111 self
112 }
113
114 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115 self.config_override = config_override;
116 self
117 }
118 /// <p>The input document, either as bytes or as an S3 object.</p>
119 /// <p>You pass image bytes to an Amazon Textract API operation by using the <code>Bytes</code> property. For example, you would use the <code>Bytes</code> property to pass a document loaded from a local file system. Image bytes passed by using the <code>Bytes</code> property must be base64 encoded. Your code might not need to encode document file bytes if you're using an AWS SDK to call Amazon Textract API operations.</p>
120 /// <p>You pass images stored in an S3 bucket to an Amazon Textract API operation by using the <code>S3Object</code> property. Documents stored in an S3 bucket don't need to be base64 encoded.</p>
121 /// <p>The AWS Region for the S3 bucket that contains the S3 object must match the AWS Region that you use for Amazon Textract operations.</p>
122 /// <p>If you use the AWS CLI to call Amazon Textract operations, passing image bytes using the Bytes property isn't supported. You must first upload the document to an Amazon S3 bucket, and then call the operation using the S3Object property.</p>
123 /// <p>For Amazon Textract to process an S3 object, the user must have permission to access the S3 object.</p>
124 pub fn document(mut self, input: crate::types::Document) -> Self {
125 self.inner = self.inner.document(input);
126 self
127 }
128 /// <p>The input document, either as bytes or as an S3 object.</p>
129 /// <p>You pass image bytes to an Amazon Textract API operation by using the <code>Bytes</code> property. For example, you would use the <code>Bytes</code> property to pass a document loaded from a local file system. Image bytes passed by using the <code>Bytes</code> property must be base64 encoded. Your code might not need to encode document file bytes if you're using an AWS SDK to call Amazon Textract API operations.</p>
130 /// <p>You pass images stored in an S3 bucket to an Amazon Textract API operation by using the <code>S3Object</code> property. Documents stored in an S3 bucket don't need to be base64 encoded.</p>
131 /// <p>The AWS Region for the S3 bucket that contains the S3 object must match the AWS Region that you use for Amazon Textract operations.</p>
132 /// <p>If you use the AWS CLI to call Amazon Textract operations, passing image bytes using the Bytes property isn't supported. You must first upload the document to an Amazon S3 bucket, and then call the operation using the S3Object property.</p>
133 /// <p>For Amazon Textract to process an S3 object, the user must have permission to access the S3 object.</p>
134 pub fn set_document(mut self, input: ::std::option::Option<crate::types::Document>) -> Self {
135 self.inner = self.inner.set_document(input);
136 self
137 }
138 /// <p>The input document, either as bytes or as an S3 object.</p>
139 /// <p>You pass image bytes to an Amazon Textract API operation by using the <code>Bytes</code> property. For example, you would use the <code>Bytes</code> property to pass a document loaded from a local file system. Image bytes passed by using the <code>Bytes</code> property must be base64 encoded. Your code might not need to encode document file bytes if you're using an AWS SDK to call Amazon Textract API operations.</p>
140 /// <p>You pass images stored in an S3 bucket to an Amazon Textract API operation by using the <code>S3Object</code> property. Documents stored in an S3 bucket don't need to be base64 encoded.</p>
141 /// <p>The AWS Region for the S3 bucket that contains the S3 object must match the AWS Region that you use for Amazon Textract operations.</p>
142 /// <p>If you use the AWS CLI to call Amazon Textract operations, passing image bytes using the Bytes property isn't supported. You must first upload the document to an Amazon S3 bucket, and then call the operation using the S3Object property.</p>
143 /// <p>For Amazon Textract to process an S3 object, the user must have permission to access the S3 object.</p>
144 pub fn get_document(&self) -> &::std::option::Option<crate::types::Document> {
145 self.inner.get_document()
146 }
147}