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