aws_sdk_lexruntime/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)]
5pub struct GetSessionOutput {
6    /// <p>An array of information about the intents used in the session. The array can contain a maximum of three summaries. If more than three intents are used in the session, the <code>recentIntentSummaryView</code> operation contains information about the last three intents used.</p>
7    /// <p>If you set the <code>checkpointLabelFilter</code> parameter in the request, the array contains only the intents with the specified label.</p>
8    pub recent_intent_summary_view: ::std::option::Option<::std::vec::Vec<crate::types::IntentSummary>>,
9    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
10    pub session_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
11    /// <p>A unique identifier for the session.</p>
12    pub session_id: ::std::option::Option<::std::string::String>,
13    /// <p>Describes the current state of the bot.</p>
14    pub dialog_action: ::std::option::Option<crate::types::DialogAction>,
15    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
16    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
17    pub active_contexts: ::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>>,
18    _request_id: Option<String>,
19}
20impl GetSessionOutput {
21    /// <p>An array of information about the intents used in the session. The array can contain a maximum of three summaries. If more than three intents are used in the session, the <code>recentIntentSummaryView</code> operation contains information about the last three intents used.</p>
22    /// <p>If you set the <code>checkpointLabelFilter</code> parameter in the request, the array contains only the intents with the specified label.</p>
23    ///
24    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.recent_intent_summary_view.is_none()`.
25    pub fn recent_intent_summary_view(&self) -> &[crate::types::IntentSummary] {
26        self.recent_intent_summary_view.as_deref().unwrap_or_default()
27    }
28    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
29    pub fn session_attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
30        self.session_attributes.as_ref()
31    }
32    /// <p>A unique identifier for the session.</p>
33    pub fn session_id(&self) -> ::std::option::Option<&str> {
34        self.session_id.as_deref()
35    }
36    /// <p>Describes the current state of the bot.</p>
37    pub fn dialog_action(&self) -> ::std::option::Option<&crate::types::DialogAction> {
38        self.dialog_action.as_ref()
39    }
40    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
41    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</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 `.active_contexts.is_none()`.
44    pub fn active_contexts(&self) -> &[crate::types::ActiveContext] {
45        self.active_contexts.as_deref().unwrap_or_default()
46    }
47}
48impl ::std::fmt::Debug for GetSessionOutput {
49    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
50        let mut formatter = f.debug_struct("GetSessionOutput");
51        formatter.field("recent_intent_summary_view", &self.recent_intent_summary_view);
52        formatter.field("session_attributes", &"*** Sensitive Data Redacted ***");
53        formatter.field("session_id", &self.session_id);
54        formatter.field("dialog_action", &self.dialog_action);
55        formatter.field("active_contexts", &"*** Sensitive Data Redacted ***");
56        formatter.field("_request_id", &self._request_id);
57        formatter.finish()
58    }
59}
60impl ::aws_types::request_id::RequestId for GetSessionOutput {
61    fn request_id(&self) -> Option<&str> {
62        self._request_id.as_deref()
63    }
64}
65impl GetSessionOutput {
66    /// Creates a new builder-style object to manufacture [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
67    pub fn builder() -> crate::operation::get_session::builders::GetSessionOutputBuilder {
68        crate::operation::get_session::builders::GetSessionOutputBuilder::default()
69    }
70}
71
72/// A builder for [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
73#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
74#[non_exhaustive]
75pub struct GetSessionOutputBuilder {
76    pub(crate) recent_intent_summary_view: ::std::option::Option<::std::vec::Vec<crate::types::IntentSummary>>,
77    pub(crate) session_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
78    pub(crate) session_id: ::std::option::Option<::std::string::String>,
79    pub(crate) dialog_action: ::std::option::Option<crate::types::DialogAction>,
80    pub(crate) active_contexts: ::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>>,
81    _request_id: Option<String>,
82}
83impl GetSessionOutputBuilder {
84    /// Appends an item to `recent_intent_summary_view`.
85    ///
86    /// To override the contents of this collection use [`set_recent_intent_summary_view`](Self::set_recent_intent_summary_view).
87    ///
88    /// <p>An array of information about the intents used in the session. The array can contain a maximum of three summaries. If more than three intents are used in the session, the <code>recentIntentSummaryView</code> operation contains information about the last three intents used.</p>
89    /// <p>If you set the <code>checkpointLabelFilter</code> parameter in the request, the array contains only the intents with the specified label.</p>
90    pub fn recent_intent_summary_view(mut self, input: crate::types::IntentSummary) -> Self {
91        let mut v = self.recent_intent_summary_view.unwrap_or_default();
92        v.push(input);
93        self.recent_intent_summary_view = ::std::option::Option::Some(v);
94        self
95    }
96    /// <p>An array of information about the intents used in the session. The array can contain a maximum of three summaries. If more than three intents are used in the session, the <code>recentIntentSummaryView</code> operation contains information about the last three intents used.</p>
97    /// <p>If you set the <code>checkpointLabelFilter</code> parameter in the request, the array contains only the intents with the specified label.</p>
98    pub fn set_recent_intent_summary_view(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::IntentSummary>>) -> Self {
99        self.recent_intent_summary_view = input;
100        self
101    }
102    /// <p>An array of information about the intents used in the session. The array can contain a maximum of three summaries. If more than three intents are used in the session, the <code>recentIntentSummaryView</code> operation contains information about the last three intents used.</p>
103    /// <p>If you set the <code>checkpointLabelFilter</code> parameter in the request, the array contains only the intents with the specified label.</p>
104    pub fn get_recent_intent_summary_view(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::IntentSummary>> {
105        &self.recent_intent_summary_view
106    }
107    /// Adds a key-value pair to `session_attributes`.
108    ///
109    /// To override the contents of this collection use [`set_session_attributes`](Self::set_session_attributes).
110    ///
111    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
112    pub fn session_attributes(
113        mut self,
114        k: impl ::std::convert::Into<::std::string::String>,
115        v: impl ::std::convert::Into<::std::string::String>,
116    ) -> Self {
117        let mut hash_map = self.session_attributes.unwrap_or_default();
118        hash_map.insert(k.into(), v.into());
119        self.session_attributes = ::std::option::Option::Some(hash_map);
120        self
121    }
122    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
123    pub fn set_session_attributes(
124        mut self,
125        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
126    ) -> Self {
127        self.session_attributes = input;
128        self
129    }
130    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
131    pub fn get_session_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
132        &self.session_attributes
133    }
134    /// <p>A unique identifier for the session.</p>
135    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.session_id = ::std::option::Option::Some(input.into());
137        self
138    }
139    /// <p>A unique identifier for the session.</p>
140    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.session_id = input;
142        self
143    }
144    /// <p>A unique identifier for the session.</p>
145    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
146        &self.session_id
147    }
148    /// <p>Describes the current state of the bot.</p>
149    pub fn dialog_action(mut self, input: crate::types::DialogAction) -> Self {
150        self.dialog_action = ::std::option::Option::Some(input);
151        self
152    }
153    /// <p>Describes the current state of the bot.</p>
154    pub fn set_dialog_action(mut self, input: ::std::option::Option<crate::types::DialogAction>) -> Self {
155        self.dialog_action = input;
156        self
157    }
158    /// <p>Describes the current state of the bot.</p>
159    pub fn get_dialog_action(&self) -> &::std::option::Option<crate::types::DialogAction> {
160        &self.dialog_action
161    }
162    /// Appends an item to `active_contexts`.
163    ///
164    /// To override the contents of this collection use [`set_active_contexts`](Self::set_active_contexts).
165    ///
166    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
167    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
168    pub fn active_contexts(mut self, input: crate::types::ActiveContext) -> Self {
169        let mut v = self.active_contexts.unwrap_or_default();
170        v.push(input);
171        self.active_contexts = ::std::option::Option::Some(v);
172        self
173    }
174    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
175    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
176    pub fn set_active_contexts(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>>) -> Self {
177        self.active_contexts = input;
178        self
179    }
180    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
181    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
182    pub fn get_active_contexts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>> {
183        &self.active_contexts
184    }
185    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
186        self._request_id = Some(request_id.into());
187        self
188    }
189
190    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
191        self._request_id = request_id;
192        self
193    }
194    /// Consumes the builder and constructs a [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
195    pub fn build(self) -> crate::operation::get_session::GetSessionOutput {
196        crate::operation::get_session::GetSessionOutput {
197            recent_intent_summary_view: self.recent_intent_summary_view,
198            session_attributes: self.session_attributes,
199            session_id: self.session_id,
200            dialog_action: self.dialog_action,
201            active_contexts: self.active_contexts,
202            _request_id: self._request_id,
203        }
204    }
205}
206impl ::std::fmt::Debug for GetSessionOutputBuilder {
207    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
208        let mut formatter = f.debug_struct("GetSessionOutputBuilder");
209        formatter.field("recent_intent_summary_view", &self.recent_intent_summary_view);
210        formatter.field("session_attributes", &"*** Sensitive Data Redacted ***");
211        formatter.field("session_id", &self.session_id);
212        formatter.field("dialog_action", &self.dialog_action);
213        formatter.field("active_contexts", &"*** Sensitive Data Redacted ***");
214        formatter.field("_request_id", &self._request_id);
215        formatter.finish()
216    }
217}