fej/src/ivago/controller/mod.rs

43 lines
1.3 KiB
Rust

mod pickup_times;
mod search;
pub use pickup_times::{get_pickup_times, PickupTime};
pub use search::{search_streets, Street};
///// Return the known pickup times for the given street and/or city
/////
///// # Arguments
/////
///// * `street` - name of the street
///// * `city` - city the street is in
//pub fn get_pickup_times(street: Street, number: u32) -> Result<Vec<PickupTime>, Box<dyn Error>> {
// // The client needs to store cookies for the requests to work
// let client = reqwest::Client::builder().cookie_store(true).build()?;
// // Create post data
// let form = [
// ("garbage_type", ""),
// ("ivago_street", String::from(street).as_str()),
// ("number", format!("{}", number).as_str()),
// ("form_id", "garbage_address_form"),
// ];
// // This request just serves to populate the cookies
// client.post(BASE_URL)
// .form(&form)
// .send()?;
// let params = [
// ("_format", "json"),
// ("type", ""),
// ]
//r2 = s.get("https://www.ivago.be/nl/particulier/garbage/pick-up/pickups?",
// params={
// "_format": "json",
// "type": "",
// "start": "1622332800",
// "end": "163861328100"
// }
//}