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