Crate zermelo [] [src]

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.

Structs

Appointment

This struct represents an appointment in the schedule. It should (more or less) match Zermelo's appointment specification.

Schedule

This struct represents the schedule, containing Appointments.

Enums

AppointmentType

You can use this enum to parse Appointment.appointment_type. This is done to make matching easier.