Class OAuth2Client.Builder

java.lang.Object
com.jagrosh.jdautilities.oauth2.OAuth2Client.Builder
Enclosing interface:
OAuth2Client

public static class OAuth2Client.Builder extends Object
Builder for creating OAuth2Client instances.

At minimum, the developer must provide a valid Client ID, as well as a valid secret.

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public OAuth2Client build()
      Finalizes and builds an OAuth2Client 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

      public OAuth2Client.Builder setClientId(long clientId)
      Sets the OAuth2Client's ID.
      Parameters:
      clientId - The OAuth2Client's ID.
      Returns:
      This builder.
    • setClientSecret

      public OAuth2Client.Builder setClientSecret(String clientSecret)
      Sets the OAuth2Client's secret.
      Parameters:
      clientSecret - The OAuth2Client's secret.
      Returns:
      This builder.
    • setSessionController

      public OAuth2Client.Builder setSessionController(SessionController sessionController)
      Sets the OAuth2Client's SessionController.
      Parameters:
      sessionController - The OAuth2Client's SessionController.
      Returns:
      This builder.
    • setStateController

      public OAuth2Client.Builder setStateController(StateController stateController)
      Sets the OAuth2Client's StateController.
      Parameters:
      stateController - The OAuth2Client's StateController.
      Returns:
      This builder.
    • setOkHttpClient

      public OAuth2Client.Builder setOkHttpClient(okhttp3.OkHttpClient client)
      Sets the client's internal OkHttpClient used for all requests and interactions with Discord.
      Parameters:
      client - The OAuth2Client's OkHttpClient.
      Returns:
      This builder.