pub const AUTH: &str = "auth"; pub const SSH_KEY: &str = "sshkey"; pub const ACCESS_KEY: &str = "accesskey"; pub const TOKEN: &str = "token"; pub const VERIFICATION: &str = "verification"; pub const ORGANIZATION: &str = "org"; pub const EMAIL: &str = "email"; pub const AGENT: &str = "agent"; pub const CHAT: &str = "chat"; pub const GIT: &str = "git"; pub const GUILD: &str = "guild"; pub const ISSUE: &str = "issue"; pub const NOTIFY: &str = "notify"; pub const OBJECT: &str = "object"; pub const PULL: &str = "pull"; pub const REALTIME: &str = "realtime"; pub const USER: &str = "user"; pub const WEBHOOK: &str = "webhook"; pub fn of(kind: &str) -> &str { let mut parts = kind.split('.'); let domain = parts.next().unwrap_or_default(); let name = parts.next().unwrap_or_default(); match (domain, name) { ("auth", "ssh_key") => SSH_KEY, ("auth", "access_key") => ACCESS_KEY, ("auth", "app_token" | "token") => TOKEN, ("auth", "verification_token") => VERIFICATION, ("auth", _) => AUTH, ("organization", _) => ORGANIZATION, ("email", _) => EMAIL, ("agent", _) => AGENT, ("chat", _) => CHAT, ("git", _) => GIT, ("guild", _) => GUILD, ("issue", _) => ISSUE, ("notify", _) => NOTIFY, ("object", _) => OBJECT, ("pull", _) => PULL, ("realtime", _) => REALTIME, ("user", _) => USER, ("webhook", _) => WEBHOOK, (other, _) => other, } }