aws_sdk_qbusiness/operation/chat/
_chat_input.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::fmt::Debug)]
5pub struct ChatInput {
6    /// <p>The identifier of the Amazon Q Business application linked to a streaming Amazon Q Business conversation.</p>
7    pub application_id: ::std::option::Option<::std::string::String>,
8    /// <p>The identifier of the user attached to the chat input.</p>
9    pub user_id: ::std::option::Option<::std::string::String>,
10    /// <p>The group names that a user associated with the chat input belongs to.</p>
11    pub user_groups: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12    /// <p>The identifier of the Amazon Q Business conversation.</p>
13    pub conversation_id: ::std::option::Option<::std::string::String>,
14    /// <p>The identifier used to associate a user message with a AI generated response.</p>
15    pub parent_message_id: ::std::option::Option<::std::string::String>,
16    /// <p>A token that you provide to identify the chat input.</p>
17    pub client_token: ::std::option::Option<::std::string::String>,
18    /// <p>The streaming input for the <code>Chat</code> API.</p>
19    pub input_stream: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError>,
20}
21impl ChatInput {
22    /// <p>The identifier of the Amazon Q Business application linked to a streaming Amazon Q Business conversation.</p>
23    pub fn application_id(&self) -> ::std::option::Option<&str> {
24        self.application_id.as_deref()
25    }
26    /// <p>The identifier of the user attached to the chat input.</p>
27    pub fn user_id(&self) -> ::std::option::Option<&str> {
28        self.user_id.as_deref()
29    }
30    /// <p>The group names that a user associated with the chat input belongs to.</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 `.user_groups.is_none()`.
33    pub fn user_groups(&self) -> &[::std::string::String] {
34        self.user_groups.as_deref().unwrap_or_default()
35    }
36    /// <p>The identifier of the Amazon Q Business conversation.</p>
37    pub fn conversation_id(&self) -> ::std::option::Option<&str> {
38        self.conversation_id.as_deref()
39    }
40    /// <p>The identifier used to associate a user message with a AI generated response.</p>
41    pub fn parent_message_id(&self) -> ::std::option::Option<&str> {
42        self.parent_message_id.as_deref()
43    }
44    /// <p>A token that you provide to identify the chat input.</p>
45    pub fn client_token(&self) -> ::std::option::Option<&str> {
46        self.client_token.as_deref()
47    }
48    /// <p>The streaming input for the <code>Chat</code> API.</p>
49    pub fn input_stream(
50        &self,
51    ) -> &::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError> {
52        &self.input_stream
53    }
54}
55impl ChatInput {
56    /// Creates a new builder-style object to manufacture [`ChatInput`](crate::operation::chat::ChatInput).
57    pub fn builder() -> crate::operation::chat::builders::ChatInputBuilder {
58        crate::operation::chat::builders::ChatInputBuilder::default()
59    }
60}
61
62/// A builder for [`ChatInput`](crate::operation::chat::ChatInput).
63#[derive(::std::default::Default, ::std::fmt::Debug)]
64#[non_exhaustive]
65pub struct ChatInputBuilder {
66    pub(crate) application_id: ::std::option::Option<::std::string::String>,
67    pub(crate) user_id: ::std::option::Option<::std::string::String>,
68    pub(crate) user_groups: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
69    pub(crate) conversation_id: ::std::option::Option<::std::string::String>,
70    pub(crate) parent_message_id: ::std::option::Option<::std::string::String>,
71    pub(crate) client_token: ::std::option::Option<::std::string::String>,
72    pub(crate) input_stream: ::std::option::Option<
73        ::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError>,
74    >,
75}
76impl ChatInputBuilder {
77    /// <p>The identifier of the Amazon Q Business application linked to a streaming Amazon Q Business conversation.</p>
78    /// This field is required.
79    pub fn application_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
80        self.application_id = ::std::option::Option::Some(input.into());
81        self
82    }
83    /// <p>The identifier of the Amazon Q Business application linked to a streaming Amazon Q Business conversation.</p>
84    pub fn set_application_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
85        self.application_id = input;
86        self
87    }
88    /// <p>The identifier of the Amazon Q Business application linked to a streaming Amazon Q Business conversation.</p>
89    pub fn get_application_id(&self) -> &::std::option::Option<::std::string::String> {
90        &self.application_id
91    }
92    /// <p>The identifier of the user attached to the chat input.</p>
93    pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
94        self.user_id = ::std::option::Option::Some(input.into());
95        self
96    }
97    /// <p>The identifier of the user attached to the chat input.</p>
98    pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
99        self.user_id = input;
100        self
101    }
102    /// <p>The identifier of the user attached to the chat input.</p>
103    pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
104        &self.user_id
105    }
106    /// Appends an item to `user_groups`.
107    ///
108    /// To override the contents of this collection use [`set_user_groups`](Self::set_user_groups).
109    ///
110    /// <p>The group names that a user associated with the chat input belongs to.</p>
111    pub fn user_groups(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
112        let mut v = self.user_groups.unwrap_or_default();
113        v.push(input.into());
114        self.user_groups = ::std::option::Option::Some(v);
115        self
116    }
117    /// <p>The group names that a user associated with the chat input belongs to.</p>
118    pub fn set_user_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
119        self.user_groups = input;
120        self
121    }
122    /// <p>The group names that a user associated with the chat input belongs to.</p>
123    pub fn get_user_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
124        &self.user_groups
125    }
126    /// <p>The identifier of the Amazon Q Business conversation.</p>
127    pub fn conversation_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.conversation_id = ::std::option::Option::Some(input.into());
129        self
130    }
131    /// <p>The identifier of the Amazon Q Business conversation.</p>
132    pub fn set_conversation_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.conversation_id = input;
134        self
135    }
136    /// <p>The identifier of the Amazon Q Business conversation.</p>
137    pub fn get_conversation_id(&self) -> &::std::option::Option<::std::string::String> {
138        &self.conversation_id
139    }
140    /// <p>The identifier used to associate a user message with a AI generated response.</p>
141    pub fn parent_message_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.parent_message_id = ::std::option::Option::Some(input.into());
143        self
144    }
145    /// <p>The identifier used to associate a user message with a AI generated response.</p>
146    pub fn set_parent_message_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.parent_message_id = input;
148        self
149    }
150    /// <p>The identifier used to associate a user message with a AI generated response.</p>
151    pub fn get_parent_message_id(&self) -> &::std::option::Option<::std::string::String> {
152        &self.parent_message_id
153    }
154    /// <p>A token that you provide to identify the chat input.</p>
155    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.client_token = ::std::option::Option::Some(input.into());
157        self
158    }
159    /// <p>A token that you provide to identify the chat input.</p>
160    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.client_token = input;
162        self
163    }
164    /// <p>A token that you provide to identify the chat input.</p>
165    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
166        &self.client_token
167    }
168    /// <p>The streaming input for the <code>Chat</code> API.</p>
169    pub fn input_stream(
170        mut self,
171        input: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError>,
172    ) -> Self {
173        self.input_stream = ::std::option::Option::Some(input);
174        self
175    }
176    /// <p>The streaming input for the <code>Chat</code> API.</p>
177    pub fn set_input_stream(
178        mut self,
179        input: ::std::option::Option<
180            ::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError>,
181        >,
182    ) -> Self {
183        self.input_stream = input;
184        self
185    }
186    /// <p>The streaming input for the <code>Chat</code> API.</p>
187    pub fn get_input_stream(
188        &self,
189    ) -> &::std::option::Option<
190        ::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError>,
191    > {
192        &self.input_stream
193    }
194    /// Consumes the builder and constructs a [`ChatInput`](crate::operation::chat::ChatInput).
195    /// This method will fail if any of the following fields are not set:
196    /// - [`input_stream`](crate::operation::chat::builders::ChatInputBuilder::input_stream)
197    pub fn build(self) -> ::std::result::Result<crate::operation::chat::ChatInput, ::aws_smithy_types::error::operation::BuildError> {
198        ::std::result::Result::Ok(crate::operation::chat::ChatInput {
199            application_id: self.application_id,
200            user_id: self.user_id,
201            user_groups: self.user_groups,
202            conversation_id: self.conversation_id,
203            parent_message_id: self.parent_message_id,
204            client_token: self.client_token,
205            input_stream: self.input_stream.ok_or_else(|| {
206                ::aws_smithy_types::error::operation::BuildError::missing_field(
207                    "input_stream",
208                    "input_stream was not specified but it is required when building ChatInput",
209                )
210            })?,
211        })
212    }
213}