1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use serde_json::json;
use crate::model::*;
use crate::FluentRequest;
use serde::{Serialize, Deserialize};
use httpclient::InMemoryResponseExt;
use crate::GmailClient;
/**You should use this struct via [`GmailClient::drafts_list`].

On request success, this will return a [`ListDraftsResponse`].*/
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DraftsListRequest {
    pub include_spam_trash: Option<bool>,
    pub max_results: Option<i64>,
    pub page_token: Option<String>,
    pub q: Option<String>,
    pub user_id: String,
}
impl DraftsListRequest {}
impl FluentRequest<'_, DraftsListRequest> {
    pub fn include_spam_trash(mut self, include_spam_trash: bool) -> Self {
        self.params.include_spam_trash = Some(include_spam_trash);
        self
    }
    pub fn max_results(mut self, max_results: i64) -> Self {
        self.params.max_results = Some(max_results);
        self
    }
    pub fn page_token(mut self, page_token: &str) -> Self {
        self.params.page_token = Some(page_token.to_owned());
        self
    }
    pub fn q(mut self, q: &str) -> Self {
        self.params.q = Some(q.to_owned());
        self
    }
}
impl<'a> ::std::future::IntoFuture for FluentRequest<'a, DraftsListRequest> {
    type Output = httpclient::InMemoryResult<ListDraftsResponse>;
    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
    fn into_future(self) -> Self::IntoFuture {
        Box::pin(async move {
            let url = &format!(
                "/gmail/v1/users/{user_id}/drafts", user_id = self.params.user_id
            );
            let mut r = self.client.client.get(url);
            r = r.set_query(self.params);
            r = self.client.authenticate(r);
            let res = r.await?;
            res.json().map_err(Into::into)
        })
    }
}