Package de.florianmichael.classic4j
Class ClassiCubeHandler
java.lang.Object
de.florianmichael.classic4j.ClassiCubeHandler
This class provides methods to interact with the ClassiCube API.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidrequestAuthentication(CCAccount account, String loginCode, LoginProcessHandler processHandler) Authenticates the given account with the given login code.static voidrequestServerInfo(CCAccount account, String serverHash, Consumer<CCServerList> complete) Requests the ClassiCube server list and returns it as aCCServerListobject.static voidrequestServerInfo(CCAccount account, String serverHash, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer) Requests the ClassiCube server list and returns it as aCCServerListobject.static voidrequestServerInfo(CCAccount account, List<String> serverHashes, Consumer<CCServerList> complete) Requests the ClassiCube server list and returns it as aCCServerListobject.static voidrequestServerInfo(CCAccount account, List<String> serverHashes, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer) Requests the ClassiCube server list and returns it as aCCServerListobject.static voidrequestServerList(CCAccount account, Consumer<CCServerList> complete) Requests the ClassiCube server list and returns it as aCCServerListobject.static voidrequestServerList(CCAccount account, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer) Requests the ClassiCube server list and returns it as aCCServerListobject.
-
Field Details
-
GSON
public static final com.google.gson.Gson GSON -
CLASSICUBE_ROOT_URI
The URI to the ClassiCube root. -
AUTHENTICATION_URI
-
SERVER_INFO_URI
-
SERVER_LIST_INFO_URI
-
-
Constructor Details
-
ClassiCubeHandler
public ClassiCubeHandler()
-
-
Method Details
-
requestServerList
Requests the ClassiCube server list and returns it as aCCServerListobject.- Parameters:
account- The account to use for the request.complete- The consumer that will be called when the request is complete.
-
requestServerList
public static void requestServerList(CCAccount account, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer) Requests the ClassiCube server list and returns it as aCCServerListobject.- Parameters:
account- The account to use for the request.complete- The consumer that will be called when the request is complete.throwableConsumer- The consumer that will be called when an error occurs.
-
requestServerInfo
public static void requestServerInfo(CCAccount account, String serverHash, Consumer<CCServerList> complete) Requests the ClassiCube server list and returns it as aCCServerListobject.- Parameters:
account- The account to use for the request.serverHash- The server hash to request.complete- The consumer that will be called when the request is complete.
-
requestServerInfo
public static void requestServerInfo(CCAccount account, String serverHash, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer) Requests the ClassiCube server list and returns it as aCCServerListobject.- Parameters:
account- The account to use for the request.serverHash- The server hash to request.complete- The consumer that will be called when the request is complete.throwableConsumer- The consumer that will be called when an error occurs.
-
requestServerInfo
public static void requestServerInfo(CCAccount account, List<String> serverHashes, Consumer<CCServerList> complete) Requests the ClassiCube server list and returns it as aCCServerListobject.- Parameters:
account- The account to use for the request.serverHashes- The server hashes to request.complete- The consumer that will be called when the request is complete.
-
requestServerInfo
public static void requestServerInfo(CCAccount account, List<String> serverHashes, Consumer<CCServerList> complete, Consumer<Throwable> throwableConsumer) Requests the ClassiCube server list and returns it as aCCServerListobject.- Parameters:
account- The account to use for the request.serverHashes- The server hashes to request.complete- The consumer that will be called when the request is complete.throwableConsumer- The consumer that will be called when an error occurs.
-
requestAuthentication
public static void requestAuthentication(CCAccount account, String loginCode, LoginProcessHandler processHandler) Authenticates the given account with the given login code. TheLoginProcessHandlerwill be called when the login process is complete. If the login process fails, theLoginProcessHandler.handleException(Throwable)method will be called. If the login process requires MFA, theLoginProcessHandler.handleMfa(CCAccount)method will be called. If the login process is successful, theLoginProcessHandler.handleSuccessfulLogin(CCAccount)method will be called. If the login process is successful, the account will be updated with the new token. If it is the first login, the loginCode parameter can be null. To authenticate an account with MFA, you call this method twice, once with null as loginCode and once with the MFA code you received.- Parameters:
account- The account to authenticate.loginCode- The login code to use.processHandler- The handler to use for the login process.
-