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
mod macros;
pub mod cum;
pub mod daily;
pub mod hosp;
pub mod refug;
type Result<T> = std::result::Result<T, CrateError>;
const BASE_URL: &'static str = "https://covid-19-greece.herokuapp.com";
#[derive(Debug, Clone, PartialEq)]
enum CrateError {
SerialError,
HttpError,
}
pub(crate) fn build_request(url_suffix: &str) -> String {
let body: String = ureq::get(format!("{}/{}", BASE_URL, url_suffix).as_str())
.set("Accept", "application/json")
.call()
.expect("http error")
.into_string()
.expect("serializaton error");
body
}