pub const READ_CALENDAR_EVENTS: &str = "esi-calendar.read_calendar_events.v1";
pub const RESPOND_CALENDAR_EVENTS: &str = "esi-calendar.respond_calendar_events.v1";
pub struct CalendarScopes {
pub(super) scopes: Vec<String>,
}
impl Default for CalendarScopes {
fn default() -> Self {
Self::new()
}
}
impl CalendarScopes {
pub fn new() -> Self {
CalendarScopes { scopes: Vec::new() }
}
pub fn all() -> Self {
CalendarScopes::new()
.read_calendar_events()
.respond_calendar_events()
}
pub fn read_calendar_events(mut self) -> Self {
self.scopes.push(READ_CALENDAR_EVENTS.to_string());
self
}
pub fn respond_calendar_events(mut self) -> Self {
self.scopes.push(RESPOND_CALENDAR_EVENTS.to_string());
self
}
}
#[cfg(test)]
mod calendar_scopes_tests {
use crate::scope::CalendarScopes;
#[test]
fn test_calendar_scopes_default() {
let calendar_scopes = CalendarScopes::default();
assert_eq!(calendar_scopes.scopes.len(), 0)
}
}