Package org.dnsge.powerschoolapi.client
Class DefaultPowerschoolClient
- java.lang.Object
-
- org.dnsge.powerschoolapi.client.DefaultPowerschoolClient
-
- All Implemented Interfaces:
PowerschoolClient
public final class DefaultPowerschoolClient extends java.lang.Object implements PowerschoolClient
Client to interface with a Powerschool Student Portal- Version:
- 1.0.3
-
-
Constructor Summary
Constructors Constructor Description DefaultPowerschoolClient(java.lang.String psInstallURL)Constructor for new PowerschoolClient with a default UserAgent in the format of "powerschoolapi/{version identifier}"DefaultPowerschoolClient(java.lang.String psInstallURL, java.lang.String userAgent)Constructor for new PowerschoolClient with a UserAgent
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Userauthenticate(java.lang.String username, java.lang.String password)Logs in a user to a Powerschool Student Portalorg.jsoup.nodes.DocumentgetAs(User user, java.lang.String getUrl)Preforms a GET request with the authentication cookies of aUserobjectjava.lang.StringgetPsInstallURL()voidrefreshUser(User user)Refreshes the information of a Userjava.lang.StringtoString()java.lang.Stringurlify(java.lang.String extension)Generates a complete URL from the base install url
-
-
-
Constructor Detail
-
DefaultPowerschoolClient
public DefaultPowerschoolClient(java.lang.String psInstallURL)
Constructor for new PowerschoolClient with a default UserAgent in the format of "powerschoolapi/{version identifier}"- Parameters:
psInstallURL- Install URL of the Powerschool server
-
DefaultPowerschoolClient
public DefaultPowerschoolClient(java.lang.String psInstallURL, java.lang.String userAgent)Constructor for new PowerschoolClient with a UserAgent- Parameters:
psInstallURL- Install URL of the Powerschool serveruserAgent- UserAgent to use in requests
-
-
Method Detail
-
urlify
public java.lang.String urlify(java.lang.String extension)
Generates a complete URL from the base install url- Specified by:
urlifyin interfacePowerschoolClient- Parameters:
extension- Extension of the base install url- Returns:
- Extended URL
-
authenticate
public User authenticate(java.lang.String username, java.lang.String password) throws java.io.IOException
Logs in a user to a Powerschool Student PortalReturns a new
Userobject populated with course information- Specified by:
authenticatein interfacePowerschoolClient- Parameters:
username- Username to login withpassword- Password to login with- Returns:
Userobject- Throws:
java.io.IOException- if something goes wrong
-
refreshUser
public void refreshUser(User user) throws java.io.IOException
Refreshes the information of a User- Specified by:
refreshUserin interfacePowerschoolClient- Parameters:
user- User to update- Throws:
java.io.IOException- if something goes wrong
-
getAs
public org.jsoup.nodes.Document getAs(User user, java.lang.String getUrl)
Preforms a GET request with the authentication cookies of aUserobject- Specified by:
getAsin interfacePowerschoolClient- Parameters:
user- User object to utilizegetUrl- Non-URLified url to get- Returns:
Documentobject from GET request- See Also:
Document
-
getPsInstallURL
public java.lang.String getPsInstallURL()
- Returns:
- Powerschool Install URL
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- A
Stringformatted like"PowerschoolClient ({psInstallURL})"
-
-