aws_sdk_connectparticipant/operation/send_message/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::send_message::_send_message_output::SendMessageOutputBuilder;
3
4pub use crate::operation::send_message::_send_message_input::SendMessageInputBuilder;
5
6impl crate::operation::send_message::builders::SendMessageInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::send_message::SendMessageOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::send_message::SendMessageError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.send_message();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `SendMessage`.
24///
25/// <p>Sends a message.</p>
26/// <p>For security recommendations, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/security-best-practices.html#bp-security-chat">Amazon Connect Chat security best practices</a>.</p><note>
27/// <p><code>ConnectionToken</code> is used for invoking this API instead of <code>ParticipantToken</code>.</p>
28/// </note>
29/// <p>The Amazon Connect Participant Service APIs do not use <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Signature Version 4 authentication</a>.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct SendMessageFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::send_message::builders::SendMessageInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::send_message::SendMessageOutput,
39        crate::operation::send_message::SendMessageError,
40    > for SendMessageFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::send_message::SendMessageOutput,
48            crate::operation::send_message::SendMessageError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl SendMessageFluentBuilder {
55    /// Creates a new `SendMessageFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the SendMessage as a reference.
64    pub fn as_input(&self) -> &crate::operation::send_message::builders::SendMessageInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::send_message::SendMessageOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::send_message::SendMessageError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::send_message::SendMessage::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::send_message::SendMessage::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::send_message::SendMessageOutput,
101        crate::operation::send_message::SendMessageError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>The type of the content. Possible types are <code>text/plain</code>, <code>text/markdown</code>, <code>application/json</code>, and <code>application/vnd.amazonaws.connect.message.interactive.response</code>.</p>
116    /// <p>Supported types on the contact are configured through <code>SupportedMessagingContentTypes</code> on <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html">StartChatContact</a> and <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_StartOutboundChatContact.html">StartOutboundChatContact</a>.</p>
117    /// <p>For Apple Messages for Business, SMS, and WhatsApp Business Messaging contacts, only <code>text/plain</code> is supported.</p>
118    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.inner = self.inner.content_type(input.into());
120        self
121    }
122    /// <p>The type of the content. Possible types are <code>text/plain</code>, <code>text/markdown</code>, <code>application/json</code>, and <code>application/vnd.amazonaws.connect.message.interactive.response</code>.</p>
123    /// <p>Supported types on the contact are configured through <code>SupportedMessagingContentTypes</code> on <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html">StartChatContact</a> and <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_StartOutboundChatContact.html">StartOutboundChatContact</a>.</p>
124    /// <p>For Apple Messages for Business, SMS, and WhatsApp Business Messaging contacts, only <code>text/plain</code> is supported.</p>
125    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.inner = self.inner.set_content_type(input);
127        self
128    }
129    /// <p>The type of the content. Possible types are <code>text/plain</code>, <code>text/markdown</code>, <code>application/json</code>, and <code>application/vnd.amazonaws.connect.message.interactive.response</code>.</p>
130    /// <p>Supported types on the contact are configured through <code>SupportedMessagingContentTypes</code> on <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html">StartChatContact</a> and <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_StartOutboundChatContact.html">StartOutboundChatContact</a>.</p>
131    /// <p>For Apple Messages for Business, SMS, and WhatsApp Business Messaging contacts, only <code>text/plain</code> is supported.</p>
132    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
133        self.inner.get_content_type()
134    }
135    /// <p>The content of the message.</p>
136    /// <ul>
137    /// <li>
138    /// <p>For <code>text/plain</code> and <code>text/markdown</code>, the Length Constraints are Minimum of 1, Maximum of 1024.</p></li>
139    /// <li>
140    /// <p>For <code>application/json</code>, the Length Constraints are Minimum of 1, Maximum of 12000.</p></li>
141    /// <li>
142    /// <p>For <code>application/vnd.amazonaws.connect.message.interactive.response</code>, the Length Constraints are Minimum of 1, Maximum of 12288.</p></li>
143    /// </ul>
144    pub fn content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.content(input.into());
146        self
147    }
148    /// <p>The content of the message.</p>
149    /// <ul>
150    /// <li>
151    /// <p>For <code>text/plain</code> and <code>text/markdown</code>, the Length Constraints are Minimum of 1, Maximum of 1024.</p></li>
152    /// <li>
153    /// <p>For <code>application/json</code>, the Length Constraints are Minimum of 1, Maximum of 12000.</p></li>
154    /// <li>
155    /// <p>For <code>application/vnd.amazonaws.connect.message.interactive.response</code>, the Length Constraints are Minimum of 1, Maximum of 12288.</p></li>
156    /// </ul>
157    pub fn set_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.inner = self.inner.set_content(input);
159        self
160    }
161    /// <p>The content of the message.</p>
162    /// <ul>
163    /// <li>
164    /// <p>For <code>text/plain</code> and <code>text/markdown</code>, the Length Constraints are Minimum of 1, Maximum of 1024.</p></li>
165    /// <li>
166    /// <p>For <code>application/json</code>, the Length Constraints are Minimum of 1, Maximum of 12000.</p></li>
167    /// <li>
168    /// <p>For <code>application/vnd.amazonaws.connect.message.interactive.response</code>, the Length Constraints are Minimum of 1, Maximum of 12288.</p></li>
169    /// </ul>
170    pub fn get_content(&self) -> &::std::option::Option<::std::string::String> {
171        self.inner.get_content()
172    }
173    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
174    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175        self.inner = self.inner.client_token(input.into());
176        self
177    }
178    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
179    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180        self.inner = self.inner.set_client_token(input);
181        self
182    }
183    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
184    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
185        self.inner.get_client_token()
186    }
187    /// <p>The authentication token associated with the connection.</p>
188    pub fn connection_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189        self.inner = self.inner.connection_token(input.into());
190        self
191    }
192    /// <p>The authentication token associated with the connection.</p>
193    pub fn set_connection_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194        self.inner = self.inner.set_connection_token(input);
195        self
196    }
197    /// <p>The authentication token associated with the connection.</p>
198    pub fn get_connection_token(&self) -> &::std::option::Option<::std::string::String> {
199        self.inner.get_connection_token()
200    }
201}