#hku #library #authentication #booking

hkulibrary

a user-friendly client for HKU library

2 unstable releases

0.2.0 Jul 18, 2023
0.1.0 Jun 29, 2023

#212 in #library

23 downloads per month

MIT/Apache and CC-PDDC licenses

15KB
339 lines

HKULibrary

a user-friendly client for HKU Library

Usage

use hkulibrary::{LibClient,Task};

#[tokio::main]
async fn main() {
    let client = LibClient::new();
    let task = Task::new("2023-06-29","08300930","129");
    client.login("username", "password")
        .await.unwrap()
        .book(&task)
        .await.unwrap();
}

Task has a From implementation for (&str, &str, &str), so you can also do

use hkulibrary::LibClient;

#[tokio::main]
async fn main() {
    let client = LibClient::new();
    client.login("username", "password")
        .await.unwrap()
        .book(&("2023-06-29","08300930","129").into())
        .await.unwrap();
}

or

use hkulibrary::LibClient;

async fn book() -> Result<(), Box<dyn std::error::Error>> {
    let client = LibClient::new();
    client.login("username", "password")
        .await?
        .book(&("2023-06-29","08300930","129").into())
        .await?;
    Ok(())
}

TODO

  • Facilities
    • Discussion Room
    • Study Room
    • Single Study Room
  • Functions
    • Book
    • Cancel
    • Get Booked

Dependencies

~11–27MB
~384K SLoC