1use reqwest::header::HeaderMap;
2
3use crate::errors::CreatorError;
4
5pub mod minecraft;
6pub mod modloader;
7pub mod mods;
8
9pub static CURSE_API_URL: &str = "https://api.curseforge.com/v1/";
11
12pub struct CurseApi {
14 http_client: reqwest::Client,
15}
16
17impl CurseApi {
18 pub fn new<S>(api_token: S) -> Result<Self, CreatorError>
32 where
33 S: AsRef<str>,
34 {
35 let mut headers = HeaderMap::new();
36 headers.insert("X-Api-Key", api_token.as_ref().parse().unwrap());
37
38 let http_client = reqwest::Client::builder()
39 .default_headers(headers)
40 .build()?;
41
42 Ok(Self { http_client })
43 }
44}