diff --git a/README.md b/README.md index bba1678..530ec30 100644 --- a/README.md +++ b/README.md @@ -93,13 +93,9 @@ So if you see anything I missed, please don't hesitate to create an issue to let + /v2/account -+ /v2/account/bank ++ /v2/account/* -+ /v2/account/inventory - -+ /v2/account/materials - -+ /v2/account/wallet ++ /v2/achievements + /v2/characters/<name>/core @@ -113,20 +109,40 @@ So if you see anything I missed, please don't hesitate to create an issue to let + /v2/currencies ++ /v2/dungeons + ++ /v2/finishers + ++ /v2/gliders + ++ /v2/guild/upgrades + + /v2/items + /v2/itemstats ++ /v2/mailcarriers + ++ /v2/masteries + + /v2/materials + /v2/minis ++ /v2/outfits + ++ /v2/pvp/heroes + ++ /v2/raids + + /v2/recipes + /v2/recipes/search + /v2/skins ++ /v2/titles + + /v2/tokeninfo + /v2/worlds diff --git a/comm.properties b/comm.properties index e74e3b6..15b7009 100644 --- a/comm.properties +++ b/comm.properties @@ -1,4 +1,4 @@ -currentVer=0.2.1 +currentVer=0.4.1 groupID='me.xhsun.gw2wrapper' siteUrl='https://github.com/xhsun/gw2wrapper' gitUrl='https://github.com/xhsun/gw2wrapper.git' \ No newline at end of file diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 884531c..3bca50b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -3,10 +3,17 @@ import me.xhsun.guildwars2wrapper.error.GuildWars2Exception; import me.xhsun.guildwars2wrapper.model.*; import me.xhsun.guildwars2wrapper.model.account.*; +import me.xhsun.guildwars2wrapper.model.achievements.Achievement; import me.xhsun.guildwars2wrapper.model.character.CharacterInventory; import me.xhsun.guildwars2wrapper.model.character.Core; import me.xhsun.guildwars2wrapper.model.commerce.Prices; import me.xhsun.guildwars2wrapper.model.commerce.Transaction; +import me.xhsun.guildwars2wrapper.model.guild.Upgrade; +import me.xhsun.guildwars2wrapper.model.pvp.Hero; +import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; +import me.xhsun.guildwars2wrapper.model.unlockable.Glider; +import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; +import me.xhsun.guildwars2wrapper.model.unlockable.Outfit; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -25,6 +32,8 @@ public class AsynchronousRequest extends Request { super(gw2API); } + //Token info + /** * For more info on TokenInfo API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -40,6 +49,7 @@ public void getAPIInfo(String API, Callback callback) throws GuildWar gw2API.getAPIInfo(API).enqueue(callback); } + //Accounts /** * For more info on Account API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -55,6 +65,21 @@ public void getAccount(String API, Callback callback) throws GuildWars2 gw2API.getAccount(API).enqueue(callback); } + /** + * For more info on Account API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see AchievementProgression Account achievement info + */ + public void getAchievementProgression(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getAchievementProgression(API).enqueue(callback); + } + /** * For more info on Bank API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -70,6 +95,93 @@ public void getBank(String API, Callback> callback) throws GuildWars2 gw2API.getBank(API).enqueue(callback); } + /** + * For more info on Dungeon progression API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + */ + public void getDailyDungeonProgression(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getDailyDungeonProgression(API).enqueue(callback); + } + + /** + * For more info on Account dyes API go here
+ * Get list of unlocked dyes ids linked to given API key + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see Color color info + */ + public void getUnlockedDyes(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedDyes(API).enqueue(callback); + } + + /** + * For more info on Account finishers API go here
+ * Get list of unlocked finishers linked to given API key + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see UnlockedFinisher unlocked finisher info + */ + public void getUnlockedFinishers(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedFinishers(API).enqueue(callback); + } + + /** + * For more info on Account gliders API go here
+ * Get list of unlocked glider id(s) linked to given API key + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + */ + public void getUnlockedGliders(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedGliders(API).enqueue(callback); + } + + /** + * For more info on Account cats API go here
+ * Get list of unlocked cats linked to given API key + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see Cat cat info + */ + public void getUnlockedCats(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedCats(API).enqueue(callback); + } + + /** + * For more info on Account nodes API go here
+ * Get list of unlocked glider id(s) linked to given API key + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + */ + public void getUnlockedHomeNodes(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedHomeNodes(API).enqueue(callback); + } + /** * For more info on Shared Inventory API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -86,32 +198,32 @@ public void getSharedInventory(String API, Callback> callb } /** - * For more info on Wallet API go here
+ * For more info on account mail carrier API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param API API key * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception invalid API key * @throws NullPointerException if given {@link Callback} is empty - * @see Wallet wallet info */ - public void getWallet(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getUnlockedMailCarriers(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); - gw2API.getWallet(API).enqueue(callback); + gw2API.getUnlockedMailCarriers(API).enqueue(callback); } /** - * For more info on Account/Skins API go here
- * Get list of unlocked skin ids linked to given API key + * For more info on account masteries API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param API API key * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception invalid API key * @throws NullPointerException if given {@link Callback} is empty + * @see UnlockedMastery unlocked mastery info */ - public void getUnlockedSkins(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getUnlockedMasteries(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); - gw2API.getUnlockedSkins(API).enqueue(callback); + gw2API.getUnlockedMasteries(API).enqueue(callback); } /** @@ -129,6 +241,152 @@ public void getMaterialStorage(String API, Callback> callback) th gw2API.getMaterialBank(API).enqueue(callback); } + /** + * For more info on account minis API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see Mini mini info + */ + public void getUnlockedMinis(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedMinis(API).enqueue(callback); + } + + /** + * For more info on account outfits API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + */ + public void getUnlockedOutfits(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedOutfits(API).enqueue(callback); + } + + /** + * For more info on account pvp heroes API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + */ + public void getUnlockedPvpHeroes(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedPvpHeroes(API).enqueue(callback); + } + + /** + * For more info on account raid API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + */ + public void getWeeklyRaidProgression(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getWeeklyRaidProgression(API).enqueue(callback); + } + + /** + * For more info on account recipes API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see Recipe recipe info + */ + public void getUnlockedRecipes(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedRecipes(API).enqueue(callback); + } + + /** + * For more info on Account/Skins API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see Skin skin info + */ + public void getUnlockedSkins(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedSkins(API).enqueue(callback); + } + + /** + * For more info on Account titles API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + */ + public void getUnlockedTitles(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedTitles(API).enqueue(callback); + } + + /** + * For more info on Wallet API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see Wallet wallet info + */ + public void getWallet(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getWallet(API).enqueue(callback); + } + + //Achievements + + /** + * For more info on achievement API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Achievement achievement info + */ + public void getAllAchievementID(Callback> callback) throws NullPointerException { + gw2API.getAllAchievementIDs().enqueue(callback); + } + + /** + * For more info on achievement API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of achievement id(s) + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see Achievement achievement info + */ + public void getAchievementInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getAchievementInfo(processIds(ids)).enqueue(callback); + } + + //Characters /** * For more info on Character API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -175,6 +433,36 @@ public void getCharacterInventory(String API, String name, Callbackhere
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Color color info + */ + public void getAllColorID(Callback> callback) throws NullPointerException { + gw2API.getAllColorIDs().enqueue(callback); + } + + /** + * For more info on Color API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of color id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Color color info + */ + public void getColorInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getColorInfo(processIds(ids)).enqueue(callback); + } + + //TP /** * For more info on Listing Price API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -199,7 +487,7 @@ public void getListing(String API, Transaction.Time time, Transaction.Type type, * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty */ - public void getAllListedItemID(Callback> callback) throws NullPointerException { + public void getAllListedItemID(Callback> callback) throws NullPointerException { gw2API.getAllPrices().enqueue(callback); } @@ -213,11 +501,25 @@ public void getAllListedItemID(Callback> callback) throws NullPointer * @throws NullPointerException if given {@link Callback} is empty * @see Prices listing item price info */ - public void getPrices(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public void getPrices(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); gw2API.getPrices(processIds(ids)).enqueue(callback); } + //Currencies + + /** + * For more info on Currency API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Currency currency info + */ + public void getAllCurrencyID(Callback> callback) throws NullPointerException { + gw2API.getAllCurrencies().enqueue(callback); + } + /** * For more info on Currency API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -228,102 +530,139 @@ public void getPrices(long[] ids, Callback> callback) throws GuildW * @throws NullPointerException if given {@link Callback} is empty * @see Currency currency info */ - public void getCurrencyInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public void getCurrencyInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); gw2API.getCurrencyInfo(processIds(ids)).enqueue(callback); } + //Dungeons + /** - * For more info on Currency API go here
+ * For more info on Dungeons API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty - * @see Currency currency info + * @see Dungeon dungeon info */ - public void getAllCurrencyID(Callback> callback) throws NullPointerException { - gw2API.getAllCurrencies().enqueue(callback); + public void getAllDungeonName(Callback> callback) throws NullPointerException { + gw2API.getAllDungeonName().enqueue(callback); } /** - * For more info on World API go here
+ * For more info on Dungeons API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of world id + * @param ids list of dungeon id * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception empty ID list * @throws NullPointerException if given {@link Callback} is empty - * @see World world info + * @see Dungeon dungeon info */ - public void getWorldInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); - gw2API.getWorldsInfo(processIds(ids)).enqueue(callback); + public void getDungeonInfo(String[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getDungeonInfo(processIds(ids)).enqueue(callback); } + //Finishers + /** - * For more info on World API go here
+ * For more info on Finishers API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty - * @see World world info + * @see Finisher finisher info */ - public void getAllWorldID(Callback> callback) throws NullPointerException { - gw2API.getAllWorldsIDs().enqueue(callback); + public void getAllFinisherID(Callback> callback) throws NullPointerException { + gw2API.getAllFinisherIDs().enqueue(callback); } /** - * For more info on Material Category API go here
+ * For more info on Finishers API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of category id + * @param ids list of finisher id * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception empty ID list * @throws NullPointerException if given {@link Callback} is empty - * @see MaterialCategory material category info + * @see Finisher finisher info */ - public void getMaterialCategoryInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); - gw2API.getMaterialBankInfo(processIds(ids)).enqueue(callback); + public void getFinisherInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getFinisherInfo(processIds(ids)).enqueue(callback); } + //Gliders + /** - * For more info on Material Category API go here
+ * For more info on gliders API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty - * @see MaterialCategory material category info + * @see Glider glider info */ - public void getAllMaterialCategoryID(Callback> callback) throws NullPointerException { - gw2API.getAllMaterialBankIDs().enqueue(callback); + public void getAllGliderID(Callback> callback) throws NullPointerException { + gw2API.getAllGliderIDs().enqueue(callback); } /** - * For more info on Skin API go here
+ * For more info on gliders API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of skin id + * @param ids list of glider id * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception empty ID list * @throws NullPointerException if given {@link Callback} is empty - * @see Skin skin info + * @see Glider glider info */ - public void getSkinInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); - gw2API.getSkinInfo(processIds(ids)).enqueue(callback); + public void getGliderInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getGliderInfo(processIds(ids)).enqueue(callback); } + //Guild Upgrades + /** - * For more info on Skin API go here
+ * For more info on guild upgrades API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty - * @see Skin skin info + * @see Upgrade guild upgrade info */ - public void getAllSkinID(Callback> callback) throws NullPointerException { - gw2API.getAllSkinIDs().enqueue(callback); + public void getGuildUpgradeID(Callback> callback) throws NullPointerException { + gw2API.getAllGuildUpgradeIDs().enqueue(callback); + } + + /** + * For more info on guild upgrades API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of guild upgrade id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Upgrade guild upgrade info + */ + public void getGuildUpgradeInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getGuildUpgradeInfo(processIds(ids)).enqueue(callback); + } + + //Items + + /** + * For more info on Item API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Item item info + */ + public void getAllItemID(Callback> callback) throws NullPointerException { + gw2API.getAllItemIDs().enqueue(callback); } /** @@ -336,21 +675,23 @@ public void getAllSkinID(Callback> callback) throws NullPointerExcept * @throws NullPointerException if given {@link Callback} is empty * @see Item item info */ - public void getItemInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public void getItemInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); gw2API.getItemInfo(processIds(ids)).enqueue(callback); } + //Item Stats + /** - * For more info on Item API go here
+ * For more info on Itemstat API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty - * @see Item item info + * @see ItemStats itemstat info */ - public void getAllItemID(Callback> callback) throws NullPointerException { - gw2API.getAllItemIDs().enqueue(callback); + public void getAllItemStatID(Callback> callback) throws NullPointerException { + gw2API.getAllItemStatIDs().enqueue(callback); } /** @@ -363,65 +704,216 @@ public void getAllItemID(Callback> callback) throws NullPointerExcept * @throws NullPointerException if given {@link Callback} is empty * @see ItemStats itemstat info */ - public void getItemStatInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public void getItemStatInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); gw2API.getItemStatInfo(processIds(ids)).enqueue(callback); } + //Mail Carriers + /** - * For more info on Itemstat API go here
+ * For more info on mail carriers API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty - * @see ItemStats itemstat info + * @see MailCarrier mail carrier info */ - public void getAllItemStatID(Callback> callback) throws NullPointerException { - gw2API.getAllItemStatIDs().enqueue(callback); + public void getAllMailCarrierID(Callback> callback) throws NullPointerException { + gw2API.getAllMailCarrierIDs().enqueue(callback); } /** - * For more info on Color API go here
+ * For more info on mail carriers API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of color id + * @param ids list of mail carrier id * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception empty ID list * @throws NullPointerException if given {@link Callback} is empty - * @see Color color info + * @see MailCarrier mail carrier info */ - public void getColorInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); - gw2API.getColorInfo(processIds(ids)).enqueue(callback); + public void getMailCarrierInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getMailCarrierInfo(processIds(ids)).enqueue(callback); } + //Masteries + /** - * For more info on Color API go here
+ * or more info on masteries API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty - * @see Color color info + * @see Mastery mastery info */ - public void getAllColorID(Callback> callback) throws NullPointerException { - gw2API.getAllColorIDs().enqueue(callback); + public void getAllMasteryID(Callback> callback) throws NullPointerException { + gw2API.getAllMasteryIDs().enqueue(callback); } /** - * For more info on Recipes API go here
+ * or more info on masteries API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of recipe id + * @param ids list of mastery id * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception empty ID list * @throws NullPointerException if given {@link Callback} is empty - * @see Recipe recipe info + * @see Mastery mastery info */ - public void getRecipeInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); - gw2API.getRecipeInfo(processIds(ids)).enqueue(callback); + public void getMasteryInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getMasteryInfo(processIds(ids)).enqueue(callback); + } + + //Material Categories + + /** + * For more info on Material Category API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see MaterialCategory material category info + */ + public void getAllMaterialCategoryID(Callback> callback) throws NullPointerException { + gw2API.getAllMaterialBankIDs().enqueue(callback); } + /** + * For more info on Material Category API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of category id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see MaterialCategory material category info + */ + public void getMaterialCategoryInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getMaterialBankInfo(processIds(ids)).enqueue(callback); + } + + //Minis + + /** + * For more info on Mini API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Mini mini info + */ + public void getAllMiniID(Callback> callback) throws NullPointerException { + gw2API.getAllMiniIDs().enqueue(callback); + } + + /** + * For more info on Mini API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of mini id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Mini mini info + */ + public void getMiniInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getMiniInfo(processIds(ids)).enqueue(callback); + } + + //Outfits + + /** + * For more info on Outfits API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Outfit outfit info + */ + public void getAllOutfitID(Callback> callback) throws NullPointerException { + gw2API.getAllOutfitIDs().enqueue(callback); + } + + /** + * For more info on Outfits API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of outfit id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Outfit outfit info + */ + public void getOutfitInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getOutfitInfo(processIds(ids)).enqueue(callback); + } + + //PvP Heroes + + /** + * For more info on pvp heroes API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Hero pvp hero info + */ + public void getAllPvPHeroID(Callback> callback) throws NullPointerException { + gw2API.getAllPvPHeroIDs().enqueue(callback); + } + + /** + * For more info on pvp heroes API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of pvp hero id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Hero pvp hero info + */ + public void getPvPHeroInfo(String[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getPvPHeroInfo(processIds(ids)).enqueue(callback); + } + + //Raids + + /** + * For more info on raids API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Raid raid info + */ + public void getAllRaidID(Callback> callback) throws NullPointerException { + gw2API.getAllRaidIDs().enqueue(callback); + } + + /** + * For more info on raids API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of raid id(s) + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Raid raid info + */ + public void getRaidInfo(String[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getRaidInfo(processIds(ids)).enqueue(callback); + } + + //Recipes + /** * For more info on Recipes API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -430,10 +922,27 @@ public void getRecipeInfo(long[] ids, Callback> callback) throws Gu * @throws NullPointerException if given {@link Callback} is empty * @see Recipe recipe info */ - public void getAllRecipeID(Callback> callback) throws NullPointerException { + public void getAllRecipeID(Callback> callback) throws NullPointerException { gw2API.getAllRecipeIDs().enqueue(callback); } + /** + * For more info on Recipes API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of recipe id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Recipe recipe info + */ + public void getRecipeInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getRecipeInfo(processIds(ids)).enqueue(callback); + } + + //Recipes Search + /** * For more info on Recipes search API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -442,35 +951,95 @@ public void getAllRecipeID(Callback> callback) throws NullPointerExce * @throws NullPointerException if given {@link Callback} is empty * @see Recipe recipe info */ - public void searchRecipes(boolean isInput, long id, Callback> callback) throws NullPointerException { - if (isInput) gw2API.searchInputRecipes(Long.toString(id)).enqueue(callback); - else gw2API.searchOutputRecipes(Long.toString(id)).enqueue(callback); + public void searchRecipes(boolean isInput, int id, Callback> callback) throws NullPointerException { + if (isInput) gw2API.searchInputRecipes(Integer.toString(id)).enqueue(callback); + else gw2API.searchOutputRecipes(Integer.toString(id)).enqueue(callback); } + //Skins + /** - * For more info on Mini API go here
+ * For more info on Skin API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of mini id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Skin skin info + */ + public void getAllSkinID(Callback> callback) throws NullPointerException { + gw2API.getAllSkinIDs().enqueue(callback); + } + + /** + * For more info on Skin API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of skin id * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception empty ID list * @throws NullPointerException if given {@link Callback} is empty - * @see Mini mini info + * @see Skin skin info */ - public void getMiniInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); - gw2API.getMiniInfo(processIds(ids)).enqueue(callback); + public void getSkinInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getSkinInfo(processIds(ids)).enqueue(callback); } + //Titles + /** - * For more info on Mini API go here
+ * For more info on titles API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws NullPointerException if given {@link Callback} is empty - * @see Mini mini info + * @see Title title info */ - public void getAllMiniID(Callback> callback) throws NullPointerException { - gw2API.getAllMiniIDs().enqueue(callback); + public void getAllTitleID(Callback> callback) throws NullPointerException { + gw2API.getAllTitleIDs().enqueue(callback); + } + + /** + * For more info on titles API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of title id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Title title info + */ + public void getTitleInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getTitleInfo(processIds(ids)).enqueue(callback); + } + + //Worlds + + /** + * For more info on World API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see World world info + */ + public void getAllWorldID(Callback> callback) throws NullPointerException { + gw2API.getAllWorldsIDs().enqueue(callback); + } + + /** + * For more info on World API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of world id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see World world info + */ + public void getWorldInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getWorldsInfo(processIds(ids)).enqueue(callback); } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java index 92d2208..ae7b05c 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java @@ -13,7 +13,8 @@ * This class provides two ways user can get and process data from the server:
* 1) use methods provided by {@link SynchronousRequest} to get data synchronously
* 2) use methods provided by {@link AsynchronousRequest} to get/process data asynchronously - * + * TODO chatLinkToItemID + * TODO language selection, default english * @author xhsun * @since 2017-02-06 */ diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index bc68e77..767ab7f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -2,10 +2,17 @@ import me.xhsun.guildwars2wrapper.model.*; import me.xhsun.guildwars2wrapper.model.account.*; +import me.xhsun.guildwars2wrapper.model.achievements.Achievement; import me.xhsun.guildwars2wrapper.model.character.CharacterInventory; import me.xhsun.guildwars2wrapper.model.character.Core; import me.xhsun.guildwars2wrapper.model.commerce.Prices; import me.xhsun.guildwars2wrapper.model.commerce.Transaction; +import me.xhsun.guildwars2wrapper.model.guild.Upgrade; +import me.xhsun.guildwars2wrapper.model.pvp.Hero; +import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; +import me.xhsun.guildwars2wrapper.model.unlockable.Glider; +import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; +import me.xhsun.guildwars2wrapper.model.unlockable.Outfit; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; @@ -20,25 +27,81 @@ * @since 2017-02-07 */ interface GuildWars2API { + //token info + @GET("/v2/tokeninfo") + Call getAPIInfo(@Query("access_token") String token); + //accounts @GET("/v2/account") Call getAccount(@Query("access_token") String token); + @GET("/v2/account/achievements") + Call> getAchievementProgression(@Query("access_token") String token); + @GET("/v2/account/bank") Call> getBank(@Query("access_token") String token); + @GET("/v2/account/dungeons") + Call> getDailyDungeonProgression(@Query("access_token") String token); + + @GET("/v2/account/dyes") + Call> getUnlockedDyes(@Query("access_token") String token); + + @GET("/v2/account/finishers") + Call> getUnlockedFinishers(@Query("access_token") String token); + + @GET("/v2/account/gliders") + Call> getUnlockedGliders(@Query("access_token") String token); + + @GET("/v2/account/home/cats") + Call> getUnlockedCats(@Query("access_token") String token); + + @GET("/v2/account/home/nodes") + Call> getUnlockedHomeNodes(@Query("access_token") String token); + @GET("/v2/account/inventory") Call> getSharedInventory(@Query("access_token") String token); - @GET("/v2/account/wallet") - Call> getWallet(@Query("access_token") String token); + @GET("/v2/account/mailcarriers") + Call> getUnlockedMailCarriers(@Query("access_token") String token); - @GET("/v2/account/skins") - Call> getUnlockedSkins(@Query("access_token") String token); + @GET("/v2/account/masteries") + Call> getUnlockedMasteries(@Query("access_token") String token); @GET("/v2/account/materials") Call> getMaterialBank(@Query("access_token") String token); + @GET("/v2/account/minis") + Call> getUnlockedMinis(@Query("access_token") String token); + + @GET("/v2/account/outfits") + Call> getUnlockedOutfits(@Query("access_token") String token); + + @GET("/v2/account/pvp/heroes") + Call> getUnlockedPvpHeroes(@Query("access_token") String token); + + @GET("/v2/account/raids") + Call> getWeeklyRaidProgression(@Query("access_token") String token); + + @GET("/v2/account/recipes") + Call> getUnlockedRecipes(@Query("access_token") String token); + + @GET("/v2/account/skins") + Call> getUnlockedSkins(@Query("access_token") String token); + + @GET("/v2/account/titles") + Call> getUnlockedTitles(@Query("access_token") String token); + + @GET("/v2/account/wallet") + Call> getWallet(@Query("access_token") String token); + + //achievements + @GET("/v2/achievements") + Call> getAllAchievementIDs(); + + @GET("/v2/achievements") + Call> getAchievementInfo(@Query("ids") String ids); + //characters @GET("/v2/characters") Call> getAllCharacterName(@Query("access_token") String token); @@ -49,87 +112,153 @@ interface GuildWars2API { @GET("/v2/characters/{name}/inventory") Call getCharacterInventory(@Path("name") String name, @Query("access_token") String token); + //colors + @GET("/v2/colors") + Call> getAllColorIDs(); + + @GET("/v2/colors") + Call> getColorInfo(@Query("ids") String ids); + //TP @GET("/v2/commerce/transactions/{time}/{type}") Call> getListing(@Path("time") String time, @Path("type") String type, @Query("access_token") String token); @GET("/v2/commerce/prices") - Call> getAllPrices(); + Call> getAllPrices(); @GET("/v2/commerce/prices") Call> getPrices(@Query("ids") String ids); - //other - @GET("/v2/tokeninfo") - Call getAPIInfo(@Query("access_token") String token); - //currencies @GET("/v2/currencies") - Call> getAllCurrencies(); + Call> getAllCurrencies(); @GET("/v2/currencies") Call> getCurrencyInfo(@Query("ids") String ids); - //worlds - @GET("/v2/worlds") - Call> getAllWorldsIDs(); + //dungeons + @GET("/v2/dungeons") + Call> getAllDungeonName(); - @GET("/v2/worlds") - Call> getWorldsInfo(@Query("ids") String ids); + @GET("/v2/dungeons") + Call> getDungeonInfo(@Query("ids") String ids); - //material categories - @GET("/v2/materials") - Call> getAllMaterialBankIDs(); + //Finishers + @GET("/v2/finishers") + Call> getAllFinisherIDs(); - @GET("/v2/materials") - Call> getMaterialBankInfo(@Query("ids") String ids); + @GET("/v2/finishers") + Call> getFinisherInfo(@Query("ids") String ids); - //skins - @GET("/v2/skins") - Call> getAllSkinIDs(); + //Gliders + @GET("/v2/gliders") + Call> getAllGliderIDs(); - @GET("/v2/skins") - Call> getSkinInfo(@Query("ids") String ids); + @GET("/v2/gliders") + Call> getGliderInfo(@Query("ids") String ids); + + //Guild Upgrades + @GET("/v2/guild/upgrades") + Call> getAllGuildUpgradeIDs(); + + @GET("/v2/guild/upgrades") + Call> getGuildUpgradeInfo(@Query("ids") String ids); //items @GET("/v2/items") - Call> getAllItemIDs(); + Call> getAllItemIDs(); @GET("/v2/items") Call> getItemInfo(@Query("ids") String ids); //item stat @GET("/v2/itemstats") - Call> getAllItemStatIDs(); + Call> getAllItemStatIDs(); @GET("/v2/itemstats") Call> getItemStatInfo(@Query("ids") String ids); - //colors - @GET("/v2/colors") - Call> getAllColorIDs(); + //mail carriers + @GET("/v2/mailcarriers") + Call> getAllMailCarrierIDs(); - @GET("/v2/colors") - Call> getColorInfo(@Query("ids") String ids); + @GET("/v2/mailcarriers") + Call> getMailCarrierInfo(@Query("ids") String ids); + + //masteries + @GET("/v2/masteries") + Call> getAllMasteryIDs(); + + @GET("/v2/masteries") + Call> getMasteryInfo(@Query("ids") String ids); + + //material categories + @GET("/v2/materials") + Call> getAllMaterialBankIDs(); + + @GET("/v2/materials") + Call> getMaterialBankInfo(@Query("ids") String ids); + + //minis + @GET("/v2/minis") + Call> getAllMiniIDs(); + + @GET("/v2/minis") + Call> getMiniInfo(@Query("ids") String ids); + + //Outfits + @GET("/v2/outfits") + Call> getAllOutfitIDs(); + + @GET("/v2/outfits") + Call> getOutfitInfo(@Query("ids") String ids); + + //PvP Heroes + @GET("/v2/pvp/heroes") + Call> getAllPvPHeroIDs(); + + @GET("/v2/pvp/heroes") + Call> getPvPHeroInfo(@Query("ids") String ids); + + //Raids + @GET("/v2/raids") + Call> getAllRaidIDs(); + + @GET("/v2/raids") + Call> getRaidInfo(@Query("ids") String ids); //recipes @GET("/v2/recipes") - Call> getAllRecipeIDs(); + Call> getAllRecipeIDs(); @GET("/v2/recipes") Call> getRecipeInfo(@Query("ids") String ids); //recipes search @GET("/v2/recipes/search") - Call> searchInputRecipes(@Query("input") String id); + Call> searchInputRecipes(@Query("input") String id); @GET("/v2/recipes/search") - Call> searchOutputRecipes(@Query("output") String id); + Call> searchOutputRecipes(@Query("output") String id); - //minis - @GET("/v2/minis") - Call> getAllMiniIDs(); + //skins + @GET("/v2/skins") + Call> getAllSkinIDs(); - @GET("/v2/minis") - Call> getMiniInfo(@Query("ids") String ids); + @GET("/v2/skins") + Call> getSkinInfo(@Query("ids") String ids); + + //Titles + @GET("/v2/titles") + Call> getAllTitleIDs(); + + @GET("/v2/titles") + Call> getTitleInfo(@Query("ids") String ids); + + //worlds + @GET("/v2/worlds") + Call> getAllWorldsIDs(); + + @GET("/v2/worlds") + Call> getWorldsInfo(@Query("ids") String ids); } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/Request.java b/src/main/java/me/xhsun/guildwars2wrapper/Request.java index 82a65ed..eaf77be 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/Request.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/Request.java @@ -23,9 +23,15 @@ abstract class Request { } //convert list of ids to comma separated list - String processIds(long[] list) { + String processIds(int[] list) { StringBuilder ids = new StringBuilder(); - for (long id : list) ids.append(id).append(","); + for (int id : list) ids.append(id).append(","); + return ids.toString().trim().substring(0, ids.length() - 1); + } + + String processIds(String[] list) { + StringBuilder ids = new StringBuilder(); + for (String id : list) ids.append(id).append(","); return ids.toString().trim().substring(0, ids.length() - 1); } @@ -81,8 +87,15 @@ void isParamValid(ParamChecker... items) throws GuildWars2Exception { } } } else { - if (c.ids == null || c.ids.length == 0) - throw new GuildWars2Exception(ErrorCode.ID, "List of id cannot be empty"); + switch (c.type) { + case ID: + if (c.ids == null || c.ids.length == 0) + throw new GuildWars2Exception(ErrorCode.ID, "List of id cannot be empty"); + break; + case STR_ID: + if (c.str_id == null || c.str_id.length == 0) + throw new GuildWars2Exception(ErrorCode.ID, "List of id cannot be empty"); + } } } @@ -92,18 +105,24 @@ void isParamValid(ParamChecker... items) throws GuildWars2Exception { class ParamChecker { ParamType type; String value; - long[] ids; + int[] ids; + String[] str_id; ParamChecker(ParamType t, String s) { type = t; value = s; } - ParamChecker(ParamType t, long[] i) { - type = t; + ParamChecker(int[] i) { + type = ParamType.ID; ids = i; } + + ParamChecker(String[] i) { + type = ParamType.STR_ID; + str_id = i; + } } - enum ParamType {API, CHAR, ID} + enum ParamType {API, CHAR, ID, STR_ID} } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 19baed3..b5a3179 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -4,10 +4,17 @@ import me.xhsun.guildwars2wrapper.error.GuildWars2Exception; import me.xhsun.guildwars2wrapper.model.*; import me.xhsun.guildwars2wrapper.model.account.*; +import me.xhsun.guildwars2wrapper.model.achievements.Achievement; import me.xhsun.guildwars2wrapper.model.character.CharacterInventory; import me.xhsun.guildwars2wrapper.model.character.Core; import me.xhsun.guildwars2wrapper.model.commerce.Prices; import me.xhsun.guildwars2wrapper.model.commerce.Transaction; +import me.xhsun.guildwars2wrapper.model.guild.Upgrade; +import me.xhsun.guildwars2wrapper.model.pvp.Hero; +import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; +import me.xhsun.guildwars2wrapper.model.unlockable.Glider; +import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; +import me.xhsun.guildwars2wrapper.model.unlockable.Outfit; import retrofit2.Response; import java.io.IOException; @@ -21,11 +28,11 @@ */ public class SynchronousRequest extends Request { - SynchronousRequest(GuildWars2API gw2API) { super(gw2API); } + //Token info /** * For more info on TokenInfo API go here
* Get detailed info related to this API key from server @@ -46,6 +53,7 @@ public TokenInfo getAPIInfo(String API) throws GuildWars2Exception { } } + //Accounts /** * For more info on Account API go here
* Get detailed info for account link to given API key @@ -66,6 +74,26 @@ public Account getAccount(String API) throws GuildWars2Exception { } } + /** + * For more info on Account API go here
+ * Get an account's progress towards all their achievements. + * + * @param API API key + * @return list of account achievement info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see AchievementProgression account achievement info + */ + public List getAchievementProgression(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getAchievementProgression(API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + /** * For more info on Bank API go here
* Get detailed info for bank linked to given API key @@ -87,18 +115,16 @@ public List getBank(String API) throws GuildWars2Exception { } /** - * For more info on Shared Inventory API go here
- * Get detailed info for shared inventory linked to given API key + * For more info on Dungeon progression API go here
* * @param API API key - * @return share inventory info + * @return an array of strings representing dungeon path names completed since daily dungeon reset * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see SharedInventory shared inventory info */ - public List getSharedInventory(String API) throws GuildWars2Exception { + public List getDailyDungeonProgression(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getSharedInventory(API).execute(); + Response> response = gw2API.getDailyDungeonProgression(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -107,18 +133,18 @@ public List getSharedInventory(String API) throws GuildWars2Exc } /** - * For more info on Wallet API go here
- * Get detailed info for wallet linked to given API key + * For more info on Account dyes API go here
+ * Get list of unlocked dyes ids linked to given API key * * @param API API key - * @return wallet info + * @return list of color ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Wallet wallet info + * @see Color */ - public List getWallet(String API) throws GuildWars2Exception { + public List getUnlockedDyes(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getWallet(API).execute(); + Response> response = gw2API.getUnlockedDyes(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -127,17 +153,18 @@ public List getWallet(String API) throws GuildWars2Exception { } /** - * For more info on Account/Skins API go here
- * Get list of unlocked skin ids linked to given API key + * For more info on Account finishers API go here
+ * Get list of unlocked finishers linked to given API key * * @param API API key - * @return list of ids + * @return list of unlocked finisher info * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see UnlockedFinisher unlocked finisher info */ - public List getUnlockedSkins(String API) throws GuildWars2Exception { + public List getUnlockedFinishers(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getUnlockedSkins(API).execute(); + Response> response = gw2API.getUnlockedFinishers(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -146,18 +173,17 @@ public List getUnlockedSkins(String API) throws GuildWars2Exception { } /** - * For more info on Material Storage API go here
- * Get detailed info for material storage linked to given API key + * For more info on Account gliders API go here
+ * Get list of unlocked glider id(s) linked to given API key * * @param API API key - * @return material storage info + * @return list of gliders id * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Material material storage info */ - public List getMaterialStorage(String API) throws GuildWars2Exception { + public List getUnlockedGliders(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getMaterialBank(API).execute(); + Response> response = gw2API.getUnlockedGliders(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -166,17 +192,18 @@ public List getMaterialStorage(String API) throws GuildWars2Exception } /** - * For more info on Character API go here
- * Get all character names linked to given API key + * For more info on Account cats API go here
+ * Get list of unlocked cats linked to given API key * * @param API API key - * @return list of character name + * @return list of cats * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Cat cat info */ - public List getAllCharacterName(String API) throws GuildWars2Exception { + public List getUnlockedCats(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAllCharacterName(API).execute(); + Response> response = gw2API.getUnlockedCats(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -185,41 +212,37 @@ public List getAllCharacterName(String API) throws GuildWars2Exception { } /** - * For more info on Character Core API go here
- * Get character information for the given character name that is linked to given API key + * For more info on Account nodes API go here
+ * Get list of unlocked home nodes linked to given API key * - * @param API API key - * @param name name of character - * @return character detail + * @param API API key + * @return list of strings * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Core character info */ - public Core getCharacterInformation(String API, String name) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + public List getUnlockedHomeNodes(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response response = gw2API.getCharacterCore(name, API).execute(); + Response> response = gw2API.getUnlockedHomeNodes(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } - } /** - * For more info on Character Inventory API go here
- * Get inventory info for the given character that is linked to given API key + * For more info on Shared Inventory API go here
+ * Get detailed info for shared inventory linked to given API key * - * @param API API key - * @param name name of character to get inventory info - * @return character inventory detail + * @param API API key + * @return share inventory info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see me.xhsun.guildwars2wrapper.model.util.Bag character inventory info + * @see SharedInventory shared inventory info */ - public CharacterInventory getCharacterInventory(String API, String name) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + public List getSharedInventory(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response response = gw2API.getCharacterInventory(name, API).execute(); + Response> response = gw2API.getSharedInventory(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -228,20 +251,17 @@ public CharacterInventory getCharacterInventory(String API, String name) throws } /** - * For more info on Transaction API go here
- * Get transaction info linked to given API key + * For more info on account mail carrier API go here
+ * Get list of unlocked mail carrier id(s) linked to given API key * - * @param API API key - * @param time current | History - * @param type buy | sell - * @return list of transaction base on the selection, if there is nothing, return empty list + * @param API API key + * @return list of mail carrier id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Transaction transaction info */ - public List getListing(String API, Transaction.Time time, Transaction.Type type) throws GuildWars2Exception { + public List getUnlockedMailCarriers(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getListing(processListingTime(time), processListingType(type), API).execute(); + Response> response = gw2API.getUnlockedMailCarriers(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -250,15 +270,18 @@ public List getListing(String API, Transaction.Time time, Transacti } /** - * For more info on Listing Price API go here
- * Get all id of items that is on the TP + * For more info on account masteries API go here
+ * Get list of unlocked masteries linked to given API key * - * @return list of item ids + * @param API API key + * @return list of unlocked masteries * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see UnlockedMastery unlocked mastery info */ - public List getAllListedItemID() throws GuildWars2Exception { + public List getUnlockedMasteries(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAllPrices().execute(); + Response> response = gw2API.getUnlockedMasteries(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -267,18 +290,18 @@ public List getAllListedItemID() throws GuildWars2Exception { } /** - * For more info on Listing Price API go here
- * Get price info for the given item id(s) + * For more info on Material Storage API go here
+ * Get detailed info for material storage linked to given API key * - * @param ids list of item id - * @return list of listing price for given id(s) + * @param API API key + * @return material storage info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Prices listing price info + * @see Material material storage info */ - public List getPrices(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public List getMaterialStorage(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getPrices(processIds(ids)).execute(); + Response> response = gw2API.getMaterialBank(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -287,18 +310,18 @@ public List getPrices(long[] ids) throws GuildWars2Exception { } /** - * For more info on Currency API go here
- * Get currency info for the given currency id(s) + * For more info on account minis API go here
+ * Get list of unlocked mini id(s) linked to given API key * - * @param ids list of currency id - * @return list of currency info + * @param API API key + * @return list of mini id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Currency currency info + * @see Mini mini info */ - public List getCurrencyInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public List getUnlockedMinis(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getCurrencyInfo(processIds(ids)).execute(); + Response> response = gw2API.getUnlockedMinis(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -307,16 +330,17 @@ public List getCurrencyInfo(long[] ids) throws GuildWars2Exception { } /** - * For more info on Currency API go here
- * Get all currency ids + * For more info on account outfits API go here
+ * Get list of unlocked outfit id(s) linked to given API key * - * @return list of currency ids + * @param API API key + * @return list of outfit id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Currency currency info */ - public List getAllCurrencyID() throws GuildWars2Exception { + public List getUnlockedOutfits(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAllCurrencies().execute(); + Response> response = gw2API.getUnlockedOutfits(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -325,18 +349,17 @@ public List getAllCurrencyID() throws GuildWars2Exception { } /** - * For more info on World API go here
- * Get world info for the given world id(s) + * For more info on account pvp heroes API go here
+ * Get list of unlocked pvp hero id(s) linked to given API key * - * @param ids list of world id - * @return list of world info + * @param API API key + * @return list of pvp heroes id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see World world info */ - public List getWorldInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public List getUnlockedPvpHeroes(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getWorldsInfo(processIds(ids)).execute(); + Response> response = gw2API.getUnlockedPvpHeroes(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -345,16 +368,17 @@ public List getWorldInfo(long[] ids) throws GuildWars2Exception { } /** - * For more info on World API go here
- * Get list of all available world id(s) + * For more info on account raid API go here
+ * Get list of cleared raid linked to given API key * - * @return list of world id + * @param API API key + * @return list of cleared raid * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see World world info */ - public List getAllWorldID() throws GuildWars2Exception { + public List getWeeklyRaidProgression(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAllWorldsIDs().execute(); + Response> response = gw2API.getWeeklyRaidProgression(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -363,18 +387,18 @@ public List getAllWorldID() throws GuildWars2Exception { } /** - * For more info on Material Category API go here
- * Get material category info for the given category id(s) + * For more info on account recipes API go here
+ * Get list of unlocked recipe id(s) linked to given API key * - * @param ids list of category id - * @return list of material category info + * @param API API key + * @return list of unlocked recipe id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see MaterialCategory material category info + * @see Recipe recipe info */ - public List getMaterialCategoryInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public List getUnlockedRecipes(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getMaterialBankInfo(processIds(ids)).execute(); + Response> response = gw2API.getUnlockedRecipes(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -383,16 +407,18 @@ public List getMaterialCategoryInfo(long[] ids) throws GuildWa } /** - * For more info on Material Category API go here
- * Get list of all available material category ids + * For more info on Account/Skins API go here
+ * Get list of unlocked skin ids linked to given API key * - * @return list of material category id + * @param API API key + * @return list of ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see MaterialCategory material category info + * @see Skin skin info */ - public List getAllMaterialCategoryID() throws GuildWars2Exception { + public List getUnlockedSkins(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAllMaterialBankIDs().execute(); + Response> response = gw2API.getUnlockedSkins(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -401,18 +427,18 @@ public List getAllMaterialCategoryID() throws GuildWars2Exception { } /** - * For more info on Skin API go here
- * Get skin info for the given skin id(s) + * For more info on Account titles API go here
+ * Get list of unlocked title id(s) linked to given API key * - * @param ids list of skin id - * @return list of skin info + * @param API API key + * @return list of unlocked title id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Skin skin info */ - public List getSkinInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + + public List getUnlockedTitles(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getSkinInfo(processIds(ids)).execute(); + Response> response = gw2API.getUnlockedTitles(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -421,16 +447,18 @@ public List getSkinInfo(long[] ids) throws GuildWars2Exception { } /** - * For more info on Skin API go here
- * Get list of all available skin ids + * For more info on Wallet API go here
+ * Get detailed info for wallet linked to given API key * - * @return list of skin ids + * @param API API key + * @return wallet info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Skin skin info + * @see Wallet wallet info */ - public List getAllSkinID() throws GuildWars2Exception { + public List getWallet(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAllSkinIDs().execute(); + Response> response = gw2API.getWallet(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -438,19 +466,18 @@ public List getAllSkinID() throws GuildWars2Exception { } } + //Achievements /** - * For more info on Item API go here
- * Get item info for the given item id(s) + * For more info on achievement API go here
+ * Get list of all available achievement id(s) * - * @param ids list of item id - * @return list of item info + * @return list of achievement id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Item item info + * @see Achievement achievement info */ - public List getItemInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public List getAllAchievementID() throws GuildWars2Exception { try { - Response> response = gw2API.getItemInfo(processIds(ids)).execute(); + Response> response = gw2API.getAllAchievementIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -459,16 +486,18 @@ public List getItemInfo(long[] ids) throws GuildWars2Exception { } /** - * For more info on Item API go here
- * Get all available item ids + * For more info on achievement API go here
+ * Get list of achievement info corresponding to the given id(s) * - * @return list of item ids + * @param ids list of achievement id(s) + * @return list of achievement info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Item item info + * @see Achievement achievement info */ - public List getAllItemID() throws GuildWars2Exception { + public List getAchievementInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); try { - Response> response = gw2API.getAllItemIDs().execute(); + Response> response = gw2API.getAchievementInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -476,19 +505,19 @@ public List getAllItemID() throws GuildWars2Exception { } } + //Characters /** - * For more info on Itemstat API go here
- * Get itemstat info for the given itemstat id(s) + * For more info on Character API go here
+ * Get all character names linked to given API key * - * @param ids list of itemstat id - * @return list of itemstat info + * @param API API key + * @return list of character name * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see ItemStats itemstat info */ - public List getItemStatInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public List getAllCharacterName(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getItemStatInfo(processIds(ids)).execute(); + Response> response = gw2API.getAllCharacterName(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -497,36 +526,41 @@ public List getItemStatInfo(long[] ids) throws GuildWars2Exception { } /** - * For more info on Itemstat API go here
- * Get all available itemstat ids + * For more info on Character Core API go here
+ * Get character information for the given character name that is linked to given API key * - * @return list of itemstat ids + * @param API API key + * @param name name of character + * @return character detail * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see ItemStats itemstat info + * @see Core character info */ - public List getAllItemStatID() throws GuildWars2Exception { + public Core getCharacterInformation(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); try { - Response> response = gw2API.getAllItemStatIDs().execute(); + Response response = gw2API.getCharacterCore(name, API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } + } /** - * For more info on Color API go here
- * Get color info for the given color id(s) + * For more info on Character Inventory API go here
+ * Get inventory info for the given character that is linked to given API key * - * @param ids array of color id - * @return list of color info + * @param API API key + * @param name name of character to get inventory info + * @return character inventory detail * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Color color info + * @see me.xhsun.guildwars2wrapper.model.util.Bag character inventory info */ - public List getColorInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public CharacterInventory getCharacterInventory(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); try { - Response> response = gw2API.getColorInfo(processIds(ids)).execute(); + Response response = gw2API.getCharacterInventory(name, API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -534,6 +568,8 @@ public List getColorInfo(long[] ids) throws GuildWars2Exception { } } + //Colors + /** * For more info on Color API go here
* Get list of all available color id(s) @@ -542,9 +578,9 @@ public List getColorInfo(long[] ids) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Color color info */ - public List getAllColorID() throws GuildWars2Exception { + public List getAllColorID() throws GuildWars2Exception { try { - Response> response = gw2API.getAllColorIDs().execute(); + Response> response = gw2API.getAllColorIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -553,18 +589,18 @@ public List getAllColorID() throws GuildWars2Exception { } /** - * For more info on Recipes API go here
- * Get recipe info for the given recipe id(s) + * For more info on Color API go here
+ * Get color info for the given color id(s) * - * @param ids array of recipe id - * @return list of recipe info + * @param ids array of color id + * @return list of color info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Recipe recipe info + * @see Color color info */ - public List getRecipeInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public List getColorInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); try { - Response> response = gw2API.getRecipeInfo(processIds(ids)).execute(); + Response> response = gw2API.getColorInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -572,17 +608,22 @@ public List getRecipeInfo(long[] ids) throws GuildWars2Exception { } } + //TP /** - * For more info on Recipes API go here
- * Get list of all available recipe id(s) + * For more info on Transaction API go here
+ * Get transaction info linked to given API key * - * @return list of recipe ids(s) + * @param API API key + * @param time current | History + * @param type buy | sell + * @return list of transaction base on the selection, if there is nothing, return empty list * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Recipe recipe info + * @see Transaction transaction info */ - public List getAllRecipeID() throws GuildWars2Exception { + public List getListing(String API, Transaction.Time time, Transaction.Type type) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAllRecipeIDs().execute(); + Response> response = gw2API.getListing(processListingTime(time), processListingType(type), API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -591,18 +632,455 @@ public List getAllRecipeID() throws GuildWars2Exception { } /** - * For more info on Recipes search API go here
+ * For more info on Listing Price API go here
+ * Get all id of items that is on the TP * - * @param isInput is given id an ingredient - * @param id recipe id - * @return list of recipe id + * @return list of item ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getAllListedItemID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllPrices().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Listing Price API go here
+ * Get price info for the given item id(s) + * + * @param ids list of item id + * @return list of listing price for given id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Prices listing price info + */ + public List getPrices(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getPrices(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Currencies + + /** + * For more info on Currency API go here
+ * Get all currency ids + * + * @return list of currency ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Currency currency info + */ + public List getAllCurrencyID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllCurrencies().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Currency API go here
+ * Get currency info for the given currency id(s) + * + * @param ids list of currency id + * @return list of currency info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Currency currency info + */ + public List getCurrencyInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getCurrencyInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Dungeons + + /** + * For more info on Dungeons API go here
+ * Get all dungeon name(s) + * + * @return list of dungeon name(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Dungeon dungeon info + */ + public List getAllDungeonName() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllDungeonName().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Dungeons API go here
+ * Get dungeon info for the given dungeon id(s) + * + * @param ids list of dungeon id + * @return list of dungeon info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Dungeon dungeon info + */ + public List getDungeonInfo(String[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getDungeonInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Finishers + + /** + * For more info on Finishers API go here
+ * Get all finisher id(s) + * + * @return list of finisher id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Finisher finisher info + */ + public List getAllFinisherID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllFinisherIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Finishers API go here
+ * Get finisher info for the given finisher id(s) + * + * @param ids list of finisher id + * @return list of finisher info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Finisher finisher info + */ + public List getFinisherInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getFinisherInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Glider + + /** + * For more info on gliders API go here
+ * Get all glider id(s) + * + * @return list of glider id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Glider glider info + */ + public List getAllGliderID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllGliderIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on gliders API go here
+ * Get glider info for the given glider id(s) + * + * @param ids list of glider id + * @return list of glider info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Glider glider info + */ + public List getGliderInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getGliderInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Guild Upgrades + + /** + * For more info on guild upgrades API go here
+ * Get all guild upgrade id(s) + * + * @return list of guild upgrade id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Upgrade guild upgrade info + */ + public List getAllGuildUpgradeID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllGuildUpgradeIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on guild upgrades API go here
+ * Get guild upgrade info for the given guild upgrade id(s) + * + * @param ids list of guild upgrade id + * @return list of guild upgrade info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Upgrade guild upgrade info + */ + public List getGuildUpgradeInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getGuildUpgradeInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Items + + /** + * For more info on Item API go here
+ * Get all available item ids + * + * @return list of item ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Item item info + */ + public List getAllItemID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllItemIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Item API go here
+ * Get item info for the given item id(s) + * + * @param ids list of item id + * @return list of item info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Item item info + */ + public List getItemInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getItemInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Item Stats + + /** + * For more info on Itemstat API go here
+ * Get all available itemstat ids + * + * @return list of itemstat ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see ItemStats itemstat info + */ + public List getAllItemStatID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllItemStatIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Itemstat API go here
+ * Get itemstat info for the given itemstat id(s) + * + * @param ids list of itemstat id + * @return list of itemstat info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see ItemStats itemstat info + */ + public List getItemStatInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getItemStatInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Mail Carriers + + /** + * For more info on mail carriers API go here
+ * Get all mail carrier id(s) + * + * @return list of mail carrier info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see MailCarrier mail carrier info + */ + public List getAllMailCarrierID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllMailCarrierIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on mail carriers API go here
+ * Get mail carrier info for the given mail carrier id(s) + * + * @param ids list of mail carrier id + * @return list of mail carrier info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see MailCarrier mail carrier info + */ + public List getMailCarrierInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getMailCarrierInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Masteries + + /** + * For more info on masteries API go here
+ * Get all mastery id(s) + * + * @return list of mastery id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Mastery mastery info + */ + public List getAllMasteryID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllMasteryIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on masteries API go here
+ * Get mastery info for the given mastery id(s) + * + * @param ids list of mastery id + * @return list of mastery info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Mastery mastery info + */ + public List getMasteryInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getMasteryInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Material Categories + + /** + * For more info on Material Category API go here
+ * Get list of all available material category ids + * + * @return list of material category id + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see MaterialCategory material category info + */ + public List getAllMaterialCategoryID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllMaterialBankIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Material Category API go here
+ * Get material category info for the given category id(s) + * + * @param ids list of category id + * @return list of material category info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see MaterialCategory material category info + */ + public List getMaterialCategoryInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getMaterialBankInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Minis + + /** + * For more info on Mini API go here
+ * Get list of all available mini id(s) + * + * @return list of mini id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Mini mini info */ - public List searchRecipes(boolean isInput, long id) throws GuildWars2Exception { + public List getAllMiniID() throws GuildWars2Exception { try { - Response> response = (isInput) ? - gw2API.searchInputRecipes(Long.toString(id)).execute() : - gw2API.searchOutputRecipes(Long.toString(id)).execute(); + Response> response = gw2API.getAllMiniIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -619,8 +1097,8 @@ public List searchRecipes(boolean isInput, long id) throws GuildWars2Excep * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Mini mini info */ - public List getMiniInfo(long[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + public List getMiniInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getMiniInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -630,17 +1108,301 @@ public List getMiniInfo(long[] ids) throws GuildWars2Exception { } } + //Outfits + /** - * For more info on Mini API go here
- * Get list of all available mini id(s) + * For more info on Outfits API go here
+ * Get all outfit id(s) * - * @return list of mini id(s) + * @return list of outfit id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Mini mini info + * @see Outfit outfit info + */ + public List getAllOutfitID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllOutfitIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Outfits API go here
+ * Get outfit info for the given outfit id(s) + * + * @param ids list of outfit id(s) + * @return list of outfit info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Outfit outfit info + */ + public List getOutfitInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getOutfitInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //PvP Heroes + + /** + * For more info on pvp heroes API go here
+ * Get all pvp hero id(s) + * + * @return list of pvp hero id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Hero pvp hero info + */ + public List getAllPvPHeroID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllPvPHeroIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on pvp heroes API go here
+ * Get pvp hero info for the given pvp hero id(s) + * + * @param ids list of pvp hero id(s) + * @return list of pvp hero info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Hero pvp hero info + */ + public List getPvPHeroInfo(String[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getPvPHeroInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Raids + + /** + * For more info on raids API go here
+ * Get all raid id(s) + * + * @return list of raid id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Raid raid info + */ + public List getAllRaidID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllRaidIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on raids API go here
+ * Get raid info for the given raid id(s) + * + * @param ids list of raid id(s) + * @return list of raid info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Raid raid info + */ + public List getRaidInfo(String[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getRaidInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Recipes + + /** + * For more info on Recipes API go here
+ * Get list of all available recipe id(s) + * + * @return list of recipe ids(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Recipe recipe info + */ + public List getAllRecipeID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllRecipeIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Recipes API go here
+ * Get recipe info for the given recipe id(s) + * + * @param ids array of recipe id + * @return list of recipe info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Recipe recipe info + */ + public List getRecipeInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getRecipeInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Recipes Search + + /** + * For more info on Recipes search API go here
+ * + * @param isInput is given id an ingredient + * @param id recipe id + * @return list of recipe id + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List searchRecipes(boolean isInput, int id) throws GuildWars2Exception { + try { + Response> response = (isInput) ? + gw2API.searchInputRecipes(Integer.toString(id)).execute() : + gw2API.searchOutputRecipes(Integer.toString(id)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Skins + + /** + * For more info on Skin API go here
+ * Get list of all available skin ids + * + * @return list of skin ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Skin skin info + */ + public List getAllSkinID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllSkinIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Skin API go here
+ * Get skin info for the given skin id(s) + * + * @param ids list of skin id + * @return list of skin info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Skin skin info + */ + public List getSkinInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getSkinInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Titles + + /** + * For more info on titles API go here
+ * Get all title id(s) + * + * @return list of title id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Title title info + */ + public List getAllTitleID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllTitleIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on titles API go here
+ * Get title info for the given title id(s) + * + * @param ids list of title id(s) + * @return list of title info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Title title info + */ + public List getTitleInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response<List<Title>> response = gw2API.getTitleInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Worlds + + /** + * For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/> + * Get list of all available world id(s) + * + * @return list of world id + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see World world info + */ + public List<Integer> getAllWorldID() throws GuildWars2Exception { + try { + Response<List<Integer>> response = gw2API.getAllWorldsIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/> + * Get world info for the given world id(s) + * + * @param ids list of world id + * @return list of world info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see World world info */ - public List<Long> getAllMiniID() throws GuildWars2Exception { + public List<World> getWorldInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); try { - Response<List<Long>> response = gw2API.getAllMiniIDs().execute(); + Response<List<World>> response = gw2API.getWorldsInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java index c5e4e9f..05e8200 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java @@ -19,16 +19,16 @@ public enum Categories { Starter, Common, Uncommon, Rare } - private long id; + private int id; private String name; private int[] base_rgb; private ColorDetail cloth; private ColorDetail leather; private ColorDetail metal; - private long item;//item id for the dye + private int item;//item id for the dye private List<Categories> categories; - public long getId() { + public int getId() { return id; } @@ -36,7 +36,7 @@ public String getName() { return name; } - public int[] getBase_rgb() { + public int[] getBaseRgb() { return base_rgb; } @@ -55,7 +55,7 @@ public ColorDetail getMetal() { /** * @return id for {@link me.xhsun.guildwars2wrapper.model.Item} */ - public long getItem() { + public int getItem() { return item; } @@ -75,8 +75,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (id ^ (id >>> 32)); - result = 31 * result + (int) (item ^ (item >>> 32)); + int result = id; + result = 31 * result + item; return result; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Currency.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Currency.java index 03dc079..b4589d8 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Currency.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Currency.java @@ -10,13 +10,13 @@ */ public class Currency { - private long id; + private int id; private String name; private String description; private String icon; - private long order; + private int order; - public long getId() { + public int getId() { return id; } @@ -32,7 +32,7 @@ public String getIcon() { return icon; } - public long getOrder() { + public int getOrder() { return order; } @@ -48,7 +48,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); + return id; } @Override diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java new file mode 100644 index 0000000..5d441fc --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java @@ -0,0 +1,76 @@ +package me.xhsun.guildwars2wrapper.model; + +import java.util.List; + +/** + * For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/> + * Model class for dungeon + * + * @author xhsun + * @since 2017-06-06 + */ +public class Dungeon { + private String id; + private List<Path> paths; + + public String getId() { + return id; + } + + public List<Path> getPaths() { + return paths; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Dungeon dungeon = (Dungeon) o; + + return id != null ? id.equals(dungeon.id) : dungeon.id == null; + } + + @Override + public int hashCode() { + return id != null ? id.hashCode() : 0; + } + + @Override + public String toString() { + return "Dungeon{" + + "id='" + id + '\'' + + ", paths=" + paths + + '}'; + } + + public class Path { + private String id; + + public String getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Path path = (Path) o; + + return id != null ? id.equals(path.id) : path.id == null; + } + + @Override + public int hashCode() { + return id != null ? id.hashCode() : 0; + } + + @Override + public String toString() { + return "Path{" + + "id='" + id + '\'' + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java index a3a7905..695ab20 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java @@ -2,7 +2,7 @@ import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemDetail; -import java.util.Arrays; +import java.util.List; /** * Item model class @@ -32,7 +32,7 @@ public enum Restriction { public enum GameType {Activity, Dungeon, Pve, Pvp, PvpLobby, Wvw} - private long id; + private int id; private String chat_link; private String name; private String icon; @@ -41,17 +41,17 @@ public enum GameType {Activity, Dungeon, Pve, Pvp, PvpLobby, Wvw} private Rarity rarity; private int level; private long vendor_value; - private long default_skin; - private Flag[] flags; - private GameType[] game_types; - private Restriction[] restrictions; + private int default_skin; + private List<Flag> flags; + private List<GameType> game_types; + private List<Restriction> restrictions; private ItemDetail details; - public long getId() { + public int getId() { return id; } - public String getChat_link() { + public String getChatLink() { return chat_link; } @@ -79,23 +79,23 @@ public int getLevel() { return level; } - public long getVendor_value() { + public long getVendorValue() { return vendor_value; } - public long getDefault_skin() { + public int getDefaultSkin() { return default_skin; } - public Flag[] getFlags() { + public List<Flag> getFlags() { return flags; } - public GameType[] getGame_types() { + public List<GameType> getGameTypes() { return game_types; } - public Restriction[] getRestrictions() { + public List<Restriction> getRestrictions() { return restrictions; } @@ -115,7 +115,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); + return id; } @Override @@ -131,9 +131,9 @@ public String toString() { ", level=" + level + ", vendor_value=" + vendor_value + ", default_skin=" + default_skin + - ", flags=" + Arrays.toString(flags) + - ", game_types=" + Arrays.toString(game_types) + - ", restrictions=" + Arrays.toString(restrictions) + + ", flags=" + flags + + ", game_types=" + game_types + + ", restrictions=" + restrictions + ", details=" + details + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/ItemStats.java b/src/main/java/me/xhsun/guildwars2wrapper/model/ItemStats.java index 282f05f..c41f52f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/ItemStats.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/ItemStats.java @@ -12,11 +12,11 @@ * @since 2017-02-07 */ public class ItemStats { - private long id; + private int id; private String name; private ItemAttributes attributes; - public long getId() { + public int getId() { return id; } @@ -42,7 +42,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (id ^ (id >>> 32)); + int result = id; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (attributes != null ? attributes.hashCode() : 0); return result; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java new file mode 100644 index 0000000..0792472 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java @@ -0,0 +1,149 @@ +package me.xhsun.guildwars2wrapper.model; + +import me.xhsun.guildwars2wrapper.model.util.comm.Region; + +import java.util.List; + +/** + * For more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> + * Model class for mastery + * + * @author xhsun + * @since 2017-06-06 + */ +public class Mastery { + private int id; + private String name; + private String requirement; + private int order; + private String background; + private Region region; + private List<Detail> levels; + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public String getRequirement() { + return requirement; + } + + public int getOrder() { + return order; + } + + public String getBackground() { + return background; + } + + public Region getRegion() { + return region; + } + + public List<Detail> getLevels() { + return levels; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Mastery mastery = (Mastery) o; + + return id == mastery.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "Mastery{" + + "id=" + id + + ", name='" + name + '\'' + + ", requirement='" + requirement + '\'' + + ", order=" + order + + ", background='" + background + '\'' + + ", region=" + region + + ", levels=" + levels + + '}'; + } + + public class Detail { + private String name; + private String description; + private String instruction; + private String icon; + private int point_cost; + private int exp_cost; + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getInstruction() { + return instruction; + } + + public String getIcon() { + return icon; + } + + public int getPointCost() { + return point_cost; + } + + public int getExpCost() { + return exp_cost; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Detail details = (Detail) o; + + return point_cost == details.point_cost && + exp_cost == details.exp_cost && + (name != null ? name.equals(details.name) : details.name == null) && + (description != null ? description.equals(details.description) : details.description == null) && + (instruction != null ? instruction.equals(details.instruction) : details.instruction == null) && + (icon != null ? icon.equals(details.icon) : details.icon == null); + } + + @Override + public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (description != null ? description.hashCode() : 0); + result = 31 * result + (instruction != null ? instruction.hashCode() : 0); + result = 31 * result + (icon != null ? icon.hashCode() : 0); + result = 31 * result + point_cost; + result = 31 * result + exp_cost; + return result; + } + + @Override + public String toString() { + return "Details{" + + "name='" + name + '\'' + + ", description='" + description + '\'' + + ", instruction='" + instruction + '\'' + + ", icon='" + icon + '\'' + + ", point_cost=" + point_cost + + ", exp_cost=" + exp_cost + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java index 0d3fae7..7748d7a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java @@ -1,6 +1,6 @@ package me.xhsun.guildwars2wrapper.model; -import java.util.Arrays; +import java.util.List; /** * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> @@ -14,7 +14,7 @@ public class MaterialCategory { private int id; private String name; - private long[] items; + private List<Integer> items; public int getId() { return id; @@ -24,7 +24,7 @@ public String getName() { return name; } - public long[] getItems() { + public List<Integer> getItems() { return items; } @@ -48,7 +48,7 @@ public String toString() { return "MaterialCategory{" + "id=" + id + ", name='" + name + '\'' + - ", items=" + Arrays.toString(items) + + ", items=" + items + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java index 76e6f45..e815100 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java @@ -8,14 +8,14 @@ * @since 2017-06-05 */ public class Mini { - private long id; + private int id; private String name; private String unlock; private String icon; - private long order; - private long item_id; + private int order; + private int item_id; - public long getId() { + public int getId() { return id; } @@ -34,11 +34,11 @@ public String getIcon() { return icon; } - public long getOrder() { + public int getOrder() { return order; } - public long getItem_id() { + public int getItemId() { return item_id; } @@ -54,7 +54,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); + return id; } @Override diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Raid.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Raid.java new file mode 100644 index 0000000..098c149 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Raid.java @@ -0,0 +1,120 @@ +package me.xhsun.guildwars2wrapper.model; + +import java.util.List; + +/** + * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> + * Model class for raid + * + * @author xhsun + * @since 2017-06-06 + */ +public class Raid { + public enum EventType {Checkpoint, Boss} + + private String id; + private List<Wing> wings; + + public String getId() { + return id; + } + + public List<Wing> getWings() { + return wings; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Raid raid = (Raid) o; + + return id != null ? id.equals(raid.id) : raid.id == null; + } + + @Override + public int hashCode() { + return id != null ? id.hashCode() : 0; + } + + @Override + public String toString() { + return "Raid{" + + "id='" + id + '\'' + + ", wings=" + wings + + '}'; + } + + public class Wing { + private String id; + private List<Event> events; + + public String getId() { + return id; + } + + public List<Event> getEvents() { + return events; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Wing wing = (Wing) o; + + return id != null ? id.equals(wing.id) : wing.id == null; + } + + @Override + public int hashCode() { + return id != null ? id.hashCode() : 0; + } + + @Override + public String toString() { + return "Wing{" + + "id='" + id + '\'' + + ", events=" + events + + '}'; + } + } + + public class Event { + private String id; + private EventType type; + + public String getId() { + return id; + } + + public EventType getType() { + return type; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Event event = (Event) o; + + return id != null ? id.equals(event.id) : event.id == null; + } + + @Override + public int hashCode() { + return id != null ? id.hashCode() : 0; + } + + @Override + public String toString() { + return "Event{" + + "id='" + id + '\'' + + ", type=" + type + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java index f3e1c6c..8741727 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java @@ -4,7 +4,6 @@ import me.xhsun.guildwars2wrapper.model.util.comm.CraftingDisciplines; import me.xhsun.guildwars2wrapper.model.util.comm.Type; -import java.util.Arrays; import java.util.List; /** @@ -17,20 +16,20 @@ public class Recipe { public enum Flag {AutoLearned, LearnedFromItem} - private long id; + private int id; private Type type; - private long output_item_id; + private int output_item_id; private int output_item_count; - private long time_to_craft_ms; + private int time_to_craft_ms; private List<CraftingDisciplines> disciplines; private int min_rating; - private Flag[] flags; + private List<Flag> flags; private List<Ingredient> ingredients; private List<Ingredient> guild_ingredients; - private long output_upgrade_id; //TODO v2/guild/upgrades + private long output_upgrade_id; private String chat_link; - public long getId() { + public int getId() { return id; } @@ -38,15 +37,15 @@ public Type getType() { return type; } - public long getOutput_item_id() { + public int getOutputItemId() { return output_item_id; } - public int getOutput_item_count() { + public int getOutputItemCount() { return output_item_count; } - public long getTime_to_craft_ms() { + public int getTimeToCraftMS() { return time_to_craft_ms; } @@ -54,11 +53,11 @@ public List<CraftingDisciplines> getDisciplines() { return disciplines; } - public int getMin_rating() { + public int getMinRating() { return min_rating; } - public Flag[] getFlags() { + public List<Flag> getFlags() { return flags; } @@ -66,15 +65,15 @@ public List<Ingredient> getIngredients() { return ingredients; } - public List<Ingredient> getGuild_ingredients() { + public List<Ingredient> getGuildIngredients() { return guild_ingredients; } - public long getOutput_upgrade_id() { + public long getOutputUpgradeId() { return output_upgrade_id; } - public String getChat_link() { + public String getChatLink() { return chat_link; } @@ -90,7 +89,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); + return id; } @Override @@ -103,7 +102,7 @@ public String toString() { ", time_to_craft_ms=" + time_to_craft_ms + ", disciplines=" + disciplines + ", min_rating=" + min_rating + - ", flags=" + Arrays.toString(flags) + + ", flags=" + flags + ", ingredients=" + ingredients + ", guild_ingredients=" + guild_ingredients + ", output_upgrade_id=" + output_upgrade_id + @@ -116,17 +115,17 @@ public String toString() { */ public class Ingredient { @Expose - private long item_id; + private int item_id; @Expose - private long upgrade_id; + private int upgrade_id; @Expose private int count; - public long getItem_id() { + public int getItemId() { return item_id; } - public long getUpgrade_id() { + public int getUpgradeId() { return upgrade_id; } @@ -148,8 +147,8 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (item_id ^ (item_id >>> 32)); - result = 31 * result + (int) (upgrade_id ^ (upgrade_id >>> 32)); + int result = id; + result = 31 * result + upgrade_id; result = 31 * result + count; return result; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java index c6be033..2338a14 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java @@ -4,7 +4,7 @@ import me.xhsun.guildwars2wrapper.model.util.comm.Type; import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemDetail; -import java.util.Arrays; +import java.util.List; /** * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> @@ -19,17 +19,17 @@ public class Skin { public enum Flag {ShowInWardrobe, NoCost, HideIfLocked, OverrideRarity} - private long id; + private int id; private String name; private Item.Type type; - private Flag[] flags; - private Item.Restriction[] restrictions; + private List<Flag> flags; + private List<Item.Restriction> restrictions; private String icon; private Item.Rarity rarity; private String description; private Detail details; - public long getId() { + public int getId() { return id; } @@ -41,11 +41,11 @@ public Item.Type getType() { return type; } - public Flag[] getFlags() { + public List<Flag> getFlags() { return flags; } - public Item.Restriction[] getRestrictions() { + public List<Item.Restriction> getRestrictions() { return restrictions; } @@ -77,7 +77,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); + return id; } @Override @@ -86,8 +86,8 @@ public String toString() { "id=" + id + ", name='" + name + '\'' + ", type=" + type + - ", flags=" + Arrays.toString(flags) + - ", restrictions=" + Arrays.toString(restrictions) + + ", flags=" + flags + + ", restrictions=" + restrictions + ", icon='" + icon + '\'' + ", rarity=" + rarity + ", description='" + description + '\'' + @@ -114,11 +114,11 @@ public Type getType() { return type; } - public ItemDetail.Weight getWeight_class() { + public ItemDetail.Weight getWeightClass() { return weight_class; } - public ItemDetail.Damage getDamage_type() { + public ItemDetail.Damage getDamageType() { return damage_type; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Title.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Title.java new file mode 100644 index 0000000..f01f049 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Title.java @@ -0,0 +1,72 @@ +package me.xhsun.guildwars2wrapper.model; + +import me.xhsun.guildwars2wrapper.model.achievements.Achievement; + +import java.util.List; + +/** + * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> + * Model class for title + * + * @author xhsun + * @since 2017-06-06 + */ +public class Title { + private int id; + private String name; + private int achievement; + private List<Integer> achievements; + private int ap_required; + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + /** + * @return {@link Achievement} id + */ + public int getAchievement() { + return achievement; + } + + /** + * @return list of {@link Achievement} id + */ + public List<Integer> getAchievements() { + return achievements; + } + + public int getApRequired() { + return ap_required; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Title title = (Title) o; + + return id == title.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "Title{" + + "id=" + id + + ", name='" + name + '\'' + + ", achievement=" + achievement + + ", achievements=" + achievements + + ", ap_required=" + ap_required + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/TokenInfo.java b/src/main/java/me/xhsun/guildwars2wrapper/model/TokenInfo.java index 148a4d0..939d4fc 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/TokenInfo.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/TokenInfo.java @@ -1,6 +1,6 @@ package me.xhsun.guildwars2wrapper.model; -import java.util.Arrays; +import java.util.List; /** * For more info on TokenInfo API go <a href="https://wiki.guildwars2.com/wiki/API:2/tokeninfo">here</a><br/> @@ -13,7 +13,7 @@ public class TokenInfo { private String id; private String name; - private String[] permissions; + private List<String> permissions; public String getId() { return id; @@ -23,7 +23,7 @@ public String getName() { return name; } - public String[] getPermissions() { + public List<String> getPermissions() { return permissions; } @@ -47,7 +47,7 @@ public String toString() { return "TokenInfo{" + "id='" + id + '\'' + ", name='" + name + '\'' + - ", permissions=" + Arrays.toString(permissions) + + ", permissions=" + permissions + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Account.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Account.java index 3639406..b880828 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Account.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Account.java @@ -49,7 +49,7 @@ public List<String> getGuilds() { return guilds; } - public List<String> getGuild_leader() { + public List<String> getGuildLeader() { return guild_leader; } @@ -68,19 +68,19 @@ public boolean isCommander() { return commander; } - public int getFractal_level() { + public int getFractalLevel() { return fractal_level; } - public long getDaily_ap() { + public long getDailyAP() { return daily_ap; } - public long getMonthly_ap() { + public long getMonthlyAP() { return monthly_ap; } - public long getWvw_rank() { + public long getWvwRank() { return wvw_rank; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java new file mode 100644 index 0000000..363959b --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java @@ -0,0 +1,81 @@ +package me.xhsun.guildwars2wrapper.model.account; + +import java.util.Arrays; + +/** + * For more info on Account Achievements API go <a href="https://wiki.guildwars2.com/wiki/API:2/account/achievements">here</a><br/> + * Model class for account achievements + * + * @author xhsun + * @since 2017-06-05 + */ +public class AchievementProgression { + private int id; + private int current; + private int max;//default -1 or 0 + private boolean done; + private long repeated; + private int[] bits; + + public int getId() { + return id; + } + + public int getCurrent() { + return current; + } + + /** + * this number can be negative + * + * @return amount needed to complete an achievement + */ + public int getMax() { + return max; + } + + public boolean isDone() { + return done; + } + + public long getRepeated() { + return repeated; + } + + /** + * giving more specific information on the progress for the achievement<br/> + * Note: meaning of bits will added in the future + * + * @return array of ints + */ + public int[] getBits() { + return bits; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + AchievementProgression that = (AchievementProgression) o; + + return id == that.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "AchievementProgression{" + + "id=" + id + + ", current=" + current + + ", max=" + max + + ", done=" + done + + ", repeated=" + repeated + + ", bits=" + Arrays.toString(bits) + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java index bc965fd..668016e 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java @@ -16,11 +16,11 @@ */ public class Bank extends Storage { - private long skin; + private int skin; private List<Integer> upgrades; private List<Integer> infusions; - public long getSkinId() { + public int getSkinId() { return skin; } @@ -44,19 +44,19 @@ public boolean equals(Object o) { getCharges() == bank.getCharges() && skin == bank.skin && getBinding() == bank.getBinding() && - (getBound_to() != null ? getBound_to().equals(bank.getBound_to()) : bank.getBound_to() == null) && + (getBoundTo() != null ? getBoundTo().equals(bank.getBoundTo()) : bank.getBoundTo() == null) && (upgrades != null ? upgrades.equals(bank.upgrades) : bank.upgrades == null) && (infusions != null ? infusions.equals(bank.infusions) : bank.infusions == null); } @Override public int hashCode() { - int result = (int) (getItemId() ^ (getItemId() >>> 32)); + int result = getItemId(); result = 31 * result + getCount(); result = 31 * result + getCharges(); result = 31 * result + (getBinding() != null ? getBinding().hashCode() : 0); - result = 31 * result + (getBound_to() != null ? getBound_to().hashCode() : 0); - result = 31 * result + (int) (skin ^ (skin >>> 32)); + result = 31 * result + (getBoundTo() != null ? getBoundTo().hashCode() : 0); + result = 31 * result + skin; result = 31 * result + (upgrades != null ? upgrades.hashCode() : 0); result = 31 * result + (infusions != null ? infusions.hashCode() : 0); return result; @@ -69,7 +69,7 @@ public String toString() { ", count=" + getCount() + ", charges=" + getCharges() + ", binding=" + getBinding() + - ", bound_to='" + getBound_to() + '\'' + + ", bound_to='" + getBoundTo() + '\'' + ", skin=" + skin + ", upgrades=" + upgrades + ", infusions=" + infusions + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java new file mode 100644 index 0000000..3081c44 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java @@ -0,0 +1,43 @@ +package me.xhsun.guildwars2wrapper.model.account; + +/** + * <a href="https://wiki.guildwars2.com/wiki/API:2/account/home/cats">Cat</a> + * + * @author xhsun + * @since 2017-06-05 + */ +public class Cat { + private int id; + private String hint; + + public int getId() { + return id; + } + + public String getHint() { + return hint; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Cat cat = (Cat) o; + + return id == cat.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "Cat{" + + "id=" + id + + ", hint='" + hint + '\'' + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Material.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Material.java index bcef288..f0c399b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Material.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Material.java @@ -35,7 +35,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (getItemId() ^ (getItemId() >>> 32)); + int result = getItemId(); result = 31 * result + getCount(); result = 31 * result + (getBinding() != null ? getBinding().hashCode() : 0); result = 31 * result + category; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/SharedInventory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/SharedInventory.java index e9f4132..b29a3e9 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/SharedInventory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/SharedInventory.java @@ -13,9 +13,9 @@ */ public class SharedInventory extends Storage { - private long skin; + private int skin; - public long getSkin() { + public int getSkin() { return skin; } @@ -35,11 +35,11 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (getItemId() ^ (getItemId() >>> 32)); + int result = getItemId(); result = 31 * result + getCount(); result = 31 * result + getCharges(); result = 31 * result + (getBinding() != null ? getBinding().hashCode() : 0); - result = 31 * result + (int) (skin ^ (skin >>> 32)); + result = 31 * result + skin; return result; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java new file mode 100644 index 0000000..cf35072 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java @@ -0,0 +1,50 @@ +package me.xhsun.guildwars2wrapper.model.account; + +/** + * For more info on Account finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/account/finishers">here</a><br/> + * Model class for account finishers + * + * @author xhsun + * @since 2017-06-05 + */ +public class UnlockedFinisher { + private int id; + private boolean permanent; + private int quantity; + + public int getId() { + return id; + } + + public boolean isPermanent() { + return permanent; + } + + public int getQuantity() { + return quantity; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + UnlockedFinisher finisher = (UnlockedFinisher) o; + + return id == finisher.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "UnlockedFinisher{" + + "id=" + id + + ", permanent=" + permanent + + ", quantity=" + quantity + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java new file mode 100644 index 0000000..650fdda --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java @@ -0,0 +1,47 @@ +package me.xhsun.guildwars2wrapper.model.account; + +/** + * For more info on Account masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/account/masteries">here</a><br/> + * Model class of account masteries + * + * @author xhsun + * @since 2017-06-05 + */ +public class UnlockedMastery { + private int id; + private int level; + + public int getId() { + return id; + } + + /** + * @return level at which the mastery is on the account | 0 if not started + */ + public int getLevel() { + return level; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + UnlockedMastery that = (UnlockedMastery) o; + + return id == that.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "UnlockedMastery{" + + "id=" + id + + ", level=" + level + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Wallet.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Wallet.java index f70de04..bed2920 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Wallet.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Wallet.java @@ -11,10 +11,10 @@ */ public class Wallet { - private long id; + private int id; private long value; - public long getId() { + public int getCurrencyId() { return id; } @@ -34,7 +34,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (id ^ (id >>> 32)); + int result = id; result = 31 * result + (int) (value ^ (value >>> 32)); return result; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java new file mode 100644 index 0000000..97f4c85 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java @@ -0,0 +1,293 @@ +package me.xhsun.guildwars2wrapper.model.achievements; + +import com.google.gson.annotations.Expose; +import me.xhsun.guildwars2wrapper.model.util.comm.Region; + +import java.util.List; + +/** + * For more info on achievements API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements">here</a><br/> + * Model class for achievements + * + * @author xhsun + * @since 2017-06-05 + */ +public class Achievement { + private enum Type { + Default, ItemSet, + Coins, Item, Mastery, Title, + Text, Minipet, Skin + } + + private enum Flag { + Pvp, CategoryDisplay, MoveToTop, IgnoreNearlyComplete, Repeatable, Hidden, + RequiresUnlock, RepairOnLogin, Daily, Weekly, Monthly, Permanent + } + + private int id; + private String icon; + private String name; + private String description; + private String requirement; + private String locked_text; + private Type type; + private List<Flag> flags; + private List<Tier> tiers; + private List<Integer> prerequisites;//achievement ids + private List<Reward> rewards; + private List<Bits> bits; + + public int getId() { + return id; + } + + public String getIcon() { + return icon; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getRequirement() { + return requirement; + } + + public String getLockedText() { + return locked_text; + } + + public Type getType() { + return type; + } + + public List<Flag> getFlags() { + return flags; + } + + public List<Tier> getTiers() { + return tiers; + } + + public List<Integer> getPrerequisites() { + return prerequisites; + } + + public List<Reward> getRewards() { + return rewards; + } + + public List<Bits> getBits() { + return bits; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Achievement that = (Achievement) o; + + return id == that.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "Achievement{" + + "id=" + id + + ", icon='" + icon + '\'' + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", requirement='" + requirement + '\'' + + ", locked_text='" + locked_text + '\'' + + ", type=" + type + + ", flags=" + flags + + ", tiers=" + tiers + + ", prerequisites=" + prerequisites + + ", rewards=" + rewards + + ", bits=" + bits + + '}'; + } + + public class Tier { + @Expose + private int count; + @Expose + private int points; + + public int getCount() { + return count; + } + + public int getPoints() { + return points; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Tier that = (Tier) o; + + return count == that.count && points == that.points; + } + + @Override + public int hashCode() { + int result = count; + result = 31 * result + points; + return result; + } + + @Override + public String toString() { + return "AchievementTier{" + + "count=" + count + + ", points=" + points + + '}'; + } + } + + public class Reward { + @Expose + private Type type; + @Expose + private int id; + @Expose + private long count; + @Expose + private Region region; + + /** + * if {@link #type} is + * - coins: count + * - item: item id, count + * - mastery: mastery id, region + * - title: title id + */ + public Type getType() { + return type; + } + + /** + * the type of id depend on {@link #type} + * + * @return item id | mastery id | title id + */ + public int getId() { + return id; + } + + /** + * the type of stuff rewarded depend on {@link #type} + * + * @return number of coin | item + */ + public long getCount() { + return count; + } + + public Region getRegion() { + return region; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Reward reward = (Reward) o; + + return id == reward.id && + count == reward.count && + type == reward.type && + region == reward.region; + } + + @Override + public int hashCode() { + int result = type != null ? type.hashCode() : 0; + result = 31 * result + id; + result = 31 * result + (int) (count ^ (count >>> 32)); + result = 31 * result + (region != null ? region.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "Reward{" + + "type=" + type + + ", id=" + id + + ", count=" + count + + ", region=" + region + + '}'; + } + } + + public class Bits { + @Expose + private Type type; + @Expose + private int id; + @Expose + private String text; + + /** + * if {@link #type} is + * - text: {@link #text} + * - item: item id + * - minipet: mini id + * - skin: skin id + */ + public Type getType() { + return type; + } + + public int getId() { + return id; + } + + public String getText() { + return text; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Bits bits = (Bits) o; + + return id == bits.id && + type == bits.type && + (text != null ? text.equals(bits.text) : bits.text == null); + } + + @Override + public int hashCode() { + int result = type != null ? type.hashCode() : 0; + result = 31 * result + id; + result = 31 * result + (text != null ? text.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "Bits{" + + "type=" + type + + ", id=" + id + + ", text='" + text + '\'' + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java index 394547a..f21df07 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java @@ -14,12 +14,12 @@ */ public class Prices { - private long id; + private int id; private boolean whitelisted; private Price buys; private Price sells; - public long getId() { + public int getItemId() { return id; } @@ -47,7 +47,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (id ^ (id >>> 32)); + int result = id; result = 31 * result + (whitelisted ? 1 : 0); return result; } @@ -74,7 +74,7 @@ public static class Price { @Expose private long quantity; - public long getUnit_price() { + public long getUnitPrice() { return unit_price; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Transaction.java b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Transaction.java index 155dfa8..c3b4ea6 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Transaction.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Transaction.java @@ -17,7 +17,7 @@ public enum Time {Current, History} public enum Type {Buy, Sell} private long id; - private long item_id; + private int item_id; private long price; private int quantity; private String created; @@ -27,7 +27,7 @@ public long getId() { return id; } - public long getItem_id() { + public int getItemId() { return item_id; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/guild/Upgrade.java b/src/main/java/me/xhsun/guildwars2wrapper/model/guild/Upgrade.java new file mode 100644 index 0000000..0fe1004 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/guild/Upgrade.java @@ -0,0 +1,177 @@ +package me.xhsun.guildwars2wrapper.model.guild; + +import java.util.List; + +/** + * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> + * Model class for guild upgrade + * + * @author xhsun + * @since 2017-06-06 + */ +public class Upgrade { + public enum Type { + AccumulatingCurrency, BankBag, Boost, Claimable, Consumable, Decoration, GuildHall, GuildHallExpedition, + Hub, Queue, Unlock + } + + public enum CostType {Item, Collectible, Currency, Coins} + + private int id; + private String name; + private String description; + private Type type; + private int bag_max_items; + private int bag_max_coins; + private String icon; + private int build_time; + private int required_level; + private int experience; + private List<Integer> prerequisites; + private List<Cost> costs; + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public Type getType() { + return type; + } + + /** + * Only used when {@link #type} is {@link Type#BankBag} + */ + public int getBagMaxItems() { + return bag_max_items; + } + + /** + * Only used when {@link #type} is {@link Type#BankBag} + */ + public int getBagMaxCoins() { + return bag_max_coins; + } + + public String getIcon() { + return icon; + } + + public int getBuildTime() { + return build_time; + } + + public int getRequiredLevel() { + return required_level; + } + + public int getExperience() { + return experience; + } + + /** + * @return list of {@link Upgrade} ids + */ + public List<Integer> getPrerequisites() { + return prerequisites; + } + + public List<Cost> getCosts() { + return costs; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Upgrade upgrade = (Upgrade) o; + + return id == upgrade.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "Upgrade{" + + "id=" + id + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", type=" + type + + ", bag_max_items=" + bag_max_items + + ", bag_max_coins=" + bag_max_coins + + ", icon='" + icon + '\'' + + ", build_time=" + build_time + + ", required_level=" + required_level + + ", experience=" + experience + + ", prerequisites=" + prerequisites + + ", costs=" + costs + + '}'; + } + + public class Cost { + private CostType type; + private String name; + private int count; + private int item_id; + + public CostType getType() { + return type; + } + + public String getName() { + return name; + } + + public int getCount() { + return count; + } + + public int getItemId() { + return item_id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Cost cost = (Cost) o; + + return count == cost.count && + item_id == cost.item_id && + type == cost.type && + (name != null ? name.equals(cost.name) : cost.name == null); + } + + @Override + public int hashCode() { + int result = type != null ? type.hashCode() : 0; + result = 31 * result + (name != null ? name.hashCode() : 0); + result = 31 * result + count; + result = 31 * result + item_id; + return result; + } + + @Override + public String toString() { + return "Cost{" + + "type=" + type + + ", name='" + name + '\'' + + ", count=" + count + + ", item_id=" + item_id + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Hero.java b/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Hero.java new file mode 100644 index 0000000..2141c2f --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Hero.java @@ -0,0 +1,162 @@ +package me.xhsun.guildwars2wrapper.model.pvp; + +import com.google.gson.annotations.SerializedName; +import me.xhsun.guildwars2wrapper.model.unlockable.Unlockable; + +import java.util.Arrays; +import java.util.List; + +/** + * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> + * Model class for pvp hero + * + * @author xhsun + * @since 2017-06-06 + */ +public class Hero { + private String id; + private String name; + private String type; + private Stat stats; + private String overlay; + private String underlay; + private List<Skin> skins; + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public Stat getStats() { + return stats; + } + + public String getOverlay() { + return overlay; + } + + public String getUnderlay() { + return underlay; + } + + public List<Skin> getSkins() { + return skins; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Hero hero = (Hero) o; + + return id != null ? id.equals(hero.id) : hero.id == null; + } + + @Override + public int hashCode() { + return id != null ? id.hashCode() : 0; + } + + @Override + public String toString() { + return "Hero{" + + "id='" + id + '\'' + + ", name='" + name + '\'' + + ", type='" + type + '\'' + + ", stats=" + stats + + ", overlay='" + overlay + '\'' + + ", underlay='" + underlay + '\'' + + ", skins=" + skins + + '}'; + } + + public class Skin extends Unlockable { + @SerializedName("default") + private boolean _default; + + public boolean isDefault() { + return _default; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Skin skin = (Skin) o; + + return super.getId() == skin.getId(); + } + + @Override + public int hashCode() { + return super.getId(); + } + + @Override + public String toString() { + return "Skin{" + + "id=" + super.getId() + + ", unlock_items=" + Arrays.toString(getUnlockItems()) + + ", icon='" + getIcon() + '\'' + + ", name='" + super.getName() + '\'' + + ", default=" + _default + + '}'; + } + } + + public class Stat { + private int offense; + private int defense; + private int speed; + + public int getOffense() { + return offense; + } + + public int getDefense() { + return defense; + } + + public int getSpeed() { + return speed; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Stat stat = (Stat) o; + + return offense == stat.offense && + defense == stat.defense && + speed == stat.speed; + } + + @Override + public int hashCode() { + int result = offense; + result = 31 * result + defense; + result = 31 * result + speed; + return result; + } + + @Override + public String toString() { + return "Stat{" + + "offense=" + offense + + ", defense=" + defense + + ", speed=" + speed + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java new file mode 100644 index 0000000..ffc9cda --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java @@ -0,0 +1,45 @@ +package me.xhsun.guildwars2wrapper.model.unlockable; + +import java.util.Arrays; + +/** + * For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> + * Model class for finisher + * + * @author xhsun + * @since 2017-06-06 + */ +public class Finisher extends Unlockable { + private String unlock_details; + + public String getUnlockDetails() { + return unlock_details; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Finisher finisher = (Finisher) o; + + return getId() == finisher.getId(); + } + + @Override + public int hashCode() { + return getId(); + } + + @Override + public String toString() { + return "Finisher{" + + "id=" + getId() + + ", unlock_details='" + unlock_details + '\'' + + ", unlock_items=" + Arrays.toString(getUnlockItems()) + + ", order=" + getOrder() + + ", icon='" + getIcon() + '\'' + + ", name='" + getName() + '\'' + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java new file mode 100644 index 0000000..50bcc38 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java @@ -0,0 +1,58 @@ +package me.xhsun.guildwars2wrapper.model.unlockable; + +import me.xhsun.guildwars2wrapper.model.Color; + +import java.util.Arrays; +import java.util.List; + +/** + * For more info on gliders API go <a href="https://wiki.guildwars2.com/wiki/API:2/gliders">here</a><br/> + * Model class for glider + * + * @author xhsun + * @since 2017-06-06 + */ +public class Glider extends Unlockable { + private String description; + private List<Integer> default_dyes;//color id + + //TODO method that give striped description, ie, no html + public String getDescription() { + return description; + } + + /** + * @return array of {@link Color} id(s) + */ + public List<Integer> getDefaultDyes() { + return default_dyes; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Glider glider = (Glider) o; + + return getId() == glider.getId(); + } + + @Override + public int hashCode() { + return getId(); + } + + @Override + public String toString() { + return "Glider{" + + "id=" + getId() + + ", unlock_items=" + Arrays.toString(getUnlockItems()) + + ", order=" + getOrder() + + ", icon='" + getIcon() + '\'' + + ", name='" + getName() + '\'' + + ", description='" + description + '\'' + + ", default_dyes=" + default_dyes + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java new file mode 100644 index 0000000..e055be0 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java @@ -0,0 +1,46 @@ +package me.xhsun.guildwars2wrapper.model.unlockable; + +import java.util.Arrays; +import java.util.List; + +/** + * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> + * Model class for mail carrier + * + * @author xhsun + * @since 2017-06-06 + */ +public class MailCarrier extends Unlockable { + private List<String> flags; + + public List<String> getFlags() { + return flags; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + MailCarrier that = (MailCarrier) o; + + return getId() == that.getId(); + } + + @Override + public int hashCode() { + return getId(); + } + + @Override + public String toString() { + return "MailCarrier{" + + "id=" + getId() + + ", unlock_items=" + Arrays.toString(getUnlockItems()) + + ", order=" + getOrder() + + ", icon='" + getIcon() + '\'' + + ", name='" + getName() + '\'' + + ", flags=" + flags + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Outfit.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Outfit.java new file mode 100644 index 0000000..e37260d --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Outfit.java @@ -0,0 +1,37 @@ +package me.xhsun.guildwars2wrapper.model.unlockable; + +import java.util.Arrays; + +/** + * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> + * Model class for outfit + * + * @author xhsun + * @since 2017-06-06 + */ +public class Outfit extends Unlockable { + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Outfit outfit = (Outfit) o; + + return getId() == outfit.getId(); + } + + @Override + public int hashCode() { + return getId(); + } + + @Override + public String toString() { + return "Outfit{" + + "id=" + getId() + + ", unlock_items=" + Arrays.toString(getUnlockItems()) + + ", icon='" + getIcon() + '\'' + + ", name='" + getName() + '\'' + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java new file mode 100644 index 0000000..5f1d9dd --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java @@ -0,0 +1,45 @@ +package me.xhsun.guildwars2wrapper.model.unlockable; + +import me.xhsun.guildwars2wrapper.model.Item; +import me.xhsun.guildwars2wrapper.model.pvp.Hero; +/** + * Super class for model classes that have unlock item field + * + * @author xhsun + * @since 2017-06-06 + */ +public class Unlockable { + private int id; + private int[] unlock_items;//item id + private int order; + private String icon; + private String name; + + public int getId() { + return id; + } + + /** + * @return array of {@link Item} id(s) + */ + public int[] getUnlockItems() { + return unlock_items; + } + + /** + * not applicable to {@link Outfit}, {@link Hero.Skin} + * + * @return Order shown in game + */ + public int getOrder() { + return order; + } + + public String getIcon() { + return icon; + } + + public String getName() { + return name; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Bag.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Bag.java index 4713fd8..2b2bca9 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Bag.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Bag.java @@ -10,11 +10,11 @@ * @since 2017-02-07 */ public class Bag { - private long id; + private int id; private int size; private List<Inventory> inventory; - public long getId() { + public int getId() { return id; } @@ -40,7 +40,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (id ^ (id >>> 32)); + int result = id; result = 31 * result + size; result = 31 * result + (inventory != null ? inventory.hashCode() : 0); return result; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java index 8791e15..78d5af8 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java @@ -2,7 +2,7 @@ import me.xhsun.guildwars2wrapper.model.ItemStats; -import java.util.Arrays; +import java.util.List; /** * Character inventory bag inventory model class @@ -14,20 +14,20 @@ * @since 2017-02-07 */ public class Inventory extends Storage { - private int[] infusions; - private int[] upgrades; - private long skin; + private List<Integer> infusions; + private List<Integer> upgrades; + private int skin; private ItemStats stats; - public int[] getInfusions() { + public List<Integer> getInfusions() { return infusions; } - public int[] getUpgrades() { + public List<Integer> getUpgrades() { return upgrades; } - public long getSkin() { + public int getSkin() { return skin; } @@ -47,21 +47,22 @@ public boolean equals(Object o) { getCharges() == inventory.getCharges() && skin == inventory.skin && getBinding() == inventory.getBinding() && - (getBound_to() != null ? getBound_to().equals(inventory.getBound_to()) : inventory.getBound_to() == null) && - Arrays.equals(infusions, inventory.infusions) && Arrays.equals(upgrades, inventory.upgrades) && + (getBoundTo() != null ? getBoundTo().equals(inventory.getBoundTo()) : inventory.getBoundTo() == null) && + (infusions != null ? infusions.equals(inventory.infusions) : inventory.infusions == null) && + (upgrades != null ? upgrades.equals(inventory.upgrades) : inventory.upgrades == null) && (stats != null ? stats.equals(inventory.stats) : inventory.stats == null); } @Override public int hashCode() { - int result = (int) (getItemId() ^ (getItemId() >>> 32)); + int result = getItemId(); result = 31 * result + getCount(); result = 31 * result + getCharges(); result = 31 * result + (getBinding() != null ? getBinding().hashCode() : 0); - result = 31 * result + (getBound_to() != null ? getBound_to().hashCode() : 0); - result = 31 * result + Arrays.hashCode(infusions); - result = 31 * result + Arrays.hashCode(upgrades); - result = 31 * result + (int) (skin ^ (skin >>> 32)); + result = 31 * result + (getBoundTo() != null ? getBoundTo().hashCode() : 0); + result = 31 * result + (infusions != null ? infusions.hashCode() : 0); + result = 31 * result + (upgrades != null ? upgrades.hashCode() : 0); + result = 31 * result + skin; result = 31 * result + (stats != null ? stats.hashCode() : 0); return result; } @@ -73,9 +74,9 @@ public String toString() { ", count=" + getCount() + ", charges=" + getCharges() + ", binding=" + getBinding() + - ", bound_to='" + getBound_to() + '\'' + - ", infusions=" + Arrays.toString(infusions) + - ", upgrades=" + Arrays.toString(upgrades) + + ", bound_to='" + getBoundTo() + '\'' + + ", infusions=" + infusions + + ", upgrades=" + upgrades + ", skin=" + skin + ", stats=" + stats + '}'; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java index 385771a..af3c54a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java @@ -7,13 +7,13 @@ public class Storage { public enum Binding {Account, Character} - private long id; + private int id; private int count; private int charges; private Binding binding; private String bound_to; - public long getItemId() { + public int getItemId() { return id; } @@ -29,7 +29,7 @@ public Binding getBinding() { return binding; } - public String getBound_to() { + public String getBoundTo() { return bound_to; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Region.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Region.java new file mode 100644 index 0000000..e383471 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Region.java @@ -0,0 +1,11 @@ +package me.xhsun.guildwars2wrapper.model.util.comm; + +/** + * Reminder: update this every time new mastery region is out + * + * @author xhsun + * @since 2017-06-06 + */ +public enum Region { + Tyria, Maguuma +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Armor.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Armor.java index 5be3a2c..9aa0c99 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Armor.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Armor.java @@ -4,7 +4,7 @@ import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfusionSlot; -import java.util.Arrays; +import java.util.List; /** * For more info on Armor detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Armor">here</a><br/> @@ -27,7 +27,7 @@ public int getDefense() { return defense; } - public InfusionSlot[] getInfusionSlots() { + public List<InfusionSlot> getInfusionSlots() { return infusion_slots; } @@ -35,7 +35,7 @@ public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } - public long getSuffixID() { + public int getSuffixID() { return suffix_item_id; } @@ -43,7 +43,7 @@ public String getSecSuffixID() { return secondary_suffix_item_id; } - public String[] getStatChoice() { + public List<String> getStatChoice() { return stat_choices; } @@ -58,10 +58,10 @@ public boolean equals(Object o) { (suffix_item_id == armor.suffix_item_id) && (type == armor.type) && (weight_class == armor.weight_class) && - (Arrays.equals(infusion_slots, armor.infusion_slots)) && + (infusion_slots != null ? infusion_slots.equals(armor.infusion_slots) : armor.infusion_slots == null) && (infix_upgrade != null ? infix_upgrade.equals(armor.infix_upgrade) : armor.infix_upgrade == null) && (secondary_suffix_item_id != null ? secondary_suffix_item_id.equals(armor.secondary_suffix_item_id) : armor.secondary_suffix_item_id == null) && - (Arrays.equals(stat_choices, armor.stat_choices)); + (stat_choices != null ? stat_choices.equals(armor.stat_choices) : armor.stat_choices == null); } @Override @@ -69,11 +69,11 @@ public int hashCode() { int result = type != null ? type.hashCode() : 0; result = 31 * result + (weight_class != null ? weight_class.hashCode() : 0); result = 31 * result + defense; - result = 31 * result + Arrays.hashCode(infusion_slots); + result = 31 * result + (infusion_slots != null ? infusion_slots.hashCode() : 0); result = 31 * result + (infix_upgrade != null ? infix_upgrade.hashCode() : 0); - result = 31 * result + (int) (suffix_item_id ^ (suffix_item_id >>> 32)); + result = 31 * result + suffix_item_id; result = 31 * result + (secondary_suffix_item_id != null ? secondary_suffix_item_id.hashCode() : 0); - result = 31 * result + Arrays.hashCode(stat_choices); + result = 31 * result + (stat_choices != null ? stat_choices.hashCode() : 0); return result; } @@ -83,11 +83,11 @@ public String toString() { "type=" + type + ", weight_class=" + weight_class + ", defense=" + defense + - ", infusion_slots=" + Arrays.toString(infusion_slots) + + ", infusion_slots=" + infusion_slots + ", infix_upgrade=" + infix_upgrade + ", suffix_item_id=" + suffix_item_id + ", secondary_suffix_item_id='" + secondary_suffix_item_id + '\'' + - ", stat_choices=" + Arrays.toString(stat_choices) + + ", stat_choices=" + stat_choices + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Back.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Back.java index fe6d1fe..120b6e8 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Back.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Back.java @@ -4,7 +4,7 @@ import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfusionSlot; -import java.util.Arrays; +import java.util.List; /** * For more info on Back detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Back_item">here</a><br/> @@ -15,7 +15,7 @@ * @since 2017-02-10 */ public class Back extends ItemDetail { - public InfusionSlot[] getInfusionSlots() { + public List<InfusionSlot> getInfusionSlots() { return infusion_slots; } @@ -23,7 +23,7 @@ public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } - public long getSuffixID() { + public int getSuffixID() { return suffix_item_id; } @@ -31,7 +31,7 @@ public String getSecSuffixID() { return secondary_suffix_item_id; } - public String[] getStatChoice() { + public List<String> getStatChoice() { return stat_choices; } @@ -43,30 +43,30 @@ public boolean equals(Object o) { Back back = (Back) o; return suffix_item_id == back.suffix_item_id && - Arrays.equals(infusion_slots, back.infusion_slots) && + (infusion_slots != null ? infusion_slots.equals(back.infusion_slots) : back.infusion_slots == null) && (infix_upgrade != null ? infix_upgrade.equals(back.infix_upgrade) : back.infix_upgrade == null) && (secondary_suffix_item_id != null ? secondary_suffix_item_id.equals(back.secondary_suffix_item_id) : back.secondary_suffix_item_id == null) && - Arrays.equals(stat_choices, back.stat_choices); + (stat_choices != null ? stat_choices.equals(back.stat_choices) : back.stat_choices == null); } @Override public int hashCode() { - int result = Arrays.hashCode(infusion_slots); + int result = infusion_slots != null ? infusion_slots.hashCode() : 0; result = 31 * result + (infix_upgrade != null ? infix_upgrade.hashCode() : 0); - result = 31 * result + (int) (suffix_item_id ^ (suffix_item_id >>> 32)); + result = 31 * result + suffix_item_id; result = 31 * result + (secondary_suffix_item_id != null ? secondary_suffix_item_id.hashCode() : 0); - result = 31 * result + Arrays.hashCode(stat_choices); + result = 31 * result + (stat_choices != null ? stat_choices.hashCode() : 0); return result; } @Override public String toString() { return "Back{" + - "infusion_slots=" + Arrays.toString(infusion_slots) + + "infusion_slots=" + infusion_slots + ", infix_upgrade=" + infix_upgrade + ", suffix_item_id=" + suffix_item_id + ", secondary_suffix_item_id='" + secondary_suffix_item_id + '\'' + - ", stat_choices=" + Arrays.toString(stat_choices) + + ", stat_choices=" + stat_choices + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Consumable.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Consumable.java index 32d8a7f..9909701 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Consumable.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Consumable.java @@ -31,11 +31,11 @@ public Unlock getUnlockType() { return unlock_type; } - public long getColorID() { + public int getColorID() { return color_id; } - public long getRecipeID() { + public int getRecipeID() { return recipe_id; } @@ -66,8 +66,8 @@ public int hashCode() { result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (int) (duration_ms ^ (duration_ms >>> 32)); result = 31 * result + (unlock_type != null ? unlock_type.hashCode() : 0); - result = 31 * result + (int) (color_id ^ (color_id >>> 32)); - result = 31 * result + (int) (recipe_id ^ (recipe_id >>> 32)); + result = 31 * result + color_id; + result = 31 * result + recipe_id; result = 31 * result + (name != null ? name.hashCode() : 0); return result; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java index ffb050f..2eb04a7 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java @@ -4,6 +4,8 @@ import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfusionSlot; +import java.util.List; + /** * For more info on Item detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Armor">here</a><br/> * template for all item detail @@ -41,11 +43,11 @@ public enum Flag { //Common Type type; int defense; - InfusionSlot[] infusion_slots; + List<InfusionSlot> infusion_slots; InfixUpgrade infix_upgrade; - long suffix_item_id; + int suffix_item_id; String secondary_suffix_item_id; - String[] stat_choices; + List<String> stat_choices; //Armor Weight weight_class; //Bag @@ -55,19 +57,19 @@ public enum Flag { String description; long duration_ms; Unlock unlock_type; - long color_id; - long recipe_id; + int color_id; + int recipe_id; String name; String icon; //Mini - long minipet_id; + int minipet_id; //Salvage kit int charges; //Upgrade component - Flag[] flags; - Infusion[] infusion_upgrade_flags; + List<Flag> flags; + List<Infusion> infusion_upgrade_flags; String suffix; - String[] bonuses;//for runes only + List<String> bonuses;//for runes only //Weapon Damage damage_type; int min_power; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Mini.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Mini.java index d09dde0..a2e53f2 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Mini.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Mini.java @@ -9,7 +9,7 @@ * @since 2017-02-10 */ public class Mini extends ItemDetail { - public long getMiniID() { + public int getMiniID() { return minipet_id; } @@ -25,7 +25,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return (int) (minipet_id ^ (minipet_id >>> 32)); + return minipet_id; } @Override diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Trinket.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Trinket.java index d2ad7f1..b5ac467 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Trinket.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Trinket.java @@ -3,7 +3,7 @@ import me.xhsun.guildwars2wrapper.model.util.comm.Type; import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; -import java.util.Arrays; +import java.util.List; /** * For more info on Trinket detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Trinket">here</a><br/> @@ -18,11 +18,11 @@ public Type getType() { return type; } - public Flag[] getFlags() { + public List<Flag> getFlags() { return flags; } - public Infusion[] getInfusionUpgradeFlag() { + public List<Infusion> getInfusionUpgradeFlag() { return infusion_upgrade_flags; } @@ -30,11 +30,11 @@ public String getSuffix() { return suffix; } - public InfixUpgrade getInfxUpgrade() { + public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } - public String[] getBonuses() { + public List<String> getBonuses() { return bonuses; } @@ -46,19 +46,19 @@ public boolean equals(Object o) { Trinket trinket = (Trinket) o; return type == trinket.type && - Arrays.equals(flags, trinket.flags) && - Arrays.equals(infusion_upgrade_flags, trinket.infusion_upgrade_flags) && + (flags != null ? flags.equals(trinket.flags) : trinket.flags == null) && + (infusion_upgrade_flags != null ? infusion_upgrade_flags.equals(trinket.infusion_upgrade_flags) : trinket.infusion_upgrade_flags == null) && (suffix != null ? suffix.equals(trinket.suffix) : trinket.suffix == null) && - Arrays.equals(bonuses, trinket.bonuses); + (bonuses != null ? bonuses.equals(trinket.bonuses) : trinket.bonuses == null); } @Override public int hashCode() { int result = type != null ? type.hashCode() : 0; - result = 31 * result + Arrays.hashCode(flags); - result = 31 * result + Arrays.hashCode(infusion_upgrade_flags); + result = 31 * result + (flags != null ? flags.hashCode() : 0); + result = 31 * result + (infusion_upgrade_flags != null ? infusion_upgrade_flags.hashCode() : 0); result = 31 * result + (suffix != null ? suffix.hashCode() : 0); - result = 31 * result + Arrays.hashCode(bonuses); + result = 31 * result + (bonuses != null ? bonuses.hashCode() : 0); return result; } @@ -66,10 +66,10 @@ public int hashCode() { public String toString() { return "Trinket{" + "type=" + type + - ", flags=" + Arrays.toString(flags) + - ", infusion_upgrade_flags=" + Arrays.toString(infusion_upgrade_flags) + + ", flags=" + flags + + ", infusion_upgrade_flags=" + infusion_upgrade_flags + ", suffix='" + suffix + '\'' + - ", bonuses=" + Arrays.toString(bonuses) + + ", bonuses=" + bonuses + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java index 3dc2178..5ac62d6 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java @@ -4,7 +4,7 @@ import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfusionSlot; -import java.util.Arrays; +import java.util.List; /** * For more info on Weapon detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Weapon">here</a><br/> @@ -35,7 +35,7 @@ public int getDefense() { return defense; } - public InfusionSlot[] getInfusionSlots() { + public List<InfusionSlot> getInfusionSlots() { return infusion_slots; } @@ -43,7 +43,7 @@ public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } - public long getSuffixID() { + public int getSuffixID() { return suffix_item_id; } @@ -51,7 +51,7 @@ public String getSecSuffixID() { return secondary_suffix_item_id; } - public String[] getStatChoice() { + public List<String> getStatChoice() { return stat_choices; } @@ -68,10 +68,10 @@ public boolean equals(Object o) { suffix_item_id == weapon.suffix_item_id && type == weapon.type && damage_type == weapon.damage_type && - Arrays.equals(infusion_slots, weapon.infusion_slots) && + (infusion_slots != null ? infusion_slots.equals(weapon.infusion_slots) : weapon.infusion_slots == null) && (infix_upgrade != null ? infix_upgrade.equals(weapon.infix_upgrade) : weapon.infix_upgrade == null) && (secondary_suffix_item_id != null ? secondary_suffix_item_id.equals(weapon.secondary_suffix_item_id) : weapon.secondary_suffix_item_id == null) && - Arrays.equals(stat_choices, weapon.stat_choices); + (stat_choices != null ? stat_choices.equals(weapon.stat_choices) : weapon.stat_choices == null); } @Override @@ -81,11 +81,11 @@ public int hashCode() { result = 31 * result + min_power; result = 31 * result + max_power; result = 31 * result + defense; - result = 31 * result + Arrays.hashCode(infusion_slots); + result = 31 * result + (infusion_slots != null ? infusion_slots.hashCode() : 0); result = 31 * result + (infix_upgrade != null ? infix_upgrade.hashCode() : 0); - result = 31 * result + (int) (suffix_item_id ^ (suffix_item_id >>> 32)); + result = 31 * result + suffix_item_id; result = 31 * result + (secondary_suffix_item_id != null ? secondary_suffix_item_id.hashCode() : 0); - result = 31 * result + Arrays.hashCode(stat_choices); + result = 31 * result + (stat_choices != null ? stat_choices.hashCode() : 0); return result; } @@ -97,11 +97,11 @@ public String toString() { ", min_power=" + min_power + ", max_power=" + max_power + ", defense=" + defense + - ", infusion_slots=" + Arrays.toString(infusion_slots) + + ", infusion_slots=" + infusion_slots + ", infix_upgrade=" + infix_upgrade + ", suffix_item_id=" + suffix_item_id + ", secondary_suffix_item_id='" + secondary_suffix_item_id + '\'' + - ", stat_choices=" + Arrays.toString(stat_choices) + + ", stat_choices=" + stat_choices + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/Buff.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/Buff.java index bc7c417..6f1723b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/Buff.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/Buff.java @@ -9,14 +9,14 @@ */ public class Buff { - private long skill_id; + private int skill_id; private String description; public String getDescription() { return description; } - public long getSkillID() { + public int getSkillID() { return skill_id; } @@ -33,7 +33,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = (int) (skill_id ^ (skill_id >>> 32)); + int result = skill_id; result = 31 * result + (description != null ? description.hashCode() : 0); return result; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixUpgrade.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixUpgrade.java index 69722d6..46834e8 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixUpgrade.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixUpgrade.java @@ -1,6 +1,6 @@ package me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject; -import java.util.Arrays; +import java.util.List; /** * For more info on Infix upgrade API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Infix_upgrade_subobject">here</a><br/> @@ -13,10 +13,10 @@ */ public class InfixUpgrade { - private InfixAttribute[] attributes; + private List<InfixAttribute> attributes; private Buff buff; - public InfixAttribute[] getAttributes() { + public List<InfixAttribute> getAttributes() { return attributes; } @@ -31,13 +31,13 @@ public boolean equals(Object o) { InfixUpgrade that = (InfixUpgrade) o; - return Arrays.equals(attributes, that.attributes) && + return (attributes != null ? attributes.equals(that.attributes) : that.attributes == null) && (buff != null ? buff.equals(that.buff) : that.buff == null); } @Override public int hashCode() { - int result = Arrays.hashCode(attributes); + int result = attributes != null ? attributes.hashCode() : 0; result = 31 * result + (buff != null ? buff.hashCode() : 0); return result; } @@ -45,7 +45,7 @@ public int hashCode() { @Override public String toString() { return "InfixUpgrade{" + - "attributes=" + Arrays.toString(attributes) + + "attributes=" + attributes + ", buff=" + buff + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java index 8f81955..4053a59 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java @@ -2,7 +2,7 @@ import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemDetail; -import java.util.Arrays; +import java.util.List; /** * For more info on Infusion slots API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Infusion_slot_subobject">here</a><br/> @@ -13,14 +13,14 @@ */ public class InfusionSlot { - private ItemDetail.Flag[] flags; - private long item_id; + private List<ItemDetail.Flag> flags; + private int item_id; - public ItemDetail.Flag[] getFlags() { + public List<ItemDetail.Flag> getFlags() { return flags; } - public long getID() { + public int getID() { return item_id; } @@ -31,20 +31,21 @@ public boolean equals(Object o) { InfusionSlot that = (InfusionSlot) o; - return item_id == that.item_id && Arrays.equals(flags, that.flags); + return item_id == that.item_id && + (flags != null ? flags.equals(that.flags) : that.flags == null); } @Override public int hashCode() { - int result = Arrays.hashCode(flags); - result = 31 * result + (int) (item_id ^ (item_id >>> 32)); + int result = flags != null ? flags.hashCode() : 0; + result = 31 * result + item_id; return result; } @Override public String toString() { return "InfusionSlot{" + - "flags=" + Arrays.toString(flags) + + "flags=" + flags + ", item_id=" + item_id + '}'; }