war-pigeon 0.1.0

An ergonomic Rust client for War Pigeon, the runtime message delivery system.
Documentation
use thiserror::Error;

#[derive(Debug, Error)]
/// War Pigeon Error variants.
pub enum Error {
    #[error("Missing the HTTP payload body.")]
    MissingPayload,

    #[error("Missing the `target` webhook URL.")]
    MissingWebhookURL,

    #[error("Invalid `target` webhook URL.")]
    InvalidTargetWebhookURL,

    #[error("Missing the `message` in the payload.")]
    MissingMessage,

    #[error("Invalid format / structure for `Message` in the `message` value.")]
    InvalidMessage,

    #[error("HTTP Request Error: {0}")]
    HttpRequest(#[from] reqwest::Error),

    #[error("Received invalid JSON Data: {0}")]
    InvalidJsonData(#[from] serde_json::Error),

    #[error("War Pigeon Internal Error, sorry about that try again soon.")]
    InternalError,

    #[error("Missing the API Key, please send in the X-Api-Key header.")]
    MissingApiKey,

    #[error("Invalid API Key Format, expected: {{ID}}.{{KEY}}, note the `.`")]
    InvalidApiKeyFormat,

    #[error("The provided API Key was revoked.")]
    RevokedApiKey,

    #[error("API Key was not found.")]
    ApiKeyNotFound,

    #[error("The provided API Key is invalid.")]
    InvalidApiKey,

    #[error("Account is currently inactive, please reactivate and try again.")]
    InactiveAccount,

    #[error(
        "You have exceeded your plan limit, please upgrade your plan or wait for limit refresh."
    )]
    PlanLimitReached,
}