Add getDepartments and getHolidays

This commit is contained in:
Timo Ley 2020-01-18 23:32:28 +01:00
parent 1ad393f107
commit 9e23125522
3 changed files with 54 additions and 0 deletions

View File

@ -163,5 +163,31 @@ public class UntisClient {
}
}
/**
* Get list of departments
* @return an ArrayList of departments
* @throws APIRequestException
*/
public DepartmentResponse getDepartments() throws APIRequestException {
try {
return client.invoke("getDepartments", new Object[0], DepartmentResponse.class);
} catch (Throwable e) {
throw new APIRequestException(e);
}
}
/**
* Get list of holidays
* @return an ArrayList of holidays
* @throws APIRequestException
*/
public HolidayResponse getHolidays() throws APIRequestException {
try {
return client.invoke("getHolidays", new Object[0], HolidayResponse.class);
} catch (Throwable e) {
throw new APIRequestException(e);
}
}
}

View File

@ -0,0 +1,13 @@
package ley.untis.data;
import java.util.ArrayList;
public class DepartmentResponse extends ArrayList<DepartmentResponse.Department> {
public static class Department {
public int id;
public String name;
public String longName;
}
}

View File

@ -0,0 +1,15 @@
package ley.untis.data;
import java.util.ArrayList;
public class HolidayResponse extends ArrayList<HolidayResponse.Holiday> {
public static class Holiday {
public int id;
public String name;
public String longName;
public int startDate;
public int endDate;
}
}