Package dev.jacrispys.JavaBot.api.libs
Class AgentApiBuilder
java.lang.Object
dev.jacrispys.JavaBot.api.libs.AgentApiBuilder
Builds a
AgentApi
instance to interact with the API.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected @Nullable String
protected @Nullable AgentOptions
protected @Nullable String
protected long
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds all previous configurations into one instance of the APIstatic AgentApiBuilder
createClient
(@Nullable String authToken) setDeveloperKey
(String developerKey) setOptions
(AgentOptions options) setUserId
(long userId)
-
Field Details
-
authToken
-
userId
protected long userId -
developerKey
-
clientOptions
-
-
Method Details
-
createClient
- Parameters:
authToken
- token to authenticate to the server with- Returns:
- new instance of the class to allow setting other variables.
-
setUserId
- 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
- Parameters:
developerKey
- alternate token that verifies credentials for developer access- Returns:
- current instance of the class to allow setting of other variables.
-
setOptions
- Parameters:
options
- advanced configuration options for the API (WIP)- Returns:
- current instance of the class to allow setting of other variables.
-
build
public AgentApi build() throws AuthorizationException, LoginException, SQLException, InterruptedException, ExecutionExceptionBuilds all previous configurations into one instance of the API- Returns:
- instance of the API
- Throws:
AuthorizationException
- if the user's token is not validLoginException
- if logging into DiscordAPI failsSQLException
- if a database error occursInterruptedException
- if logging into the database failsExecutionException
- if obtaining a SqlInstanceManager fails.
-