Constructs a new EskomCalendar using the provided custom server
Constructs a new EskomCalendar using the default reference server
Get all the areas
Get all areas matching a given regular expression
Get schedules from a given area
Gets schedules from a given time
Gets schedules up until a given time
Gets any schedules in the given area that would be valid for the 24 hours of today's date
Get the schedules that will occur within today's 24 hours in the western-cape-worscester area
EskomCalendar calendar = new EskomCalendar(); try { Schedule[] schedules = calendar.getTodaySchedules("western-cape-worscester"); foreach(Schedule schedule; schedules) { writeln("Today: "~schedule.toString()); } } catch(EskomCalendarException e) { writeln("Crashed with '"~e.toString()~"'"); assert(false); }
Get the first 10 areas and then all schedules of each said area
EskomCalendar calendar = new EskomCalendar(); /** * Get all areas available * and take a subset of them */ string[] areas = calendar.getAreas()[0..10]; /** * Get the schedules per-each of them */ foreach(string area; areas) { Schedule[] schedules = calendar.getSchedules(area); }
Get the schedules for the western-cape-worscester area
EskomCalendar calendar = new EskomCalendar(); try { Schedule[] schedules = calendar.getSchedules("western-cape-worscester"); assert(schedules.length > 5); foreach(Schedule schedule; schedules) { writeln(schedule); } } catch(EskomCalendarException e) { writeln("Crashed with '"~e.toString()~"'"); assert(false); }
Get all areas
EskomCalendar calendar = new EskomCalendar(); try { string[] areas = calendar.getAreas(); writeln(areas); assert(areas.length > 40); } catch(EskomCalendarException e) { writeln("Crashed with '"~e.toString()~"'"); assert(false); }
Test failing network connection
EskomCalendar calendar = new EskomCalendar("http://sdhjdshkjdas.com"); try { calendar.getAreas(); assert(false); } catch(EskomCalendarException e) { assert(e.getError() == ErrType.NETWORK_ERROR); }
Client API wrapper for the eskom-calendar service