thunderstore 0.5.0

A library for interacting with the Thunderstore API
Documentation
/// An error that can occur when interacting with the API.
#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum Error {
    /// A non-specific network error.
    #[error("reqwest error")]
    Reqwest(#[from] reqwest::Error),

    /// JSON parse error.
    #[error("serde_json error")]
    Json(#[from] serde_json::Error),

    /// Base64 decode error.
    #[error("base64 error")]
    Base64(#[from] base64::DecodeError),

    #[error("I/O error")]
    Io(#[from] std::io::Error),

    /// The profile data was incorrectly formatted.
    #[error("invalid profile data")]
    InvalidProfileData,

    /// A restricted enpoint was used, but the client's API token was missing or invalid.
    #[error("API token is missing or invalid")]
    ApiTokenInvalid,

    /// A 404 was returned by Thunderstore.
    #[error("requested resource was not found")]
    NotFound,

    /// The package or version identifier was incorrectly formatted.
    #[error("invalid package or version identifier")]
    InvalidIdent,

    #[error("the channel was closed too early")]
    ChannelClosedTooEarly,
}

/// A [`Result`] alias where the error type is [`crate::Error`].
pub type Result<T> = std::result::Result<T, Error>;