weeb_api 0.2.0

A Rust library for the Weeb.sh API.
Documentation
//! Provides a helper for creating a `Authorization` string.

/// An authorization type used for selecting the type of token to be used in
/// the [`generate_auth`] function.
///
/// [`generate_auth`]: fn.generate_auth.html
pub enum AuthorizationType {
    /// Bearer token, used if the user has an older Weeb.sh token.
    Bearer,
    /// Wolken token, used if the user has recieved a newer Weeb.sh token (*most
    /// common*).
    Wolken,
}

/// A helper function used to easier generate an Authorization string to be
/// passed to the relevant request functions.
pub fn generate_auth(token: &str, auth_type: &AuthorizationType) -> String {
    match *auth_type {
        AuthorizationType::Bearer => format!("Bearer {}", token),
        AuthorizationType::Wolken => format!("Wolke {}", token),
    }
}