Added SteamAPI and achievement searching

This commit is contained in:
Gnarwhal 2021-02-18 02:15:09 -05:00
parent b229ff9a15
commit 627cc810ed
Signed by: Gnarwhal
GPG key ID: 0989A73D8C421174
61 changed files with 2781 additions and 903 deletions

View file

@ -0,0 +1,126 @@
package achievements.data;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class APIResponse {
public static class Game {
public static class Achievement {
@JsonProperty("name")
private String name;
@JsonProperty("description")
private String description;
@JsonProperty("stages")
private int stages;
@JsonProperty("progress")
private int progress;
@JsonProperty("thumbnail")
private String thumbnail;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getStages() {
return stages;
}
public void setStages(int stages) {
this.stages = stages;
}
public int getProgress() {
return progress;
}
public void setProgress(int progress) {
this.progress = progress;
}
public String getThumbnail() {
return thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
}
@JsonProperty("platformGameId")
private String platformGameId;
@JsonProperty("name")
private String name;
@JsonProperty("played")
private boolean played;
@JsonProperty("thumbnail")
private String thumbnail;
@JsonProperty("achievements")
private List<Achievement> achievements;
public String getPlatformGameId() {
return platformGameId;
}
public void setPlatformGameId(String platformGameId) {
this.platformGameId = platformGameId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isPlayed() {
return played;
}
public void setPlayed(boolean played) {
this.played = played;
}
public String getThumbnail() {
return thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
public List<Achievement> getAchievements() {
return achievements;
}
public void setAchievements(List<Achievement> achievements) {
this.achievements = achievements;
}
}
@JsonProperty("games")
private List<Game> games;
public List<Game> getGames() {
return games;
}
public void setGames(List<Game> games) {
this.games = games;
}
}

View file

@ -1,122 +1,38 @@
package achievements.data;
import achievements.data.query.NumericFilter;
import achievements.data.query.StringFilter;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Achievement {
public static class Query {
@JsonProperty("sessionKey")
private String sessionKey;
@JsonProperty("name")
private StringFilter name;
@JsonProperty("stages")
private NumericFilter stages;
@JsonProperty("completion")
private NumericFilter completion;
@JsonProperty("difficulty")
private NumericFilter difficulty;
@JsonProperty("quality")
private NumericFilter quality;
public Query(String sessionKey, StringFilter name, NumericFilter stages, NumericFilter completion, NumericFilter difficulty, NumericFilter quality) {
this.sessionKey = sessionKey;
this.name = name;
this.stages = stages;
this.completion = completion;
this.difficulty = difficulty;
this.quality = quality;
}
public String getSessionKey() {
return sessionKey;
}
public void setSessionKey(String sessionKey) {
this.sessionKey = sessionKey;
}
public StringFilter getName() {
return name;
}
public void setName(StringFilter name) {
this.name = name;
}
public NumericFilter getStages() {
return stages;
}
public void setStages(NumericFilter stages) {
this.stages = stages;
}
public NumericFilter getCompletion() {
return completion;
}
public void setCompletion(NumericFilter completion) {
this.completion = completion;
}
public NumericFilter getDifficulty() {
return difficulty;
}
public void setDifficulty(NumericFilter difficulty) {
this.difficulty = difficulty;
}
public NumericFilter getQuality() {
return quality;
}
public void setQuality(NumericFilter quality) {
this.quality = quality;
}
}
@JsonProperty("ID")
private int id;
private int ID;
@JsonProperty("game")
private int gameId;
private String game;
@JsonProperty("name")
private String name;
@JsonProperty("description")
private String description;
@JsonProperty("stages")
private int stages;
@JsonProperty("completion")
private float completion;
private Integer completion;
@JsonProperty("difficulty")
private float difficulty;
private Float difficulty;
@JsonProperty("quality")
private float quality;
private Float quality;
public Achievement(int id, int gameId, String name, String description, int stages, float completion, float difficulty, float quality) {
this.id = id;
this.gameId = gameId;
this.name = name;
this.description = description;
this.stages = stages;
this.completion = completion;
this.difficulty = difficulty;
this.quality = quality;
public int getID() {
return ID;
}
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public int getGameId() {
return gameId;
public void setID(int ID) {
this.ID = ID;
}
public void setGameId(int gameId) {
this.gameId = gameId;
public String getGame() {
return game;
}
public void setGame(String game) {
this.game = game;
}
public String getName() { return name; }
@ -127,31 +43,27 @@ public class Achievement {
public void setDescription(String description) { this.description = description; }
public int getStages() { return stages; }
public void setStages(int stages) { this.stages = stages; }
public float getCompletion() {
public Integer getCompletion() {
return completion;
}
public void setCompletion(float completion) {
public void setCompletion(Integer completion) {
this.completion = completion;
}
public float getDifficulty() {
public Float getDifficulty() {
return difficulty;
}
public void setDifficulty(float difficulty) {
public void setDifficulty(Float difficulty) {
this.difficulty = difficulty;
}
public float getQuality() {
public Float getQuality() {
return quality;
}
public void setQuality(float quality) {
public void setQuality(Float quality) {
this.quality = quality;
}
}

View file

@ -1,20 +1,11 @@
package achievements.data;
import achievements.data.query.StringFilter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
public class Game {
public static class Query {
@JsonProperty("name")
private StringFilter name;
@JsonProperty("platforms")
private StringFilter platforms;
}
@JsonProperty("ID")
private int id;
@JsonProperty("name")
@ -24,13 +15,6 @@ public class Game {
@JsonProperty("achievementCount")
private int achievementCount;
public Game(int id, String name, String platform) {
this.id = id;
this.name = name;
this.platforms = new ArrayList<>();
this.platforms.add(platform);
}
public int getId() { return id; }
public void setId(int id) { this.id = id; }

View file

@ -1,6 +1,5 @@
package achievements.data;
import achievements.data.query.StringFilter;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

View file

@ -11,14 +11,17 @@ public class Session {
private int id;
@JsonProperty("hue")
private int hue;
@JsonProperty("admin")
private boolean admin;
@JsonIgnore
private boolean used;
public Session(String key, int id, int hue) {
this.key = key;
this.id = id;
this.hue = hue;
this.used = false;
public Session(String key, int id, int hue, boolean admin) {
this.key = key;
this.id = id;
this.hue = hue;
this.admin = admin;
this.used = false;
}
public String getKey() {
@ -45,7 +48,15 @@ public class Session {
this.hue = hue;
}
public boolean getUsed() {
public boolean isAdmin() {
return admin;
}
public void setAdmin(boolean admin) {
this.admin = admin;
}
public boolean isUsed() {
return used;
}

View file

@ -2,7 +2,7 @@ package achievements.data.query;
import com.fasterxml.jackson.annotation.JsonProperty;
public class AddPlatformRequest {
public class AddPlatform {
@JsonProperty("sessionKey")
private String sessionKey;
@JsonProperty("platformId")

View file

@ -1,32 +0,0 @@
package achievements.data.query;
import com.fasterxml.jackson.annotation.JsonProperty;
public class NumericFilter {
@JsonProperty("min")
private Float min;
@JsonProperty("max")
private Float max;
public NumericFilter(Float min, Float max) {
this.min = min;
this.max = max;
}
public Float getMin() {
return min;
}
public void setMin(Float min) {
this.min = min;
}
public Float getMax() {
return max;
}
public void setMax(Float max) {
this.max = max;
}
}

View file

@ -2,7 +2,7 @@ package achievements.data.query;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RemovePlatformRequest {
public class RemovePlatform {
@JsonProperty("sessionKey")
private String sessionKey;
@JsonProperty("platformId")

View file

@ -0,0 +1,97 @@
package achievements.data.query;
import com.fasterxml.jackson.annotation.JsonProperty;
public class SearchAchievements {
@JsonProperty("searchTerm")
private String searchTerm;
@JsonProperty("userId")
private Integer userId;
@JsonProperty("completed")
private boolean completed;
@JsonProperty("minCompletion")
private Float minCompletion;
@JsonProperty("maxCompletion")
private Float maxCompletion;
@JsonProperty("minDifficulty")
private Float minDifficulty;
@JsonProperty("maxDifficulty")
private Float maxDifficulty;
@JsonProperty("minQuality")
private Float minQuality;
@JsonProperty("maxQuality")
private Float maxQuality;
public String getSearchTerm() {
return searchTerm;
}
public void setSearchTerm(String searchTerm) {
this.searchTerm = searchTerm;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public boolean isCompleted() {
return completed;
}
public void setCompleted(boolean completed) {
this.completed = completed;
}
public Float getMinCompletion() {
return minCompletion;
}
public void setMinCompletion(Float minCompletion) {
this.minCompletion = minCompletion;
}
public Float getMaxCompletion() {
return maxCompletion;
}
public void setMaxCompletion(Float maxCompletion) {
this.maxCompletion = maxCompletion;
}
public Float getMinDifficulty() {
return minDifficulty;
}
public void setMinDifficulty(Float minDifficulty) {
this.minDifficulty = minDifficulty;
}
public Float getMaxDifficulty() {
return maxDifficulty;
}
public void setMaxDifficulty(Float maxDifficulty) {
this.maxDifficulty = maxDifficulty;
}
public Float getMinQuality() {
return minQuality;
}
public void setMinQuality(Float minQuality) {
this.minQuality = minQuality;
}
public Float getMaxQuality() {
return maxQuality;
}
public void setMaxQuality(Float maxQuality) {
this.maxQuality = maxQuality;
}
}

View file

@ -1,21 +0,0 @@
package achievements.data.query;
import com.fasterxml.jackson.annotation.JsonProperty;
public class StringFilter {
@JsonProperty("query")
private String query;
public StringFilter(String query) {
this.query = query;
}
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
}