1use std::fmt::{self, Display, Formatter};
2use ureq::serde_json;
3
4pub mod apis;
5pub mod newsdata_io;
6pub use newsdata_io::NewsdataIO;
7
8pub type Json = serde_json::Value;
9pub type ApiResult<T> = Result<T, Error>;
10
11#[derive(Debug)]
12pub enum Error {
13 ApiError(String),
15 RequestError(String),
17}
18
19impl Display for Error {
20 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
21 match self {
22 Error::ApiError(msg) => write!(f, "API error: {}", msg),
23 Error::RequestError(msg) => write!(f, "Request error: {}", msg),
24 }
25 }
26}