Add getSubjects method to UntisClient
This commit is contained in:
parent
16787a3fa8
commit
2b5bca72ae
|
@ -3,6 +3,7 @@ package ley.untis;
|
|||
import com.googlecode.jsonrpc4j.JsonRpcHttpClient;
|
||||
import ley.untis.data.AuthParams;
|
||||
import ley.untis.data.AuthResponse;
|
||||
import ley.untis.data.SubjectResponse;
|
||||
import ley.untis.exception.APIRequestException;
|
||||
|
||||
import java.net.URL;
|
||||
|
@ -63,5 +64,18 @@ public class UntisClient {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of subjects
|
||||
* @return an ArrayList of subjects
|
||||
* @throws APIRequestException
|
||||
*/
|
||||
public SubjectResponse getSubjects() throws APIRequestException{
|
||||
try {
|
||||
return client.invoke("getSubjects", new Object[0], SubjectResponse.class);
|
||||
} catch (Throwable e) {
|
||||
throw new APIRequestException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
17
src/main/java/ley/untis/data/SubjectResponse.java
Normal file
17
src/main/java/ley/untis/data/SubjectResponse.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package ley.untis.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SubjectResponse extends ArrayList<SubjectResponse.Subject> {
|
||||
|
||||
public static class Subject {
|
||||
public int id;
|
||||
public String name;
|
||||
public String longName;
|
||||
public String foreColor;
|
||||
public String backColor;
|
||||
public String alternateName;
|
||||
public boolean active;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue