Class GeneralServiceImpl
- java.lang.Object
-
- org.dajlab.bricksetapi.v3.service.AbstractBricksetService
-
- org.dajlab.bricksetapi.v3.service.impl.GeneralServiceImpl
-
public class GeneralServiceImpl extends AbstractBricksetService
Implementation of the general methods.
-
-
Constructor Summary
Constructors Constructor Description GeneralServiceImpl(String apiKey)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckKey()Check if an API key is valid.booleancheckUserHash(String userHash)Check if a userHash key is valid.List<ApiKeyUsage>getKeyUsageStats()Get key usage stats for the last 30 days.Stringlogin(String username, String password)Log in as a user and retrieve a token that can be used in subsequent API calls.-
Methods inherited from class org.dajlab.bricksetapi.v3.service.AbstractBricksetService
returnJsonResponse, returnJsonResponse
-
-
-
-
Constructor Detail
-
GeneralServiceImpl
public GeneralServiceImpl(String apiKey)
Constructor.- Parameters:
apiKey- api key
-
-
Method Detail
-
checkKey
public boolean checkKey() throws BricksetExceptionCheck if an API key is valid.- Returns:
- true if so.
- Throws:
BricksetException- if the key is incorrect
-
login
public String login(String username, String password) throws BricksetException
Log in as a user and retrieve a token that can be used in subsequent API calls.- Parameters:
username- Brickset usernamepassword- password- Returns:
- the userHash
- Throws:
BricksetException- if log in failed
-
checkUserHash
public boolean checkUserHash(String userHash) throws BricksetException
Check if a userHash key is valid.- Parameters:
userHash- a userHash- Returns:
- true if valid
- Throws:
BricksetException- if userhash is invalid
-
getKeyUsageStats
public List<ApiKeyUsage> getKeyUsageStats() throws BricksetException
Get key usage stats for the last 30 days. Note that only calls to the getSets method count against key usage.- Returns:
- key usage stats
- Throws:
BricksetException- if status is not success
-
-