Compare commits

..

No commits in common. "e8e73e9afe27bcf31fc0ef0b32b0370ac46d083a" and "b89a0a4192ef7ba871c2056abfa3ce0a4e1ff84c" have entirely different histories.

10 changed files with 0 additions and 1334 deletions

26
.gitignore vendored
View File

@ -1,26 +0,0 @@
# Created by https://www.toptal.com/developers/gitignore/api/rust,rust-analyzer
# Edit at https://www.toptal.com/developers/gitignore?templates=rust,rust-analyzer
### Rust ###
# Generated by Cargo
# will have compiled files and executables
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
# Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
### rust-analyzer ###
# Can be generated by other build systems other than cargo (ex: bazelbuild/rust_rules)
rust-project.json
# End of https://www.toptal.com/developers/gitignore/api/rust,rust-analyzer

1178
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
[workspace]
members = [
"affluences-api",
"bot",
]

View File

@ -1,26 +0,0 @@
curl -L 'https://api.affluences.com/app/v3/sites/ghent-university' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0'
returnt lijst van alle bibliotheken op ugent, inclusief de uuids die dan nodig zijn om de specifieke requests te sturen naar die bib zijn stuff
curl -L 'https://api.affluences.com/app/v3/timetables/4737e57a-ee05-4f7b-901a-7bb541eeb297?offset=0' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0'
returnt de time table voor die bib
https://reservation.affluences.com/api/sites/4737e57a-ee05-4f7b-901a-7bb541eeb297
Basisinformatie voor s5 bib
https://reservation.affluences.com/api/resources/4737e57a-ee05-4f7b-901a-7bb541eeb297?type=1
returnt lijst van mogelijke lokalen voor s5
https://reservation.affluences.com/api/resources/4737e57a-ee05-4f7b-901a-7bb541eeb297/available?date=2023-05-11&type=1
returnt momenten die nog vrij zijn voor gegeven datum
pretty sure da die type 1 slaat op da et een bib is
https://api.affluences.com/app/v3/sites
body: {"selected_categories":[1],"page":0,"search_query":"university of ghent"}
zoek op alle mogelijke bibs, met een search query

View File

@ -1,10 +0,0 @@
[package]
name = "affluences-api"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
reqwest = { version = "0.11.17", features = ["json"] }
serde = { version = "1.0.163", features = ["derive"] }

View File

@ -1,22 +0,0 @@
mod models;
use models::Resource;
const USER_AGENT: &str = "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0";
pub struct AffluencesClient {
client: reqwest::Client,
}
impl AffluencesClient {
pub fn new() -> Self {
Self {
client: reqwest::Client::builder()
.user_agent(USER_AGENT).build().unwrap(),
}
}
pub async fn available(&mut self) -> reqwest::Result<Vec<Resource>> {
self.client.get("https://reservation.affluences.com/api/resources/026b8caa-d310-464f-b714-4c21a2cf98ea/available?date=2023-05-11&type=1").send().await?.json::<Vec<Resource>>().await
}
}

View File

@ -1,40 +0,0 @@
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Debug)]
pub struct Hour {
pub hour: String,
pub state: u32,
// reservations
pub granularity: u32,
pub person_count: u32,
pub places_available: u32,
pub places_bookable: u32,
}
#[derive(Deserialize, Debug)]
pub struct Resource {
pub resource_id: u32,
pub resource_name: String,
pub resource_type: u32,
pub granularity: u32,
pub time_slot_count: u32,
pub static_time_slot: bool,
// reservations_by_timeslot
pub note_available: bool,
pub note_required: bool,
pub note_description: String,
pub description: String,
pub capacity: u32,
pub site_timezone: String,
pub user_name_required: bool,
pub user_phone_required: bool,
pub user_name_available: bool,
pub user_phone_available: bool,
// time_before_reservations_closed
// min_places_per_reservation
// max_places_per_reservation
pub image_url: Option<String>,
// services
pub slots_state: u32,
pub hours: Vec<Hour>,
}

View File

@ -1,10 +0,0 @@
[package]
name = "bot"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
affluences-api = { path = "../affluences-api" }
tokio = { version = "1.28.1", features = ["full"] }

View File

@ -1,8 +0,0 @@
use affluences_api::AffluencesClient;
#[tokio::main]
async fn main() {
let mut client = AffluencesClient::new();
let res = client.available().await.unwrap();
println!("{:?}", res);
}

View File

@ -1,8 +0,0 @@
use reqwest;
type Response = Vec<Resource>;
fn main() {
let res = reqwest::blocking::get("https://reservation.affluences.com/api/resources/026b8caa-d310-464f-b714-4c21a2cf98ea/available?date=2023-05-11&type=1").unwrap().json::<Response>().unwrap();
println!("{:?}", res);
}