zulip-api 0.0.8

Client library for interacting with the Zulip API
Documentation
use zeroize::Zeroize;

/// Represents a Zulip API key used to authenticate to the service.
#[derive(Clone, Debug, Eq, PartialEq, Zeroize)]
pub struct ApiKey(String);

impl ApiKey {
    /// Creates a new [ApiKey].
    pub const fn new() -> Self {
        Self(String::new())
    }

    /// Gets the string representation of the [ApiKey].
    pub fn as_str(&self) -> &str {
        self.0.as_str()
    }
}

impl Default for ApiKey {
    fn default() -> Self {
        Self::new()
    }
}

impl From<&str> for ApiKey {
    fn from(val: &str) -> Self {
        Self(val.into())
    }
}

impl From<String> for ApiKey {
    fn from(val: String) -> Self {
        Self(val)
    }
}