public class StudIPAPI extends Object
| Constructor and Description |
|---|
StudIPAPI(String consumerKey,
String consumerSecret)
Initializes a new
StudIPAPI instance. |
| Modifier and Type | Method and Description |
|---|---|
de.femtopedia.studip.shib.CustomAccessHttpResponse |
get(String url)
Performs a HTTP GET Request.
|
String |
getAuthorizationUrl(String callback)
Retrieves a Request Token and returns a authorization URL, which you
have to open in a browser and approve access to your account.
|
Contacts |
getContacts(String userID)
Returns data about the searched user's contacts.
|
Course |
getCourse(String courseID)
Returns data about the searched course.
|
Courses |
getCourses(String userID)
Returns data about the searched user's courses.
|
Folder |
getCourseTopFolder(String courseID)
Returns the top folder object of the searched course.
|
User |
getCurrentUserData()
Returns the currently logged in user's data.
|
<T> T |
getData(String apiUrl,
Class<T> objClass)
Performs a HTTP GET Request and converts the site's content into the
given Object type using
Gson. |
Events |
getEvents(String userID)
Returns data about the searched user's events.
|
Folder |
getFolder(String folderID)
Returns the searched folder object for the given folder ID.
|
de.femtopedia.studip.shib.OAuthClient |
getOAuthClient()
Returns the currently used
OAuthClient instance. |
Schedule |
getSchedule(String userID)
Returns data about the currently logged in user's schedule.
|
Schedule |
getSchedule(String userID,
String semesterID)
Returns data about the currently logged in user's schedule.
|
Semester |
getSemester(String semesterID)
Returns data about the searched semester.
|
Semesters |
getSemesters()
Returns data about all semesters.
|
User |
getUserData(String userID)
Returns data about the searched user.
|
boolean |
isSessionValid()
Returns, whether the current session is valid or you need to re-login.
|
void |
verifyAccess(String verifyToken)
Retrieves a working Access Token and saves it.
|
public String getAuthorizationUrl(String callback) throws oauth.signpost.exception.OAuthException
callback - A callback URI or
OAuth.OUT_OF_BAND.oauth.signpost.exception.OAuthException - if any OAuth errors occurpublic void verifyAccess(String verifyToken) throws oauth.signpost.exception.OAuthException
getAuthorizationUrl(String) first and authorize in a
browser).verifyToken - The Verification Code from the Authorization process.oauth.signpost.exception.OAuthException - if any OAuth errors occurpublic de.femtopedia.studip.shib.OAuthClient getOAuthClient()
OAuthClient instance.OAuthClient instancepublic boolean isSessionValid()
throws IOException,
oauth.signpost.exception.OAuthException
IOException - if reading errors occuroauth.signpost.exception.OAuthException - if any OAuth errors occurpublic de.femtopedia.studip.shib.CustomAccessHttpResponse get(String url) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
url - The URL to getCustomAccessHttpResponse representing the resultIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic <T> T getData(String apiUrl, Class<T> objClass) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
Gson.T - The wanted Generic typeapiUrl - The URL to getobjClass - The class to cast toIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic User getCurrentUserData() throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
User objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic User getUserData(String userID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
userID - The user to search forUser objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Contacts getContacts(String userID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
userID - The user to search forContacts objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Events getEvents(String userID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
userID - The user to search forEvents objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Course getCourse(String courseID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
courseID - The course to search forCourse objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Courses getCourses(String userID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
userID - The user to search forCourses objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Folder getCourseTopFolder(String courseID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
courseID - The course to search forFolder objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Folder getFolder(String folderID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
folderID - The folder to search forFolder objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Semesters getSemesters() throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
Semesters objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Semester getSemester(String semesterID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
semesterID - The semester to search forSemester objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Schedule getSchedule(String userID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
userID - The user to search forSchedule objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurpublic Schedule getSchedule(String userID, String semesterID) throws IOException, IllegalArgumentException, IllegalAccessException, oauth.signpost.exception.OAuthException
userID - The user to search forsemesterID - The semester to search forSchedule objectIOException - if reading errors occurIllegalArgumentException - if the header values are brokenIllegalAccessException - if the session isn't validoauth.signpost.exception.OAuthException - if any OAuth errors occurCopyright © 2020. All rights reserved.