public class CLSApiContext extends Object
| Constructor and Description |
|---|
CLSApiContext(String apiKey)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
CLSAchievementClaim |
ClaimAchievement(String playerApiReference,
String achievementApiReference)
Convenience override for ClaimAchievement(playerApiReference, achievementApiReference, null)
|
CLSAchievementClaim |
ClaimAchievement(String playerApiReference,
String achievementApiReference,
Double progress)
Awards an event achievement to a player or updates progress on a progress achievement.
|
CLSAchievement |
GetAchievement(String achievementApiReference)
Requests information about a specific achievement.
|
List<CLSAchievementClaim> |
GetAchievementClaims(String playerApiReference)
Convenience override for GetAchievementClaims(playerApiReference, null)
|
List<CLSAchievementClaim> |
GetAchievementClaims(String playerApiReference,
String achievementApiReference)
Requests achievement claims for a specific player.
|
List<CLSAchievement> |
GetAchievements()
Requests information about all achievements.
|
CLSPlayer |
GetPlayer(String playerApiReference)
Requests information about a specific player.
|
CLSProject |
GetProject()
Requests information about the project the API key was generated for.
|
CLSScoreboard |
GetScoreboardResults(String scoreboardApiReference,
int offset,
int limit)
Requests scoreboard results.
|
CLSScoreboard |
GetScoreboardResults(String scoreboardApiReference,
String playerApiReference,
int offset,
int limit)
Requests scoreboard results for a specific player.
|
CLSScoreboardEntry |
InsertScoreboardRecord(String scoreboardApiReference,
CLSPlayer player,
double value)
Records a new scoreboard entry.
|
CLSScoreboardEntry |
InsertScoreboardRecord(String scoreboardApiReference,
String playerApiReference,
double value)
Records a new scoreboard entry.
|
CLSPlayer |
RegisterPlayer()
Registers a new player at CLS.
|
CLSPlayer |
RegisterPlayer(String playerName)
Registers a new player with username at CLS.
|
CLSPlayer |
UpdatePlayer(CLSPlayer player,
String playerName)
Registers a new player at CLS.
|
CLSPlayer |
UpdatePlayer(String playerApiReference,
String playerName)
Registers a new player at CLS.
|
boolean |
ValidateKey()
Checks the API key for validity.
|
public CLSApiContext(String apiKey) throws CLSInvalidApiKeyException
apiKey - The projects API-KeyCLSInvalidApiKeyException - if the provided api key is not a valid keypublic boolean ValidateKey()
public CLSProject GetProject() throws IOException, CLSApiException
IOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSPlayer GetPlayer(String playerApiReference) throws IOException, CLSApiException
playerApiReference - The CLS player api-referenceIOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSPlayer RegisterPlayer() throws IOException, CLSApiException
IOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSPlayer RegisterPlayer(String playerName) throws IOException, CLSApiException
playerName - The players user nameIOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSPlayer UpdatePlayer(String playerApiReference, String playerName) throws IOException, CLSApiException
playerApiReference - The CLS player api-referenceplayerName - The players new user nameIOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSPlayer UpdatePlayer(CLSPlayer player, String playerName) throws IOException, CLSApiException
player - The CLS playerplayerName - The players new user nameIOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSScoreboard GetScoreboardResults(String scoreboardApiReference, int offset, int limit) throws IOException, CLSApiException
scoreboardApiReference - The CLS scoreboard api-referencelimit - Defines the offset for the entry query (0 <= offset)limit - Defines how many records should be queried (1 <= limit <= 1000)IOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSScoreboard GetScoreboardResults(String scoreboardApiReference, String playerApiReference, int offset, int limit) throws IOException, CLSApiException
scoreboardApiReference - The CLS scoreboard api-referenceplayerApiReference - The CLS player api-referencelimit - Defines the offset for the entry query (0 < offset)limit - Defines how many records should be queried (1 <= limit <= 1000)IOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSScoreboardEntry InsertScoreboardRecord(String scoreboardApiReference, CLSPlayer player, double value) throws IOException, CLSApiException
scoreboardApiReference - The CLS scoreboard api-referenceplayer - The CLS player that should be referenced by the recordvalue - The value of the scoreboard entry (eg. the players score)IOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSScoreboardEntry InsertScoreboardRecord(String scoreboardApiReference, String playerApiReference, double value) throws IOException, CLSApiException
scoreboardApiReference - The CLS scoreboard api-referenceplayerApiReference - The api-reference of the CLS player that should be referenced by the recordvalue - The value of the scoreboard entry (eg. the players score)IOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSAchievement GetAchievement(String achievementApiReference) throws IOException, CLSApiException
achievementApiReference - The CLS achievement api-referenceIOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic List<CLSAchievement> GetAchievements() throws IOException, CLSApiException
IOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic List<CLSAchievementClaim> GetAchievementClaims(String playerApiReference) throws IOException, CLSApiException
playerApiReference - The CLS player api-referenceIOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic List<CLSAchievementClaim> GetAchievementClaims(String playerApiReference, String achievementApiReference) throws IOException, CLSApiException
playerApiReference - The CLS player api-referenceachievementApiReference - The CLS achievement api-referenceIOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSAchievementClaim ClaimAchievement(String playerApiReference, String achievementApiReference) throws IOException, CLSApiException
playerApiReference - The CLS player api-referenceachievementApiReference - The CLS achievement api-referenceIOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responsepublic CLSAchievementClaim ClaimAchievement(String playerApiReference, String achievementApiReference, Double progress) throws IOException, CLSApiException
playerApiReference - The CLS player api-referenceachievementApiReference - The CLS achievement api-referenceprogress - The progress that will be added to the current achievement progress (should be null for event achievements and greater than 0 for progress achievements)IOException - if api request failed on a network levelCLSApiException - if the api reports an error or returns an invalid responseCopyright © 2019. All rights reserved.