mangadex_api/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#![doc = include_str!("../README.md")]
#![forbid(unsafe_code)]
#![cfg_attr(
    not(any(feature = "multi-thread", feature = "tokio-multi-thread")),
    allow(clippy::await_holding_refcell_ref)
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[macro_use]
pub(crate) mod macros;

pub mod constants;
#[macro_use]
pub mod http_client;
pub mod v5;

cfg_utils! {
    pub mod utils;
}

pub use constants::*;
pub use http_client::{HttpClient, HttpClientRef};
use reqwest::{
    header::{HeaderMap, HeaderValue, USER_AGENT},
    Client,
};
pub use v5::MangaDexClient;

pub(crate) fn get_default_client_api() -> Client {
    let mut headers = HeaderMap::new();
    headers.append(
        USER_AGENT,
        HeaderValue::from_static("mangadex-api-rs 3.2.0"),
    );
    Client::builder().default_headers(headers).build().unwrap()
}