twilio/request/
list_recording.rs1use serde_json::json;
2use crate::model::*;
3use crate::TwilioClient;
4#[derive(Clone)]
8pub struct ListRecordingRequest<'a> {
9 pub(crate) http_client: &'a TwilioClient,
10 pub account_sid: String,
11 pub call_sid: Option<String>,
12 pub conference_sid: Option<String>,
13 pub date_created: Option<chrono::DateTime<chrono::Utc>>,
14 pub date_created_gt: Option<chrono::DateTime<chrono::Utc>>,
15 pub date_created_lt: Option<chrono::DateTime<chrono::Utc>>,
16 pub include_soft_deleted: Option<bool>,
17 pub page: Option<i64>,
18 pub page_size: Option<i64>,
19 pub page_token: Option<String>,
20}
21impl<'a> ListRecordingRequest<'a> {
22 pub async fn send(self) -> ::httpclient::InMemoryResult<serde_json::Value> {
23 let mut r = self
24 .http_client
25 .client
26 .get(
27 &format!(
28 "/2010-04-01/Accounts/{account_sid}/Recordings.json", account_sid =
29 self.account_sid
30 ),
31 );
32 if let Some(ref unwrapped) = self.call_sid {
33 r = r.query("CallSid", &unwrapped.to_string());
34 }
35 if let Some(ref unwrapped) = self.conference_sid {
36 r = r.query("ConferenceSid", &unwrapped.to_string());
37 }
38 if let Some(ref unwrapped) = self.date_created {
39 r = r.query("DateCreated", &unwrapped.to_string());
40 }
41 if let Some(ref unwrapped) = self.date_created_gt {
42 r = r.query("DateCreated_gt", &unwrapped.to_string());
43 }
44 if let Some(ref unwrapped) = self.date_created_lt {
45 r = r.query("DateCreated_lt", &unwrapped.to_string());
46 }
47 if let Some(ref unwrapped) = self.include_soft_deleted {
48 r = r.query("IncludeSoftDeleted", &unwrapped.to_string());
49 }
50 if let Some(ref unwrapped) = self.page {
51 r = r.query("Page", &unwrapped.to_string());
52 }
53 if let Some(ref unwrapped) = self.page_size {
54 r = r.query("PageSize", &unwrapped.to_string());
55 }
56 if let Some(ref unwrapped) = self.page_token {
57 r = r.query("PageToken", &unwrapped.to_string());
58 }
59 r = self.http_client.authenticate(r);
60 let res = r.send_awaiting_body().await?;
61 res.json()
62 }
63 pub fn call_sid(mut self, call_sid: &str) -> Self {
64 self.call_sid = Some(call_sid.to_owned());
65 self
66 }
67 pub fn conference_sid(mut self, conference_sid: &str) -> Self {
68 self.conference_sid = Some(conference_sid.to_owned());
69 self
70 }
71 pub fn date_created(mut self, date_created: chrono::DateTime<chrono::Utc>) -> Self {
72 self.date_created = Some(date_created);
73 self
74 }
75 pub fn date_created_gt(
76 mut self,
77 date_created_gt: chrono::DateTime<chrono::Utc>,
78 ) -> Self {
79 self.date_created_gt = Some(date_created_gt);
80 self
81 }
82 pub fn date_created_lt(
83 mut self,
84 date_created_lt: chrono::DateTime<chrono::Utc>,
85 ) -> Self {
86 self.date_created_lt = Some(date_created_lt);
87 self
88 }
89 pub fn include_soft_deleted(mut self, include_soft_deleted: bool) -> Self {
90 self.include_soft_deleted = Some(include_soft_deleted);
91 self
92 }
93 pub fn page(mut self, page: i64) -> Self {
94 self.page = Some(page);
95 self
96 }
97 pub fn page_size(mut self, page_size: i64) -> Self {
98 self.page_size = Some(page_size);
99 self
100 }
101 pub fn page_token(mut self, page_token: &str) -> Self {
102 self.page_token = Some(page_token.to_owned());
103 self
104 }
105}
106impl<'a> ::std::future::IntoFuture for ListRecordingRequest<'a> {
107 type Output = httpclient::InMemoryResult<serde_json::Value>;
108 type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
109 fn into_future(self) -> Self::IntoFuture {
110 Box::pin(self.send())
111 }
112}