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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The message object that provides the message text and its type.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Message {
/// <p>The content type of the message string.</p>
pub content_type: crate::types::ContentType,
/// <p>The text of the message.</p>
pub content: ::std::string::String,
/// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
pub group_number: ::std::option::Option<i32>,
}
impl Message {
/// <p>The content type of the message string.</p>
pub fn content_type(&self) -> &crate::types::ContentType {
&self.content_type
}
/// <p>The text of the message.</p>
pub fn content(&self) -> &str {
use std::ops::Deref;
self.content.deref()
}
/// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
pub fn group_number(&self) -> ::std::option::Option<i32> {
self.group_number
}
}
impl Message {
/// Creates a new builder-style object to manufacture [`Message`](crate::types::Message).
pub fn builder() -> crate::types::builders::MessageBuilder {
crate::types::builders::MessageBuilder::default()
}
}
/// A builder for [`Message`](crate::types::Message).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct MessageBuilder {
pub(crate) content_type: ::std::option::Option<crate::types::ContentType>,
pub(crate) content: ::std::option::Option<::std::string::String>,
pub(crate) group_number: ::std::option::Option<i32>,
}
impl MessageBuilder {
/// <p>The content type of the message string.</p>
/// This field is required.
pub fn content_type(mut self, input: crate::types::ContentType) -> Self {
self.content_type = ::std::option::Option::Some(input);
self
}
/// <p>The content type of the message string.</p>
pub fn set_content_type(mut self, input: ::std::option::Option<crate::types::ContentType>) -> Self {
self.content_type = input;
self
}
/// <p>The content type of the message string.</p>
pub fn get_content_type(&self) -> &::std::option::Option<crate::types::ContentType> {
&self.content_type
}
/// <p>The text of the message.</p>
/// This field is required.
pub fn content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.content = ::std::option::Option::Some(input.into());
self
}
/// <p>The text of the message.</p>
pub fn set_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.content = input;
self
}
/// <p>The text of the message.</p>
pub fn get_content(&self) -> &::std::option::Option<::std::string::String> {
&self.content
}
/// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
pub fn group_number(mut self, input: i32) -> Self {
self.group_number = ::std::option::Option::Some(input);
self
}
/// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
pub fn set_group_number(mut self, input: ::std::option::Option<i32>) -> Self {
self.group_number = input;
self
}
/// <p>Identifies the message group that the message belongs to. When a group is assigned to a message, Amazon Lex returns one message from each group in the response.</p>
pub fn get_group_number(&self) -> &::std::option::Option<i32> {
&self.group_number
}
/// Consumes the builder and constructs a [`Message`](crate::types::Message).
/// This method will fail if any of the following fields are not set:
/// - [`content_type`](crate::types::builders::MessageBuilder::content_type)
/// - [`content`](crate::types::builders::MessageBuilder::content)
pub fn build(self) -> ::std::result::Result<crate::types::Message, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Message {
content_type: self.content_type.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"content_type",
"content_type was not specified but it is required when building Message",
)
})?,
content: self.content.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"content",
"content was not specified but it is required when building Message",
)
})?,
group_number: self.group_number,
})
}
}