14 unstable releases (3 breaking)
Uses old Rust 2015
0.4.1 | Mar 29, 2018 |
---|---|
0.4.0 | Mar 13, 2018 |
0.3.1 | Mar 6, 2018 |
0.3.0 | Nov 27, 2017 |
0.1.8 | Nov 10, 2017 |
#72 in #schedule
33 downloads per month
19KB
250 lines
zermelo-rs
A Rust crate that retrieves a schedule from Zermelo.
Documentation
You can find the documentation here: docs.rs/zermelo. This also contains some examples.
Examples
See examples/ for some example programs using this crate. To run the examples on your machine:
$ git clone https://github.com/splintah/zermelo-rs.git
$ cd zermelo-rs/
$ cargo run --example schedule
Disclaimer
This crate is not affiliated with Zermelo Software B.V. It only uses its API for retrieving a schedule.
lib.rs
:
This is a crate that can be used to retrieve a schedule from Zermelo. The goal of this crate is to be easy to use, whilst also being powerful.
Examples
Obtaining an access token
let school = "example";
let code = "123456789012";
let schedule = zermelo::Schedule::new(&school, &code).unwrap();
println!("Your access token is: {}", schedule.access_token);
You have now successfully obtained an access token, so you can continue with Retrieving a schedule.
Creating schedule with an access token
let school = "example";
let access_token = "abcdefghijklmnopqrstuvwxyz";
let schedule = zermelo::Schedule::with_access_token(&school, &access_token);
You can continue with Retrieving a schedule.
Retrieving a schedule
This example assumes you have got a mutable variable named schedule
, obtained with one of the above methods.
Before running this with the properties found in the Zermelo portal, set start
and end
to something else.
I recommend using chrono to get today's time.
// These should be set to something else.
let start: i64 = 0;
let end: i64 = 10;
// Get schedule.
schedule.get_appointments(start, end).unwrap();
// Print schedule.
for appointment in schedule.appointments {
println!("{:?}", appointment);
}
See Schedule for the Schedule struct and its members.
Dependencies
~15–24MB
~425K SLoC