twilio/request/
fetch_recording.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 FetchRecordingRequest<'a> {
9    pub(crate) http_client: &'a TwilioClient,
10    pub account_sid: String,
11    pub include_soft_deleted: Option<bool>,
12    pub sid: String,
13}
14impl<'a> FetchRecordingRequest<'a> {
15    pub async fn send(self) -> ::httpclient::InMemoryResult<ApiV2010AccountRecording> {
16        let mut r = self
17            .http_client
18            .client
19            .get(
20                &format!(
21                    "/2010-04-01/Accounts/{account_sid}/Recordings/{sid}.json",
22                    account_sid = self.account_sid, sid = self.sid
23                ),
24            );
25        if let Some(ref unwrapped) = self.include_soft_deleted {
26            r = r.query("IncludeSoftDeleted", &unwrapped.to_string());
27        }
28        r = self.http_client.authenticate(r);
29        let res = r.send_awaiting_body().await?;
30        res.json()
31    }
32    pub fn include_soft_deleted(mut self, include_soft_deleted: bool) -> Self {
33        self.include_soft_deleted = Some(include_soft_deleted);
34        self
35    }
36}
37impl<'a> ::std::future::IntoFuture for FetchRecordingRequest<'a> {
38    type Output = httpclient::InMemoryResult<ApiV2010AccountRecording>;
39    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
40    fn into_future(self) -> Self::IntoFuture {
41        Box::pin(self.send())
42    }
43}