use super::{CalendarAccessRole, CalendarList, CalendarListItem, ClientResult, GCalClient};
pub struct CalendarListClient(GCalClient);
impl CalendarListClient {
pub fn new(client: GCalClient) -> Self {
Self(client)
}
pub async fn list(
&self,
hidden: bool,
access_role: CalendarAccessRole,
) -> ClientResult<Vec<CalendarListItem>> {
let mut cl = CalendarList::default();
cl.add_query("minAccessRole".to_string(), access_role.to_string());
cl.add_query("showHidden".to_string(), hidden.to_string());
Ok(self
.0
.get(None, cl)
.await?
.json::<CalendarList>()
.await?
.items)
}
}