use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum Scope {
#[serde(rename = "api")]
Api,
#[serde(rename = "offline_access")]
OfflineAccess,
#[serde(rename = "api.send.access")]
ApiSendAccess,
}
impl Scope {
pub(crate) fn as_str(&self) -> &'static str {
match self {
Scope::Api => "api",
Scope::OfflineAccess => "offline_access",
Scope::ApiSendAccess => "api.send.access",
}
}
}
pub(crate) fn scopes_to_string(scopes: &[Scope]) -> String {
scopes
.iter()
.map(|s| s.as_str())
.collect::<Vec<_>>()
.join(" ")
}