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 SessionManagerBuilder
builder()
Creates a newSessionManagerBuilder
okhttp3.OkHttpClient
Returns theObjectMapper
, used to read json from discord api responses.com.fasterxml.jackson.databind.ObjectMapper
Returns theObjectMapper
, used to read json from discord api responses.default JDOA2
getOrCreateSession
(String authCode) Returns aJDOA2
session, fresh created if didn't exist, retrieved otherwise.getSession
(String authCode) newSession
(String authCode) Creates a newJDOA2
session for the specifiedauthCode
.
-
Method Details
-
builder
Creates a newSessionManagerBuilder
- Returns:
- builder
-
getSessions
Returns unmodifiableMap
, holding all managedJDOA2
instances, key being theauthCode
specified when creating the session.- Returns:
- map with managed
JDOA2
instances
-
newSession
Creates a newJDOA2
session 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 aJDOA2
session, 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
-