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