aws_sdk_rekognition/operation/detect_text/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::detect_text::_detect_text_output::DetectTextOutputBuilder;
3
4pub use crate::operation::detect_text::_detect_text_input::DetectTextInputBuilder;
5
6impl crate::operation::detect_text::builders::DetectTextInputBuilder {
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::detect_text::DetectTextOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::detect_text::DetectTextError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.detect_text();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `DetectText`.
24///
25/// <p>Detects text in the input image and converts it into machine-readable text.</p>
26/// <p>Pass the input image as base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition operations, you must pass it as a reference to an image in an Amazon S3 bucket. For the AWS CLI, passing image bytes is not supported. The image must be either a .png or .jpeg formatted file.</p>
27/// <p>The <code>DetectText</code> operation returns text in an array of <code>TextDetection</code> elements, <code>TextDetections</code>. Each <code>TextDetection</code> element provides information about a single word or line of text that was detected in the image.</p>
28/// <p>A word is one or more script characters that are not separated by spaces. <code>DetectText</code> can detect up to 100 words in an image.</p>
29/// <p>A line is a string of equally spaced words. A line isn't necessarily a complete sentence. For example, a driver's license number is detected as a line. A line ends when there is no aligned text after it. Also, a line ends when there is a large gap between words, relative to the length of the words. This means, depending on the gap between words, Amazon Rekognition may detect multiple lines in text aligned in the same direction. Periods don't represent the end of a line. If a sentence spans multiple lines, the <code>DetectText</code> operation returns multiple lines.</p>
30/// <p>To determine whether a <code>TextDetection</code> element is a line of text or a word, use the <code>TextDetection</code> object <code>Type</code> field.</p>
31/// <p>To be detected, text must be within +/- 90 degrees orientation of the horizontal axis.</p>
32/// <p>For more information, see Detecting text in the Amazon Rekognition Developer Guide.</p>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct DetectTextFluentBuilder {
35    handle: ::std::sync::Arc<crate::client::Handle>,
36    inner: crate::operation::detect_text::builders::DetectTextInputBuilder,
37    config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40    crate::client::customize::internal::CustomizableSend<
41        crate::operation::detect_text::DetectTextOutput,
42        crate::operation::detect_text::DetectTextError,
43    > for DetectTextFluentBuilder
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::detect_text::DetectTextOutput,
51            crate::operation::detect_text::DetectTextError,
52        >,
53    > {
54        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55    }
56}
57impl DetectTextFluentBuilder {
58    /// Creates a new `DetectTextFluentBuilder`.
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 DetectText as a reference.
67    pub fn as_input(&self) -> &crate::operation::detect_text::builders::DetectTextInputBuilder {
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::detect_text::DetectTextOutput,
82        ::aws_smithy_runtime_api::client::result::SdkError<
83            crate::operation::detect_text::DetectTextError,
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::detect_text::DetectText::operation_runtime_plugins(
92            self.handle.runtime_plugins.clone(),
93            &self.handle.conf,
94            self.config_override,
95        );
96        crate::operation::detect_text::DetectText::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::detect_text::DetectTextOutput,
104        crate::operation::detect_text::DetectTextError,
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 image as base64-encoded bytes or an Amazon S3 object. If you use the AWS CLI to call Amazon Rekognition operations, you can't pass image bytes.</p>
119    /// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
120    pub fn image(mut self, input: crate::types::Image) -> Self {
121        self.inner = self.inner.image(input);
122        self
123    }
124    /// <p>The input image as base64-encoded bytes or an Amazon S3 object. If you use the AWS CLI to call Amazon Rekognition operations, you can't pass image bytes.</p>
125    /// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
126    pub fn set_image(mut self, input: ::std::option::Option<crate::types::Image>) -> Self {
127        self.inner = self.inner.set_image(input);
128        self
129    }
130    /// <p>The input image as base64-encoded bytes or an Amazon S3 object. If you use the AWS CLI to call Amazon Rekognition operations, you can't pass image bytes.</p>
131    /// <p>If you are using an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image bytes passed using the <code>Bytes</code> field. For more information, see Images in the Amazon Rekognition developer guide.</p>
132    pub fn get_image(&self) -> &::std::option::Option<crate::types::Image> {
133        self.inner.get_image()
134    }
135    /// <p>Optional parameters that let you set the criteria that the text must meet to be included in your response.</p>
136    pub fn filters(mut self, input: crate::types::DetectTextFilters) -> Self {
137        self.inner = self.inner.filters(input);
138        self
139    }
140    /// <p>Optional parameters that let you set the criteria that the text must meet to be included in your response.</p>
141    pub fn set_filters(mut self, input: ::std::option::Option<crate::types::DetectTextFilters>) -> Self {
142        self.inner = self.inner.set_filters(input);
143        self
144    }
145    /// <p>Optional parameters that let you set the criteria that the text must meet to be included in your response.</p>
146    pub fn get_filters(&self) -> &::std::option::Option<crate::types::DetectTextFilters> {
147        self.inner.get_filters()
148    }
149}