1use governor::clock::MonotonicClock;
2use governor::state::{InMemoryState, NotKeyed};
3use governor::{Quota, RateLimiter};
4use nonzero_ext::nonzero;
5use url::Url;
6use url_macro::url;
7
8pub struct Config {
10 pub base_url: Url,
12 pub client: reqwest::Client,
14 pub limiter: RateLimiter<NotKeyed, InMemoryState, MonotonicClock>,
16 pub bearer_token: String,
18 pub user_agent: Option<String>,
20}
21
22impl Config {
23 pub fn new(bearer_token: String) -> Self {
25 Self {
26 base_url: url!("https://api.themoviedb.org"),
27 client: reqwest::Client::new(),
28 limiter: RateLimiter::direct(Quota::per_second(nonzero!(30u32))),
29 bearer_token,
30 user_agent: None,
31 }
32 }
33}