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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionStarts a OAuth2 token exchange process.Refreshes an existing OAuth2 token, or if none found, callsJDOA2.doTokenExchange().Returns theApplicationInfoReturns the token this JDOA2 instance has last cached.com.github.natanbc.reliqua.request.PendingRequest<CurrentUser>RetrievesCurrentUserinformation, returningPendingRequest.okhttp3.OkHttpClientReturns theOkHttpClient, used to handle requests.com.fasterxml.jackson.databind.ObjectMapperReturns theObjectMapper, used to read json from discord api responses.booleanReturns whenever the token we have is valid or not.Methods inherited from class com.github.natanbc.reliqua.Reliqua
createRequest, createRequest, getClient, getRateLimiter, getRateLimiterFactory, isTrackingCallSites, setTrackCallSitesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mrivanplays.jdoa2.JDOA2
getGuildIconUrl, getUserAvatarUrl
-
Constructor Details
-
JDOA2Impl
-
-
Method Details
-
doTokenExchange
Description copied from interface:JDOA2Starts 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:
doTokenExchangein interfaceJDOA2- Returns:
- token object
- See Also:
-
doTokenExchangeUsingRefreshToken
Description copied from interface:JDOA2Refreshes 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:
doTokenExchangeUsingRefreshTokenin interfaceJDOA2- Returns:
- token object
- See Also:
-
getCurrentToken
Description copied from interface:JDOA2Returns the token this JDOA2 instance has last cached.- Specified by:
getCurrentTokenin interfaceJDOA2- Returns:
- last token
-
isCurrentTokenValid
public boolean isCurrentTokenValid()Description copied from interface:JDOA2Returns 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:
isCurrentTokenValidin interfaceJDOA2- Returns:
trueif valid,falseotherwise
-
getCurrentUser
Description copied from interface:JDOA2RetrievesCurrentUserinformation, 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:
getCurrentUserin interfaceJDOA2- Returns:
- pending request, containing current user information
- See Also:
-
PendingRequestCurrentUser
-
getCurrentUserGuilds
Description copied from interface:JDOA2Retrieves aListofGuilds, which theCurrentUserhas 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:
getCurrentUserGuildsin interfaceJDOA2- Returns:
- pending request, containing guilds information
- See Also:
-
PendingRequestGuild
-
getHttpClient
Description copied from interface:JDOA2Returns theOkHttpClient, used to handle requests.- Specified by:
getHttpClientin interfaceJDOA2- Returns:
- http client
-
getJsonMapper
Description copied from interface:JDOA2Returns theObjectMapper, used to read json from discord api responses.- Specified by:
getJsonMapperin interfaceJDOA2- Returns:
- json mapper
-
getApplicationInfo
Description copied from interface:JDOA2Returns theApplicationInfo- Specified by:
getApplicationInfoin interfaceJDOA2- Returns:
- application info
- See Also:
-