Class BricksetServiceImpl
- java.lang.Object
-
- org.dajlab.bricksetapi.v3.service.impl.BricksetServiceImpl
-
- All Implemented Interfaces:
IBricksetService
public class BricksetServiceImpl extends Object implements IBricksetService
Implementation.
-
-
Constructor Summary
Constructors Constructor Description BricksetServiceImpl(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<AdditionalImages>getAdditionalImages(int setId)Get a list of URLs of additional set images for the specified set.List<Instruction>getInstructions(int setId)Get a list of instructions for the specified set.List<Instruction>getInstructions2(String setNumber)Get a list of instructions for the specified set without the need to look up the set ID first.List<ApiKeyUsage>getKeyUsageStats()Get key usage stats for the last 30 days.List<MinifigCollection>getMinifigCollection(GetMinifigCollectionParameters params, String userHash)Get a list of minifigs owned/wanted by a user.List<Reviews>getReviews(int setId)Get user reviews for the specified set.List<Set>getSets(SetParameters params)Retrieve a list of sets, or more information about a particular one.List<Set>getSets(SetParameters params, String userHash)Retrieve a list of sets, or more information about a particular one.List<Subtheme>getSubthemes(String theme)Get a list of subthemes for a given theme, with the total number of sets in each.List<Theme>getThemes()Get a list of themes, with the total number of sets in each.List<UserMinifigNotes>getUserMinifigNotes(String userHash)Get all of a user's minifigure notes.List<UserNotes>getUserNotes(String userHash)Get all of a user's set notes.List<Year>getYears(String theme)Get a list of years for a given theme, with the total number of sets in each.Stringlogin(String username, String password)Log in as a user and retrieve a token that can be used in subsequent API calls.voidsetCollection(int setId, SetCollectionParameters params, String userHash)Set a user's collection details.voidsetMinifigCollection(String minifigNumber, SetMinifigCollectionParameters params, String userHash)Add/change a user's 'loose' minifig collection.
-
-
-
Constructor Detail
-
BricksetServiceImpl
public BricksetServiceImpl(String apiKey)
Constructor.- Parameters:
apiKey- api key
-
-
Method Detail
-
checkKey
public boolean checkKey() throws BricksetExceptionCheck if an API key is valid.- Specified by:
checkKeyin interfaceIBricksetService- Returns:
- true if key is valid
- Throws:
BricksetException- if status is not success
-
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.- Specified by:
loginin interfaceIBricksetService- Parameters:
username- A Brickset usernamepassword- A Brickset password- Returns:
- the user hash
- Throws:
BricksetException- if status is not success
-
checkUserHash
public boolean checkUserHash(String userHash) throws BricksetException
Check if a userHash key is valid.- Specified by:
checkUserHashin interfaceIBricksetService- Parameters:
userHash- User hash retrieved by the login method- Returns:
- true if userHash is valid
- Throws:
BricksetException- if status is not success
-
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.- Specified by:
getKeyUsageStatsin interfaceIBricksetService- Returns:
- key usage stats
- Throws:
BricksetException- if status is not success
-
getSets
public List<Set> getSets(SetParameters params) throws BricksetException
Retrieve a list of sets, or more information about a particular one.- Specified by:
getSetsin interfaceIBricksetService- Parameters:
params- parameters- Returns:
- a list of sets
- Throws:
BricksetException- if status is not success
-
getSets
public List<Set> getSets(SetParameters params, String userHash) throws BricksetException
Retrieve a list of sets, or more information about a particular one.- Specified by:
getSetsin interfaceIBricksetService- Parameters:
params- parametersuserHash- userHash, only if user data needed- Returns:
- a list of sets
- Throws:
BricksetException- if status is not success
-
getAdditionalImages
public List<AdditionalImages> getAdditionalImages(int setId) throws BricksetException
Get a list of URLs of additional set images for the specified set.- Specified by:
getAdditionalImagesin interfaceIBricksetService- Parameters:
setId- Set ID- Returns:
- a list of additional images
- Throws:
BricksetException- if status is not success
-
getInstructions
public List<Instruction> getInstructions(int setId) throws BricksetException
Get a list of instructions for the specified set.- Specified by:
getInstructionsin interfaceIBricksetService- Parameters:
setId- Set ID- Returns:
- a list of instructions
- Throws:
BricksetException- if status is not success
-
getInstructions2
public List<Instruction> getInstructions2(String setNumber) throws BricksetException
Get a list of instructions for the specified set without the need to look up the set ID first.- Specified by:
getInstructions2in interfaceIBricksetService- Parameters:
setNumber- Set number- Returns:
- a list of instructions
- Throws:
BricksetException- if status is not success
-
getReviews
public List<Reviews> getReviews(int setId) throws BricksetException
Get user reviews for the specified set.- Specified by:
getReviewsin interfaceIBricksetService- Parameters:
setId- a set id.- Returns:
- a list of reviews
- Throws:
BricksetException- if status is not success
-
getThemes
public List<Theme> getThemes() throws BricksetException
Get a list of themes, with the total number of sets in each.- Specified by:
getThemesin interfaceIBricksetService- Returns:
- the list of themes
- Throws:
BricksetException- if status is not success
-
getSubthemes
public List<Subtheme> getSubthemes(String theme) throws BricksetException
Get a list of subthemes for a given theme, with the total number of sets in each.- Specified by:
getSubthemesin interfaceIBricksetService- Parameters:
theme- a theme- Returns:
- a list of subthemes
- Throws:
BricksetException- if status is not success
-
getYears
public List<Year> getYears(String theme) throws BricksetException
Get a list of years for a given theme, with the total number of sets in each.- Specified by:
getYearsin interfaceIBricksetService- Parameters:
theme- theme- Returns:
- a list of years
- Throws:
BricksetException- if status is not success
-
setCollection
public void setCollection(int setId, SetCollectionParameters params, String userHash) throws BricksetExceptionSet a user's collection details.- Specified by:
setCollectionin interfaceIBricksetService- Parameters:
setId- Set ID.params- parametersuserHash- user hash- Throws:
BricksetException- if status is not success
-
getUserNotes
public List<UserNotes> getUserNotes(String userHash) throws BricksetException
Get all of a user's set notes.- Specified by:
getUserNotesin interfaceIBricksetService- Parameters:
userHash- user hash- Returns:
- a list of user's notes
- Throws:
BricksetException- if status is not success
-
getUserMinifigNotes
public List<UserMinifigNotes> getUserMinifigNotes(String userHash) throws BricksetException
Get all of a user's minifigure notes.- Specified by:
getUserMinifigNotesin interfaceIBricksetService- Parameters:
userHash- userhash- Returns:
- a list of all user's notes
- Throws:
BricksetException- if status is not success
-
getMinifigCollection
public List<MinifigCollection> getMinifigCollection(GetMinifigCollectionParameters params, String userHash) throws BricksetException
Get a list of minifigs owned/wanted by a user.- Specified by:
getMinifigCollectionin interfaceIBricksetService- Parameters:
params- parametersuserHash- user hash- Returns:
- a list of minifigs
- Throws:
BricksetException- if status is not success
-
setMinifigCollection
public void setMinifigCollection(String minifigNumber, SetMinifigCollectionParameters params, String userHash) throws BricksetException
Add/change a user's 'loose' minifig collection.- Specified by:
setMinifigCollectionin interfaceIBricksetService- Parameters:
minifigNumber- minifig numberparams- parametersuserHash- user hash- Throws:
BricksetException- if status is not success
-
-