twilio/request/
list_application.rs1use serde_json::json;
2use crate::model::*;
3use crate::TwilioClient;
4#[derive(Clone)]
8pub struct ListApplicationRequest<'a> {
9 pub(crate) http_client: &'a TwilioClient,
10 pub account_sid: String,
11 pub friendly_name: Option<String>,
12 pub page: Option<i64>,
13 pub page_size: Option<i64>,
14 pub page_token: Option<String>,
15}
16impl<'a> ListApplicationRequest<'a> {
17 pub async fn send(self) -> ::httpclient::InMemoryResult<serde_json::Value> {
18 let mut r = self
19 .http_client
20 .client
21 .get(
22 &format!(
23 "/2010-04-01/Accounts/{account_sid}/Applications.json", account_sid =
24 self.account_sid
25 ),
26 );
27 if let Some(ref unwrapped) = self.friendly_name {
28 r = r.query("FriendlyName", &unwrapped.to_string());
29 }
30 if let Some(ref unwrapped) = self.page {
31 r = r.query("Page", &unwrapped.to_string());
32 }
33 if let Some(ref unwrapped) = self.page_size {
34 r = r.query("PageSize", &unwrapped.to_string());
35 }
36 if let Some(ref unwrapped) = self.page_token {
37 r = r.query("PageToken", &unwrapped.to_string());
38 }
39 r = self.http_client.authenticate(r);
40 let res = r.send_awaiting_body().await?;
41 res.json()
42 }
43 pub fn friendly_name(mut self, friendly_name: &str) -> Self {
44 self.friendly_name = Some(friendly_name.to_owned());
45 self
46 }
47 pub fn page(mut self, page: i64) -> Self {
48 self.page = Some(page);
49 self
50 }
51 pub fn page_size(mut self, page_size: i64) -> Self {
52 self.page_size = Some(page_size);
53 self
54 }
55 pub fn page_token(mut self, page_token: &str) -> Self {
56 self.page_token = Some(page_token.to_owned());
57 self
58 }
59}
60impl<'a> ::std::future::IntoFuture for ListApplicationRequest<'a> {
61 type Output = httpclient::InMemoryResult<serde_json::Value>;
62 type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
63 fn into_future(self) -> Self::IntoFuture {
64 Box::pin(self.send())
65 }
66}