twilio/request/
create_call.rs

1use serde_json::json;
2use crate::model::*;
3use crate::TwilioClient;
4/**Create this with the associated client method.
5
6That method takes required values as arguments. Set optional values using builder methods on this struct.*/
7#[derive(Clone)]
8pub struct CreateCallRequest<'a> {
9    pub(crate) http_client: &'a TwilioClient,
10    pub account_sid: String,
11}
12impl<'a> CreateCallRequest<'a> {
13    pub async fn send(self) -> ::httpclient::InMemoryResult<ApiV2010AccountCall> {
14        let mut r = self
15            .http_client
16            .client
17            .post(
18                &format!(
19                    "/2010-04-01/Accounts/{account_sid}/Calls.json", account_sid = self
20                    .account_sid
21                ),
22            );
23        r = self.http_client.authenticate(r);
24        let res = r.send_awaiting_body().await?;
25        res.json()
26    }
27}
28impl<'a> ::std::future::IntoFuture for CreateCallRequest<'a> {
29    type Output = httpclient::InMemoryResult<ApiV2010AccountCall>;
30    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
31    fn into_future(self) -> Self::IntoFuture {
32        Box::pin(self.send())
33    }
34}