aws_sdk_qconnect/operation/send_message/
_send_message_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 SendMessageOutput {
6    /// <p>The identifier of the submitted message.</p>
7    pub request_message_id: ::std::string::String,
8    /// <p>The token for the next message, used by GetNextMessage.</p>
9    pub next_message_token: ::std::string::String,
10    _request_id: Option<String>,
11}
12impl SendMessageOutput {
13    /// <p>The identifier of the submitted message.</p>
14    pub fn request_message_id(&self) -> &str {
15        use std::ops::Deref;
16        self.request_message_id.deref()
17    }
18    /// <p>The token for the next message, used by GetNextMessage.</p>
19    pub fn next_message_token(&self) -> &str {
20        use std::ops::Deref;
21        self.next_message_token.deref()
22    }
23}
24impl ::aws_types::request_id::RequestId for SendMessageOutput {
25    fn request_id(&self) -> Option<&str> {
26        self._request_id.as_deref()
27    }
28}
29impl SendMessageOutput {
30    /// Creates a new builder-style object to manufacture [`SendMessageOutput`](crate::operation::send_message::SendMessageOutput).
31    pub fn builder() -> crate::operation::send_message::builders::SendMessageOutputBuilder {
32        crate::operation::send_message::builders::SendMessageOutputBuilder::default()
33    }
34}
35
36/// A builder for [`SendMessageOutput`](crate::operation::send_message::SendMessageOutput).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct SendMessageOutputBuilder {
40    pub(crate) request_message_id: ::std::option::Option<::std::string::String>,
41    pub(crate) next_message_token: ::std::option::Option<::std::string::String>,
42    _request_id: Option<String>,
43}
44impl SendMessageOutputBuilder {
45    /// <p>The identifier of the submitted message.</p>
46    /// This field is required.
47    pub fn request_message_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
48        self.request_message_id = ::std::option::Option::Some(input.into());
49        self
50    }
51    /// <p>The identifier of the submitted message.</p>
52    pub fn set_request_message_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53        self.request_message_id = input;
54        self
55    }
56    /// <p>The identifier of the submitted message.</p>
57    pub fn get_request_message_id(&self) -> &::std::option::Option<::std::string::String> {
58        &self.request_message_id
59    }
60    /// <p>The token for the next message, used by GetNextMessage.</p>
61    /// This field is required.
62    pub fn next_message_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
63        self.next_message_token = ::std::option::Option::Some(input.into());
64        self
65    }
66    /// <p>The token for the next message, used by GetNextMessage.</p>
67    pub fn set_next_message_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
68        self.next_message_token = input;
69        self
70    }
71    /// <p>The token for the next message, used by GetNextMessage.</p>
72    pub fn get_next_message_token(&self) -> &::std::option::Option<::std::string::String> {
73        &self.next_message_token
74    }
75    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
76        self._request_id = Some(request_id.into());
77        self
78    }
79
80    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
81        self._request_id = request_id;
82        self
83    }
84    /// Consumes the builder and constructs a [`SendMessageOutput`](crate::operation::send_message::SendMessageOutput).
85    /// This method will fail if any of the following fields are not set:
86    /// - [`request_message_id`](crate::operation::send_message::builders::SendMessageOutputBuilder::request_message_id)
87    /// - [`next_message_token`](crate::operation::send_message::builders::SendMessageOutputBuilder::next_message_token)
88    pub fn build(self) -> ::std::result::Result<crate::operation::send_message::SendMessageOutput, ::aws_smithy_types::error::operation::BuildError> {
89        ::std::result::Result::Ok(crate::operation::send_message::SendMessageOutput {
90            request_message_id: self.request_message_id.ok_or_else(|| {
91                ::aws_smithy_types::error::operation::BuildError::missing_field(
92                    "request_message_id",
93                    "request_message_id was not specified but it is required when building SendMessageOutput",
94                )
95            })?,
96            next_message_token: self.next_message_token.ok_or_else(|| {
97                ::aws_smithy_types::error::operation::BuildError::missing_field(
98                    "next_message_token",
99                    "next_message_token was not specified but it is required when building SendMessageOutput",
100                )
101            })?,
102            _request_id: self._request_id,
103        })
104    }
105}