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