asana/request/
get_organization_export.rs

1use serde_json::json;
2use crate::model::*;
3use crate::FluentRequest;
4use serde::{Serialize, Deserialize};
5use httpclient::InMemoryResponseExt;
6use crate::AsanaClient;
7/**You should use this struct via [`AsanaClient::get_organization_export`].
8
9On request success, this will return a [`GetOrganizationExportResponse`].*/
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct GetOrganizationExportRequest {
12    pub opt_fields: Option<Vec<String>>,
13    pub opt_pretty: Option<bool>,
14    pub organization_export_gid: String,
15}
16impl GetOrganizationExportRequest {}
17impl FluentRequest<'_, GetOrganizationExportRequest> {
18    pub fn opt_fields(
19        mut self,
20        opt_fields: impl IntoIterator<Item = impl AsRef<str>>,
21    ) -> Self {
22        self
23            .params
24            .opt_fields = Some(
25            opt_fields.into_iter().map(|s| s.as_ref().to_owned()).collect(),
26        );
27        self
28    }
29    pub fn opt_pretty(mut self, opt_pretty: bool) -> Self {
30        self.params.opt_pretty = Some(opt_pretty);
31        self
32    }
33}
34impl<'a> ::std::future::IntoFuture for FluentRequest<'a, GetOrganizationExportRequest> {
35    type Output = httpclient::InMemoryResult<GetOrganizationExportResponse>;
36    type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>;
37    fn into_future(self) -> Self::IntoFuture {
38        Box::pin(async move {
39            let url = &format!(
40                "/organization_exports/{organization_export_gid}",
41                organization_export_gid = self.params.organization_export_gid
42            );
43            let mut r = self.client.client.get(url);
44            r = r.set_query(self.params);
45            r = self.client.authenticate(r);
46            let res = r.await?;
47            res.json().map_err(Into::into)
48        })
49    }
50}