feat: working reservation api

This commit is contained in:
Jef Roosens 2023-05-11 21:35:28 +02:00
parent 0deb67478f
commit 0d144f3b61
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
3 changed files with 31 additions and 11 deletions

View file

@ -1,4 +1,4 @@
use affluences_api::AffluencesClient;
use affluences_api::{AffluencesClient, Reservation};
use chrono::NaiveDate;
use uuid::{uuid, Uuid};
@ -10,9 +10,29 @@ async fn main() {
// let res = client.site_data(site).await.unwrap();
let date = NaiveDate::from_ymd_opt(2023, 5, 12).unwrap();
let res = client
.available(id, NaiveDate::from_ymd_opt(2023, 5, 11).unwrap(), 1)
.available(id, date, 1)
.await
.unwrap();
println!("{:?}", res);
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);
}