affluence/bot/src/main.rs

39 lines
1.2 KiB
Rust
Raw Normal View History

2023-05-11 21:35:28 +02:00
use affluences_api::{AffluencesClient, Reservation};
2023-05-11 14:36:07 +02:00
use chrono::NaiveDate;
2023-05-11 15:49:05 +02:00
use uuid::{uuid, Uuid};
2023-05-11 09:30:25 +02:00
#[tokio::main]
async fn main() {
2023-05-11 15:49:05 +02:00
let site = "faculty-library-sciences";
let id: Uuid = uuid!("4737e57a-ee05-4f7b-901a-7bb541eeb297");
2023-05-11 09:30:25 +02:00
let mut client = AffluencesClient::new();
2023-05-11 14:36:07 +02:00
2023-05-11 15:49:05 +02:00
// let res = client.site_data(site).await.unwrap();
2023-05-11 21:35:28 +02:00
let date = NaiveDate::from_ymd_opt(2023, 5, 12).unwrap();
2023-05-11 15:49:05 +02:00
let res = client
2023-05-11 21:35:28 +02:00
.available(id, date, 1)
2023-05-11 15:49:05 +02:00
.await
.unwrap();
2023-05-11 21:35:28 +02:00
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);
2023-05-11 22:03:32 +02:00
// let res2 = client.make_reservation(first.resource_id, &reservation).await;
// println!("{:?}", res2);
2023-05-11 09:30:25 +02:00
}