39 lines
1.2 KiB
Rust
39 lines
1.2 KiB
Rust
use affluences_api::{AffluencesClient, Reservation};
|
|
use chrono::NaiveDate;
|
|
use uuid::{uuid, Uuid};
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
let site = "faculty-library-sciences";
|
|
let id: Uuid = uuid!("4737e57a-ee05-4f7b-901a-7bb541eeb297");
|
|
let mut client = AffluencesClient::new();
|
|
|
|
// let res = client.site_data(site).await.unwrap();
|
|
|
|
let date = NaiveDate::from_ymd_opt(2023, 5, 12).unwrap();
|
|
let res = client
|
|
.available(id, date, 1)
|
|
.await
|
|
.unwrap();
|
|
let first = res.first().unwrap();
|
|
let hour = first.hours[0];
|
|
let reservation = Reservation{
|
|
auth_type: None,
|
|
email: String::from("mark.verbeken@ugent.be"),
|
|
date: date,
|
|
start_time: hour.hour,
|
|
end_time: hour.hour + chrono::Duration::minutes(30),
|
|
note: String::from("hello"),
|
|
user_firstname: String::from("Mark"),
|
|
user_lastname: String::from("Verbeken"),
|
|
user_phone: None,
|
|
person_count: 1
|
|
};
|
|
println!("{:?}", first);
|
|
println!("{:?}", hour);
|
|
println!("{:?}", reservation);
|
|
|
|
// let res2 = client.make_reservation(first.resource_id, &reservation).await;
|
|
// println!("{:?}", res2);
|
|
}
|