aws-sdk-textract 1.28.0

AWS SDK for Amazon Textract
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Used to contain the information detected by an AnalyzeID operation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct AnalyzeIdDetections {
    /// <p>Text of either the normalized field or value associated with it.</p>
    pub text: ::std::string::String,
    /// <p>Only returned for dates, returns the type of value detected and the date written in a more machine readable way.</p>
    pub normalized_value: ::std::option::Option<crate::types::NormalizedValue>,
    /// <p>The confidence score of the detected text.</p>
    pub confidence: ::std::option::Option<f32>,
}
impl AnalyzeIdDetections {
    /// <p>Text of either the normalized field or value associated with it.</p>
    pub fn text(&self) -> &str {
        use std::ops::Deref;
        self.text.deref()
    }
    /// <p>Only returned for dates, returns the type of value detected and the date written in a more machine readable way.</p>
    pub fn normalized_value(&self) -> ::std::option::Option<&crate::types::NormalizedValue> {
        self.normalized_value.as_ref()
    }
    /// <p>The confidence score of the detected text.</p>
    pub fn confidence(&self) -> ::std::option::Option<f32> {
        self.confidence
    }
}
impl AnalyzeIdDetections {
    /// Creates a new builder-style object to manufacture [`AnalyzeIdDetections`](crate::types::AnalyzeIdDetections).
    pub fn builder() -> crate::types::builders::AnalyzeIdDetectionsBuilder {
        crate::types::builders::AnalyzeIdDetectionsBuilder::default()
    }
}

/// A builder for [`AnalyzeIdDetections`](crate::types::AnalyzeIdDetections).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct AnalyzeIdDetectionsBuilder {
    pub(crate) text: ::std::option::Option<::std::string::String>,
    pub(crate) normalized_value: ::std::option::Option<crate::types::NormalizedValue>,
    pub(crate) confidence: ::std::option::Option<f32>,
}
impl AnalyzeIdDetectionsBuilder {
    /// <p>Text of either the normalized field or value associated with it.</p>
    /// This field is required.
    pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.text = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Text of either the normalized field or value associated with it.</p>
    pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.text = input;
        self
    }
    /// <p>Text of either the normalized field or value associated with it.</p>
    pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
        &self.text
    }
    /// <p>Only returned for dates, returns the type of value detected and the date written in a more machine readable way.</p>
    pub fn normalized_value(mut self, input: crate::types::NormalizedValue) -> Self {
        self.normalized_value = ::std::option::Option::Some(input);
        self
    }
    /// <p>Only returned for dates, returns the type of value detected and the date written in a more machine readable way.</p>
    pub fn set_normalized_value(mut self, input: ::std::option::Option<crate::types::NormalizedValue>) -> Self {
        self.normalized_value = input;
        self
    }
    /// <p>Only returned for dates, returns the type of value detected and the date written in a more machine readable way.</p>
    pub fn get_normalized_value(&self) -> &::std::option::Option<crate::types::NormalizedValue> {
        &self.normalized_value
    }
    /// <p>The confidence score of the detected text.</p>
    pub fn confidence(mut self, input: f32) -> Self {
        self.confidence = ::std::option::Option::Some(input);
        self
    }
    /// <p>The confidence score of the detected text.</p>
    pub fn set_confidence(mut self, input: ::std::option::Option<f32>) -> Self {
        self.confidence = input;
        self
    }
    /// <p>The confidence score of the detected text.</p>
    pub fn get_confidence(&self) -> &::std::option::Option<f32> {
        &self.confidence
    }
    /// Consumes the builder and constructs a [`AnalyzeIdDetections`](crate::types::AnalyzeIdDetections).
    /// This method will fail if any of the following fields are not set:
    /// - [`text`](crate::types::builders::AnalyzeIdDetectionsBuilder::text)
    pub fn build(self) -> ::std::result::Result<crate::types::AnalyzeIdDetections, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::AnalyzeIdDetections {
            text: self.text.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "text",
                    "text was not specified but it is required when building AnalyzeIdDetections",
                )
            })?,
            normalized_value: self.normalized_value,
            confidence: self.confidence,
        })
    }
}