twilio/request/
create_user_defined_message.rs1use serde_json::json;
2use crate::model::*;
3use crate::TwilioClient;
4#[derive(Clone)]
8pub struct CreateUserDefinedMessageRequest<'a> {
9 pub(crate) http_client: &'a TwilioClient,
10 pub account_sid: String,
11 pub call_sid: String,
12}
13impl<'a> CreateUserDefinedMessageRequest<'a> {
14 pub async fn send(
15 self,
16 ) -> ::httpclient::InMemoryResult<ApiV2010AccountCallUserDefinedMessage> {
17 let mut r = self
18 .http_client
19 .client
20 .post(
21 &format!(
22 "/2010-04-01/Accounts/{account_sid}/Calls/{call_sid}/UserDefinedMessages.json",
23 account_sid = self.account_sid, call_sid = self.call_sid
24 ),
25 );
26 r = self.http_client.authenticate(r);
27 let res = r.send_awaiting_body().await?;
28 res.json()
29 }
30}
31impl<'a> ::std::future::IntoFuture for CreateUserDefinedMessageRequest<'a> {
32 type Output = httpclient::InMemoryResult<ApiV2010AccountCallUserDefinedMessage>;
33 type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
34 fn into_future(self) -> Self::IntoFuture {
35 Box::pin(self.send())
36 }
37}