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]
pub fn new<S>(school: &S, code: &S) -> Result<Self, Box<Error>> where
S: ToString,
[src]
S: ToString,
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.
pub fn with_access_token<S>(school: &S, access_token: &S) -> Self where
S: ToString,
[src]
S: ToString,
Create a new Schedule
when an access token has been obtained already.
This cannot fail, so this will not return a Result
.
pub fn get_appointments(
&mut self,
start: i64,
end: i64
) -> Result<&Self, Box<Error>>
[src]
&mut self,
start: i64,
end: i64
) -> Result<&Self, Box<Error>>
Get the appointments between start
and end
from the API, and set them to self.appointments
.
Returns a reference to itself, or an error.