twilio/request/
create_validation_request.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 CreateValidationRequestRequest<'a> {
9    pub(crate) http_client: &'a TwilioClient,
10    pub account_sid: String,
11}
12impl<'a> CreateValidationRequestRequest<'a> {
13    pub async fn send(
14        self,
15    ) -> ::httpclient::InMemoryResult<ApiV2010AccountValidationRequest> {
16        let mut r = self
17            .http_client
18            .client
19            .post(
20                &format!(
21                    "/2010-04-01/Accounts/{account_sid}/OutgoingCallerIds.json",
22                    account_sid = self.account_sid
23                ),
24            );
25        r = self.http_client.authenticate(r);
26        let res = r.send_awaiting_body().await?;
27        res.json()
28    }
29}
30impl<'a> ::std::future::IntoFuture for CreateValidationRequestRequest<'a> {
31    type Output = httpclient::InMemoryResult<ApiV2010AccountValidationRequest>;
32    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
33    fn into_future(self) -> Self::IntoFuture {
34        Box::pin(self.send())
35    }
36}