Package com.mrivanplays.jdoa2
Interface SessionManager
- All Known Implementing Classes:
SessionManagerImpl
public interface SessionManager
Represents a session manager, for managing
JDOA2 instances, used by your application.-
Method Summary
Modifier and TypeMethodDescriptionstatic SessionManagerBuilderbuilder()Creates a newSessionManagerBuilderokhttp3.OkHttpClientReturns theObjectMapper, used to read json from discord api responses.com.fasterxml.jackson.databind.ObjectMapperReturns theObjectMapper, used to read json from discord api responses.default JDOA2getOrCreateSession(String authCode) Returns aJDOA2session, fresh created if didn't exist, retrieved otherwise.getSession(String authCode) newSession(String authCode) Creates a newJDOA2session for the specifiedauthCode.
-
Method Details
-
builder
Creates a newSessionManagerBuilder- Returns:
- builder
-
getSessions
Returns unmodifiableMap, holding all managedJDOA2instances, key being theauthCodespecified when creating the session.- Returns:
- map with managed
JDOA2instances
-
newSession
Creates a newJDOA2session for the specifiedauthCode. You can seeApplicationInfo.getAuthCode()for information about thatauthCode.- Parameters:
authCode- auth code- Returns:
- fresh new jdoa2 session
- Throws:
IllegalArgumentException- if session with such code already exists.
-
getSession
- Parameters:
authCode- auth code of the session you want to retrieve- Returns:
- session if exists, optional empty otherwise
-
getOrCreateSession
Returns aJDOA2session, fresh created if didn't exist, retrieved otherwise.- Parameters:
authCode- auth code of the session- Returns:
- new session or retrieved session
-
getHttpClient
Returns theObjectMapper, used to read json from discord api responses.- Returns:
- json mapper
-
getJsonMapper
Returns theObjectMapper, used to read json from discord api responses.- Returns:
- json mapper
-