aws_sdk_comprehend/operation/detect_entities/_detect_entities_output.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct DetectEntitiesOutput {
6 /// <p>A collection of entities identified in the input text. For each entity, the response provides the entity text, entity type, where the entity text begins and ends, and the level of confidence that Amazon Comprehend has in the detection.</p>
7 /// <p>If your request uses a custom entity recognition model, Amazon Comprehend detects the entities that the model is trained to recognize. Otherwise, it detects the default entity types. For a list of default entity types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
8 pub entities: ::std::option::Option<::std::vec::Vec<crate::types::Entity>>,
9 /// <p>Information about the document, discovered during text extraction. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
10 pub document_metadata: ::std::option::Option<crate::types::DocumentMetadata>,
11 /// <p>The document type for each page in the input document. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
12 pub document_type: ::std::option::Option<::std::vec::Vec<crate::types::DocumentTypeListItem>>,
13 /// <p>Information about each block of text in the input document. Blocks are nested. A page block contains a block for each line of text, which contains a block for each word.</p>
14 /// <p>The <code>Block</code> content for a Word input document does not include a <code>Geometry</code> field.</p>
15 /// <p>The <code>Block</code> field is not present in the response for plain-text inputs.</p>
16 pub blocks: ::std::option::Option<::std::vec::Vec<crate::types::Block>>,
17 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
18 pub errors: ::std::option::Option<::std::vec::Vec<crate::types::ErrorsListItem>>,
19 _request_id: Option<String>,
20}
21impl DetectEntitiesOutput {
22 /// <p>A collection of entities identified in the input text. For each entity, the response provides the entity text, entity type, where the entity text begins and ends, and the level of confidence that Amazon Comprehend has in the detection.</p>
23 /// <p>If your request uses a custom entity recognition model, Amazon Comprehend detects the entities that the model is trained to recognize. Otherwise, it detects the default entity types. For a list of default entity types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
24 ///
25 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.entities.is_none()`.
26 pub fn entities(&self) -> &[crate::types::Entity] {
27 self.entities.as_deref().unwrap_or_default()
28 }
29 /// <p>Information about the document, discovered during text extraction. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
30 pub fn document_metadata(&self) -> ::std::option::Option<&crate::types::DocumentMetadata> {
31 self.document_metadata.as_ref()
32 }
33 /// <p>The document type for each page in the input document. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
34 ///
35 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.document_type.is_none()`.
36 pub fn document_type(&self) -> &[crate::types::DocumentTypeListItem] {
37 self.document_type.as_deref().unwrap_or_default()
38 }
39 /// <p>Information about each block of text in the input document. Blocks are nested. A page block contains a block for each line of text, which contains a block for each word.</p>
40 /// <p>The <code>Block</code> content for a Word input document does not include a <code>Geometry</code> field.</p>
41 /// <p>The <code>Block</code> field is not present in the response for plain-text inputs.</p>
42 ///
43 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.blocks.is_none()`.
44 pub fn blocks(&self) -> &[crate::types::Block] {
45 self.blocks.as_deref().unwrap_or_default()
46 }
47 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
48 ///
49 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.errors.is_none()`.
50 pub fn errors(&self) -> &[crate::types::ErrorsListItem] {
51 self.errors.as_deref().unwrap_or_default()
52 }
53}
54impl ::std::fmt::Debug for DetectEntitiesOutput {
55 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
56 let mut formatter = f.debug_struct("DetectEntitiesOutput");
57 formatter.field("entities", &"*** Sensitive Data Redacted ***");
58 formatter.field("document_metadata", &"*** Sensitive Data Redacted ***");
59 formatter.field("document_type", &"*** Sensitive Data Redacted ***");
60 formatter.field("blocks", &"*** Sensitive Data Redacted ***");
61 formatter.field("errors", &"*** Sensitive Data Redacted ***");
62 formatter.field("_request_id", &self._request_id);
63 formatter.finish()
64 }
65}
66impl ::aws_types::request_id::RequestId for DetectEntitiesOutput {
67 fn request_id(&self) -> Option<&str> {
68 self._request_id.as_deref()
69 }
70}
71impl DetectEntitiesOutput {
72 /// Creates a new builder-style object to manufacture [`DetectEntitiesOutput`](crate::operation::detect_entities::DetectEntitiesOutput).
73 pub fn builder() -> crate::operation::detect_entities::builders::DetectEntitiesOutputBuilder {
74 crate::operation::detect_entities::builders::DetectEntitiesOutputBuilder::default()
75 }
76}
77
78/// A builder for [`DetectEntitiesOutput`](crate::operation::detect_entities::DetectEntitiesOutput).
79#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
80#[non_exhaustive]
81pub struct DetectEntitiesOutputBuilder {
82 pub(crate) entities: ::std::option::Option<::std::vec::Vec<crate::types::Entity>>,
83 pub(crate) document_metadata: ::std::option::Option<crate::types::DocumentMetadata>,
84 pub(crate) document_type: ::std::option::Option<::std::vec::Vec<crate::types::DocumentTypeListItem>>,
85 pub(crate) blocks: ::std::option::Option<::std::vec::Vec<crate::types::Block>>,
86 pub(crate) errors: ::std::option::Option<::std::vec::Vec<crate::types::ErrorsListItem>>,
87 _request_id: Option<String>,
88}
89impl DetectEntitiesOutputBuilder {
90 /// Appends an item to `entities`.
91 ///
92 /// To override the contents of this collection use [`set_entities`](Self::set_entities).
93 ///
94 /// <p>A collection of entities identified in the input text. For each entity, the response provides the entity text, entity type, where the entity text begins and ends, and the level of confidence that Amazon Comprehend has in the detection.</p>
95 /// <p>If your request uses a custom entity recognition model, Amazon Comprehend detects the entities that the model is trained to recognize. Otherwise, it detects the default entity types. For a list of default entity types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
96 pub fn entities(mut self, input: crate::types::Entity) -> Self {
97 let mut v = self.entities.unwrap_or_default();
98 v.push(input);
99 self.entities = ::std::option::Option::Some(v);
100 self
101 }
102 /// <p>A collection of entities identified in the input text. For each entity, the response provides the entity text, entity type, where the entity text begins and ends, and the level of confidence that Amazon Comprehend has in the detection.</p>
103 /// <p>If your request uses a custom entity recognition model, Amazon Comprehend detects the entities that the model is trained to recognize. Otherwise, it detects the default entity types. For a list of default entity types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
104 pub fn set_entities(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Entity>>) -> Self {
105 self.entities = input;
106 self
107 }
108 /// <p>A collection of entities identified in the input text. For each entity, the response provides the entity text, entity type, where the entity text begins and ends, and the level of confidence that Amazon Comprehend has in the detection.</p>
109 /// <p>If your request uses a custom entity recognition model, Amazon Comprehend detects the entities that the model is trained to recognize. Otherwise, it detects the default entity types. For a list of default entity types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html">Entities</a> in the Comprehend Developer Guide.</p>
110 pub fn get_entities(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Entity>> {
111 &self.entities
112 }
113 /// <p>Information about the document, discovered during text extraction. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
114 pub fn document_metadata(mut self, input: crate::types::DocumentMetadata) -> Self {
115 self.document_metadata = ::std::option::Option::Some(input);
116 self
117 }
118 /// <p>Information about the document, discovered during text extraction. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
119 pub fn set_document_metadata(mut self, input: ::std::option::Option<crate::types::DocumentMetadata>) -> Self {
120 self.document_metadata = input;
121 self
122 }
123 /// <p>Information about the document, discovered during text extraction. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
124 pub fn get_document_metadata(&self) -> &::std::option::Option<crate::types::DocumentMetadata> {
125 &self.document_metadata
126 }
127 /// Appends an item to `document_type`.
128 ///
129 /// To override the contents of this collection use [`set_document_type`](Self::set_document_type).
130 ///
131 /// <p>The document type for each page in the input document. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
132 pub fn document_type(mut self, input: crate::types::DocumentTypeListItem) -> Self {
133 let mut v = self.document_type.unwrap_or_default();
134 v.push(input);
135 self.document_type = ::std::option::Option::Some(v);
136 self
137 }
138 /// <p>The document type for each page in the input document. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
139 pub fn set_document_type(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DocumentTypeListItem>>) -> Self {
140 self.document_type = input;
141 self
142 }
143 /// <p>The document type for each page in the input document. This field is present in the response only if your request used the <code>Byte</code> parameter.</p>
144 pub fn get_document_type(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DocumentTypeListItem>> {
145 &self.document_type
146 }
147 /// Appends an item to `blocks`.
148 ///
149 /// To override the contents of this collection use [`set_blocks`](Self::set_blocks).
150 ///
151 /// <p>Information about each block of text in the input document. Blocks are nested. A page block contains a block for each line of text, which contains a block for each word.</p>
152 /// <p>The <code>Block</code> content for a Word input document does not include a <code>Geometry</code> field.</p>
153 /// <p>The <code>Block</code> field is not present in the response for plain-text inputs.</p>
154 pub fn blocks(mut self, input: crate::types::Block) -> Self {
155 let mut v = self.blocks.unwrap_or_default();
156 v.push(input);
157 self.blocks = ::std::option::Option::Some(v);
158 self
159 }
160 /// <p>Information about each block of text in the input document. Blocks are nested. A page block contains a block for each line of text, which contains a block for each word.</p>
161 /// <p>The <code>Block</code> content for a Word input document does not include a <code>Geometry</code> field.</p>
162 /// <p>The <code>Block</code> field is not present in the response for plain-text inputs.</p>
163 pub fn set_blocks(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Block>>) -> Self {
164 self.blocks = input;
165 self
166 }
167 /// <p>Information about each block of text in the input document. Blocks are nested. A page block contains a block for each line of text, which contains a block for each word.</p>
168 /// <p>The <code>Block</code> content for a Word input document does not include a <code>Geometry</code> field.</p>
169 /// <p>The <code>Block</code> field is not present in the response for plain-text inputs.</p>
170 pub fn get_blocks(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Block>> {
171 &self.blocks
172 }
173 /// Appends an item to `errors`.
174 ///
175 /// To override the contents of this collection use [`set_errors`](Self::set_errors).
176 ///
177 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
178 pub fn errors(mut self, input: crate::types::ErrorsListItem) -> Self {
179 let mut v = self.errors.unwrap_or_default();
180 v.push(input);
181 self.errors = ::std::option::Option::Some(v);
182 self
183 }
184 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
185 pub fn set_errors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ErrorsListItem>>) -> Self {
186 self.errors = input;
187 self
188 }
189 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
190 pub fn get_errors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ErrorsListItem>> {
191 &self.errors
192 }
193 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
194 self._request_id = Some(request_id.into());
195 self
196 }
197
198 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
199 self._request_id = request_id;
200 self
201 }
202 /// Consumes the builder and constructs a [`DetectEntitiesOutput`](crate::operation::detect_entities::DetectEntitiesOutput).
203 pub fn build(self) -> crate::operation::detect_entities::DetectEntitiesOutput {
204 crate::operation::detect_entities::DetectEntitiesOutput {
205 entities: self.entities,
206 document_metadata: self.document_metadata,
207 document_type: self.document_type,
208 blocks: self.blocks,
209 errors: self.errors,
210 _request_id: self._request_id,
211 }
212 }
213}
214impl ::std::fmt::Debug for DetectEntitiesOutputBuilder {
215 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
216 let mut formatter = f.debug_struct("DetectEntitiesOutputBuilder");
217 formatter.field("entities", &"*** Sensitive Data Redacted ***");
218 formatter.field("document_metadata", &"*** Sensitive Data Redacted ***");
219 formatter.field("document_type", &"*** Sensitive Data Redacted ***");
220 formatter.field("blocks", &"*** Sensitive Data Redacted ***");
221 formatter.field("errors", &"*** Sensitive Data Redacted ***");
222 formatter.field("_request_id", &self._request_id);
223 formatter.finish()
224 }
225}