1#![doc = include_str!("../README.md")]
2#![forbid(unsafe_code)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![deny(clippy::exhaustive_enums)]
5#![deny(clippy::exhaustive_structs)]
6
7#[macro_use]
8pub(crate) mod macros;
9
10pub mod constants;
11#[macro_use]
12pub mod http_client;
13pub mod error;
14pub mod rate_limit;
15pub mod traits;
16pub mod v5;
17
18cfg_utils! {
19 pub mod utils;
20}
21
22pub use constants::*;
23pub use http_client::{HttpClient, HttpClientRef};
24use reqwest::{
25 header::{HeaderMap, HeaderValue, USER_AGENT},
26 Client,
27};
28pub use v5::MangaDexClient;
29
30pub type Result<T, E = error::Error> = std::result::Result<T, E>;
31
32pub(crate) fn get_default_client_api() -> Client {
33 let mut headers = HeaderMap::new();
34 let version = env!("CARGO_PKG_VERSION");
35 headers.append(
36 USER_AGENT,
37 HeaderValue::from_str(&format!("mangadex-api-rs {version}")).unwrap(),
38 );
39 Client::builder().default_headers(headers).build().unwrap()
40}