#[cfg(not(any(feature = "rustls", feature = "native-tls")))]
compile_error!("至少应该启用一个 rustls 或是 native-tls features");
#[cfg(all(feature = "rustls", feature = "native-tls"))]
compile_error!("rustls 和 native-tls features 只能同时启用一个");
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde;
pub mod connection;
pub mod requests;
#[cfg(feature = "live")]
pub mod ws_protocol;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Network error: {0}")]
Network(#[from] reqwest::Error),
#[cfg(feature = "live")]
#[error("Websocket error: {0}")]
WebSocket(#[from] async_tungstenite::tungstenite::Error),
#[error("Unexpected status code: {0}")]
StatusCode(reqwest::StatusCode),
#[error("Failed to parse http body as expected json.")]
Serde(#[from] serde_json::Error),
#[error("Bilibili error: ({}) {}", .code, .message)]
BiliCustom { code: i64, message: String },
#[error("The request seems ok but no data is found.")]
DataNotFound,
#[cfg(feature = "live")]
#[error("Failed to parse as bilibili protocol: {0}")]
Protocol(#[from] ws_protocol::ParseError),
}
pub type Result<T, E = Error> = std::result::Result<T, E>;
pub use requests::Request;