public class ApiConfig
extends java.lang.Object
implements java.lang.Cloneable
RiotApi
.Modifier and Type | Field and Description |
---|---|
int |
DEFAULT_ASYNC_REQUEST_TIMEOUT |
java.util.logging.Level |
DEFAULT_DEBUG_LEVEL |
boolean |
DEFAULT_DEBUG_TO_FILE |
int |
DEFAULT_MAX_ASYNC_THREADS |
RateLimitHandler |
DEFAULT_RATE_LIMIT_HANDLER |
int |
DEFAULT_REQUEST_TIMEOUT |
boolean |
DEFAULT_TOURNAMENT_MOCK_MODE |
Constructor and Description |
---|
ApiConfig() |
Modifier and Type | Method and Description |
---|---|
ApiConfig |
clone() |
int |
getAsyncRequestTimeout() |
java.util.logging.Level |
getDebugLevel() |
boolean |
getDebugToFile() |
java.lang.String |
getKey() |
int |
getMaxAsyncThreads() |
RateLimitHandler |
getRateLimitHandler() |
int |
getRequestTimeout() |
java.lang.String |
getTournamentKey() |
boolean |
getTournamentMockMode() |
ApiConfig |
setAsyncRequestTimeout(int asyncRequestTimeout)
Sets a specified timeout value, in milliseconds, for calls in
RiotApiAsync to wait at most for a response. |
ApiConfig |
setDebugLevel(java.util.logging.Level debugLevel)
Sets the debug level.
|
ApiConfig |
setDebugToFile(boolean debugToFile)
Sets whether the debug log should be saved in a file.
|
ApiConfig |
setKey(java.lang.String key)
Sets the api key for the Riot Api.
|
ApiConfig |
setMaxAsyncThreads(int maxAsyncThreads)
Sets the maximum amount of threads for asynchronous api calls running at once.
|
ApiConfig |
setRateLimitHandler(RateLimitHandler rateLimitHandler)
Sets the
RateLimitHandler to take care of rate limiting. |
ApiConfig |
setRequestTimeout(int requestTimeout)
Sets a specified timeout value, in milliseconds, for calls in
RiotApi to wait at most for a response. |
ApiConfig |
setTournamentKey(java.lang.String tournamentKey)
Sets the tournament api key for the Riot Api.
|
ApiConfig |
setTournamentMockMode(boolean tournamentMockMode)
Sets whether the api should redirect tournament method calls should be redirected to the
TOURNAMENT-STUB endpoint. |
public final int DEFAULT_ASYNC_REQUEST_TIMEOUT
public final java.util.logging.Level DEFAULT_DEBUG_LEVEL
public final boolean DEFAULT_DEBUG_TO_FILE
public final int DEFAULT_MAX_ASYNC_THREADS
public final RateLimitHandler DEFAULT_RATE_LIMIT_HANDLER
public final int DEFAULT_REQUEST_TIMEOUT
public final boolean DEFAULT_TOURNAMENT_MOCK_MODE
public ApiConfig clone()
clone
in class java.lang.Object
public int getAsyncRequestTimeout()
public java.util.logging.Level getDebugLevel()
public boolean getDebugToFile()
public java.lang.String getKey()
public int getMaxAsyncThreads()
public RateLimitHandler getRateLimitHandler()
public int getRequestTimeout()
public java.lang.String getTournamentKey()
public boolean getTournamentMockMode()
public ApiConfig setAsyncRequestTimeout(int asyncRequestTimeout)
RiotApiAsync
to wait at most for a response. If set to zero,
asynchronous requests won't time out.
To set the timeout for synchronous requests use setRequestTimeout(int)
instead.
timeout
- The maximum time for an asynchronous call to wait for a response until it times outjava.lang.IllegalArgumentException
- If the timeout value is smaller than 0
public ApiConfig setDebugLevel(java.util.logging.Level debugLevel)
debugLevel
- Debug levelpublic ApiConfig setDebugToFile(boolean debugToFile)
If debug logging to file is activated, a file named riot-api.log
will be created and contain all logging messages for the
level set via setDebugLevel(Level)
.
debugToFile
- true
if the debug log should be saved in a file, false
otherwisepublic ApiConfig setKey(java.lang.String key)
key
- Your api keyjava.lang.NullPointerException
- If the key
is nullpublic ApiConfig setMaxAsyncThreads(int maxAsyncThreads)
If you make asynchronous calls, and the current thread limit is reached, the api call will be queued and executed when resources become available.
maxAsyncThreads
- Max amount of threads to run at the same timejava.lang.IllegalArgumentException
- If the limit is smaller than 0
public ApiConfig setRateLimitHandler(RateLimitHandler rateLimitHandler)
RateLimitHandler
to take care of rate limiting. Can bet set to null
to ignore rate limiting.rateLimitHandler
- RateLimitHandler
instancepublic ApiConfig setRequestTimeout(int requestTimeout)
RiotApi
to wait at most for a response. If set to zero,
requests won't time out.
To set the timeout for asynchronous requests use setAsyncRequestTimeout(int)
instead.
timeout
- The maximum time to wait for a response until a synchronous call failsjava.lang.IllegalArgumentException
- If the timeout value is smaller than 0
public ApiConfig setTournamentKey(java.lang.String tournamentKey)
key
- Your tournament api keyjava.lang.NullPointerException
- If the tournamentKey
is nullpublic ApiConfig setTournamentMockMode(boolean tournamentMockMode)
TOURNAMENT-STUB
endpoint.
The TOURNAMENT-STUB
endpoint provides dummy data meant for testing your app before going into production. Note that not all
tournament methods are available in mock mode.
tournamentMockMode
- true
if tournament methods should be called in mock mode