Package com.mrivanplays.jdoa2.internal
Class JDOA2Impl
java.lang.Object
com.github.natanbc.reliqua.Reliqua
com.mrivanplays.jdoa2.internal.JDOA2Impl
- All Implemented Interfaces:
JDOA2
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionStarts a OAuth2 token exchange process.Refreshes an existing OAuth2 token, or if none found, callsJDOA2.doTokenExchange()
.Returns theApplicationInfo
Returns the token this JDOA2 instance has last cached.com.github.natanbc.reliqua.request.PendingRequest<CurrentUser>
RetrievesCurrentUser
information, returningPendingRequest
.okhttp3.OkHttpClient
Returns theOkHttpClient
, used to handle requests.com.fasterxml.jackson.databind.ObjectMapper
Returns theObjectMapper
, used to read json from discord api responses.boolean
Returns whenever the token we have is valid or not.Methods inherited from class com.github.natanbc.reliqua.Reliqua
createRequest, createRequest, getClient, getRateLimiter, getRateLimiterFactory, isTrackingCallSites, setTrackCallSites
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mrivanplays.jdoa2.JDOA2
getGuildIconUrl, getUserAvatarUrl
-
Constructor Details
-
JDOA2Impl
-
-
Method Details
-
doTokenExchange
Description copied from interface:JDOA2
Starts a OAuth2 token exchange process. You may want to call this right after you receive a instance of this class in order for the application to interact with discord api to provide you information.WARNING: This is a thread blocking method, it may block the thread if the application is rate limited by discord api. CONSIDER RUNNING ASYNCHRONOUSLY!!!!
- Specified by:
doTokenExchange
in interfaceJDOA2
- Returns:
- token object
- See Also:
-
doTokenExchangeUsingRefreshToken
Description copied from interface:JDOA2
Refreshes an existing OAuth2 token, or if none found, callsJDOA2.doTokenExchange()
. You may want to call this hand in hand withJDOA2.isCurrentTokenValid()
in order for the wrapper to have a working access token.WARNING: This is a thread blocking method, it may block the thread if the application is rate limited by discord api. CONSIDER RUNNING ASYNCHRONOUSLY!!!!
- Specified by:
doTokenExchangeUsingRefreshToken
in interfaceJDOA2
- Returns:
- token object
- See Also:
-
getCurrentToken
Description copied from interface:JDOA2
Returns the token this JDOA2 instance has last cached.- Specified by:
getCurrentToken
in interfaceJDOA2
- Returns:
- last token
-
isCurrentTokenValid
public boolean isCurrentTokenValid()Description copied from interface:JDOA2
Returns whenever the token we have is valid or not. You may want to check this every time before using any of the information receiver methods, and if the token isn't valid you may want to callJDOA2.doTokenExchangeUsingRefreshToken()
.- Specified by:
isCurrentTokenValid
in interfaceJDOA2
- Returns:
true
if valid,false
otherwise
-
getCurrentUser
Description copied from interface:JDOA2
RetrievesCurrentUser
information, returningPendingRequest
.Caching is recommended in order to not hit discord's rate limits. Due to the nature of the api, we currently cannot apply caching.
- Specified by:
getCurrentUser
in interfaceJDOA2
- Returns:
- pending request, containing current user information
- See Also:
-
PendingRequest
CurrentUser
-
getCurrentUserGuilds
Description copied from interface:JDOA2
Retrieves aList
ofGuilds
, which theCurrentUser
has joined in, returningPendingRequest
. Requires "guilds" scope.Caching is recommended in order to not hit discord's rate limits. Due to the nature of the api, we currently cannot apply caching.
- Specified by:
getCurrentUserGuilds
in interfaceJDOA2
- Returns:
- pending request, containing guilds information
- See Also:
-
PendingRequest
Guild
-
getHttpClient
Description copied from interface:JDOA2
Returns theOkHttpClient
, used to handle requests.- Specified by:
getHttpClient
in interfaceJDOA2
- Returns:
- http client
-
getJsonMapper
Description copied from interface:JDOA2
Returns theObjectMapper
, used to read json from discord api responses.- Specified by:
getJsonMapper
in interfaceJDOA2
- Returns:
- json mapper
-
getApplicationInfo
Description copied from interface:JDOA2
Returns theApplicationInfo
- Specified by:
getApplicationInfo
in interfaceJDOA2
- Returns:
- application info
- See Also:
-