aws_sdk_qbusiness/operation/chat/
_chat_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::fmt::Debug)]
5pub struct ChatOutput {
6    /// <p>The streaming output for the <code>Chat</code> API.</p>
7    pub output_stream: crate::event_receiver::EventReceiver<crate::types::ChatOutputStream, crate::types::error::ChatOutputStreamError>,
8    _request_id: Option<String>,
9}
10impl ChatOutput {
11    /// <p>The streaming output for the <code>Chat</code> API.</p>
12    pub fn output_stream(&self) -> &crate::event_receiver::EventReceiver<crate::types::ChatOutputStream, crate::types::error::ChatOutputStreamError> {
13        &self.output_stream
14    }
15}
16impl ::aws_types::request_id::RequestId for ChatOutput {
17    fn request_id(&self) -> Option<&str> {
18        self._request_id.as_deref()
19    }
20}
21impl ChatOutput {
22    /// Creates a new builder-style object to manufacture [`ChatOutput`](crate::operation::chat::ChatOutput).
23    pub fn builder() -> crate::operation::chat::builders::ChatOutputBuilder {
24        crate::operation::chat::builders::ChatOutputBuilder::default()
25    }
26}
27
28/// A builder for [`ChatOutput`](crate::operation::chat::ChatOutput).
29#[derive(::std::default::Default, ::std::fmt::Debug)]
30#[non_exhaustive]
31pub struct ChatOutputBuilder {
32    pub(crate) output_stream:
33        ::std::option::Option<crate::event_receiver::EventReceiver<crate::types::ChatOutputStream, crate::types::error::ChatOutputStreamError>>,
34    _request_id: Option<String>,
35}
36impl ChatOutputBuilder {
37    /// <p>The streaming output for the <code>Chat</code> API.</p>
38    pub fn output_stream(
39        mut self,
40        input: crate::event_receiver::EventReceiver<crate::types::ChatOutputStream, crate::types::error::ChatOutputStreamError>,
41    ) -> Self {
42        self.output_stream = ::std::option::Option::Some(input);
43        self
44    }
45    /// <p>The streaming output for the <code>Chat</code> API.</p>
46    pub fn set_output_stream(
47        mut self,
48        input: ::std::option::Option<
49            crate::event_receiver::EventReceiver<crate::types::ChatOutputStream, crate::types::error::ChatOutputStreamError>,
50        >,
51    ) -> Self {
52        self.output_stream = input;
53        self
54    }
55    /// <p>The streaming output for the <code>Chat</code> API.</p>
56    pub fn get_output_stream(
57        &self,
58    ) -> &::std::option::Option<crate::event_receiver::EventReceiver<crate::types::ChatOutputStream, crate::types::error::ChatOutputStreamError>>
59    {
60        &self.output_stream
61    }
62    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
63        self._request_id = Some(request_id.into());
64        self
65    }
66
67    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
68        self._request_id = request_id;
69        self
70    }
71    /// Consumes the builder and constructs a [`ChatOutput`](crate::operation::chat::ChatOutput).
72    /// This method will fail if any of the following fields are not set:
73    /// - [`output_stream`](crate::operation::chat::builders::ChatOutputBuilder::output_stream)
74    pub fn build(self) -> ::std::result::Result<crate::operation::chat::ChatOutput, ::aws_smithy_types::error::operation::BuildError> {
75        ::std::result::Result::Ok(crate::operation::chat::ChatOutput {
76            output_stream: self.output_stream.ok_or_else(|| {
77                ::aws_smithy_types::error::operation::BuildError::missing_field(
78                    "output_stream",
79                    "output_stream was not specified but it is required when building ChatOutput",
80                )
81            })?,
82            _request_id: self._request_id,
83        })
84    }
85}