twilio/request/
list_sip_credential.rs

1use serde_json::json;
2use crate::model::*;
3use crate::TwilioClient;
4/**Create this with the associated client method.
5
6That method takes required values as arguments. Set optional values using builder methods on this struct.*/
7#[derive(Clone)]
8pub struct ListSipCredentialRequest<'a> {
9    pub(crate) http_client: &'a TwilioClient,
10    pub account_sid: String,
11    pub credential_list_sid: String,
12    pub page: Option<i64>,
13    pub page_size: Option<i64>,
14    pub page_token: Option<String>,
15}
16impl<'a> ListSipCredentialRequest<'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}/SIP/CredentialLists/{credential_list_sid}/Credentials.json",
24                    account_sid = self.account_sid, credential_list_sid = self
25                    .credential_list_sid
26                ),
27            );
28        if let Some(ref unwrapped) = self.page {
29            r = r.query("Page", &unwrapped.to_string());
30        }
31        if let Some(ref unwrapped) = self.page_size {
32            r = r.query("PageSize", &unwrapped.to_string());
33        }
34        if let Some(ref unwrapped) = self.page_token {
35            r = r.query("PageToken", &unwrapped.to_string());
36        }
37        r = self.http_client.authenticate(r);
38        let res = r.send_awaiting_body().await?;
39        res.json()
40    }
41    pub fn page(mut self, page: i64) -> Self {
42        self.page = Some(page);
43        self
44    }
45    pub fn page_size(mut self, page_size: i64) -> Self {
46        self.page_size = Some(page_size);
47        self
48    }
49    pub fn page_token(mut self, page_token: &str) -> Self {
50        self.page_token = Some(page_token.to_owned());
51        self
52    }
53}
54impl<'a> ::std::future::IntoFuture for ListSipCredentialRequest<'a> {
55    type Output = httpclient::InMemoryResult<serde_json::Value>;
56    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
57    fn into_future(self) -> Self::IntoFuture {
58        Box::pin(self.send())
59    }
60}