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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Each query contains the question you want to ask in the Text and the alias you want to associate.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Query {
/// <p>Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"</p>
pub text: ::std::string::String,
/// <p>Alias attached to the query, for ease of location.</p>
pub alias: ::std::option::Option<::std::string::String>,
/// <p>Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>\["1"\]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>\[“1-3”, “1-1”, “4-*”\]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
pub pages: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl Query {
/// <p>Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"</p>
pub fn text(&self) -> &str {
use std::ops::Deref;
self.text.deref()
}
/// <p>Alias attached to the query, for ease of location.</p>
pub fn alias(&self) -> ::std::option::Option<&str> {
self.alias.as_deref()
}
/// <p>Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>\["1"\]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>\[“1-3”, “1-1”, “4-*”\]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.pages.is_none()`.
pub fn pages(&self) -> &[::std::string::String] {
self.pages.as_deref().unwrap_or_default()
}
}
impl Query {
/// Creates a new builder-style object to manufacture [`Query`](crate::types::Query).
pub fn builder() -> crate::types::builders::QueryBuilder {
crate::types::builders::QueryBuilder::default()
}
}
/// A builder for [`Query`](crate::types::Query).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct QueryBuilder {
pub(crate) text: ::std::option::Option<::std::string::String>,
pub(crate) alias: ::std::option::Option<::std::string::String>,
pub(crate) pages: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl QueryBuilder {
/// <p>Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"</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>Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"</p>
pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.text = input;
self
}
/// <p>Question that Amazon Textract will apply to the document. An example would be "What is the customer's SSN?"</p>
pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
&self.text
}
/// <p>Alias attached to the query, for ease of location.</p>
pub fn alias(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.alias = ::std::option::Option::Some(input.into());
self
}
/// <p>Alias attached to the query, for ease of location.</p>
pub fn set_alias(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.alias = input;
self
}
/// <p>Alias attached to the query, for ease of location.</p>
pub fn get_alias(&self) -> &::std::option::Option<::std::string::String> {
&self.alias
}
/// Appends an item to `pages`.
///
/// To override the contents of this collection use [`set_pages`](Self::set_pages).
///
/// <p>Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>\["1"\]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>\[“1-3”, “1-1”, “4-*”\]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
pub fn pages(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.pages.unwrap_or_default();
v.push(input.into());
self.pages = ::std::option::Option::Some(v);
self
}
/// <p>Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>\["1"\]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>\[“1-3”, “1-1”, “4-*”\]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
pub fn set_pages(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.pages = input;
self
}
/// <p>Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>\["1"\]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>\[“1-3”, “1-1”, “4-*”\]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
pub fn get_pages(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.pages
}
/// Consumes the builder and constructs a [`Query`](crate::types::Query).
/// This method will fail if any of the following fields are not set:
/// - [`text`](crate::types::builders::QueryBuilder::text)
pub fn build(self) -> ::std::result::Result<crate::types::Query, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Query {
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 Query",
)
})?,
alias: self.alias,
pages: self.pages,
})
}
}