twilio/request/
list_call_notification.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 ListCallNotificationRequest<'a> {
9    pub(crate) http_client: &'a TwilioClient,
10    pub account_sid: String,
11    pub call_sid: String,
12    pub log: Option<i64>,
13    pub message_date: Option<chrono::NaiveDate>,
14    pub message_date_gt: Option<chrono::NaiveDate>,
15    pub message_date_lt: Option<chrono::NaiveDate>,
16    pub page: Option<i64>,
17    pub page_size: Option<i64>,
18    pub page_token: Option<String>,
19}
20impl<'a> ListCallNotificationRequest<'a> {
21    pub async fn send(self) -> ::httpclient::InMemoryResult<serde_json::Value> {
22        let mut r = self
23            .http_client
24            .client
25            .get(
26                &format!(
27                    "/2010-04-01/Accounts/{account_sid}/Calls/{call_sid}/Notifications.json",
28                    account_sid = self.account_sid, call_sid = self.call_sid
29                ),
30            );
31        if let Some(ref unwrapped) = self.log {
32            r = r.query("Log", &unwrapped.to_string());
33        }
34        if let Some(ref unwrapped) = self.message_date {
35            r = r.query("MessageDate", &unwrapped.to_string());
36        }
37        if let Some(ref unwrapped) = self.message_date_gt {
38            r = r.query("MessageDate_gt", &unwrapped.to_string());
39        }
40        if let Some(ref unwrapped) = self.message_date_lt {
41            r = r.query("MessageDate_lt", &unwrapped.to_string());
42        }
43        if let Some(ref unwrapped) = self.page {
44            r = r.query("Page", &unwrapped.to_string());
45        }
46        if let Some(ref unwrapped) = self.page_size {
47            r = r.query("PageSize", &unwrapped.to_string());
48        }
49        if let Some(ref unwrapped) = self.page_token {
50            r = r.query("PageToken", &unwrapped.to_string());
51        }
52        r = self.http_client.authenticate(r);
53        let res = r.send_awaiting_body().await?;
54        res.json()
55    }
56    pub fn log(mut self, log: i64) -> Self {
57        self.log = Some(log);
58        self
59    }
60    pub fn message_date(mut self, message_date: chrono::NaiveDate) -> Self {
61        self.message_date = Some(message_date);
62        self
63    }
64    pub fn message_date_gt(mut self, message_date_gt: chrono::NaiveDate) -> Self {
65        self.message_date_gt = Some(message_date_gt);
66        self
67    }
68    pub fn message_date_lt(mut self, message_date_lt: chrono::NaiveDate) -> Self {
69        self.message_date_lt = Some(message_date_lt);
70        self
71    }
72    pub fn page(mut self, page: i64) -> Self {
73        self.page = Some(page);
74        self
75    }
76    pub fn page_size(mut self, page_size: i64) -> Self {
77        self.page_size = Some(page_size);
78        self
79    }
80    pub fn page_token(mut self, page_token: &str) -> Self {
81        self.page_token = Some(page_token.to_owned());
82        self
83    }
84}
85impl<'a> ::std::future::IntoFuture for ListCallNotificationRequest<'a> {
86    type Output = httpclient::InMemoryResult<serde_json::Value>;
87    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
88    fn into_future(self) -> Self::IntoFuture {
89        Box::pin(self.send())
90    }
91}