pub const READ_CHARACTER_CONTRACTS: &str = "esi-contracts.read_character_contracts.v1";
pub const READ_CORPORATION_CONTRACTS: &str = "esi-contracts.read_corporation_contracts.v1";
pub struct ContractsScopes {
pub(super) scopes: Vec<String>,
}
impl Default for ContractsScopes {
fn default() -> Self {
Self::new()
}
}
impl ContractsScopes {
pub fn new() -> Self {
ContractsScopes { scopes: Vec::new() }
}
pub fn all() -> Self {
ContractsScopes::new()
.read_character_contracts()
.read_corporation_contracts()
}
pub fn read_character_contracts(mut self) -> Self {
self.scopes.push(READ_CHARACTER_CONTRACTS.to_string());
self
}
pub fn read_corporation_contracts(mut self) -> Self {
self.scopes.push(READ_CORPORATION_CONTRACTS.to_string());
self
}
}
#[cfg(test)]
mod contracts_scopes_tests {
use crate::scope::ContractsScopes;
#[test]
fn test_contracts_scopes_default() {
let contracts_scopes = ContractsScopes::default();
assert_eq!(contracts_scopes.scopes.len(), 0)
}
}