aws_sdk_pinpointsmsvoicev2/operation/send_text_message/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::send_text_message::_send_text_message_output::SendTextMessageOutputBuilder;
3
4pub use crate::operation::send_text_message::_send_text_message_input::SendTextMessageInputBuilder;
5
6impl crate::operation::send_text_message::builders::SendTextMessageInputBuilder {
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_text_message::SendTextMessageOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::send_text_message::SendTextMessageError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.send_text_message();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `SendTextMessage`.
24///
25/// <p>Creates a new text message and sends it to a recipient's phone number. SendTextMessage only sends an SMS message to one recipient each time it is invoked.</p>
26/// <p>SMS throughput limits are measured in Message Parts per Second (MPS). Your MPS limit depends on the destination country of your messages, as well as the type of phone number (origination number) that you use to send the message. For more information about MPS, see <a href="https://docs.aws.amazon.com/sms-voice/latest/userguide/sms-limitations-mps.html">Message Parts per Second (MPS) limits</a> in the <i>End User MessagingSMS User Guide</i>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct SendTextMessageFluentBuilder {
29 handle: ::std::sync::Arc<crate::client::Handle>,
30 inner: crate::operation::send_text_message::builders::SendTextMessageInputBuilder,
31 config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34 crate::client::customize::internal::CustomizableSend<
35 crate::operation::send_text_message::SendTextMessageOutput,
36 crate::operation::send_text_message::SendTextMessageError,
37 > for SendTextMessageFluentBuilder
38{
39 fn send(
40 self,
41 config_override: crate::config::Builder,
42 ) -> crate::client::customize::internal::BoxFuture<
43 crate::client::customize::internal::SendResult<
44 crate::operation::send_text_message::SendTextMessageOutput,
45 crate::operation::send_text_message::SendTextMessageError,
46 >,
47 > {
48 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49 }
50}
51impl SendTextMessageFluentBuilder {
52 /// Creates a new `SendTextMessageFluentBuilder`.
53 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54 Self {
55 handle,
56 inner: ::std::default::Default::default(),
57 config_override: ::std::option::Option::None,
58 }
59 }
60 /// Access the SendTextMessage as a reference.
61 pub fn as_input(&self) -> &crate::operation::send_text_message::builders::SendTextMessageInputBuilder {
62 &self.inner
63 }
64 /// Sends the request and returns the response.
65 ///
66 /// If an error occurs, an `SdkError` will be returned with additional details that
67 /// can be matched against.
68 ///
69 /// By default, any retryable failures will be retried twice. Retry behavior
70 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71 /// set when configuring the client.
72 pub async fn send(
73 self,
74 ) -> ::std::result::Result<
75 crate::operation::send_text_message::SendTextMessageOutput,
76 ::aws_smithy_runtime_api::client::result::SdkError<
77 crate::operation::send_text_message::SendTextMessageError,
78 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79 >,
80 > {
81 let input = self
82 .inner
83 .build()
84 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85 let runtime_plugins = crate::operation::send_text_message::SendTextMessage::operation_runtime_plugins(
86 self.handle.runtime_plugins.clone(),
87 &self.handle.conf,
88 self.config_override,
89 );
90 crate::operation::send_text_message::SendTextMessage::orchestrate(&runtime_plugins, input).await
91 }
92
93 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94 pub fn customize(
95 self,
96 ) -> crate::client::customize::CustomizableOperation<
97 crate::operation::send_text_message::SendTextMessageOutput,
98 crate::operation::send_text_message::SendTextMessageError,
99 Self,
100 > {
101 crate::client::customize::CustomizableOperation::new(self)
102 }
103 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104 self.set_config_override(::std::option::Option::Some(config_override.into()));
105 self
106 }
107
108 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109 self.config_override = config_override;
110 self
111 }
112 /// <p>The destination phone number in E.164 format.</p>
113 pub fn destination_phone_number(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114 self.inner = self.inner.destination_phone_number(input.into());
115 self
116 }
117 /// <p>The destination phone number in E.164 format.</p>
118 pub fn set_destination_phone_number(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119 self.inner = self.inner.set_destination_phone_number(input);
120 self
121 }
122 /// <p>The destination phone number in E.164 format.</p>
123 pub fn get_destination_phone_number(&self) -> &::std::option::Option<::std::string::String> {
124 self.inner.get_destination_phone_number()
125 }
126 /// <p>The origination identity of the message. This can be either the PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn, PoolId, or PoolArn.</p><important>
127 /// <p>If you are using a shared End User MessagingSMS resource then you must use the full Amazon Resource Name(ARN).</p>
128 /// </important>
129 pub fn origination_identity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130 self.inner = self.inner.origination_identity(input.into());
131 self
132 }
133 /// <p>The origination identity of the message. This can be either the PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn, PoolId, or PoolArn.</p><important>
134 /// <p>If you are using a shared End User MessagingSMS resource then you must use the full Amazon Resource Name(ARN).</p>
135 /// </important>
136 pub fn set_origination_identity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137 self.inner = self.inner.set_origination_identity(input);
138 self
139 }
140 /// <p>The origination identity of the message. This can be either the PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn, PoolId, or PoolArn.</p><important>
141 /// <p>If you are using a shared End User MessagingSMS resource then you must use the full Amazon Resource Name(ARN).</p>
142 /// </important>
143 pub fn get_origination_identity(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_origination_identity()
145 }
146 /// <p>The body of the text message.</p>
147 pub fn message_body(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148 self.inner = self.inner.message_body(input.into());
149 self
150 }
151 /// <p>The body of the text message.</p>
152 pub fn set_message_body(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153 self.inner = self.inner.set_message_body(input);
154 self
155 }
156 /// <p>The body of the text message.</p>
157 pub fn get_message_body(&self) -> &::std::option::Option<::std::string::String> {
158 self.inner.get_message_body()
159 }
160 /// <p>The type of message. Valid values are for messages that are critical or time-sensitive and PROMOTIONAL for messages that aren't critical or time-sensitive.</p>
161 pub fn message_type(mut self, input: crate::types::MessageType) -> Self {
162 self.inner = self.inner.message_type(input);
163 self
164 }
165 /// <p>The type of message. Valid values are for messages that are critical or time-sensitive and PROMOTIONAL for messages that aren't critical or time-sensitive.</p>
166 pub fn set_message_type(mut self, input: ::std::option::Option<crate::types::MessageType>) -> Self {
167 self.inner = self.inner.set_message_type(input);
168 self
169 }
170 /// <p>The type of message. Valid values are for messages that are critical or time-sensitive and PROMOTIONAL for messages that aren't critical or time-sensitive.</p>
171 pub fn get_message_type(&self) -> &::std::option::Option<crate::types::MessageType> {
172 self.inner.get_message_type()
173 }
174 /// <p>When you register a short code in the US, you must specify a program name. If you don’t have a US short code, omit this attribute.</p>
175 pub fn keyword(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176 self.inner = self.inner.keyword(input.into());
177 self
178 }
179 /// <p>When you register a short code in the US, you must specify a program name. If you don’t have a US short code, omit this attribute.</p>
180 pub fn set_keyword(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181 self.inner = self.inner.set_keyword(input);
182 self
183 }
184 /// <p>When you register a short code in the US, you must specify a program name. If you don’t have a US short code, omit this attribute.</p>
185 pub fn get_keyword(&self) -> &::std::option::Option<::std::string::String> {
186 self.inner.get_keyword()
187 }
188 /// <p>The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.</p>
189 pub fn configuration_set_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
190 self.inner = self.inner.configuration_set_name(input.into());
191 self
192 }
193 /// <p>The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.</p>
194 pub fn set_configuration_set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195 self.inner = self.inner.set_configuration_set_name(input);
196 self
197 }
198 /// <p>The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.</p>
199 pub fn get_configuration_set_name(&self) -> &::std::option::Option<::std::string::String> {
200 self.inner.get_configuration_set_name()
201 }
202 /// <p>The maximum amount that you want to spend, in US dollars, per each text message. If the calculated amount to send the text message is greater than <code>MaxPrice</code>, the message is not sent and an error is returned.</p>
203 pub fn max_price(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
204 self.inner = self.inner.max_price(input.into());
205 self
206 }
207 /// <p>The maximum amount that you want to spend, in US dollars, per each text message. If the calculated amount to send the text message is greater than <code>MaxPrice</code>, the message is not sent and an error is returned.</p>
208 pub fn set_max_price(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
209 self.inner = self.inner.set_max_price(input);
210 self
211 }
212 /// <p>The maximum amount that you want to spend, in US dollars, per each text message. If the calculated amount to send the text message is greater than <code>MaxPrice</code>, the message is not sent and an error is returned.</p>
213 pub fn get_max_price(&self) -> &::std::option::Option<::std::string::String> {
214 self.inner.get_max_price()
215 }
216 /// <p>How long the text message is valid for, in seconds. By default this is 72 hours. If the messages isn't handed off before the TTL expires we stop attempting to hand off the message and return <code>TTL_EXPIRED</code> event.</p>
217 pub fn time_to_live(mut self, input: i32) -> Self {
218 self.inner = self.inner.time_to_live(input);
219 self
220 }
221 /// <p>How long the text message is valid for, in seconds. By default this is 72 hours. If the messages isn't handed off before the TTL expires we stop attempting to hand off the message and return <code>TTL_EXPIRED</code> event.</p>
222 pub fn set_time_to_live(mut self, input: ::std::option::Option<i32>) -> Self {
223 self.inner = self.inner.set_time_to_live(input);
224 self
225 }
226 /// <p>How long the text message is valid for, in seconds. By default this is 72 hours. If the messages isn't handed off before the TTL expires we stop attempting to hand off the message and return <code>TTL_EXPIRED</code> event.</p>
227 pub fn get_time_to_live(&self) -> &::std::option::Option<i32> {
228 self.inner.get_time_to_live()
229 }
230 ///
231 /// Adds a key-value pair to `Context`.
232 ///
233 /// To override the contents of this collection use [`set_context`](Self::set_context).
234 ///
235 /// <p>You can specify custom data in this field. If you do, that data is logged to the event destination.</p>
236 pub fn context(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
237 self.inner = self.inner.context(k.into(), v.into());
238 self
239 }
240 /// <p>You can specify custom data in this field. If you do, that data is logged to the event destination.</p>
241 pub fn set_context(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
242 self.inner = self.inner.set_context(input);
243 self
244 }
245 /// <p>You can specify custom data in this field. If you do, that data is logged to the event destination.</p>
246 pub fn get_context(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
247 self.inner.get_context()
248 }
249 ///
250 /// Adds a key-value pair to `DestinationCountryParameters`.
251 ///
252 /// To override the contents of this collection use [`set_destination_country_parameters`](Self::set_destination_country_parameters).
253 ///
254 /// <p>This field is used for any country-specific registration requirements. Currently, this setting is only used when you send messages to recipients in India using a sender ID. For more information see <a href="https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-senderid-india.html">Special requirements for sending SMS messages to recipients in India</a>.</p>
255 /// <ul>
256 /// <li>
257 /// <p><code>IN_ENTITY_ID</code> The entity ID or Principal Entity (PE) ID that you received after completing the sender ID registration process.</p></li>
258 /// <li>
259 /// <p><code>IN_TEMPLATE_ID</code> The template ID that you received after completing the sender ID registration process.</p><important>
260 /// <p>Make sure that the Template ID that you specify matches your message template exactly. If your message doesn't match the template that you provided during the registration process, the mobile carriers might reject your message.</p>
261 /// </important></li>
262 /// </ul>
263 pub fn destination_country_parameters(
264 mut self,
265 k: crate::types::DestinationCountryParameterKey,
266 v: impl ::std::convert::Into<::std::string::String>,
267 ) -> Self {
268 self.inner = self.inner.destination_country_parameters(k, v.into());
269 self
270 }
271 /// <p>This field is used for any country-specific registration requirements. Currently, this setting is only used when you send messages to recipients in India using a sender ID. For more information see <a href="https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-senderid-india.html">Special requirements for sending SMS messages to recipients in India</a>.</p>
272 /// <ul>
273 /// <li>
274 /// <p><code>IN_ENTITY_ID</code> The entity ID or Principal Entity (PE) ID that you received after completing the sender ID registration process.</p></li>
275 /// <li>
276 /// <p><code>IN_TEMPLATE_ID</code> The template ID that you received after completing the sender ID registration process.</p><important>
277 /// <p>Make sure that the Template ID that you specify matches your message template exactly. If your message doesn't match the template that you provided during the registration process, the mobile carriers might reject your message.</p>
278 /// </important></li>
279 /// </ul>
280 pub fn set_destination_country_parameters(
281 mut self,
282 input: ::std::option::Option<::std::collections::HashMap<crate::types::DestinationCountryParameterKey, ::std::string::String>>,
283 ) -> Self {
284 self.inner = self.inner.set_destination_country_parameters(input);
285 self
286 }
287 /// <p>This field is used for any country-specific registration requirements. Currently, this setting is only used when you send messages to recipients in India using a sender ID. For more information see <a href="https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-senderid-india.html">Special requirements for sending SMS messages to recipients in India</a>.</p>
288 /// <ul>
289 /// <li>
290 /// <p><code>IN_ENTITY_ID</code> The entity ID or Principal Entity (PE) ID that you received after completing the sender ID registration process.</p></li>
291 /// <li>
292 /// <p><code>IN_TEMPLATE_ID</code> The template ID that you received after completing the sender ID registration process.</p><important>
293 /// <p>Make sure that the Template ID that you specify matches your message template exactly. If your message doesn't match the template that you provided during the registration process, the mobile carriers might reject your message.</p>
294 /// </important></li>
295 /// </ul>
296 pub fn get_destination_country_parameters(
297 &self,
298 ) -> &::std::option::Option<::std::collections::HashMap<crate::types::DestinationCountryParameterKey, ::std::string::String>> {
299 self.inner.get_destination_country_parameters()
300 }
301 /// <p>When set to true, the message is checked and validated, but isn't sent to the end recipient. You are not charged for using <code>DryRun</code>.</p>
302 /// <p>The Message Parts per Second (MPS) limit when using <code>DryRun</code> is five. If your origination identity has a lower MPS limit then the lower MPS limit is used. For more information about MPS limits, see <a href="https://docs.aws.amazon.com/sms-voice/latest/userguide/sms-limitations-mps.html">Message Parts per Second (MPS) limits</a> in the <i>End User MessagingSMS User Guide</i>..</p>
303 pub fn dry_run(mut self, input: bool) -> Self {
304 self.inner = self.inner.dry_run(input);
305 self
306 }
307 /// <p>When set to true, the message is checked and validated, but isn't sent to the end recipient. You are not charged for using <code>DryRun</code>.</p>
308 /// <p>The Message Parts per Second (MPS) limit when using <code>DryRun</code> is five. If your origination identity has a lower MPS limit then the lower MPS limit is used. For more information about MPS limits, see <a href="https://docs.aws.amazon.com/sms-voice/latest/userguide/sms-limitations-mps.html">Message Parts per Second (MPS) limits</a> in the <i>End User MessagingSMS User Guide</i>..</p>
309 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
310 self.inner = self.inner.set_dry_run(input);
311 self
312 }
313 /// <p>When set to true, the message is checked and validated, but isn't sent to the end recipient. You are not charged for using <code>DryRun</code>.</p>
314 /// <p>The Message Parts per Second (MPS) limit when using <code>DryRun</code> is five. If your origination identity has a lower MPS limit then the lower MPS limit is used. For more information about MPS limits, see <a href="https://docs.aws.amazon.com/sms-voice/latest/userguide/sms-limitations-mps.html">Message Parts per Second (MPS) limits</a> in the <i>End User MessagingSMS User Guide</i>..</p>
315 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
316 self.inner.get_dry_run()
317 }
318 /// <p>The unique identifier for the protect configuration.</p>
319 pub fn protect_configuration_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
320 self.inner = self.inner.protect_configuration_id(input.into());
321 self
322 }
323 /// <p>The unique identifier for the protect configuration.</p>
324 pub fn set_protect_configuration_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
325 self.inner = self.inner.set_protect_configuration_id(input);
326 self
327 }
328 /// <p>The unique identifier for the protect configuration.</p>
329 pub fn get_protect_configuration_id(&self) -> &::std::option::Option<::std::string::String> {
330 self.inner.get_protect_configuration_id()
331 }
332 /// <p>Set to true to enable message feedback for the message. When a user receives the message you need to update the message status using <code>PutMessageFeedback</code>.</p>
333 pub fn message_feedback_enabled(mut self, input: bool) -> Self {
334 self.inner = self.inner.message_feedback_enabled(input);
335 self
336 }
337 /// <p>Set to true to enable message feedback for the message. When a user receives the message you need to update the message status using <code>PutMessageFeedback</code>.</p>
338 pub fn set_message_feedback_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
339 self.inner = self.inner.set_message_feedback_enabled(input);
340 self
341 }
342 /// <p>Set to true to enable message feedback for the message. When a user receives the message you need to update the message status using <code>PutMessageFeedback</code>.</p>
343 pub fn get_message_feedback_enabled(&self) -> &::std::option::Option<bool> {
344 self.inner.get_message_feedback_enabled()
345 }
346}