Start ivago calendar endpoint

This commit is contained in:
Jef Roosens 2021-03-21 16:18:53 +01:00
parent b42ea850cd
commit c6d29f329c
Signed by: Jef Roosens
GPG key ID: B580B976584B5F30
5 changed files with 66 additions and 14 deletions

View file

@ -1,5 +1,7 @@
mod search;
mod pickup_times;
pub use search::{Street, search_streets};
pub use pickup_times::{get_pickup_times, PickupTime};
///// Return the known pickup times for the given street and/or city

View file

@ -1,19 +1,27 @@
use std::error::Error;
use chrono::NaiveDate;
use super::search::Street;
const BASE_URL: &str = "https://www.ivago.be/nl/particulier/afval/ophaling";
/// Represents a timezoneless date
pub struct Date {
day: u8,
month: u8,
year: u32,
}
/// Represents a pickup time instance. All fields are a direct map of the
/// original API
pub struct PickupTime {
date: Date,
date: NaiveDate,
label: String,
classes: Vec<String>,
url: String
}
pub fn get_pickup_times(
street: Street,
number: u64,
start_date: NaiveDate,
end_date: NaiveDate
) -> Result<Vec<PickupTime>, Box<dyn Error>> {
Ok(Vec::new())
}