use serde_json::json; use crate::model::*; use crate::FluentRequest; use serde::{Serialize, Deserialize}; use httpclient::InMemoryResponseExt; use crate::AsanaClient; /**You should use this struct via [`AsanaClient::get_project_template`]. On request success, this will return a [`GetProjectTemplateResponse`].*/ #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GetProjectTemplateRequest { pub opt_fields: Option>, pub opt_pretty: Option, pub project_template_gid: String, } impl GetProjectTemplateRequest {} impl FluentRequest<'_, GetProjectTemplateRequest> { pub fn opt_fields( mut self, opt_fields: impl IntoIterator>, ) -> Self { self .params .opt_fields = Some( opt_fields.into_iter().map(|s| s.as_ref().to_owned()).collect(), ); self } pub fn opt_pretty(mut self, opt_pretty: bool) -> Self { self.params.opt_pretty = Some(opt_pretty); self } } impl<'a> ::std::future::IntoFuture for FluentRequest<'a, GetProjectTemplateRequest> { type Output = httpclient::InMemoryResult; type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>; fn into_future(self) -> Self::IntoFuture { Box::pin(async move { let url = &format!( "/project_templates/{project_template_gid}", project_template_gid = self .params.project_template_gid ); 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) }) } }