Interface SessionManager

All Known Implementing Classes:
SessionManagerImpl

public interface SessionManager
Represents a session manager, for managing JDOA2 instances, used by your application.
  • Method Details

    • builder

      @Nonnull static SessionManagerBuilder builder()
      Creates a new SessionManagerBuilder
      Returns:
      builder
    • getSessions

      @Nonnull Map<String,JDOA2> getSessions()
      Returns unmodifiable Map, holding all managed JDOA2 instances, key being the authCode specified when creating the session.
      Returns:
      map with managed JDOA2 instances
    • newSession

      @Nonnull JDOA2 newSession(@Nonnull String authCode)
      Creates a new JDOA2 session for the specified authCode. You can see ApplicationInfo.getAuthCode() for information about that authCode.
      Parameters:
      authCode - auth code
      Returns:
      fresh new jdoa2 session
      Throws:
      IllegalArgumentException - if session with such code already exists.
    • getSession

      Optional<JDOA2> getSession(@Nonnull String authCode)
      Returns an Optional, which may hold a JDOA2 session, identified by the authCode specified, if any.
      Parameters:
      authCode - auth code of the session you want to retrieve
      Returns:
      session if exists, optional empty otherwise
    • getOrCreateSession

      @Nonnull default JDOA2 getOrCreateSession(@Nonnull String authCode)
      Returns a JDOA2 session, fresh created if didn't exist, retrieved otherwise.
      Parameters:
      authCode - auth code of the session
      Returns:
      new session or retrieved session
    • getHttpClient

      @Nonnull okhttp3.OkHttpClient getHttpClient()
      Returns the ObjectMapper, used to read json from discord api responses.
      Returns:
      json mapper
    • getJsonMapper

      @Nonnull com.fasterxml.jackson.databind.ObjectMapper getJsonMapper()
      Returns the ObjectMapper, used to read json from discord api responses.
      Returns:
      json mapper