pub const ORGANIZE_MAIL: &str = "esi-mail.organize_mail.v1";
pub const READ_MAIL: &str = "esi-mail.read_mail.v1";
pub const SEND_MAIL: &str = "esi-mail.send_mail.v1";
pub struct MailScopes {
pub(super) scopes: Vec<String>,
}
impl Default for MailScopes {
fn default() -> Self {
Self::new()
}
}
impl MailScopes {
pub fn new() -> Self {
MailScopes { scopes: Vec::new() }
}
pub fn all() -> Self {
MailScopes::new().organize_mail().read_mail().send_mail()
}
pub fn organize_mail(mut self) -> Self {
self.scopes.push(ORGANIZE_MAIL.to_string());
self
}
pub fn read_mail(mut self) -> Self {
self.scopes.push(READ_MAIL.to_string());
self
}
pub fn send_mail(mut self) -> Self {
self.scopes.push(SEND_MAIL.to_string());
self
}
}
#[cfg(test)]
mod mail_scopes_tests {
use crate::scope::MailScopes;
#[test]
fn test_mail_scopes_default() {
let mail_scopes = MailScopes::default();
assert_eq!(mail_scopes.scopes.len(), 0)
}
}