twilio/request/
create_address.rs1use serde_json::json;
2use crate::model::*;
3use crate::TwilioClient;
4#[derive(Clone)]
8pub struct CreateAddressRequest<'a> {
9 pub(crate) http_client: &'a TwilioClient,
10 pub account_sid: String,
11}
12impl<'a> CreateAddressRequest<'a> {
13 pub async fn send(self) -> ::httpclient::InMemoryResult<ApiV2010AccountAddress> {
14 let mut r = self
15 .http_client
16 .client
17 .post(
18 &format!(
19 "/2010-04-01/Accounts/{account_sid}/Addresses.json", account_sid =
20 self.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 CreateAddressRequest<'a> {
29 type Output = httpclient::InMemoryResult<ApiV2010AccountAddress>;
30 type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
31 fn into_future(self) -> Self::IntoFuture {
32 Box::pin(self.send())
33 }
34}