Struct zermelo::Schedule
[−]
[src]
pub struct Schedule { pub school: String, pub access_token: String, pub appointments: Vec<Appointment>, }
This struct represents the schedule, containing Appointments.
Fields
school: String
The school id used in the URL.
For the school id of 'example', this URL will be: https://example.zportal.nl/
.
access_token: String
The access token obtained from the API, used to obtain appointments.
appointments: Vec<Appointment>
A vector of the appointments.
Methods
impl Schedule
[src]
fn new(school: String, code: String) -> Result<Self, String>
[src]
Create a new Schedule
from an authorization code (only once usable) and a school identifier.
This will get the access token from the API.
Returns a Schedule
or an error.
fn with_access_token(school: String, access_token: String) -> Self
[src]
Create a new Schedule
when an access token has been obtained already.
This cannot fail, so this will not return a Result
.
fn get_appointments(&mut self, start: i64, end: i64) -> Result<&Self, String>
[src]
Get the appointments between start
and end
from the API, and set them to self.appointments
.
Returns a reference to itself, or an error.