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
// 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).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
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,
})
}
}