public Promise<Timetable, Void, Void> getTimetable(final LocalDate weekStart) {
String endpoint = "/Timetables?weekStart=" + weekStart.toString("yyyy-MM-dd");
return getObject(endpoint, "Timetable", Timetable.class);
}
public <T> Promise<T, Void, Void> getObject(String endpoint, final String topLevelName, final Class<T> clazz) {
<BUG>final Deferred<T, Void, Void> deferred = new DeferredObject<>();
APIRequest(endpoint).done(new DoneCallback<JSONObject>() {
</BUG>
@Override
<BUG>public void onDone(JSONObject json) {

T result = parseObject(json.toString(), topLevelName, clazz);

deferred.resolve(result);</BUG>
}

public Promise<Timetable, Void, Void> getTimetable(final LocalDate weekStart) {
String endpoint = "/Timetables?weekStart=" + weekStart.toString("yyyy-MM-dd");
return getObject(endpoint, "Timetable", Timetable.class);
}
public <T> Promise<T, Void, Void> getObject(String endpoint, final String topLevelName, final Class<T> clazz) {
return APIRequest(endpoint).then(new DoneFilter<JSONObject, T>() {
@Override
public T filterDone(JSONObject json) {
return parseObject(json.toString(), topLevelName, clazz);
}
