aws_sdk_lexruntimev2/operation/get_session/
_get_session_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, ::std::fmt::Debug)]
5pub struct GetSessionOutput {
6    /// <p>The identifier of the returned session.</p>
7    pub session_id: ::std::option::Option<::std::string::String>,
8    /// <p>A list of messages that were last sent to the user. The messages are ordered based on the order that your returned the messages from your Lambda function or the order that messages are defined in the bot.</p>
9    pub messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
10    /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
11    /// <p>Each interpretation includes the intent, a score that indicates how confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
12    pub interpretations: ::std::option::Option<::std::vec::Vec<crate::types::Interpretation>>,
13    /// <p>Represents the current state of the dialog between the user and the bot.</p>
14    /// <p>You can use this to determine the progress of the conversation and what the next action might be.</p>
15    pub session_state: ::std::option::Option<crate::types::SessionState>,
16    _request_id: Option<String>,
17}
18impl GetSessionOutput {
19    /// <p>The identifier of the returned session.</p>
20    pub fn session_id(&self) -> ::std::option::Option<&str> {
21        self.session_id.as_deref()
22    }
23    /// <p>A list of messages that were last sent to the user. The messages are ordered based on the order that your returned the messages from your Lambda function or the order that messages are defined in the bot.</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 `.messages.is_none()`.
26    pub fn messages(&self) -> &[crate::types::Message] {
27        self.messages.as_deref().unwrap_or_default()
28    }
29    /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
30    /// <p>Each interpretation includes the intent, a score that indicates how confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
31    ///
32    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.interpretations.is_none()`.
33    pub fn interpretations(&self) -> &[crate::types::Interpretation] {
34        self.interpretations.as_deref().unwrap_or_default()
35    }
36    /// <p>Represents the current state of the dialog between the user and the bot.</p>
37    /// <p>You can use this to determine the progress of the conversation and what the next action might be.</p>
38    pub fn session_state(&self) -> ::std::option::Option<&crate::types::SessionState> {
39        self.session_state.as_ref()
40    }
41}
42impl ::aws_types::request_id::RequestId for GetSessionOutput {
43    fn request_id(&self) -> Option<&str> {
44        self._request_id.as_deref()
45    }
46}
47impl GetSessionOutput {
48    /// Creates a new builder-style object to manufacture [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
49    pub fn builder() -> crate::operation::get_session::builders::GetSessionOutputBuilder {
50        crate::operation::get_session::builders::GetSessionOutputBuilder::default()
51    }
52}
53
54/// A builder for [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct GetSessionOutputBuilder {
58    pub(crate) session_id: ::std::option::Option<::std::string::String>,
59    pub(crate) messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
60    pub(crate) interpretations: ::std::option::Option<::std::vec::Vec<crate::types::Interpretation>>,
61    pub(crate) session_state: ::std::option::Option<crate::types::SessionState>,
62    _request_id: Option<String>,
63}
64impl GetSessionOutputBuilder {
65    /// <p>The identifier of the returned session.</p>
66    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67        self.session_id = ::std::option::Option::Some(input.into());
68        self
69    }
70    /// <p>The identifier of the returned session.</p>
71    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72        self.session_id = input;
73        self
74    }
75    /// <p>The identifier of the returned session.</p>
76    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
77        &self.session_id
78    }
79    /// Appends an item to `messages`.
80    ///
81    /// To override the contents of this collection use [`set_messages`](Self::set_messages).
82    ///
83    /// <p>A list of messages that were last sent to the user. The messages are ordered based on the order that your returned the messages from your Lambda function or the order that messages are defined in the bot.</p>
84    pub fn messages(mut self, input: crate::types::Message) -> Self {
85        let mut v = self.messages.unwrap_or_default();
86        v.push(input);
87        self.messages = ::std::option::Option::Some(v);
88        self
89    }
90    /// <p>A list of messages that were last sent to the user. The messages are ordered based on the order that your returned the messages from your Lambda function or the order that messages are defined in the bot.</p>
91    pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
92        self.messages = input;
93        self
94    }
95    /// <p>A list of messages that were last sent to the user. The messages are ordered based on the order that your returned the messages from your Lambda function or the order that messages are defined in the bot.</p>
96    pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
97        &self.messages
98    }
99    /// Appends an item to `interpretations`.
100    ///
101    /// To override the contents of this collection use [`set_interpretations`](Self::set_interpretations).
102    ///
103    /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
104    /// <p>Each interpretation includes the intent, a score that indicates how confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
105    pub fn interpretations(mut self, input: crate::types::Interpretation) -> Self {
106        let mut v = self.interpretations.unwrap_or_default();
107        v.push(input);
108        self.interpretations = ::std::option::Option::Some(v);
109        self
110    }
111    /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
112    /// <p>Each interpretation includes the intent, a score that indicates how confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
113    pub fn set_interpretations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Interpretation>>) -> Self {
114        self.interpretations = input;
115        self
116    }
117    /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
118    /// <p>Each interpretation includes the intent, a score that indicates how confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
119    pub fn get_interpretations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Interpretation>> {
120        &self.interpretations
121    }
122    /// <p>Represents the current state of the dialog between the user and the bot.</p>
123    /// <p>You can use this to determine the progress of the conversation and what the next action might be.</p>
124    pub fn session_state(mut self, input: crate::types::SessionState) -> Self {
125        self.session_state = ::std::option::Option::Some(input);
126        self
127    }
128    /// <p>Represents the current state of the dialog between the user and the bot.</p>
129    /// <p>You can use this to determine the progress of the conversation and what the next action might be.</p>
130    pub fn set_session_state(mut self, input: ::std::option::Option<crate::types::SessionState>) -> Self {
131        self.session_state = input;
132        self
133    }
134    /// <p>Represents the current state of the dialog between the user and the bot.</p>
135    /// <p>You can use this to determine the progress of the conversation and what the next action might be.</p>
136    pub fn get_session_state(&self) -> &::std::option::Option<crate::types::SessionState> {
137        &self.session_state
138    }
139    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
140        self._request_id = Some(request_id.into());
141        self
142    }
143
144    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
145        self._request_id = request_id;
146        self
147    }
148    /// Consumes the builder and constructs a [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
149    pub fn build(self) -> crate::operation::get_session::GetSessionOutput {
150        crate::operation::get_session::GetSessionOutput {
151            session_id: self.session_id,
152            messages: self.messages,
153            interpretations: self.interpretations,
154            session_state: self.session_state,
155            _request_id: self._request_id,
156        }
157    }
158}