hkulibrary

Crates.iohkulibrary
lib.rshkulibrary
version0.2.0
sourcesrc
created_at2023-06-29 13:31:32.81478
updated_at2023-07-18 11:13:20.582985
descriptiona user-friendly client for HKU library
homepagehttps://github.com/adlsdztony/hkulibrary
repositoryhttps://github.com/adlsdztony/hkulibrary
max_upload_size
id903291
size14,897
Zilong Zhou (adlsdztony)

documentation

README

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
Commit count: 6

cargo fmt