gwelle 0.1.0

Lightweight Rust client for the Google Trends API
Documentation
use thiserror::Error;

#[derive(Error, Debug)]
pub enum TrendsError {
    #[error("HTTP error: {0}")]
    Http(#[from] reqwest::Error),

    #[error("JSON parsing error: {0}")]
    Json(#[from] serde_json::Error),

    #[error("Session error: {0}")]
    Session(String),

    #[error("Rate limited (HTTP 429)")]
    RateLimited,

    #[error("Response didn't start with the expected XSSI prefix \")]}}'\"")]
    XssiPrefixMissing,

    #[error("Explore widget token not found: {0}")]
    TokenNotFound(String),

    #[error("URL parsing error: {0}")]
    Url(#[from] url::ParseError),

    #[error("Invalid input: {0}")]
    InvalidInput(String),
}

pub type Result<T> = std::result::Result<T, TrendsError>;