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_templates`]. On request success, this will return a [`GetProjectTemplatesResponse`].*/ #[derive(Debug, Clone, Serialize, Deserialize)] pub struct GetProjectTemplatesRequest { pub limit: Option, pub offset: Option, pub opt_fields: Option>, pub opt_pretty: Option, pub team: Option, pub workspace: Option, } impl GetProjectTemplatesRequest {} impl FluentRequest<'_, GetProjectTemplatesRequest> { pub fn limit(mut self, limit: i64) -> Self { self.params.limit = Some(limit); self } pub fn offset(mut self, offset: &str) -> Self { self.params.offset = Some(offset.to_owned()); self } 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 } pub fn team(mut self, team: &str) -> Self { self.params.team = Some(team.to_owned()); self } pub fn workspace(mut self, workspace: &str) -> Self { self.params.workspace = Some(workspace.to_owned()); self } } impl<'a> ::std::future::IntoFuture for FluentRequest<'a, GetProjectTemplatesRequest> { type Output = httpclient::InMemoryResult; type IntoFuture = ::futures::future::BoxFuture<'a, Self::Output>; fn into_future(self) -> Self::IntoFuture { Box::pin(async move { let url = "/project_templates"; 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) }) } }