1use ureq::{Request};
2
3pub struct Client {
4 pub api_key: String,
5 pub sent_with: String,
6}
7
8impl Client {
9 pub fn request(&self, method: &str, endpoint: &str) -> Request {
10 ureq::request(method, &*format!("https://gateway.seven.io/api/{}", endpoint))
11 .set("X-API-KEY", &*self.api_key)
12 .set("SentWith", &*self.sent_with)
13 }
14
15 pub fn bool_to_string(&self, value: bool) -> &str {
16 if value {
17 return "1";
18 }
19
20 "0"
21 }
22
23 pub fn new(api_key: String, sent_with: String) -> Self {
24 Self {
25 api_key,
26 sent_with,
27 }
28 }
29}