get method
Implementation
Future<List> get(DateTime startDate, DateTime endDate, {user = "~me"}) async {
final response = await http.get(ZermeloUtil.createApiURL(
this.school,
"appointments?user=$user&start=${(startDate.millisecondsSinceEpoch / 1000).round()}&end=${(endDate.millisecondsSinceEpoch / 1000).round()}",
this.accessToken));
if (response.statusCode == 200) {
return json
.decode(response.body)['response']['data']
.map((appointment) => Appointment.fromJson(appointment))
.toList();
} else {
print(
"Server returned with an error ${response.statusCode} (${response.body})");
throw Exception('Failed to load appointments');
}
}