gemini-chat-api 0.1.5

Async Rust client for Google's internal Gemini Chat API
Documentation
//! Error types for this crate.

use thiserror::Error;

/// Main error type for Gemini client operations.
#[derive(Error, Debug)]
pub enum Error {
    /// Authentication failed (invalid or expired cookies, or login redirect).
    #[error("Authentication failed: {0}")]
    Authentication(String),

    /// Network request failed.
    #[error("Network error: {0}")]
    Network(#[from] reqwest::Error),

    /// Failed to parse a response from the web endpoint.
    #[error("Parse error: {0}")]
    Parse(String),

    /// Request timed out.
    ///
    /// Note: the current implementation uses `reqwest` timeouts, which are
    /// reported as `Error::Network` rather than this variant.
    #[error("Request timed out")]
    Timeout,

    /// Cookie file not found or invalid.
    #[error("Cookie error: {0}")]
    Cookie(String),

    /// File I/O error.
    #[error("I/O error: {0}")]
    Io(#[from] std::io::Error),

    /// JSON serialization/deserialization error.
    #[error("JSON error: {0}")]
    Json(#[from] serde_json::Error),

    /// Client not initialized properly.
    #[error("Client not initialized: {0}")]
    NotInitialized(String),

    /// File upload failed.
    #[error("Upload failed: {0}")]
    Upload(String),
}

/// Result type alias for this crate.
pub type Result<T> = std::result::Result<T, Error>;