twilio/request/
list_sip_auth_registrations_credential_list_mapping.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 ListSipAuthRegistrationsCredentialListMappingRequest<'a> {
9    pub(crate) http_client: &'a TwilioClient,
10    pub account_sid: String,
11    pub domain_sid: String,
12    pub page: Option<i64>,
13    pub page_size: Option<i64>,
14    pub page_token: Option<String>,
15}
16impl<'a> ListSipAuthRegistrationsCredentialListMappingRequest<'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/Domains/{domain_sid}/Auth/Registrations/CredentialListMappings.json",
24                    account_sid = self.account_sid, domain_sid = self.domain_sid
25                ),
26            );
27        if let Some(ref unwrapped) = self.page {
28            r = r.query("Page", &unwrapped.to_string());
29        }
30        if let Some(ref unwrapped) = self.page_size {
31            r = r.query("PageSize", &unwrapped.to_string());
32        }
33        if let Some(ref unwrapped) = self.page_token {
34            r = r.query("PageToken", &unwrapped.to_string());
35        }
36        r = self.http_client.authenticate(r);
37        let res = r.send_awaiting_body().await?;
38        res.json()
39    }
40    pub fn page(mut self, page: i64) -> Self {
41        self.page = Some(page);
42        self
43    }
44    pub fn page_size(mut self, page_size: i64) -> Self {
45        self.page_size = Some(page_size);
46        self
47    }
48    pub fn page_token(mut self, page_token: &str) -> Self {
49        self.page_token = Some(page_token.to_owned());
50        self
51    }
52}
53impl<'a> ::std::future::IntoFuture
54for ListSipAuthRegistrationsCredentialListMappingRequest<'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}