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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A collection of messages that convey information to the user. At runtime, Amazon Lex selects the message to convey.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Statement {
/// <p>A collection of message objects.</p>
pub messages: ::std::vec::Vec<crate::types::Message>,
/// <p>At runtime, if the client is using the <a href="http://docs.aws.amazon.com/lex/latest/dg/API_runtime_PostText.html">PostText</a> API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.</p>
pub response_card: ::std::option::Option<::std::string::String>,
}
impl Statement {
/// <p>A collection of message objects.</p>
pub fn messages(&self) -> &[crate::types::Message] {
use std::ops::Deref;
self.messages.deref()
}
/// <p>At runtime, if the client is using the <a href="http://docs.aws.amazon.com/lex/latest/dg/API_runtime_PostText.html">PostText</a> API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.</p>
pub fn response_card(&self) -> ::std::option::Option<&str> {
self.response_card.as_deref()
}
}
impl Statement {
/// Creates a new builder-style object to manufacture [`Statement`](crate::types::Statement).
pub fn builder() -> crate::types::builders::StatementBuilder {
crate::types::builders::StatementBuilder::default()
}
}
/// A builder for [`Statement`](crate::types::Statement).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct StatementBuilder {
pub(crate) messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
pub(crate) response_card: ::std::option::Option<::std::string::String>,
}
impl StatementBuilder {
/// Appends an item to `messages`.
///
/// To override the contents of this collection use [`set_messages`](Self::set_messages).
///
/// <p>A collection of message objects.</p>
pub fn messages(mut self, input: crate::types::Message) -> Self {
let mut v = self.messages.unwrap_or_default();
v.push(input);
self.messages = ::std::option::Option::Some(v);
self
}
/// <p>A collection of message objects.</p>
pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
self.messages = input;
self
}
/// <p>A collection of message objects.</p>
pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
&self.messages
}
/// <p>At runtime, if the client is using the <a href="http://docs.aws.amazon.com/lex/latest/dg/API_runtime_PostText.html">PostText</a> API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.</p>
pub fn response_card(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.response_card = ::std::option::Option::Some(input.into());
self
}
/// <p>At runtime, if the client is using the <a href="http://docs.aws.amazon.com/lex/latest/dg/API_runtime_PostText.html">PostText</a> API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.</p>
pub fn set_response_card(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.response_card = input;
self
}
/// <p>At runtime, if the client is using the <a href="http://docs.aws.amazon.com/lex/latest/dg/API_runtime_PostText.html">PostText</a> API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.</p>
pub fn get_response_card(&self) -> &::std::option::Option<::std::string::String> {
&self.response_card
}
/// Consumes the builder and constructs a [`Statement`](crate::types::Statement).
/// This method will fail if any of the following fields are not set:
/// - [`messages`](crate::types::builders::StatementBuilder::messages)
pub fn build(self) -> ::std::result::Result<crate::types::Statement, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Statement {
messages: self.messages.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"messages",
"messages was not specified but it is required when building Statement",
)
})?,
response_card: self.response_card,
})
}
}