Class AgentApiBuilder

java.lang.Object
dev.jacrispys.JavaBot.api.libs.AgentApiBuilder

public class AgentApiBuilder extends Object
Builds a AgentApi instance to interact with the API.
  • Field Details

    • authToken

      @Nullable protected @Nullable String authToken
    • userId

      protected long userId
    • developerKey

      @Nullable protected @Nullable String developerKey
    • clientOptions

      @Nullable protected @Nullable AgentOptions clientOptions
  • Method Details

    • createClient

      @CheckReturnValue public static AgentApiBuilder createClient(@Nullable @Nullable String authToken)
      Parameters:
      authToken - token to authenticate to the server with
      Returns:
      new instance of the class to allow setting other variables.
    • setUserId

      public AgentApiBuilder setUserId(long userId)
      Parameters:
      userId - Discord user ID to link the User to the API
      Returns:
      current instance of the class to allow setting of other variables.
    • setDeveloperKey

      public AgentApiBuilder setDeveloperKey(String developerKey)
      Parameters:
      developerKey - alternate token that verifies credentials for developer access
      Returns:
      current instance of the class to allow setting of other variables.
    • setOptions

      public AgentApiBuilder setOptions(AgentOptions options)
      Parameters:
      options - advanced configuration options for the API (WIP)
      Returns:
      current instance of the class to allow setting of other variables.
    • build

      Builds all previous configurations into one instance of the API
      Returns:
      instance of the API
      Throws:
      AuthorizationException - if the user's token is not valid
      LoginException - if logging into DiscordAPI fails
      SQLException - if a database error occurs
      InterruptedException - if logging into the database fails
      ExecutionException - if obtaining a SqlInstanceManager fails.