tradestation-api 0.1.0

Complete TradeStation REST API v3 wrapper for Rust
Documentation
//! Error types for the TradeStation API client.

/// Errors returned by the TradeStation API client.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// An HTTP transport error (connection, timeout, TLS).
    #[error("HTTP request failed: {0}")]
    Http(#[from] reqwest::Error),

    /// Failed to parse a JSON response body.
    #[error("JSON parsing failed: {0}")]
    Json(#[from] serde_json::Error),

    /// Authentication or token management error.
    #[error("Authentication failed: {0}")]
    Auth(String),

    /// The API returned a non-success HTTP status code.
    #[error("API error ({status}): {message}")]
    Api {
        /// HTTP status code.
        status: u16,
        /// Response body or error message.
        message: String,
    },

    /// The streaming connection was closed by the server.
    #[error("Stream ended: {0}")]
    StreamEnded(String),
}