Package com.jagrosh.jdautilities.oauth2
Class OAuth2Client.Builder
java.lang.Object
com.jagrosh.jdautilities.oauth2.OAuth2Client.Builder
- Enclosing interface:
OAuth2Client
Builder for creating OAuth2Client instances.
At minimum, the developer must provide a valid Client ID, as well as a valid secret.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finalizes and builds anOAuth2Client
instance using this builder.setClientId
(long clientId) Sets the OAuth2Client's ID.setClientSecret
(String clientSecret) Sets the OAuth2Client's secret.setOkHttpClient
(okhttp3.OkHttpClient client) Sets the client's internalOkHttpClient
used for all requests and interactions with Discord.setSessionController
(SessionController sessionController) Sets the OAuth2Client'sSessionController
.setStateController
(StateController stateController) Sets the OAuth2Client'sStateController
.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Finalizes and builds anOAuth2Client
instance using this builder.- Returns:
- The OAuth2Client instance build.
- Throws:
IllegalArgumentException
- If either:- The Client ID is not valid.
- The Client Secret is empty.
-
setClientId
Sets the OAuth2Client's ID.- Parameters:
clientId
- The OAuth2Client's ID.- Returns:
- This builder.
-
setClientSecret
Sets the OAuth2Client's secret.- Parameters:
clientSecret
- The OAuth2Client's secret.- Returns:
- This builder.
-
setSessionController
Sets the OAuth2Client'sSessionController
.- Parameters:
sessionController
- The OAuth2Client's SessionController.- Returns:
- This builder.
-
setStateController
Sets the OAuth2Client'sStateController
.- Parameters:
stateController
- The OAuth2Client's StateController.- Returns:
- This builder.
-
setOkHttpClient
Sets the client's internalOkHttpClient
used for all requests and interactions with Discord.- Parameters:
client
- The OAuth2Client's OkHttpClient.- Returns:
- This builder.
-