From 7a2a46d1d270642b2acb0f28d494ec3b2b277ef1 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 18:58:43 -0600 Subject: [PATCH 01/33] done account achievements API --- .../AsynchronousRequest.java | 15 ++++ .../guildwars2wrapper/GuildWars2API.java | 3 + .../guildwars2wrapper/SynchronousRequest.java | 20 +++++ .../model/account/Achievement.java | 81 +++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/account/Achievement.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 884531c..286999a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -55,6 +55,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 Achievement Account achievement info + */ + public void getAccountAchievements(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getAccountAchievements(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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index bc68e77..a3f5a3e 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -24,6 +24,9 @@ interface GuildWars2API { @GET("/v2/account") Call getAccount(@Query("access_token") String token); + @GET("/v2/account/achievements") + Call> getAccountAchievements(@Query("access_token") String token); + @GET("/v2/account/bank") Call> getBank(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 19baed3..5d1633f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -66,6 +66,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 Achievement account achievement info + */ + public List getAccountAchievements(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getAccountAchievements(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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Achievement.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Achievement.java new file mode 100644 index 0000000..df2276f --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Achievement.java @@ -0,0 +1,81 @@ +package me.xhsun.guildwars2wrapper.model.account; + +import java.util.Arrays; + +/** + * For more info on Account Achievements API go here
+ * Model class for account achievements + * + * @author xhsun + * @since 2017-06-05 + */ +public class Achievement { + private long id;//TODO /v2/achievements + private long current; + private long max;//default -1 or 0 + private boolean done; + private long repeated; + private int[] bits; //TODO available in future updates + + public long getId() { + return id; + } + + public long getCurrent() { + return current; + } + + /** + * this number can be negative + * + * @return amount needed to complete an achievement + */ + public long getMax() { + return max; + } + + public boolean isDone() { + return done; + } + + public long getRepeated() { + return repeated; + } + + /** + * giving more specific information on the progress for the achievement
+ * 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; + + Achievement that = (Achievement) o; + + return id == that.id; + } + + @Override + public int hashCode() { + return (int) (id ^ (id >>> 32)); + } + + @Override + public String toString() { + return "Achievement{" + + "id=" + id + + ", current=" + current + + ", max=" + max + + ", done=" + done + + ", repeated=" + repeated + + ", bits=" + Arrays.toString(bits) + + '}'; + } +} From ff619ee75b3b6aab02b4932482bf275a4d1166e7 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:03:40 -0600 Subject: [PATCH 02/33] done account dungeons API --- .../AsynchronousRequest.java | 18 +++++++++++++-- .../guildwars2wrapper/GuildWars2API.java | 5 +++- .../guildwars2wrapper/SynchronousRequest.java | 23 +++++++++++++++++-- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 286999a..09b5581 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -65,9 +65,9 @@ public void getAccount(String API, Callback callback) throws GuildWars2 * @throws NullPointerException if given {@link Callback} is empty * @see Achievement Account achievement info */ - public void getAccountAchievements(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getAchievementProgression(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); - gw2API.getAccountAchievements(API).enqueue(callback); + gw2API.getAchievementProgression(API).enqueue(callback); } /** @@ -85,6 +85,20 @@ 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 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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index a3f5a3e..ba1a22a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -25,11 +25,14 @@ interface GuildWars2API { Call getAccount(@Query("access_token") String token); @GET("/v2/account/achievements") - Call> getAccountAchievements(@Query("access_token") String token); + 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/inventory") Call> getSharedInventory(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 5d1633f..983a8d5 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -75,10 +75,10 @@ public Account getAccount(String API) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Achievement account achievement info */ - public List getAccountAchievements(String API) throws GuildWars2Exception { + public List getAchievementProgression(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAccountAchievements(API).execute(); + Response> response = gw2API.getAchievementProgression(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -106,6 +106,25 @@ public List getBank(String API) throws GuildWars2Exception { } } + /** + * For more info on Dungeon progression API go here
+ * TODO /v2/dungeons + * + * @param API API key + * @return an array of strings representing dungeon path names completed since daily dungeon reset + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getDailyDungeonProgression(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getDailyDungeonProgression(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 Shared Inventory API go here
* Get detailed info for shared inventory linked to given API key From 8aaa966682cb05c8256c4ad75f1a047bddca2193 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:07:44 -0600 Subject: [PATCH 03/33] done account dyes API --- .../AsynchronousRequest.java | 14 ++++++++++++++ .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 09b5581..078af2f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -99,6 +99,20 @@ public void getDailyDungeonProgression(String API, Callback> callba 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 + */ + 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 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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index ba1a22a..642f20a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -33,6 +33,9 @@ interface GuildWars2API { @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/inventory") Call> getSharedInventory(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 983a8d5..ca0f2eb 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -125,6 +125,25 @@ public List getDailyDungeonProgression(String API) throws GuildWars2Exce } } + /** + * 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 list of color ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getUnlockedDyes(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedDyes(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 Shared Inventory API go here
* Get detailed info for shared inventory linked to given API key From 3894715bc24df35f672bcbb470a053c35464b93c Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:21:08 -0600 Subject: [PATCH 04/33] done account finishers API --- .../AsynchronousRequest.java | 18 ++++++- .../guildwars2wrapper/GuildWars2API.java | 5 +- .../guildwars2wrapper/SynchronousRequest.java | 26 ++++++++-- ...ement.java => AchievementProgression.java} | 6 +-- .../model/account/UnlockedFinisher.java | 50 +++++++++++++++++++ 5 files changed, 96 insertions(+), 9 deletions(-) rename src/main/java/me/xhsun/guildwars2wrapper/model/account/{Achievement.java => AchievementProgression.java} (91%) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 078af2f..33b5bcd 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -63,9 +63,9 @@ public void getAccount(String API, Callback callback) throws GuildWars2 * @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 Account achievement info + * @see AchievementProgression Account achievement info */ - public void getAchievementProgression(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getAchievementProgression(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getAchievementProgression(API).enqueue(callback); } @@ -113,6 +113,20 @@ public void getUnlockedDyes(String API, Callback> callback) throws Gu gw2API.getUnlockedDyes(API).enqueue(callback); } + /** + * For more info on Account finishers 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 + */ + 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 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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 642f20a..5801b35 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -25,7 +25,7 @@ interface GuildWars2API { Call getAccount(@Query("access_token") String token); @GET("/v2/account/achievements") - Call> getAchievementProgression(@Query("access_token") String token); + Call> getAchievementProgression(@Query("access_token") String token); @GET("/v2/account/bank") Call> getBank(@Query("access_token") String token); @@ -36,6 +36,9 @@ interface GuildWars2API { @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/inventory") Call> getSharedInventory(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index ca0f2eb..3b83a06 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -73,12 +73,12 @@ public Account getAccount(String API) throws GuildWars2Exception { * @param API API key * @return list of account achievement info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Achievement account achievement info + * @see AchievementProgression account achievement info */ - public List getAchievementProgression(String API) throws GuildWars2Exception { + public List getAchievementProgression(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getAchievementProgression(API).execute(); + Response> response = gw2API.getAchievementProgression(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -144,6 +144,26 @@ public List getUnlockedDyes(String API) throws GuildWars2Exception { } } + /** + * 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 unlocked finisher info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see UnlockedFinisher unlocked finisher info + */ + public List getUnlockedFinishers(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedFinishers(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 Shared Inventory API go here
* Get detailed info for shared inventory linked to given API key diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Achievement.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java similarity index 91% rename from src/main/java/me/xhsun/guildwars2wrapper/model/account/Achievement.java rename to src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java index df2276f..15999b6 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Achievement.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java @@ -9,7 +9,7 @@ * @author xhsun * @since 2017-06-05 */ -public class Achievement { +public class AchievementProgression { private long id;//TODO /v2/achievements private long current; private long max;//default -1 or 0 @@ -57,7 +57,7 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - Achievement that = (Achievement) o; + AchievementProgression that = (AchievementProgression) o; return id == that.id; } @@ -69,7 +69,7 @@ public int hashCode() { @Override public String toString() { - return "Achievement{" + + return "AchievementProgression{" + "id=" + id + ", current=" + current + ", max=" + max + 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..3a28776 --- /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 here
+ * Model class for account finishers + * + * @author xhsun + * @since 2017-06-05 + */ +public class UnlockedFinisher { + private long id;//TODO /v2/finishers + private boolean permanent; + private int quantity; + + public long 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 (int) (id ^ (id >>> 32)); + } + + @Override + public String toString() { + return "UnlockedFinisher{" + + "id=" + id + + ", permanent=" + permanent + + ", quantity=" + quantity + + '}'; + } +} From 6de8494914eb51c2af083b770402e26b964ac716 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:27:43 -0600 Subject: [PATCH 05/33] done account gliders API --- .../AsynchronousRequest.java | 17 +++++++++++++++- .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 20 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 33b5bcd..8edc8fd 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -115,18 +115,33 @@ public void getUnlockedDyes(String API, Callback> callback) throws Gu /** * For more info on Account finishers API go here
- * Get list of unlocked dyes ids linked to given API key + * 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 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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 5801b35..be4d340 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -39,6 +39,9 @@ interface GuildWars2API { @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/inventory") Call> getSharedInventory(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 3b83a06..b0c8c92 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -164,6 +164,26 @@ public List getUnlockedFinishers(String API) throws GuildWars2 } } + /** + * For more info on Account gliders API go here
+ * Get list of unlocked glider id(s) linked to given API key + * TODO /v2/gliders + * + * @param API API key + * @return list of gliders id + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getUnlockedGliders(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedGliders(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 Shared Inventory API go here
* Get detailed info for shared inventory linked to given API key From 692450870f70396b42b47aec693c07670adcf853 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:35:30 -0600 Subject: [PATCH 06/33] cat --- .../AsynchronousRequest.java | 15 +++++++ .../guildwars2wrapper/GuildWars2API.java | 3 ++ .../guildwars2wrapper/SynchronousRequest.java | 20 +++++++++ .../guildwars2wrapper/model/account/Cat.java | 43 +++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 8edc8fd..c76471a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -142,6 +142,21 @@ public void getUnlockedGliders(String API, Callback> callback) throws gw2API.getUnlockedGliders(API).enqueue(callback); } + /** + * For more info on Account cats 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 + * @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 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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index be4d340..2981d09 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -42,6 +42,9 @@ interface GuildWars2API { @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/inventory") Call> getSharedInventory(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index b0c8c92..813910b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -184,6 +184,26 @@ public List getUnlockedGliders(String API) throws GuildWars2Exception { } } + /** + * 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 cats + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Cat cat info + */ + public List getUnlockedCats(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedCats(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 Shared Inventory API go here
* Get detailed info for shared inventory linked to given API key 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..2fbd2c8 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java @@ -0,0 +1,43 @@ +package me.xhsun.guildwars2wrapper.model.account; + +/** + * Cat + * + * @author xhsun + * @since 2017-06-05 + */ +public class Cat { + private long id; + private String hint; + + public long 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 (int) (id ^ (id >>> 32)); + } + + @Override + public String toString() { + return "Cat{" + + "id=" + id + + ", hint='" + hint + '\'' + + '}'; + } +} From 02b48bd63b4f9bfe267ab0a4a39397f989233bcf Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:39:25 -0600 Subject: [PATCH 07/33] done account home nodes API --- .../AsynchronousRequest.java | 16 +++++++++++++++- .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index c76471a..2ab08a9 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -144,7 +144,7 @@ public void getUnlockedGliders(String API, Callback> callback) throws /** * For more info on Account cats API go here
- * Get list of unlocked glider id(s) linked to given API key + * 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)} @@ -157,6 +157,20 @@ public void getUnlockedCats(String API, Callback> callback) throws Gui 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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 2981d09..9634d19 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -45,6 +45,9 @@ interface GuildWars2API { @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); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 813910b..6ec5330 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -204,6 +204,25 @@ public List getUnlockedCats(String API) throws GuildWars2Exception { } } + /** + * For more info on Account nodes API go here
+ * Get list of unlocked home nodes linked to given API key + * + * @param API API key + * @return list of strings + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getUnlockedHomeNodes(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + 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 Shared Inventory API go here
* Get detailed info for shared inventory linked to given API key From d1074c17235077cb34297edb0d0acb90a7cb605b Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:45:35 -0600 Subject: [PATCH 08/33] done account mail carriers API --- .../AsynchronousRequest.java | 14 +++++++++++++ .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 20 +++++++++++++++++++ .../guildwars2wrapper/model/account/Cat.java | 6 +++--- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 2ab08a9..7e7aa21 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -186,6 +186,20 @@ public void getSharedInventory(String API, Callback> callb gw2API.getSharedInventory(API).enqueue(callback); } + /** + * 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 + */ + public void getUnlockedMailCarriers(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedMailCarriers(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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 9634d19..8a0e315 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -51,6 +51,9 @@ interface GuildWars2API { @GET("/v2/account/inventory") Call> getSharedInventory(@Query("access_token") String token); + @GET("/v2/account/mailcarriers") + Call> getUnlockedMailCarriers(@Query("access_token") String token); + @GET("/v2/account/wallet") Call> getWallet(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 6ec5330..a6a4d32 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -243,6 +243,26 @@ public List getSharedInventory(String API) throws GuildWars2Exc } } + /** + * For more info on account mail carrier API go here
+ * Get list of unlocked mail carrier id(s) linked to given API key + * TODO /v2/mailcarriers + * + * @param API API key + * @return list of mail carrier id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getUnlockedMailCarriers(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedMailCarriers(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 Wallet API go here
* Get detailed info for wallet linked to given API key diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java index 2fbd2c8..3081c44 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java @@ -7,10 +7,10 @@ * @since 2017-06-05 */ public class Cat { - private long id; + private int id; private String hint; - public long getId() { + public int getId() { return id; } @@ -30,7 +30,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); + return id; } @Override From 38b44dc58e785038ea6c833b2a80041fad4a3230 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:53:50 -0600 Subject: [PATCH 09/33] done account masteries API --- .../AsynchronousRequest.java | 15 ++++++ .../guildwars2wrapper/GuildWars2API.java | 3 ++ .../guildwars2wrapper/SynchronousRequest.java | 20 ++++++++ .../model/account/UnlockedMastery.java | 48 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 7e7aa21..789cdb2 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -200,6 +200,21 @@ public void getUnlockedMailCarriers(String API, Callback> callback gw2API.getUnlockedMailCarriers(API).enqueue(callback); } + /** + * 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 getUnlockedMasteries(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + gw2API.getUnlockedMasteries(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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 8a0e315..59485bc 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -54,6 +54,9 @@ interface GuildWars2API { @GET("/v2/account/mailcarriers") Call> getUnlockedMailCarriers(@Query("access_token") String token); + @GET("/v2/account/masteries") + Call> getUnlockedMasteries(@Query("access_token") String token); + @GET("/v2/account/wallet") Call> getWallet(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index a6a4d32..abc34f6 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -263,6 +263,26 @@ public List getUnlockedMailCarriers(String API) throws GuildWars2Except } } + /** + * For more info on account masteries API go here
+ * Get list of unlocked masteries linked to given API key + * + * @param API API key + * @return list of unlocked masteries + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see UnlockedMastery unlocked mastery info + */ + public List getUnlockedMasteries(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedMasteries(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 Wallet API go here
* Get detailed info for wallet linked to given API key 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..94ab422 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java @@ -0,0 +1,48 @@ +package me.xhsun.guildwars2wrapper.model.account; + +/** + * For more info on Account masteries API go here
+ * Model class of account masteries + * TODO /v2/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 + + '}'; + } +} From 195818b5fd05a9fb7c94cc39d20259d5fb0a60fb Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 19:58:07 -0600 Subject: [PATCH 10/33] done account minis API --- .../AsynchronousRequest.java | 14 ++++++++++++++ .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 789cdb2..0fa12ba 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -215,6 +215,20 @@ public void getUnlockedMasteries(String API, Callback> cal gw2API.getUnlockedMasteries(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 + */ + 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 Wallet API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 59485bc..ce92fc9 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -57,6 +57,9 @@ interface GuildWars2API { @GET("/v2/account/masteries") Call> getUnlockedMasteries(@Query("access_token") String token); + @GET("/v2/account/minis") + Call> getUnlockedMinis(@Query("access_token") String token); + @GET("/v2/account/wallet") Call> getWallet(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index abc34f6..1aff967 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -283,6 +283,25 @@ public List getUnlockedMasteries(String API) throws GuildWars2E } } + /** + * For more info on account minis API go here
+ * Get list of unlocked mini id(s) linked to given API key + * + * @param API API key + * @return list of mini id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getUnlockedMinis(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedMinis(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 Wallet API go here
* Get detailed info for wallet linked to given API key From 0df90a40c9b9921b8d3e03737e7b0b17bfd3f090 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 20:04:44 -0600 Subject: [PATCH 11/33] done account outfits API --- .../AsynchronousRequest.java | 30 +++++++++---- .../guildwars2wrapper/GuildWars2API.java | 11 +++-- .../guildwars2wrapper/SynchronousRequest.java | 44 ++++++++++++++----- 3 files changed, 61 insertions(+), 24 deletions(-) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 0fa12ba..aa4743d 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -215,6 +215,21 @@ public void getUnlockedMasteries(String API, Callback> cal gw2API.getUnlockedMasteries(API).enqueue(callback); } + /** + * For more info on MaterialCategory Storage 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 Material material storage info + */ + public void getMaterialStorage(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API)); + 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 @@ -230,18 +245,17 @@ public void getUnlockedMinis(String API, Callback> callback) throws G } /** - * For more info on Wallet API go here
+ * 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 - * @see Wallet wallet info */ - public void getWallet(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getUnlockedOutfits(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); - gw2API.getWallet(API).enqueue(callback); + gw2API.getUnlockedOutfits(API).enqueue(callback); } /** @@ -259,18 +273,18 @@ public void getUnlockedSkins(String API, Callback> callback) throws G } /** - * For more info on MaterialCategory Storage API go here
+ * 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 Material material storage info + * @see Wallet wallet info */ - public void getMaterialStorage(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getWallet(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); - gw2API.getMaterialBank(API).enqueue(callback); + gw2API.getWallet(API).enqueue(callback); } /** diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index ce92fc9..1a5f5da 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -57,17 +57,20 @@ interface GuildWars2API { @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/wallet") - Call> getWallet(@Query("access_token") String token); + @GET("/v2/account/outfits") + Call> getUnlockedOutfits(@Query("access_token") String token); @GET("/v2/account/skins") Call> getUnlockedSkins(@Query("access_token") String token); - @GET("/v2/account/materials") - Call> getMaterialBank(@Query("access_token") String token); + @GET("/v2/account/wallet") + Call> getWallet(@Query("access_token") String token); //characters @GET("/v2/characters") diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 1aff967..136d3c7 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -283,6 +283,26 @@ public List getUnlockedMasteries(String API) throws GuildWars2E } } + /** + * For more info on Material Storage API go here
+ * Get detailed info for material storage linked to given API key + * + * @param API API key + * @return material storage info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Material material storage info + */ + public List getMaterialStorage(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getMaterialBank(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 account minis API go here
* Get list of unlocked mini id(s) linked to given API key @@ -303,18 +323,18 @@ public List getUnlockedMinis(String API) throws GuildWars2Exception { } /** - * For more info on Wallet API go here
- * Get detailed info for wallet linked to given API key + * For more info on account outfits API go here
+ * Get list of unlocked outfit id(s) linked to given API key + * TODO /v2/outfits * * @param API API key - * @return wallet info + * @return list of outfit id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Wallet wallet info */ - public List getWallet(String API) throws GuildWars2Exception { + public List getUnlockedOutfits(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getWallet(API).execute(); + Response> response = gw2API.getUnlockedOutfits(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -342,18 +362,18 @@ 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 Wallet API go here
+ * Get detailed info for wallet linked to given API key * * @param API API key - * @return material storage info + * @return wallet info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Material material storage info + * @see Wallet wallet info */ - public List getMaterialStorage(String API) throws GuildWars2Exception { + public List getWallet(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getMaterialBank(API).execute(); + Response> response = gw2API.getWallet(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { From 40296e68b2d1fd441b95541e35c2ad34b1f680df Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 20:07:33 -0600 Subject: [PATCH 12/33] done account pvp heroes API --- .../AsynchronousRequest.java | 14 +++++++++++++ .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index aa4743d..cbbafb3 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -258,6 +258,20 @@ public void getUnlockedOutfits(String API, Callback> callback) thr 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/Skins API go here
* Get list of unlocked skin ids linked to given API key diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 1a5f5da..32ac3e2 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -66,6 +66,9 @@ interface GuildWars2API { @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/skins") Call> getUnlockedSkins(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 136d3c7..3e45b0c 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -342,6 +342,26 @@ public List getUnlockedOutfits(String API) throws GuildWars2Exception { } } + /** + * For more info on account pvp heroes API go here
+ * Get list of unlocked pvp hero id(s) linked to given API key + * TODO /v2/pvp/heroes + * + * @param API API key + * @return list of pvp heroes id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getUnlockedPvpHeroes(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedPvpHeroes(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 Account/Skins API go here
* Get list of unlocked skin ids linked to given API key From 19efedcfc229d14351820134b89b2a18cfd421c8 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 20:11:02 -0600 Subject: [PATCH 13/33] done account raid API --- .../AsynchronousRequest.java | 14 +++++++++++++ .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 20 +++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index cbbafb3..4bb70a6 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -272,6 +272,20 @@ public void getUnlockedPvpHeroes(String API, Callback> callback) t 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/Skins API go here
* Get list of unlocked skin ids linked to given API key diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 32ac3e2..88b185f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -69,6 +69,9 @@ interface GuildWars2API { @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/skins") Call> getUnlockedSkins(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 3e45b0c..e0f1189 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -362,6 +362,26 @@ public List getUnlockedPvpHeroes(String API) throws GuildWars2Exception } } + /** + * For more info on account raid API go here
+ * Get list of cleared raid linked to given API key + * TODO /v2/raids + * + * @param API API key + * @return list of cleared raid + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getWeeklyRaidProgression(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getWeeklyRaidProgression(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 Account/Skins API go here
* Get list of unlocked skin ids linked to given API key From f3a3a6318f26817dfc1bce09b067972d45f3d1a5 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 20:17:03 -0600 Subject: [PATCH 14/33] done account recipes API --- .../AsynchronousRequest.java | 17 ++++++++++++++ .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 22 +++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 4bb70a6..486e7c2 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -107,6 +107,7 @@ public void getDailyDungeonProgression(String API, Callback> callba * @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)); @@ -238,6 +239,7 @@ public void getMaterialStorage(String API, Callback> callback) th * @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)); @@ -286,6 +288,21 @@ public void getWeeklyRaidProgression(String API, Callback> callback 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
* Get list of unlocked skin ids linked to given API key diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 88b185f..51d9991 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -72,6 +72,9 @@ interface GuildWars2API { @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); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index e0f1189..cb4af07 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -132,6 +132,7 @@ public List getDailyDungeonProgression(String API) throws GuildWars2Exce * @param API API key * @return list of color ids * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Color */ public List getUnlockedDyes(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); @@ -310,6 +311,7 @@ public List getMaterialStorage(String API) throws GuildWars2Exception * @param API API key * @return list of mini id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Mini mini info */ public List getUnlockedMinis(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); @@ -382,6 +384,26 @@ public List getWeeklyRaidProgression(String API) throws GuildWars2Except } } + /** + * For more info on account recipes API go here
+ * Get list of unlocked recipe id(s) linked to given API key + * + * @param API API key + * @return list of unlocked recipe id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Recipe recipe info + */ + public List getUnlockedRecipes(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedRecipes(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 Account/Skins API go here
* Get list of unlocked skin ids linked to given API key From 8b74fa388cd5967c5259c27a948cc118d5a4b2ed Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 20:21:49 -0600 Subject: [PATCH 15/33] done account titles API --- .../AsynchronousRequest.java | 17 +++++++++++++- .../guildwars2wrapper/GuildWars2API.java | 3 +++ .../guildwars2wrapper/SynchronousRequest.java | 22 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 486e7c2..2be594f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -305,18 +305,33 @@ public void getUnlockedRecipes(String API, Callback> callback) throws /** * For more info on Account/Skins API go here
- * Get list of unlocked skin ids linked to given API key + * 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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 51d9991..57ed614 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -78,6 +78,9 @@ interface GuildWars2API { @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); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index cb4af07..bc4f17e 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -411,6 +411,7 @@ public List getUnlockedRecipes(String API) throws GuildWars2Exception { * @param API API key * @return list of ids * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Skin skin info */ public List getUnlockedSkins(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); @@ -423,6 +424,27 @@ public List getUnlockedSkins(String API) throws GuildWars2Exception { } } + /** + * For more info on Account titles API go here
+ * Get list of unlocked title id(s) linked to given API key + * TODO /v2/titles + * + * @param API API key + * @return list of unlocked title id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + + public List getUnlockedTitles(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getUnlockedTitles(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 Wallet API go here
* Get detailed info for wallet linked to given API key From 770df35b219697c1efe7f65be2094a1adbb072df Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 20:24:03 -0600 Subject: [PATCH 16/33] update readme --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index bba1678..34f09ea 100644 --- a/README.md +++ b/README.md @@ -93,13 +93,7 @@ So if you see anything I missed, please don't hesitate to create an issue to let + /v2/account -+ /v2/account/bank - -+ /v2/account/inventory - -+ /v2/account/materials - -+ /v2/account/wallet ++ /v2/account/* + /v2/characters/<name>/core From 69ae712a3cbbe51923f29fd89f445cc9c883bb78 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 20:44:38 -0600 Subject: [PATCH 17/33] change long to int --- .../AsynchronousRequest.java | 28 +++++----- .../guildwars2wrapper/GuildWars2API.java | 30 +++++----- .../guildwars2wrapper/SynchronousRequest.java | 56 +++++++++---------- .../xhsun/guildwars2wrapper/model/Color.java | 12 ++-- .../guildwars2wrapper/model/Currency.java | 10 ++-- .../xhsun/guildwars2wrapper/model/Item.java | 10 ++-- .../guildwars2wrapper/model/ItemStats.java | 6 +- .../model/MaterialCategory.java | 4 +- .../xhsun/guildwars2wrapper/model/Mini.java | 14 ++--- .../xhsun/guildwars2wrapper/model/Recipe.java | 26 ++++----- .../xhsun/guildwars2wrapper/model/Skin.java | 6 +- .../model/account/AchievementProgression.java | 14 ++--- .../guildwars2wrapper/model/account/Bank.java | 8 +-- .../model/account/Material.java | 2 +- .../model/account/SharedInventory.java | 8 +-- .../model/account/UnlockedFinisher.java | 6 +- .../model/account/Wallet.java | 6 +- .../model/commerce/Prices.java | 6 +- .../model/commerce/Transaction.java | 4 +- .../guildwars2wrapper/model/util/Bag.java | 6 +- .../model/util/Inventory.java | 6 +- .../guildwars2wrapper/model/util/Storage.java | 4 +- .../model/util/itemDetail/Armor.java | 4 +- .../model/util/itemDetail/Back.java | 4 +- .../model/util/itemDetail/Consumable.java | 8 +-- .../model/util/itemDetail/ItemDetail.java | 8 +-- .../model/util/itemDetail/Mini.java | 4 +- .../model/util/itemDetail/Weapon.java | 4 +- .../model/util/itemDetail/subobject/Buff.java | 6 +- .../itemDetail/subobject/InfusionSlot.java | 6 +- 30 files changed, 158 insertions(+), 158 deletions(-) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 2be594f..96ea34d 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -109,7 +109,7 @@ public void getDailyDungeonProgression(String API, Callback> callba * @throws NullPointerException if given {@link Callback} is empty * @see Color color info */ - public void getUnlockedDyes(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getUnlockedDyes(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getUnlockedDyes(API).enqueue(callback); } @@ -138,7 +138,7 @@ public void getUnlockedFinishers(String API, Callback> ca * @throws GuildWars2Exception invalid API key * @throws NullPointerException if given {@link Callback} is empty */ - public void getUnlockedGliders(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getUnlockedGliders(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getUnlockedGliders(API).enqueue(callback); } @@ -241,7 +241,7 @@ public void getMaterialStorage(String API, Callback> callback) th * @throws NullPointerException if given {@link Callback} is empty * @see Mini mini info */ - public void getUnlockedMinis(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getUnlockedMinis(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getUnlockedMinis(API).enqueue(callback); } @@ -298,7 +298,7 @@ public void getWeeklyRaidProgression(String API, Callback> callback * @throws NullPointerException if given {@link Callback} is empty * @see Recipe recipe info */ - public void getUnlockedRecipes(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getUnlockedRecipes(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getUnlockedRecipes(API).enqueue(callback); } @@ -313,7 +313,7 @@ public void getUnlockedRecipes(String API, Callback> callback) throws * @throws NullPointerException if given {@link Callback} is empty * @see Skin skin info */ - public void getUnlockedSkins(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getUnlockedSkins(String API, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getUnlockedSkins(API).enqueue(callback); } @@ -417,7 +417,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); } @@ -459,7 +459,7 @@ public void getCurrencyInfo(long[] ids, Callback> callback) throw * @throws NullPointerException if given {@link Callback} is empty * @see Currency currency info */ - public void getAllCurrencyID(Callback> callback) throws NullPointerException { + public void getAllCurrencyID(Callback> callback) throws NullPointerException { gw2API.getAllCurrencies().enqueue(callback); } @@ -540,7 +540,7 @@ public void getSkinInfo(long[] ids, Callback> callback) throws GuildW * @throws NullPointerException if given {@link Callback} is empty * @see Skin skin info */ - public void getAllSkinID(Callback> callback) throws NullPointerException { + public void getAllSkinID(Callback> callback) throws NullPointerException { gw2API.getAllSkinIDs().enqueue(callback); } @@ -567,7 +567,7 @@ public void getItemInfo(long[] ids, Callback> callback) throws GuildW * @throws NullPointerException if given {@link Callback} is empty * @see Item item info */ - public void getAllItemID(Callback> callback) throws NullPointerException { + public void getAllItemID(Callback> callback) throws NullPointerException { gw2API.getAllItemIDs().enqueue(callback); } @@ -594,7 +594,7 @@ public void getItemStatInfo(long[] ids, Callback> callback) thro * @throws NullPointerException if given {@link Callback} is empty * @see ItemStats itemstat info */ - public void getAllItemStatID(Callback> callback) throws NullPointerException { + public void getAllItemStatID(Callback> callback) throws NullPointerException { gw2API.getAllItemStatIDs().enqueue(callback); } @@ -621,7 +621,7 @@ public void getColorInfo(long[] ids, Callback> callback) throws Guil * @throws NullPointerException if given {@link Callback} is empty * @see Color color info */ - public void getAllColorID(Callback> callback) throws NullPointerException { + public void getAllColorID(Callback> callback) throws NullPointerException { gw2API.getAllColorIDs().enqueue(callback); } @@ -648,7 +648,7 @@ 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); } @@ -660,7 +660,7 @@ 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 { + 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); } @@ -688,7 +688,7 @@ public void getMiniInfo(long[] ids, Callback> callback) throws GuildW * @throws NullPointerException if given {@link Callback} is empty * @see Mini mini info */ - public void getAllMiniID(Callback> callback) throws NullPointerException { + public void getAllMiniID(Callback> callback) throws NullPointerException { gw2API.getAllMiniIDs().enqueue(callback); } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 57ed614..62c45bf 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -34,13 +34,13 @@ interface GuildWars2API { Call> getDailyDungeonProgression(@Query("access_token") String token); @GET("/v2/account/dyes") - Call> getUnlockedDyes(@Query("access_token") String token); + 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); + Call> getUnlockedGliders(@Query("access_token") String token); @GET("/v2/account/home/cats") Call> getUnlockedCats(@Query("access_token") String token); @@ -61,7 +61,7 @@ interface GuildWars2API { Call> getMaterialBank(@Query("access_token") String token); @GET("/v2/account/minis") - Call> getUnlockedMinis(@Query("access_token") String token); + Call> getUnlockedMinis(@Query("access_token") String token); @GET("/v2/account/outfits") Call> getUnlockedOutfits(@Query("access_token") String token); @@ -73,10 +73,10 @@ interface GuildWars2API { Call> getWeeklyRaidProgression(@Query("access_token") String token); @GET("/v2/account/recipes") - Call> getUnlockedRecipes(@Query("access_token") String token); + Call> getUnlockedRecipes(@Query("access_token") String token); @GET("/v2/account/skins") - Call> getUnlockedSkins(@Query("access_token") String token); + Call> getUnlockedSkins(@Query("access_token") String token); @GET("/v2/account/titles") Call> getUnlockedTitles(@Query("access_token") String token); @@ -99,7 +99,7 @@ interface GuildWars2API { 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); @@ -110,7 +110,7 @@ interface GuildWars2API { //currencies @GET("/v2/currencies") - Call> getAllCurrencies(); + Call> getAllCurrencies(); @GET("/v2/currencies") Call> getCurrencyInfo(@Query("ids") String ids); @@ -131,49 +131,49 @@ interface GuildWars2API { //skins @GET("/v2/skins") - Call> getAllSkinIDs(); + Call> getAllSkinIDs(); @GET("/v2/skins") Call> getSkinInfo(@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(); + Call> getAllColorIDs(); @GET("/v2/colors") Call> getColorInfo(@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(); + Call> getAllMiniIDs(); @GET("/v2/minis") Call> getMiniInfo(@Query("ids") String ids); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index bc4f17e..36e2075 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -134,10 +134,10 @@ public List getDailyDungeonProgression(String API) throws GuildWars2Exce * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Color */ - public List getUnlockedDyes(String API) throws GuildWars2Exception { + public List getUnlockedDyes(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getUnlockedDyes(API).execute(); + Response> response = gw2API.getUnlockedDyes(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -174,10 +174,10 @@ public List getUnlockedFinishers(String API) throws GuildWars2 * @return list of gliders id * @throws GuildWars2Exception see {@link ErrorCode} for detail */ - public List getUnlockedGliders(String API) throws GuildWars2Exception { + public List getUnlockedGliders(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getUnlockedGliders(API).execute(); + Response> response = gw2API.getUnlockedGliders(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -313,10 +313,10 @@ public List getMaterialStorage(String API) throws GuildWars2Exception * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Mini mini info */ - public List getUnlockedMinis(String API) throws GuildWars2Exception { + public List getUnlockedMinis(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getUnlockedMinis(API).execute(); + Response> response = gw2API.getUnlockedMinis(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -393,10 +393,10 @@ public List getWeeklyRaidProgression(String API) throws GuildWars2Except * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Recipe recipe info */ - public List getUnlockedRecipes(String API) throws GuildWars2Exception { + public List getUnlockedRecipes(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getUnlockedRecipes(API).execute(); + Response> response = gw2API.getUnlockedRecipes(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -413,10 +413,10 @@ public List getUnlockedRecipes(String API) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Skin skin info */ - public List getUnlockedSkins(String API) throws GuildWars2Exception { + public List getUnlockedSkins(String API) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.API, API)); try { - Response> response = gw2API.getUnlockedSkins(API).execute(); + Response> response = gw2API.getUnlockedSkins(API).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -556,9 +556,9 @@ public List getListing(String API, Transaction.Time time, Transacti * @return list of item ids * @throws GuildWars2Exception see {@link ErrorCode} for detail */ - public List getAllListedItemID() throws GuildWars2Exception { + public List getAllListedItemID() throws GuildWars2Exception { try { - Response> response = gw2API.getAllPrices().execute(); + Response> response = gw2API.getAllPrices().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -614,9 +614,9 @@ public List getCurrencyInfo(long[] ids) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Currency currency info */ - public List getAllCurrencyID() throws GuildWars2Exception { + public List getAllCurrencyID() throws GuildWars2Exception { try { - Response> response = gw2API.getAllCurrencies().execute(); + Response> response = gw2API.getAllCurrencies().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -728,9 +728,9 @@ public List getSkinInfo(long[] ids) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Skin skin info */ - public List getAllSkinID() throws GuildWars2Exception { + public List getAllSkinID() throws GuildWars2Exception { try { - Response> response = gw2API.getAllSkinIDs().execute(); + Response> response = gw2API.getAllSkinIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -766,9 +766,9 @@ public List getItemInfo(long[] ids) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Item item info */ - public List getAllItemID() throws GuildWars2Exception { + public List getAllItemID() throws GuildWars2Exception { try { - Response> response = gw2API.getAllItemIDs().execute(); + Response> response = gw2API.getAllItemIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -804,9 +804,9 @@ public List getItemStatInfo(long[] ids) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see ItemStats itemstat info */ - public List getAllItemStatID() throws GuildWars2Exception { + public List getAllItemStatID() throws GuildWars2Exception { try { - Response> response = gw2API.getAllItemStatIDs().execute(); + Response> response = gw2API.getAllItemStatIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -842,9 +842,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) { @@ -880,9 +880,9 @@ public List getRecipeInfo(long[] ids) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Recipe recipe info */ - public List getAllRecipeID() throws GuildWars2Exception { + public List getAllRecipeID() throws GuildWars2Exception { try { - Response> response = gw2API.getAllRecipeIDs().execute(); + Response> response = gw2API.getAllRecipeIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -898,9 +898,9 @@ public List getAllRecipeID() throws GuildWars2Exception { * @return list of recipe id * @throws GuildWars2Exception see {@link ErrorCode} for detail */ - public List searchRecipes(boolean isInput, long id) throws GuildWars2Exception { + public List searchRecipes(boolean isInput, long id) throws GuildWars2Exception { try { - Response> response = (isInput) ? + Response> response = (isInput) ? gw2API.searchInputRecipes(Long.toString(id)).execute() : gw2API.searchOutputRecipes(Long.toString(id)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -938,9 +938,9 @@ public List getMiniInfo(long[] ids) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Mini mini info */ - public List getAllMiniID() throws GuildWars2Exception { + public List getAllMiniID() throws GuildWars2Exception { try { - Response> response = gw2API.getAllMiniIDs().execute(); + Response> response = gw2API.getAllMiniIDs().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..701c538 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; - public long getId() { + public int getId() { return id; } @@ -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/Item.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java index a3a7905..865248b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java @@ -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,13 +41,13 @@ public enum GameType {Activity, Dungeon, Pve, Pvp, PvpLobby, Wvw} private Rarity rarity; private int level; private long vendor_value; - private long default_skin; + private int default_skin; private Flag[] flags; private GameType[] game_types; private Restriction[] restrictions; private ItemDetail details; - public long getId() { + public int getId() { return id; } @@ -83,7 +83,7 @@ public long getVendor_value() { return vendor_value; } - public long getDefault_skin() { + public int getDefault_skin() { return default_skin; } @@ -115,7 +115,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/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/MaterialCategory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java index 0d3fae7..e473279 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java @@ -14,7 +14,7 @@ public class MaterialCategory { private int id; private String name; - private long[] items; + private int[] items; public int getId() { return id; @@ -24,7 +24,7 @@ public String getName() { return name; } - public long[] getItems() { + public int[] getItems() { return 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..50f56f0 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 getItem_id() { 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/Recipe.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java index f3e1c6c..7dfe970 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java @@ -17,11 +17,11 @@ 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 disciplines; private int min_rating; private Flag[] flags; @@ -30,7 +30,7 @@ public enum Flag {AutoLearned, LearnedFromItem} private long output_upgrade_id; //TODO v2/guild/upgrades private String chat_link; - public long getId() { + public int getId() { return id; } @@ -38,7 +38,7 @@ public Type getType() { return type; } - public long getOutput_item_id() { + public int getOutput_item_id() { return output_item_id; } @@ -46,7 +46,7 @@ public int getOutput_item_count() { return output_item_count; } - public long getTime_to_craft_ms() { + public int getTime_to_craft_ms() { return time_to_craft_ms; } @@ -90,7 +90,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return (int) (id ^ (id >>> 32)); + return id; } @Override @@ -116,17 +116,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 getItem_id() { return item_id; } - public long getUpgrade_id() { + public int getUpgrade_id() { return upgrade_id; } @@ -148,8 +148,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..3b51a17 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java @@ -19,7 +19,7 @@ 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; @@ -29,7 +29,7 @@ public enum Flag {ShowInWardrobe, NoCost, HideIfLocked, OverrideRarity} private String description; private Detail details; - public long getId() { + public int getId() { return id; } @@ -77,7 +77,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/account/AchievementProgression.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java index 15999b6..107e4e2 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java @@ -10,18 +10,18 @@ * @since 2017-06-05 */ public class AchievementProgression { - private long id;//TODO /v2/achievements - private long current; - private long max;//default -1 or 0 + private int id;//TODO /v2/achievements + private int current; + private int max;//default -1 or 0 private boolean done; private long repeated; private int[] bits; //TODO available in future updates - public long getId() { + public int getId() { return id; } - public long getCurrent() { + public int getCurrent() { return current; } @@ -30,7 +30,7 @@ public long getCurrent() { * * @return amount needed to complete an achievement */ - public long getMax() { + public int getMax() { return max; } @@ -64,7 +64,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/account/Bank.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java index bc965fd..1026dda 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 upgrades; private List infusions; - public long getSkinId() { + public int getSkinId() { return skin; } @@ -51,12 +51,12 @@ 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 + (getBound_to() != null ? getBound_to().hashCode() : 0); - result = 31 * result + (int) (skin ^ (skin >>> 32)); + result = 31 * result + skin; result = 31 * result + (upgrades != null ? upgrades.hashCode() : 0); result = 31 * result + (infusions != null ? infusions.hashCode() : 0); return result; 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 index 3a28776..91fd510 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java @@ -8,11 +8,11 @@ * @since 2017-06-05 */ public class UnlockedFinisher { - private long id;//TODO /v2/finishers + private int id;//TODO /v2/finishers private boolean permanent; private int quantity; - public long getId() { + public int getId() { return id; } @@ -36,7 +36,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/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/commerce/Prices.java b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java index 394547a..740178c 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; } 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..dde3e4f 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 getItem_id() { return item_id; } 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; - 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..c431afd 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java @@ -16,7 +16,7 @@ public class Inventory extends Storage { private int[] infusions; private int[] upgrades; - private long skin; + private int skin; private ItemStats stats; public int[] getInfusions() { @@ -27,7 +27,7 @@ public int[] getUpgrades() { return upgrades; } - public long getSkin() { + public int getSkin() { return skin; } @@ -61,7 +61,7 @@ public int hashCode() { 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 + skin; result = 31 * result + (stats != null ? stats.hashCode() : 0); return result; } 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..17ee711 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; } 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..dd1b644 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 @@ -35,7 +35,7 @@ public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } - public long getSuffixID() { + public int getSuffixID() { return suffix_item_id; } @@ -71,7 +71,7 @@ public int hashCode() { result = 31 * result + defense; result = 31 * result + Arrays.hashCode(infusion_slots); 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); return result; 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..84a2ea9 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 @@ -23,7 +23,7 @@ public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } - public long getSuffixID() { + public int getSuffixID() { return suffix_item_id; } @@ -53,7 +53,7 @@ public boolean equals(Object o) { public int hashCode() { int result = Arrays.hashCode(infusion_slots); 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); return result; 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..cccef0c 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 @@ -43,7 +43,7 @@ public enum Flag { int defense; InfusionSlot[] infusion_slots; InfixUpgrade infix_upgrade; - long suffix_item_id; + int suffix_item_id; String secondary_suffix_item_id; String[] stat_choices; //Armor @@ -55,12 +55,12 @@ 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 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/Weapon.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java index 3dc2178..c7f5fa1 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 @@ -43,7 +43,7 @@ public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } - public long getSuffixID() { + public int getSuffixID() { return suffix_item_id; } @@ -83,7 +83,7 @@ public int hashCode() { result = 31 * result + defense; result = 31 * result + Arrays.hashCode(infusion_slots); 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); return result; 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/InfusionSlot.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java index 8f81955..0cf0815 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 @@ -14,13 +14,13 @@ public class InfusionSlot { private ItemDetail.Flag[] flags; - private long item_id; + private int item_id; public ItemDetail.Flag[] getFlags() { return flags; } - public long getID() { + public int getID() { return item_id; } @@ -37,7 +37,7 @@ public boolean equals(Object o) { @Override public int hashCode() { int result = Arrays.hashCode(flags); - result = 31 * result + (int) (item_id ^ (item_id >>> 32)); + result = 31 * result + item_id; return result; } From 56a40504f6470897a631bbdc6690c306e51be376 Mon Sep 17 00:00:00 2001 From: xhsun Date: Mon, 5 Jun 2017 21:39:07 -0600 Subject: [PATCH 18/33] done achievement API --- .../AsynchronousRequest.java | 58 +++- .../guildwars2wrapper/GuildWars2API.java | 8 + .../me/xhsun/guildwars2wrapper/Request.java | 8 +- .../guildwars2wrapper/SynchronousRequest.java | 69 +++- .../model/account/AchievementProgression.java | 2 +- .../model/achievements/Achievement.java | 294 ++++++++++++++++++ 6 files changed, 408 insertions(+), 31 deletions(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 96ea34d..68f0254 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -3,6 +3,7 @@ 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; @@ -25,6 +26,7 @@ public class AsynchronousRequest extends Request { super(gw2API); } + //Accounts /** * 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 @@ -347,6 +349,36 @@ public void getWallet(String API, Callback> callback) throws GuildW 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 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(ParamType.ID, ids)); + gw2API.getAchievementInfo(processIds(ids)).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 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); + } + + //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 @@ -431,7 +463,7 @@ public void getAllListedItemID(Callback> callback) throws NullPoin * @throws NullPointerException if given {@link Callback} is empty * @see Prices listing item price info */ - public void getPrices(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getPrices(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getPrices(processIds(ids)).enqueue(callback); } @@ -446,7 +478,7 @@ 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 { + public void getCurrencyInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getCurrencyInfo(processIds(ids)).enqueue(callback); } @@ -473,7 +505,7 @@ public void getAllCurrencyID(Callback> callback) throws NullPointe * @throws NullPointerException if given {@link Callback} is empty * @see World world info */ - public void getWorldInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getWorldInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getWorldsInfo(processIds(ids)).enqueue(callback); } @@ -500,7 +532,7 @@ public void getAllWorldID(Callback> callback) throws NullPointerEx * @throws NullPointerException if given {@link Callback} is empty * @see MaterialCategory material category info */ - public void getMaterialCategoryInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getMaterialCategoryInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getMaterialBankInfo(processIds(ids)).enqueue(callback); } @@ -527,7 +559,7 @@ public void getAllMaterialCategoryID(Callback> callback) throws Nu * @throws NullPointerException if given {@link Callback} is empty * @see Skin skin info */ - public void getSkinInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getSkinInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getSkinInfo(processIds(ids)).enqueue(callback); } @@ -554,7 +586,7 @@ public void getAllSkinID(Callback> callback) throws NullPointerExc * @throws NullPointerException if given {@link Callback} is empty * @see Item item info */ - public void getItemInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getItemInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getItemInfo(processIds(ids)).enqueue(callback); } @@ -581,7 +613,7 @@ public void getAllItemID(Callback> callback) throws NullPointerExc * @throws NullPointerException if given {@link Callback} is empty * @see ItemStats itemstat info */ - public void getItemStatInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getItemStatInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getItemStatInfo(processIds(ids)).enqueue(callback); } @@ -608,7 +640,7 @@ public void getAllItemStatID(Callback> callback) throws NullPointe * @throws NullPointerException if given {@link Callback} is empty * @see Color color info */ - public void getColorInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getColorInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getColorInfo(processIds(ids)).enqueue(callback); } @@ -635,7 +667,7 @@ public void getAllColorID(Callback> callback) throws NullPointerEx * @throws NullPointerException if given {@link Callback} is empty * @see Recipe recipe info */ - public void getRecipeInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getRecipeInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getRecipeInfo(processIds(ids)).enqueue(callback); } @@ -660,9 +692,9 @@ public void getAllRecipeID(Callback> callback) throws NullPointerE * @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); } /** @@ -675,7 +707,7 @@ public void searchRecipes(boolean isInput, long id, Callback> call * @throws NullPointerException if given {@link Callback} is empty * @see Mini mini info */ - public void getMiniInfo(long[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + public void getMiniInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.ID, ids)); gw2API.getMiniInfo(processIds(ids)).enqueue(callback); } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 62c45bf..a245b12 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -2,6 +2,7 @@ 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; @@ -84,6 +85,13 @@ interface GuildWars2API { @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); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/Request.java b/src/main/java/me/xhsun/guildwars2wrapper/Request.java index 82a65ed..83dbe4c 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/Request.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/Request.java @@ -23,9 +23,9 @@ 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); } @@ -92,14 +92,14 @@ void isParamValid(ParamChecker... items) throws GuildWars2Exception { class ParamChecker { ParamType type; String value; - long[] ids; + int[] ids; ParamChecker(ParamType t, String s) { type = t; value = s; } - ParamChecker(ParamType t, long[] i) { + ParamChecker(ParamType t, int[] i) { type = t; ids = i; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 36e2075..02bdf8e 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -4,6 +4,7 @@ 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; @@ -26,6 +27,7 @@ public class SynchronousRequest extends Request { super(gw2API); } + //Accounts /** * For more info on TokenInfo API go here
* Get detailed info related to this API key from server @@ -465,6 +467,47 @@ public List getWallet(String API) throws GuildWars2Exception { } } + //Achievements + + /** + * For more info on achievement API go here
+ * Get list of achievement info corresponding to the given id(s) + * + * @param ids list of achievement id(s) + * @return list of achievement info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Achievement achievement info + */ + public List getAchievementInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.ID, ids)); + try { + Response> response = gw2API.getAchievementInfo(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()); + } + } + + /** + * For more info on achievement API go here
+ * Get list of all available achievement id(s) + * + * @return list of achievement id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Achievement achievement info + */ + public List getAllAchievementID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllAchievementIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Characters /** * For more info on Character API go here
* Get all character names linked to given API key @@ -575,7 +618,7 @@ public List getAllListedItemID() throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Prices listing price info */ - public List getPrices(long[] ids) throws GuildWars2Exception { + public List getPrices(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getPrices(processIds(ids)).execute(); @@ -595,7 +638,7 @@ public List getPrices(long[] ids) throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Currency currency info */ - public List getCurrencyInfo(long[] ids) throws GuildWars2Exception { + public List getCurrencyInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getCurrencyInfo(processIds(ids)).execute(); @@ -633,7 +676,7 @@ public List getAllCurrencyID() throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see World world info */ - public List getWorldInfo(long[] ids) throws GuildWars2Exception { + public List getWorldInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getWorldsInfo(processIds(ids)).execute(); @@ -671,7 +714,7 @@ public List getAllWorldID() throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see MaterialCategory material category info */ - public List getMaterialCategoryInfo(long[] ids) throws GuildWars2Exception { + public List getMaterialCategoryInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getMaterialBankInfo(processIds(ids)).execute(); @@ -709,7 +752,7 @@ public List getAllMaterialCategoryID() throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Skin skin info */ - public List getSkinInfo(long[] ids) throws GuildWars2Exception { + public List getSkinInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getSkinInfo(processIds(ids)).execute(); @@ -747,7 +790,7 @@ public List getAllSkinID() throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Item item info */ - public List getItemInfo(long[] ids) throws GuildWars2Exception { + public List getItemInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getItemInfo(processIds(ids)).execute(); @@ -785,7 +828,7 @@ public List getAllItemID() throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see ItemStats itemstat info */ - public List getItemStatInfo(long[] ids) throws GuildWars2Exception { + public List getItemStatInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getItemStatInfo(processIds(ids)).execute(); @@ -823,7 +866,7 @@ public List getAllItemStatID() throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Color color info */ - public List getColorInfo(long[] ids) throws GuildWars2Exception { + public List getColorInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getColorInfo(processIds(ids)).execute(); @@ -861,7 +904,7 @@ public List getAllColorID() throws GuildWars2Exception { * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Recipe recipe info */ - public List getRecipeInfo(long[] ids) throws GuildWars2Exception { + public List getRecipeInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getRecipeInfo(processIds(ids)).execute(); @@ -898,11 +941,11 @@ public List getAllRecipeID() throws GuildWars2Exception { * @return list of recipe id * @throws GuildWars2Exception see {@link ErrorCode} for detail */ - public List searchRecipes(boolean isInput, long id) throws GuildWars2Exception { + public List searchRecipes(boolean isInput, int id) throws GuildWars2Exception { try { Response> response = (isInput) ? - gw2API.searchInputRecipes(Long.toString(id)).execute() : - gw2API.searchOutputRecipes(Long.toString(id)).execute(); + 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) { @@ -919,7 +962,7 @@ public List searchRecipes(boolean isInput, long id) throws GuildWars2Ex * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Mini mini info */ - public List getMiniInfo(long[] ids) throws GuildWars2Exception { + public List getMiniInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ParamType.ID, ids)); try { Response> response = gw2API.getMiniInfo(processIds(ids)).execute(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java index 107e4e2..0ccd2f3 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java @@ -10,7 +10,7 @@ * @since 2017-06-05 */ public class AchievementProgression { - private int id;//TODO /v2/achievements + private int id; private int current; private int max;//default -1 or 0 private boolean done; 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..1d8639d --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java @@ -0,0 +1,294 @@ +package me.xhsun.guildwars2wrapper.model.achievements; + +import com.google.gson.annotations.Expose; + +import java.util.Arrays; + +/** + * For more info on achievements API go here
+ * 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 + } + + public enum RewardRegion {Tyria, Maguuma}//TODO update this every time new mastery region is out + + 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 Flag[] flags; + private Tier[] tiers; + private int[] prerequisites;//achievement ids + private Reward[] rewards; + private 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 getLocked_text() { + return locked_text; + } + + public Type getType() { + return type; + } + + public Flag[] getFlags() { + return flags; + } + + public Tier[] getTiers() { + return tiers; + } + + public int[] getPrerequisites() { + return prerequisites; + } + + public Reward[] getRewards() { + return rewards; + } + + public 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=" + Arrays.toString(flags) + + ", tiers=" + Arrays.toString(tiers) + + ", prerequisites=" + Arrays.toString(prerequisites) + + ", rewards=" + Arrays.toString(rewards) + + ", bits=" + Arrays.toString(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 RewardRegion 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 RewardRegion 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 + '\'' + + '}'; + } + } +} From 0639c9451f63c3dd66a3b1882e3effe37d86b44d Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 12:46:16 -0600 Subject: [PATCH 19/33] done dungeons API -also reworked some backend methods, so that string ids is allowed --- .../AsynchronousRequest.java | 49 +++++++++--- .../guildwars2wrapper/GuildWars2API.java | 73 ++++++++++-------- .../me/xhsun/guildwars2wrapper/Request.java | 29 +++++-- .../guildwars2wrapper/SynchronousRequest.java | 67 ++++++++++++---- .../guildwars2wrapper/model/Dungeon.java | 76 +++++++++++++++++++ 5 files changed, 232 insertions(+), 62 deletions(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 68f0254..a61a8fe 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -362,7 +362,7 @@ public void getWallet(String API, Callback> callback) throws GuildW * @see Achievement achievement info */ public void getAchievementInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getAchievementInfo(processIds(ids)).enqueue(callback); } @@ -464,7 +464,7 @@ public void getAllListedItemID(Callback> callback) throws NullPoin * @see Prices listing item price info */ public void getPrices(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getPrices(processIds(ids)).enqueue(callback); } @@ -479,7 +479,7 @@ public void getPrices(int[] ids, Callback> callback) throws GuildWa * @see Currency currency info */ public void getCurrencyInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getCurrencyInfo(processIds(ids)).enqueue(callback); } @@ -495,6 +495,33 @@ public void getAllCurrencyID(Callback> callback) throws NullPointe gw2API.getAllCurrencies().enqueue(callback); } + /** + * 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 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 Dungeon dungeon info + */ + public void getDungeonInfo(String[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getDungeonInfo(processIds(ids)).enqueue(callback); + } + + /** + * 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 Dungeon dungeon info + */ + public void getAllDungeonName(Callback> callback) throws NullPointerException { + gw2API.getAllDungeonName().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 @@ -506,7 +533,7 @@ public void getAllCurrencyID(Callback> callback) throws NullPointe * @see World world info */ public void getWorldInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getWorldsInfo(processIds(ids)).enqueue(callback); } @@ -533,7 +560,7 @@ public void getAllWorldID(Callback> callback) throws NullPointerEx * @see MaterialCategory material category info */ public void getMaterialCategoryInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getMaterialBankInfo(processIds(ids)).enqueue(callback); } @@ -560,7 +587,7 @@ public void getAllMaterialCategoryID(Callback> callback) throws Nu * @see Skin skin info */ public void getSkinInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getSkinInfo(processIds(ids)).enqueue(callback); } @@ -587,7 +614,7 @@ public void getAllSkinID(Callback> callback) throws NullPointerExc * @see Item item info */ public void getItemInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getItemInfo(processIds(ids)).enqueue(callback); } @@ -614,7 +641,7 @@ public void getAllItemID(Callback> callback) throws NullPointerExc * @see ItemStats itemstat info */ public void getItemStatInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getItemStatInfo(processIds(ids)).enqueue(callback); } @@ -641,7 +668,7 @@ public void getAllItemStatID(Callback> callback) throws NullPointe * @see Color color info */ public void getColorInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getColorInfo(processIds(ids)).enqueue(callback); } @@ -668,7 +695,7 @@ public void getAllColorID(Callback> callback) throws NullPointerEx * @see Recipe recipe info */ public void getRecipeInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getRecipeInfo(processIds(ids)).enqueue(callback); } @@ -708,7 +735,7 @@ public void searchRecipes(boolean isInput, int id, Callback> callb * @see Mini mini info */ public void getMiniInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); gw2API.getMiniInfo(processIds(ids)).enqueue(callback); } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index a245b12..dea21e6 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -102,6 +102,13 @@ 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); @@ -112,10 +119,6 @@ interface GuildWars2API { @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(); @@ -123,26 +126,12 @@ interface GuildWars2API { @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); - - //material categories - @GET("/v2/materials") - Call> getAllMaterialBankIDs(); - - @GET("/v2/materials") - Call> getMaterialBankInfo(@Query("ids") String ids); - - //skins - @GET("/v2/skins") - Call> getAllSkinIDs(); - - @GET("/v2/skins") - Call> getSkinInfo(@Query("ids") String ids); + @GET("/v2/dungeons") + Call> getDungeonInfo(@Query("ids") String ids); //items @GET("/v2/items") @@ -158,12 +147,26 @@ interface GuildWars2API { @GET("/v2/itemstats") Call> getItemStatInfo(@Query("ids") String ids); - //colors - @GET("/v2/colors") - Call> getAllColorIDs(); + //material categories + @GET("/v2/materials") + Call> getAllMaterialBankIDs(); - @GET("/v2/colors") - Call> getColorInfo(@Query("ids") String ids); + @GET("/v2/materials") + Call> getMaterialBankInfo(@Query("ids") String ids); + + //minis + @GET("/v2/minis") + Call> getAllMiniIDs(); + + @GET("/v2/minis") + Call> getMiniInfo(@Query("ids") String ids); + + //skins + @GET("/v2/skins") + Call> getAllSkinIDs(); + + @GET("/v2/skins") + Call> getSkinInfo(@Query("ids") String ids); //recipes @GET("/v2/recipes") @@ -179,10 +182,14 @@ interface GuildWars2API { @GET("/v2/recipes/search") Call> searchOutputRecipes(@Query("output") String id); - //minis - @GET("/v2/minis") - Call> getAllMiniIDs(); + //token info + @GET("/v2/tokeninfo") + Call getAPIInfo(@Query("access_token") String token); - @GET("/v2/minis") - Call> getMiniInfo(@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 83dbe4c..eaf77be 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/Request.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/Request.java @@ -29,6 +29,12 @@ String processIds(int[] list) { 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); + } + //convert transaction.Time to string String processListingTime(Transaction.Time time) throws GuildWars2Exception { if (time == null) throw new GuildWars2Exception(ErrorCode.TransTime, "Transaction time type cannot be empty"); @@ -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"); + } } } @@ -93,17 +106,23 @@ class ParamChecker { ParamType type; String value; int[] ids; + String[] str_id; ParamChecker(ParamType t, String s) { type = t; value = s; } - ParamChecker(ParamType t, int[] 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 02bdf8e..aaf6087 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -110,7 +110,6 @@ public List getBank(String API) throws GuildWars2Exception { /** * For more info on Dungeon progression API go here
- * TODO /v2/dungeons * * @param API API key * @return an array of strings representing dungeon path names completed since daily dungeon reset @@ -468,7 +467,6 @@ public List getWallet(String API) throws GuildWars2Exception { } //Achievements - /** * For more info on achievement API go here
* Get list of achievement info corresponding to the given id(s) @@ -479,7 +477,7 @@ public List getWallet(String API) throws GuildWars2Exception { * @see Achievement achievement info */ public List getAchievementInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getAchievementInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -570,6 +568,7 @@ public CharacterInventory getCharacterInventory(String API, String name) throws } } + //TP /** * For more info on Transaction API go here
* Get transaction info linked to given API key @@ -619,7 +618,7 @@ public List getAllListedItemID() throws GuildWars2Exception { * @see Prices listing price info */ public List getPrices(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getPrices(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -629,6 +628,7 @@ public List getPrices(int[] ids) throws GuildWars2Exception { } } + //Currencies /** * For more info on Currency API go here
* Get currency info for the given currency id(s) @@ -639,7 +639,7 @@ public List getPrices(int[] ids) throws GuildWars2Exception { * @see Currency currency info */ public List getCurrencyInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getCurrencyInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -667,6 +667,47 @@ public List getAllCurrencyID() throws GuildWars2Exception { } } + //Dungeons + + /** + * 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()); + } + } + + /** + * For more info on Dungeons API go here
+ * Get all dungeon id(s) + * + * @return list of dungeon info + * @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()); + } + } + + //Worlds /** * For more info on World API go here
* Get world info for the given world id(s) @@ -677,7 +718,7 @@ public List getAllCurrencyID() throws GuildWars2Exception { * @see World world info */ public List getWorldInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getWorldsInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -715,7 +756,7 @@ public List getAllWorldID() throws GuildWars2Exception { * @see MaterialCategory material category info */ public List getMaterialCategoryInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getMaterialBankInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -753,7 +794,7 @@ public List getAllMaterialCategoryID() throws GuildWars2Exception { * @see Skin skin info */ public List getSkinInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getSkinInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -791,7 +832,7 @@ public List getAllSkinID() throws GuildWars2Exception { * @see Item item info */ public List getItemInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getItemInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -829,7 +870,7 @@ public List getAllItemID() throws GuildWars2Exception { * @see ItemStats itemstat info */ public List getItemStatInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getItemStatInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -867,7 +908,7 @@ public List getAllItemStatID() throws GuildWars2Exception { * @see Color color info */ public List getColorInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getColorInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -905,7 +946,7 @@ public List getAllColorID() throws GuildWars2Exception { * @see Recipe recipe info */ public List getRecipeInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getRecipeInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); @@ -963,7 +1004,7 @@ public List searchRecipes(boolean isInput, int id) throws GuildWars2Exc * @see Mini mini info */ public List getMiniInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.ID, ids)); + isParamValid(new ParamChecker(ids)); try { Response> response = gw2API.getMiniInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); 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..8c58661 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java @@ -0,0 +1,76 @@ +package me.xhsun.guildwars2wrapper.model; + +import java.util.Arrays; + +/** + * For more info on Dungeons API go here
+ * Model class for dungeon + * + * @author xhsun + * @since 2017-06-06 + */ +public class Dungeon { + private String id; + private Path[] paths; + + public String getId() { + return id; + } + + public 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=" + Arrays.toString(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 + '\'' + + '}'; + } + } +} From 9618b5ab53a44a5805ec1ef7a22e8709c4be0be2 Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 12:57:25 -0600 Subject: [PATCH 20/33] done finishers API --- .../AsynchronousRequest.java | 30 ++++++++ .../guildwars2wrapper/GuildWars2API.java | 7 ++ .../guildwars2wrapper/SynchronousRequest.java | 45 +++++++++++- .../guildwars2wrapper/model/Finisher.java | 70 +++++++++++++++++++ .../model/account/UnlockedFinisher.java | 2 +- 5 files changed, 150 insertions(+), 4 deletions(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index a61a8fe..c825004 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -495,6 +495,7 @@ public void getAllCurrencyID(Callback> callback) throws NullPointe gw2API.getAllCurrencies().enqueue(callback); } + //Dungeons /** * 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 @@ -522,6 +523,35 @@ public void getAllDungeonName(Callback> callback) throws NullPointe gw2API.getAllDungeonName().enqueue(callback); } + //Finishers + + /** + * 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 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 Finisher finisher info + */ + public void getFinisherInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getFinisherInfo(processIds(ids)).enqueue(callback); + } + + /** + * 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 Finisher finisher info + */ + public void getAllFinisherID(Callback> callback) throws NullPointerException { + gw2API.getAllFinisherIDs().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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index dea21e6..ce77a45 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -133,6 +133,13 @@ interface GuildWars2API { @GET("/v2/dungeons") Call> getDungeonInfo(@Query("ids") String ids); + //Finishers + @GET("/v2/finishers") + Call> getAllFinisherIDs(); + + @GET("/v2/finishers") + Call> getFinisherInfo(@Query("ids") String ids); + //items @GET("/v2/items") Call> getAllItemIDs(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index aaf6087..b2408e1 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -668,7 +668,6 @@ public List getAllCurrencyID() throws GuildWars2Exception { } //Dungeons - /** * For more info on Dungeons API go here
* Get dungeon info for the given dungeon id(s) @@ -691,9 +690,9 @@ public List getDungeonInfo(String[] ids) throws GuildWars2Exception { /** * For more info on Dungeons API go here
- * Get all dungeon id(s) + * Get all dungeon name(s) * - * @return list of dungeon info + * @return list of dungeon name(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Dungeon dungeon info */ @@ -707,6 +706,46 @@ public List getAllDungeonName() throws GuildWars2Exception { } } + //Finishers + + /** + * 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()); + } + } + + /** + * 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()); + } + } + //Worlds /** * For more info on World API go here
diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java new file mode 100644 index 0000000..418d0b1 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java @@ -0,0 +1,70 @@ +package me.xhsun.guildwars2wrapper.model; + +import java.util.Arrays; + +/** + * For more info on Finishers API go here
+ * Model class for finisher + * + * @author xhsun + * @since 2017-06-06 + */ +public class Finisher { + private int id; + private String unlock_details; + private int[] unlock_items;//item ids + private int order; + private String icon; + private String name; + + public int getId() { + return id; + } + + public String getUnlock_details() { + return unlock_details; + } + + public int[] getUnlock_items() { + return unlock_items; + } + + public int getOrder() { + return order; + } + + public String getIcon() { + return icon; + } + + public String getName() { + return name; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Finisher finisher = (Finisher) o; + + return id == finisher.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "Finisher{" + + "id=" + id + + ", unlock_details='" + unlock_details + '\'' + + ", unlock_items=" + Arrays.toString(unlock_items) + + ", order=" + order + + ", icon='" + icon + '\'' + + ", name='" + name + '\'' + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java index 91fd510..cf35072 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java @@ -8,7 +8,7 @@ * @since 2017-06-05 */ public class UnlockedFinisher { - private int id;//TODO /v2/finishers + private int id; private boolean permanent; private int quantity; From b3a25838a7af58c35223ffe83fe117278e852b66 Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 13:43:19 -0600 Subject: [PATCH 21/33] done gliders API --- .../AsynchronousRequest.java | 29 +++++++ .../guildwars2wrapper/GuildWars2API.java | 7 ++ .../guildwars2wrapper/SynchronousRequest.java | 41 ++++++++- .../guildwars2wrapper/model/Finisher.java | 1 + .../xhsun/guildwars2wrapper/model/Glider.java | 83 +++++++++++++++++++ 5 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/Glider.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index c825004..c6a0dea 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -552,6 +552,35 @@ public void getAllFinisherID(Callback> callback) throws NullPointe gw2API.getAllFinisherIDs().enqueue(callback); } + //Gliders + + /** + * 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 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 Glider glider info + */ + public void getGliderInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getGliderInfo(processIds(ids)).enqueue(callback); + } + + /** + * 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 Glider glider info + */ + public void getAllGliderID(Callback> callback) throws NullPointerException { + gw2API.getAllGliderIDs().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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index ce77a45..e2ad2ec 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -140,6 +140,13 @@ interface GuildWars2API { @GET("/v2/finishers") Call> getFinisherInfo(@Query("ids") String ids); + //Gliders + @GET("/v2/gliders") + Call> getAllGliderIDs(); + + @GET("/v2/gliders") + Call> getGliderInfo(@Query("ids") String ids); + //items @GET("/v2/items") Call> getAllItemIDs(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index b2408e1..f4b6ee7 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -169,7 +169,6 @@ public List getUnlockedFinishers(String API) throws GuildWars2 /** * For more info on Account gliders API go here
* Get list of unlocked glider id(s) linked to given API key - * TODO /v2/gliders * * @param API API key * @return list of gliders id @@ -746,6 +745,46 @@ public List getAllFinisherID() throws GuildWars2Exception { } } + //Glider + + /** + * 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()); + } + } + + /** + * 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()); + } + } + //Worlds /** * For more info on World API go here
diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java index 418d0b1..fcf116a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java @@ -17,6 +17,7 @@ public class Finisher { private String icon; private String name; + //TODO javadoc public int getId() { return id; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Glider.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Glider.java new file mode 100644 index 0000000..ec0acfa --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Glider.java @@ -0,0 +1,83 @@ +package me.xhsun.guildwars2wrapper.model; + +import java.util.Arrays; + +/** + * For more info on gliders API go here
+ * Model class for glider + * + * @author xhsun + * @since 2017-06-06 + */ +public class Glider { + private int id; + private int[] unlock_items;//item id + private int order; + private String icon; + private String name; + private String description; + private int[] default_dyes;//color id + + public int getId() { + return id; + } + + /** + * @return array of {@link Item} id(s) + */ + public int[] getUnlock_items() { + return unlock_items; + } + + public int getOrder() { + return order; + } + + public String getIcon() { + return icon; + } + + public String getName() { + return name; + } + + //TODO method that give striped description, ie, no html + public String getDescription() { + return description; + } + + /** + * @return array of {@link Color} id(s) + */ + public int[] getDefault_dyes() { + 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 id == glider.id; + } + + @Override + public int hashCode() { + return id; + } + + @Override + public String toString() { + return "Glider{" + + "id=" + id + + ", unlock_items=" + Arrays.toString(unlock_items) + + ", order=" + order + + ", icon='" + icon + '\'' + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", default_dyes=" + Arrays.toString(default_dyes) + + '}'; + } +} From 06759264d8574914c4c9eecebc4ec65dba16c87f Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 14:03:02 -0600 Subject: [PATCH 22/33] done mail carriers API --- .../AsynchronousRequest.java | 36 ++++++++++++++ .../guildwars2wrapper/GuildWars2API.java | 10 ++++ .../guildwars2wrapper/SynchronousRequest.java | 46 ++++++++++++++++++ .../model/{ => unlockable}/Finisher.java | 44 ++++------------- .../model/{ => unlockable}/Glider.java | 48 +++++-------------- .../model/unlockable/MailCarrier.java | 45 +++++++++++++++++ .../model/unlockable/Unlockable.java | 40 ++++++++++++++++ 7 files changed, 197 insertions(+), 72 deletions(-) rename src/main/java/me/xhsun/guildwars2wrapper/model/{ => unlockable}/Finisher.java (50%) rename src/main/java/me/xhsun/guildwars2wrapper/model/{ => unlockable}/Glider.java (57%) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index c6a0dea..c47254f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -8,6 +8,9 @@ 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.unlockable.Finisher; +import me.xhsun.guildwars2wrapper.model.unlockable.Glider; +import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -581,6 +584,7 @@ public void getAllGliderID(Callback> callback) throws NullPointerE gw2API.getAllGliderIDs().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 @@ -662,6 +666,7 @@ public void getAllSkinID(Callback> callback) throws NullPointerExc gw2API.getAllSkinIDs().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 @@ -689,6 +694,7 @@ public void getAllItemID(Callback> callback) throws NullPointerExc gw2API.getAllItemIDs().enqueue(callback); } + //Item Stats /** * 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 @@ -716,6 +722,36 @@ public void getAllItemStatID(Callback> callback) throws NullPointe gw2API.getAllItemStatIDs().enqueue(callback); } + //Mail Carriers + + /** + * 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 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 MailCarrier mail carrier info + */ + public void getMailCarrierInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getMailCarrierInfo(processIds(ids)).enqueue(callback); + } + + /** + * 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 MailCarrier mail carrier info + */ + public void getAllMailCarrierID(Callback> callback) throws NullPointerException { + gw2API.getAllMailCarrierIDs().enqueue(callback); + } + + //Colors /** * 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 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index e2ad2ec..eb29b8e 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -7,6 +7,9 @@ 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.unlockable.Finisher; +import me.xhsun.guildwars2wrapper.model.unlockable.Glider; +import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; @@ -161,6 +164,13 @@ interface GuildWars2API { @GET("/v2/itemstats") Call> getItemStatInfo(@Query("ids") String ids); + //mail carriers + @GET("/v2/mailcarriers") + Call> getAllMailCarrierIDs(); + + @GET("/v2/mailcarriers") + Call> getMailCarrierInfo(@Query("ids") String ids); + //material categories @GET("/v2/materials") Call> getAllMaterialBankIDs(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index f4b6ee7..349025f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -9,6 +9,9 @@ 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.unlockable.Finisher; +import me.xhsun.guildwars2wrapper.model.unlockable.Glider; +import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; import retrofit2.Response; import java.io.IOException; @@ -900,6 +903,7 @@ public List getAllSkinID() throws GuildWars2Exception { } } + //Items /** * For more info on Item API go here
* Get item info for the given item id(s) @@ -938,6 +942,7 @@ public List getAllItemID() throws GuildWars2Exception { } } + //Item Stats /** * For more info on Itemstat API go here
* Get itemstat info for the given itemstat id(s) @@ -976,6 +981,47 @@ public List getAllItemStatID() throws GuildWars2Exception { } } + //Mail Carriers + + /** + * 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()); + } + } + + /** + * 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()); + } + } + + //Color /** * For more info on Color API go here
* Get color info for the given color id(s) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java similarity index 50% rename from src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java rename to src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java index fcf116a..d7afe53 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Finisher.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java @@ -1,4 +1,4 @@ -package me.xhsun.guildwars2wrapper.model; +package me.xhsun.guildwars2wrapper.model.unlockable; import java.util.Arrays; @@ -9,39 +9,13 @@ * @author xhsun * @since 2017-06-06 */ -public class Finisher { - private int id; +public class Finisher extends Unlockable { private String unlock_details; - private int[] unlock_items;//item ids - private int order; - private String icon; - private String name; - - //TODO javadoc - public int getId() { - return id; - } public String getUnlock_details() { return unlock_details; } - public int[] getUnlock_items() { - return unlock_items; - } - - public int getOrder() { - return order; - } - - public String getIcon() { - return icon; - } - - public String getName() { - return name; - } - @Override public boolean equals(Object o) { if (this == o) return true; @@ -49,23 +23,23 @@ public boolean equals(Object o) { Finisher finisher = (Finisher) o; - return id == finisher.id; + return getId() == finisher.getId(); } @Override public int hashCode() { - return id; + return getId(); } @Override public String toString() { return "Finisher{" + - "id=" + id + + "id=" + getId() + ", unlock_details='" + unlock_details + '\'' + - ", unlock_items=" + Arrays.toString(unlock_items) + - ", order=" + order + - ", icon='" + icon + '\'' + - ", name='" + name + '\'' + + ", unlock_items=" + Arrays.toString(getUnlock_items()) + + ", order=" + getOrder() + + ", icon='" + getIcon() + '\'' + + ", name='" + getName() + '\'' + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Glider.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java similarity index 57% rename from src/main/java/me/xhsun/guildwars2wrapper/model/Glider.java rename to src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java index ec0acfa..87dc269 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Glider.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java @@ -1,4 +1,6 @@ -package me.xhsun.guildwars2wrapper.model; +package me.xhsun.guildwars2wrapper.model.unlockable; + +import me.xhsun.guildwars2wrapper.model.Color; import java.util.Arrays; @@ -9,38 +11,10 @@ * @author xhsun * @since 2017-06-06 */ -public class Glider { - private int id; - private int[] unlock_items;//item id - private int order; - private String icon; - private String name; +public class Glider extends Unlockable { private String description; private int[] default_dyes;//color id - public int getId() { - return id; - } - - /** - * @return array of {@link Item} id(s) - */ - public int[] getUnlock_items() { - return unlock_items; - } - - public int getOrder() { - return order; - } - - public String getIcon() { - return icon; - } - - public String getName() { - return name; - } - //TODO method that give striped description, ie, no html public String getDescription() { return description; @@ -60,22 +34,22 @@ public boolean equals(Object o) { Glider glider = (Glider) o; - return id == glider.id; + return getId() == glider.getId(); } @Override public int hashCode() { - return id; + return getId(); } @Override public String toString() { return "Glider{" + - "id=" + id + - ", unlock_items=" + Arrays.toString(unlock_items) + - ", order=" + order + - ", icon='" + icon + '\'' + - ", name='" + name + '\'' + + "id=" + getId() + + ", unlock_items=" + Arrays.toString(getUnlock_items()) + + ", order=" + getOrder() + + ", icon='" + getIcon() + '\'' + + ", name='" + getName() + '\'' + ", description='" + description + '\'' + ", default_dyes=" + Arrays.toString(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..edbf22d --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java @@ -0,0 +1,45 @@ +package me.xhsun.guildwars2wrapper.model.unlockable; + +import java.util.Arrays; + +/** + * For more info on mail carriers API go here
+ * Model class for mail carrier + * + * @author xhsun + * @since 2017-06-06 + */ +public class MailCarrier extends Unlockable { + private String[] flags; + + public 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(getUnlock_items()) + + ", order=" + getOrder() + + ", icon='" + getIcon() + '\'' + + ", name='" + getName() + '\'' + + ", flags=" + Arrays.toString(flags) + + '}'; + } +} 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..7a298b7 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java @@ -0,0 +1,40 @@ +package me.xhsun.guildwars2wrapper.model.unlockable; + +import me.xhsun.guildwars2wrapper.model.Item; + +/** + * Super class for model classes that have unlock item field + * + * @author xhsun + * @since 2017-06-06 + */ +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[] getUnlock_items() { + return unlock_items; + } + + public int getOrder() { + return order; + } + + public String getIcon() { + return icon; + } + + public String getName() { + return name; + } +} From 9801b656923f8f09598e8222aea6500c67aff1df Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 14:31:45 -0600 Subject: [PATCH 23/33] done masteries API --- .../AsynchronousRequest.java | 29 ++++ .../guildwars2wrapper/GuildWars2API.java | 7 + .../guildwars2wrapper/SynchronousRequest.java | 41 ++++- .../xhsun/guildwars2wrapper/model/Color.java | 2 +- .../xhsun/guildwars2wrapper/model/Item.java | 8 +- .../guildwars2wrapper/model/Mastery.java | 149 ++++++++++++++++++ .../xhsun/guildwars2wrapper/model/Mini.java | 2 +- .../xhsun/guildwars2wrapper/model/Recipe.java | 18 +-- .../xhsun/guildwars2wrapper/model/Skin.java | 4 +- .../model/account/Account.java | 10 +- .../guildwars2wrapper/model/account/Bank.java | 6 +- .../model/account/UnlockedMastery.java | 1 - .../model/achievements/Achievement.java | 9 +- .../model/commerce/Prices.java | 2 +- .../model/commerce/Transaction.java | 2 +- .../model/unlockable/Finisher.java | 4 +- .../model/unlockable/Glider.java | 4 +- .../model/unlockable/MailCarrier.java | 2 +- .../model/unlockable/Unlockable.java | 2 +- .../model/util/Inventory.java | 8 +- .../guildwars2wrapper/model/util/Storage.java | 2 +- .../model/util/comm/Region.java | 9 ++ .../model/util/itemDetail/Trinket.java | 2 +- 23 files changed, 277 insertions(+), 46 deletions(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Region.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index c47254f..9d02383 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -751,6 +751,35 @@ public void getAllMailCarrierID(Callback> callback) throws NullPoi gw2API.getAllMailCarrierIDs().enqueue(callback); } + //Masteries + + /** + * 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 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 Mastery mastery info + */ + public void getMasteryInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getMasteryInfo(processIds(ids)).enqueue(callback); + } + + /** + * 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 Mastery mastery info + */ + public void getAllMasteryID(Callback> callback) throws NullPointerException { + gw2API.getAllMasteryIDs().enqueue(callback); + } + //Colors /** * For more info on Color API go here
diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index eb29b8e..35fc35a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -171,6 +171,13 @@ interface GuildWars2API { @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(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 349025f..45590e5 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -250,7 +250,6 @@ public List getSharedInventory(String API) throws GuildWars2Exc /** * For more info on account mail carrier API go here
* Get list of unlocked mail carrier id(s) linked to given API key - * TODO /v2/mailcarriers * * @param API API key * @return list of mail carrier id(s) @@ -1021,6 +1020,46 @@ public List getAllMailCarrierID() throws GuildWars2Exception { } } + //Masteries + + /** + * 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()); + } + } + + /** + * 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()); + } + } + //Color /** * For more info on Color API go here
diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java index 701c538..05e8200 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java @@ -36,7 +36,7 @@ public String getName() { return name; } - public int[] getBase_rgb() { + public int[] getBaseRgb() { return base_rgb; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java index 865248b..c566fa9 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java @@ -51,7 +51,7 @@ public int getId() { return id; } - public String getChat_link() { + public String getChatLink() { return chat_link; } @@ -79,11 +79,11 @@ public int getLevel() { return level; } - public long getVendor_value() { + public long getVendorValue() { return vendor_value; } - public int getDefault_skin() { + public int getDefaultSkin() { return default_skin; } @@ -91,7 +91,7 @@ public Flag[] getFlags() { return flags; } - public GameType[] getGame_types() { + public GameType[] getGameTypes() { return game_types; } 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..dff1dfd --- /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.Arrays; + +/** + * For more info on masteries API go here
+ * 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 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 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=" + Arrays.toString(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/Mini.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java index 50f56f0..e815100 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java @@ -38,7 +38,7 @@ public int getOrder() { return order; } - public int getItem_id() { + public int getItemId() { return item_id; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java index 7dfe970..9370376 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java @@ -38,15 +38,15 @@ public Type getType() { return type; } - public int getOutput_item_id() { + public int getOutputItemId() { return output_item_id; } - public int getOutput_item_count() { + public int getOutputItemCount() { return output_item_count; } - public int getTime_to_craft_ms() { + public int getTimeToCraftMS() { return time_to_craft_ms; } @@ -54,7 +54,7 @@ public List getDisciplines() { return disciplines; } - public int getMin_rating() { + public int getMinRating() { return min_rating; } @@ -66,15 +66,15 @@ public List getIngredients() { return ingredients; } - public List getGuild_ingredients() { + public List 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; } @@ -122,11 +122,11 @@ public class Ingredient { @Expose private int count; - public int getItem_id() { + public int getItemId() { return item_id; } - public int getUpgrade_id() { + public int getUpgradeId() { return upgrade_id; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java index 3b51a17..8d6df27 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java @@ -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/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 getGuilds() { return guilds; } - public List getGuild_leader() { + public List 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/Bank.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java index 1026dda..668016e 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java @@ -44,7 +44,7 @@ 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); } @@ -55,7 +55,7 @@ public int hashCode() { 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 + (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); @@ -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/UnlockedMastery.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java index 94ab422..650fdda 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java @@ -3,7 +3,6 @@ /** * For more info on Account masteries API go here
* Model class of account masteries - * TODO /v2/masteries * * @author xhsun * @since 2017-06-05 diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java index 1d8639d..cad95f9 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model.achievements; import com.google.gson.annotations.Expose; +import me.xhsun.guildwars2wrapper.model.util.comm.Region; import java.util.Arrays; @@ -18,8 +19,6 @@ private enum Type { Text, Minipet, Skin } - public enum RewardRegion {Tyria, Maguuma}//TODO update this every time new mastery region is out - private enum Flag { Pvp, CategoryDisplay, MoveToTop, IgnoreNearlyComplete, Repeatable, Hidden, RequiresUnlock, RepairOnLogin, Daily, Weekly, Monthly, Permanent @@ -58,7 +57,7 @@ public String getRequirement() { return requirement; } - public String getLocked_text() { + public String getLockedText() { return locked_text; } @@ -167,7 +166,7 @@ public class Reward { @Expose private long count; @Expose - private RewardRegion region; + private Region region; /** * if {@link #type} is @@ -198,7 +197,7 @@ public long getCount() { return count; } - public RewardRegion getRegion() { + public Region getRegion() { return region; } 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 740178c..f21df07 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java @@ -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 dde3e4f..c3b4ea6 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Transaction.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Transaction.java @@ -27,7 +27,7 @@ public long getId() { return id; } - public int getItem_id() { + public int getItemId() { return item_id; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java index d7afe53..ffc9cda 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java @@ -12,7 +12,7 @@ public class Finisher extends Unlockable { private String unlock_details; - public String getUnlock_details() { + public String getUnlockDetails() { return unlock_details; } @@ -36,7 +36,7 @@ public String toString() { return "Finisher{" + "id=" + getId() + ", unlock_details='" + unlock_details + '\'' + - ", unlock_items=" + Arrays.toString(getUnlock_items()) + + ", 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 index 87dc269..330b236 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java @@ -23,7 +23,7 @@ public String getDescription() { /** * @return array of {@link Color} id(s) */ - public int[] getDefault_dyes() { + public int[] getDefaultDyes() { return default_dyes; } @@ -46,7 +46,7 @@ public int hashCode() { public String toString() { return "Glider{" + "id=" + getId() + - ", unlock_items=" + Arrays.toString(getUnlock_items()) + + ", unlock_items=" + Arrays.toString(getUnlockItems()) + ", order=" + getOrder() + ", icon='" + getIcon() + '\'' + ", name='" + getName() + '\'' + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java index edbf22d..dc6164b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java @@ -35,7 +35,7 @@ public int hashCode() { public String toString() { return "MailCarrier{" + "id=" + getId() + - ", unlock_items=" + Arrays.toString(getUnlock_items()) + + ", unlock_items=" + Arrays.toString(getUnlockItems()) + ", order=" + getOrder() + ", 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 index 7a298b7..0e4ca02 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java @@ -22,7 +22,7 @@ public int getId() { /** * @return array of {@link Item} id(s) */ - public int[] getUnlock_items() { + public int[] getUnlockItems() { return unlock_items; } 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 c431afd..1bc7f06 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java @@ -47,18 +47,18 @@ 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) && + (getBoundTo() != null ? getBoundTo().equals(inventory.getBoundTo()) : inventory.getBoundTo() == null) && Arrays.equals(infusions, inventory.infusions) && Arrays.equals(upgrades, inventory.upgrades) && (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 + (getBoundTo() != null ? getBoundTo().hashCode() : 0); result = 31 * result + Arrays.hashCode(infusions); result = 31 * result + Arrays.hashCode(upgrades); result = 31 * result + skin; @@ -73,7 +73,7 @@ public String toString() { ", count=" + getCount() + ", charges=" + getCharges() + ", binding=" + getBinding() + - ", bound_to='" + getBound_to() + '\'' + + ", bound_to='" + getBoundTo() + '\'' + ", infusions=" + Arrays.toString(infusions) + ", upgrades=" + Arrays.toString(upgrades) + ", skin=" + skin + 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 17ee711..af3c54a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java @@ -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..34e8854 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Region.java @@ -0,0 +1,9 @@ +package me.xhsun.guildwars2wrapper.model.util.comm; + +/** + * //TODO update this every time new mastery region is out + * Created by hannah on 06/06/17. + */ +public enum Region { + Tyria, Maguuma +} 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..9715f9d 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 @@ -30,7 +30,7 @@ public String getSuffix() { return suffix; } - public InfixUpgrade getInfxUpgrade() { + public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } From 45ef6909ab3eb4fb45cdc62d046974db25f9b549 Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 14:41:58 -0600 Subject: [PATCH 24/33] done outfits API --- .../AsynchronousRequest.java | 31 +++++++++++++ .../guildwars2wrapper/GuildWars2API.java | 8 ++++ .../guildwars2wrapper/SynchronousRequest.java | 43 ++++++++++++++++++- .../model/unlockable/Outfit.java | 37 ++++++++++++++++ .../model/unlockable/Unlockable.java | 5 +++ 5 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Outfit.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 9d02383..3a0cece 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -11,6 +11,7 @@ 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; @@ -848,6 +849,7 @@ public void searchRecipes(boolean isInput, int id, Callback> callb else gw2API.searchOutputRecipes(Integer.toString(id)).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 @@ -874,4 +876,33 @@ public void getMiniInfo(int[] ids, Callback> callback) throws GuildWa public void getAllMiniID(Callback> callback) throws NullPointerException { gw2API.getAllMiniIDs().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 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); + } + + /** + * 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); + } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 35fc35a..3ab2908 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -10,6 +10,7 @@ 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; @@ -192,6 +193,13 @@ interface GuildWars2API { @GET("/v2/minis") Call> getMiniInfo(@Query("ids") String ids); + //Outfits + @GET("/v2/outfits") + Call> getAllOutfitIDs(); + + @GET("/v2/outfits") + Call> getOutfitInfo(@Query("ids") String ids); + //skins @GET("/v2/skins") Call> getAllSkinIDs(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 45590e5..a41dea8 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -12,6 +12,7 @@ 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; @@ -329,7 +330,6 @@ public List getUnlockedMinis(String API) throws GuildWars2Exception { /** * For more info on account outfits API go here
* Get list of unlocked outfit id(s) linked to given API key - * TODO /v2/outfits * * @param API API key * @return list of outfit id(s) @@ -1157,6 +1157,7 @@ public List searchRecipes(boolean isInput, int id) throws GuildWars2Exc } } + //Minis /** * For more info on Mini API go here
* Get mini info for the given mini id(s) @@ -1194,4 +1195,44 @@ public List getAllMiniID() throws GuildWars2Exception { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } } + + //Outfits + + /** + * 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()); + } + } + + /** + * For more info on Outfits API go here
+ * Get all outfit id(s) + * + * @return list of outfit id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @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()); + } + } } 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 here
+ * 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 index 0e4ca02..6686a67 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java @@ -26,6 +26,11 @@ public int[] getUnlockItems() { return unlock_items; } + /** + * not applicable to {@link Outfit} + * + * @return Order shown in game + */ public int getOrder() { return order; } From a98e8b7819865f12c0ffc092ee5d3f23535dd9e4 Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 15:10:15 -0600 Subject: [PATCH 25/33] done pvp heroes API --- .../AsynchronousRequest.java | 30 ++++ .../guildwars2wrapper/GuildWars2API.java | 8 + .../guildwars2wrapper/SynchronousRequest.java | 42 ++++- .../guildwars2wrapper/model/pvp/Hero.java | 162 ++++++++++++++++++ .../model/unlockable/Unlockable.java | 6 +- 5 files changed, 244 insertions(+), 4 deletions(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Hero.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 3a0cece..a32c245 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -8,6 +8,7 @@ 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.pvp.Hero; import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; import me.xhsun.guildwars2wrapper.model.unlockable.Glider; import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; @@ -905,4 +906,33 @@ public void getOutfitInfo(int[] ids, Callback> callback) throws Gui public void getAllOutfitID(Callback> callback) throws NullPointerException { gw2API.getAllOutfitIDs().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 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); + } + + /** + * 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); + } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 3ab2908..9b7fe89 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -7,6 +7,7 @@ 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.pvp.Hero; import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; import me.xhsun.guildwars2wrapper.model.unlockable.Glider; import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; @@ -200,6 +201,13 @@ interface GuildWars2API { @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); + //skins @GET("/v2/skins") Call> getAllSkinIDs(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index a41dea8..29b2791 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -9,6 +9,7 @@ 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.pvp.Hero; import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; import me.xhsun.guildwars2wrapper.model.unlockable.Glider; import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; @@ -349,7 +350,6 @@ public List getUnlockedOutfits(String API) throws GuildWars2Exception { /** * For more info on account pvp heroes API go here
* Get list of unlocked pvp hero id(s) linked to given API key - * TODO /v2/pvp/heroes * * @param API API key * @return list of pvp heroes id(s) @@ -1235,4 +1235,44 @@ public List getAllOutfitID() throws GuildWars2Exception { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } } + + //PvP Heroes + + /** + * 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()); + } + } + + /** + * 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()); + } + } } 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 here
+ * 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 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 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/Unlockable.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java index 6686a67..5f1d9dd 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java @@ -1,14 +1,14 @@ 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 */ -class Unlockable { +public class Unlockable { private int id; private int[] unlock_items;//item id private int order; @@ -27,7 +27,7 @@ public int[] getUnlockItems() { } /** - * not applicable to {@link Outfit} + * not applicable to {@link Outfit}, {@link Hero.Skin} * * @return Order shown in game */ From e5eab4ef257498d87ffd3c256c0b9790ea60195e Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 15:12:22 -0600 Subject: [PATCH 26/33] few more todo --- src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java | 3 ++- .../java/me/xhsun/guildwars2wrapper/SynchronousRequest.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 29b2791..4a25bb3 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -21,7 +21,7 @@ /** * This class contains all the method for accessing data synchronously - * + * TODO reorder methods * @author xhsun * @since 2017-06-04 */ From 87fb9f9da4504342430c74f3fbeeb5e20bb53080 Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 17:38:25 -0600 Subject: [PATCH 27/33] done raids API --- .../AsynchronousRequest.java | 29 +++++ .../guildwars2wrapper/GuildWars2API.java | 7 + .../guildwars2wrapper/SynchronousRequest.java | 39 +++++- .../guildwars2wrapper/model/Dungeon.java | 8 +- .../xhsun/guildwars2wrapper/model/Item.java | 20 +-- .../guildwars2wrapper/model/Mastery.java | 8 +- .../model/MaterialCategory.java | 8 +- .../xhsun/guildwars2wrapper/model/Raid.java | 120 ++++++++++++++++++ .../xhsun/guildwars2wrapper/model/Recipe.java | 7 +- .../xhsun/guildwars2wrapper/model/Skin.java | 14 +- .../guildwars2wrapper/model/TokenInfo.java | 8 +- .../model/achievements/Achievement.java | 32 ++--- .../model/unlockable/Glider.java | 7 +- .../model/unlockable/MailCarrier.java | 7 +- .../model/util/Inventory.java | 21 +-- .../model/util/itemDetail/Armor.java | 18 +-- .../model/util/itemDetail/Back.java | 18 +-- .../model/util/itemDetail/ItemDetail.java | 12 +- .../model/util/itemDetail/Trinket.java | 26 ++-- .../model/util/itemDetail/Weapon.java | 18 +-- .../itemDetail/subobject/InfixUpgrade.java | 12 +- .../itemDetail/subobject/InfusionSlot.java | 13 +- 22 files changed, 325 insertions(+), 127 deletions(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/Raid.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index a32c245..694a412 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -935,4 +935,33 @@ public void getPvPHeroInfo(String[] ids, Callback> callback) throws G public void getAllPvPHeroID(Callback> callback) throws NullPointerException { gw2API.getAllPvPHeroIDs().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 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); + } + + /** + * 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); + } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 9b7fe89..168fd25 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -208,6 +208,13 @@ interface GuildWars2API { @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); + //skins @GET("/v2/skins") Call> getAllSkinIDs(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 4a25bb3..398dfee 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -369,7 +369,6 @@ public List getUnlockedPvpHeroes(String API) throws GuildWars2Exception /** * For more info on account raid API go here
* Get list of cleared raid linked to given API key - * TODO /v2/raids * * @param API API key * @return list of cleared raid @@ -1275,4 +1274,42 @@ public List getAllPvPHeroID() throws GuildWars2Exception { 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()); + } + } + + /** + * 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()); + } + } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java index 8c58661..5d441fc 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java @@ -1,6 +1,6 @@ package me.xhsun.guildwars2wrapper.model; -import java.util.Arrays; +import java.util.List; /** * For more info on Dungeons API go here
@@ -11,13 +11,13 @@ */ public class Dungeon { private String id; - private Path[] paths; + private List paths; public String getId() { return id; } - public Path[] getPaths() { + public List getPaths() { return paths; } @@ -40,7 +40,7 @@ public int hashCode() { public String toString() { return "Dungeon{" + "id='" + id + '\'' + - ", paths=" + Arrays.toString(paths) + + ", paths=" + paths + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java index c566fa9..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 @@ -42,9 +42,9 @@ public enum GameType {Activity, Dungeon, Pve, Pvp, PvpLobby, Wvw} private int level; private long vendor_value; private int default_skin; - private Flag[] flags; - private GameType[] game_types; - private Restriction[] restrictions; + private List flags; + private List game_types; + private List restrictions; private ItemDetail details; public int getId() { @@ -87,15 +87,15 @@ public int getDefaultSkin() { return default_skin; } - public Flag[] getFlags() { + public List getFlags() { return flags; } - public GameType[] getGameTypes() { + public List getGameTypes() { return game_types; } - public Restriction[] getRestrictions() { + public List getRestrictions() { return restrictions; } @@ -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/Mastery.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java index dff1dfd..0792472 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java @@ -2,7 +2,7 @@ import me.xhsun.guildwars2wrapper.model.util.comm.Region; -import java.util.Arrays; +import java.util.List; /** * For more info on masteries API go here
@@ -18,7 +18,7 @@ public class Mastery { private int order; private String background; private Region region; - private Detail[] levels; + private List levels; public int getId() { return id; @@ -44,7 +44,7 @@ public Region getRegion() { return region; } - public Detail[] getLevels() { + public List getLevels() { return levels; } @@ -72,7 +72,7 @@ public String toString() { ", order=" + order + ", background='" + background + '\'' + ", region=" + region + - ", levels=" + Arrays.toString(levels) + + ", levels=" + levels + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java index e473279..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 here
@@ -14,7 +14,7 @@ public class MaterialCategory { private int id; private String name; - private int[] items; + private List items; public int getId() { return id; @@ -24,7 +24,7 @@ public String getName() { return name; } - public int[] getItems() { + public List 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/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 here
+ * Model class for raid + * + * @author xhsun + * @since 2017-06-06 + */ +public class Raid { + public enum EventType {Checkpoint, Boss} + + private String id; + private List wings; + + public String getId() { + return id; + } + + public List 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 events; + + public String getId() { + return id; + } + + public List 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 9370376..904d356 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; /** @@ -24,7 +23,7 @@ public enum Flag {AutoLearned, LearnedFromItem} private int time_to_craft_ms; private List disciplines; private int min_rating; - private Flag[] flags; + private List flags; private List ingredients; private List guild_ingredients; private long output_upgrade_id; //TODO v2/guild/upgrades @@ -58,7 +57,7 @@ public int getMinRating() { return min_rating; } - public Flag[] getFlags() { + public List getFlags() { return flags; } @@ -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 + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java index 8d6df27..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 here
@@ -22,8 +22,8 @@ public enum Flag {ShowInWardrobe, NoCost, HideIfLocked, OverrideRarity} private int id; private String name; private Item.Type type; - private Flag[] flags; - private Item.Restriction[] restrictions; + private List flags; + private List restrictions; private String icon; private Item.Rarity rarity; private String description; @@ -41,11 +41,11 @@ public Item.Type getType() { return type; } - public Flag[] getFlags() { + public List getFlags() { return flags; } - public Item.Restriction[] getRestrictions() { + public List getRestrictions() { return restrictions; } @@ -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 + '\'' + 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 here
@@ -13,7 +13,7 @@ public class TokenInfo { private String id; private String name; - private String[] permissions; + private List permissions; public String getId() { return id; @@ -23,7 +23,7 @@ public String getName() { return name; } - public String[] getPermissions() { + public List 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/achievements/Achievement.java b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java index cad95f9..97f4c85 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java @@ -3,7 +3,7 @@ import com.google.gson.annotations.Expose; import me.xhsun.guildwars2wrapper.model.util.comm.Region; -import java.util.Arrays; +import java.util.List; /** * For more info on achievements API go here
@@ -31,11 +31,11 @@ private enum Flag { private String requirement; private String locked_text; private Type type; - private Flag[] flags; - private Tier[] tiers; - private int[] prerequisites;//achievement ids - private Reward[] rewards; - private Bits[] bits; + private List flags; + private List tiers; + private List prerequisites;//achievement ids + private List rewards; + private List bits; public int getId() { return id; @@ -65,23 +65,23 @@ public Type getType() { return type; } - public Flag[] getFlags() { + public List getFlags() { return flags; } - public Tier[] getTiers() { + public List getTiers() { return tiers; } - public int[] getPrerequisites() { + public List getPrerequisites() { return prerequisites; } - public Reward[] getRewards() { + public List getRewards() { return rewards; } - public Bits[] getBits() { + public List getBits() { return bits; } @@ -110,11 +110,11 @@ public String toString() { ", requirement='" + requirement + '\'' + ", locked_text='" + locked_text + '\'' + ", type=" + type + - ", flags=" + Arrays.toString(flags) + - ", tiers=" + Arrays.toString(tiers) + - ", prerequisites=" + Arrays.toString(prerequisites) + - ", rewards=" + Arrays.toString(rewards) + - ", bits=" + Arrays.toString(bits) + + ", flags=" + flags + + ", tiers=" + tiers + + ", prerequisites=" + prerequisites + + ", rewards=" + rewards + + ", bits=" + bits + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java index 330b236..50bcc38 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java @@ -3,6 +3,7 @@ import me.xhsun.guildwars2wrapper.model.Color; import java.util.Arrays; +import java.util.List; /** * For more info on gliders API go here
@@ -13,7 +14,7 @@ */ public class Glider extends Unlockable { private String description; - private int[] default_dyes;//color id + private List default_dyes;//color id //TODO method that give striped description, ie, no html public String getDescription() { @@ -23,7 +24,7 @@ public String getDescription() { /** * @return array of {@link Color} id(s) */ - public int[] getDefaultDyes() { + public List getDefaultDyes() { return default_dyes; } @@ -51,7 +52,7 @@ public String toString() { ", icon='" + getIcon() + '\'' + ", name='" + getName() + '\'' + ", description='" + description + '\'' + - ", default_dyes=" + Arrays.toString(default_dyes) + + ", 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 index dc6164b..e055be0 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model.unlockable; import java.util.Arrays; +import java.util.List; /** * For more info on mail carriers API go here
@@ -10,9 +11,9 @@ * @since 2017-06-06 */ public class MailCarrier extends Unlockable { - private String[] flags; + private List flags; - public String[] getFlags() { + public List getFlags() { return flags; } @@ -39,7 +40,7 @@ public String toString() { ", order=" + getOrder() + ", icon='" + getIcon() + '\'' + ", name='" + getName() + '\'' + - ", flags=" + Arrays.toString(flags) + + ", flags=" + flags + '}'; } } 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 1bc7f06..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,16 +14,16 @@ * @since 2017-02-07 */ public class Inventory extends Storage { - private int[] infusions; - private int[] upgrades; + private List infusions; + private List upgrades; private int skin; private ItemStats stats; - public int[] getInfusions() { + public List getInfusions() { return infusions; } - public int[] getUpgrades() { + public List getUpgrades() { return upgrades; } @@ -48,7 +48,8 @@ public boolean equals(Object o) { skin == inventory.skin && getBinding() == inventory.getBinding() && (getBoundTo() != null ? getBoundTo().equals(inventory.getBoundTo()) : inventory.getBoundTo() == null) && - Arrays.equals(infusions, inventory.infusions) && Arrays.equals(upgrades, inventory.upgrades) && + (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); } @@ -59,8 +60,8 @@ public int hashCode() { result = 31 * result + getCharges(); result = 31 * result + (getBinding() != null ? getBinding().hashCode() : 0); result = 31 * result + (getBoundTo() != null ? getBoundTo().hashCode() : 0); - result = 31 * result + Arrays.hashCode(infusions); - result = 31 * result + Arrays.hashCode(upgrades); + 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; @@ -74,8 +75,8 @@ public String toString() { ", charges=" + getCharges() + ", binding=" + getBinding() + ", bound_to='" + getBoundTo() + '\'' + - ", infusions=" + Arrays.toString(infusions) + - ", upgrades=" + Arrays.toString(upgrades) + + ", infusions=" + infusions + + ", upgrades=" + upgrades + ", skin=" + skin + ", stats=" + stats + '}'; 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 dd1b644..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 here
@@ -27,7 +27,7 @@ public int getDefense() { return defense; } - public InfusionSlot[] getInfusionSlots() { + public List getInfusionSlots() { return infusion_slots; } @@ -43,7 +43,7 @@ public String getSecSuffixID() { return secondary_suffix_item_id; } - public String[] getStatChoice() { + public List 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 + 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 84a2ea9..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 here
@@ -15,7 +15,7 @@ * @since 2017-02-10 */ public class Back extends ItemDetail { - public InfusionSlot[] getInfusionSlots() { + public List getInfusionSlots() { return infusion_slots; } @@ -31,7 +31,7 @@ public String getSecSuffixID() { return secondary_suffix_item_id; } - public String[] getStatChoice() { + public List 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 + 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/ItemDetail.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java index cccef0c..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 here
* template for all item detail @@ -41,11 +43,11 @@ public enum Flag { //Common Type type; int defense; - InfusionSlot[] infusion_slots; + List infusion_slots; InfixUpgrade infix_upgrade; int suffix_item_id; String secondary_suffix_item_id; - String[] stat_choices; + List stat_choices; //Armor Weight weight_class; //Bag @@ -64,10 +66,10 @@ public enum Flag { //Salvage kit int charges; //Upgrade component - Flag[] flags; - Infusion[] infusion_upgrade_flags; + List flags; + List infusion_upgrade_flags; String suffix; - String[] bonuses;//for runes only + List bonuses;//for runes only //Weapon Damage damage_type; int min_power; 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 9715f9d..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 here
@@ -18,11 +18,11 @@ public Type getType() { return type; } - public Flag[] getFlags() { + public List getFlags() { return flags; } - public Infusion[] getInfusionUpgradeFlag() { + public List getInfusionUpgradeFlag() { return infusion_upgrade_flags; } @@ -34,7 +34,7 @@ public InfixUpgrade getInfixUpgrade() { return infix_upgrade; } - public String[] getBonuses() { + public List 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 c7f5fa1..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 here
@@ -35,7 +35,7 @@ public int getDefense() { return defense; } - public InfusionSlot[] getInfusionSlots() { + public List getInfusionSlots() { return infusion_slots; } @@ -51,7 +51,7 @@ public String getSecSuffixID() { return secondary_suffix_item_id; } - public String[] getStatChoice() { + public List 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 + 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/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 here
@@ -13,10 +13,10 @@ */ public class InfixUpgrade { - private InfixAttribute[] attributes; + private List attributes; private Buff buff; - public InfixAttribute[] getAttributes() { + public List 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 0cf0815..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 here
@@ -13,10 +13,10 @@ */ public class InfusionSlot { - private ItemDetail.Flag[] flags; + private List flags; private int item_id; - public ItemDetail.Flag[] getFlags() { + public List getFlags() { return flags; } @@ -31,12 +31,13 @@ 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); + int result = flags != null ? flags.hashCode() : 0; result = 31 * result + item_id; return result; } @@ -44,7 +45,7 @@ public int hashCode() { @Override public String toString() { return "InfusionSlot{" + - "flags=" + Arrays.toString(flags) + + "flags=" + flags + ", item_id=" + item_id + '}'; } From 3a8808a2c49d1f239ff6050258db38110d395b59 Mon Sep 17 00:00:00 2001 From: xhsun Date: Tue, 6 Jun 2017 17:48:48 -0600 Subject: [PATCH 28/33] done titles API --- .../AsynchronousRequest.java | 31 ++++++++ .../guildwars2wrapper/GuildWars2API.java | 7 ++ .../guildwars2wrapper/SynchronousRequest.java | 42 +++++++++++ .../xhsun/guildwars2wrapper/model/Title.java | 72 +++++++++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/Title.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 694a412..158693a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -810,6 +810,7 @@ public void getAllColorID(Callback> callback) throws NullPointerEx gw2API.getAllColorIDs().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 @@ -837,6 +838,7 @@ public void getAllRecipeID(Callback> callback) throws NullPointerE gw2API.getAllRecipeIDs().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 @@ -850,6 +852,35 @@ public void searchRecipes(boolean isInput, int id, Callback> callb else gw2API.searchOutputRecipes(Integer.toString(id)).enqueue(callback); } + //Titles + + /** + * 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); + } + + /** + * 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 Title title info + */ + public void getAllTitleID(Callback> callback) throws NullPointerException { + gw2API.getAllTitleIDs().enqueue(callback); + } + //Minis /** * For more info on Mini API go here
diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 168fd25..3e1daba 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -236,6 +236,13 @@ interface GuildWars2API { @GET("/v2/recipes/search") Call> searchOutputRecipes(@Query("output") String id); + //Titles + @GET("/v2/titles") + Call> getAllTitleIDs(); + + @GET("/v2/titles") + Call> getTitleInfo(@Query("ids") String ids); + //token info @GET("/v2/tokeninfo") Call getAPIInfo(@Query("access_token") String token); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 398dfee..73d173c 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -1098,6 +1098,7 @@ public List getAllColorID() throws GuildWars2Exception { } } + //Recipes /** * For more info on Recipes API go here
* Get recipe info for the given recipe id(s) @@ -1136,6 +1137,7 @@ public List getAllRecipeID() throws GuildWars2Exception { } } + //Recipes Search /** * For more info on Recipes search API go here
* @@ -1156,6 +1158,46 @@ public List searchRecipes(boolean isInput, int id) throws GuildWars2Exc } } + //Titles + + /** + * 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()); + } + } + + /** + * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> + * Get all title id(s) + * + * @return list of title id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Title title info + */ + public List<Integer> getAllTitleID() throws GuildWars2Exception { + try { + Response<List<Integer>> 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()); + } + } + //Minis /** * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> 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 + + '}'; + } +} From 72ba6fb826dc8e01b04984e2c5ba2a60df4c345d Mon Sep 17 00:00:00 2001 From: xhsun <xhsun@ucalgary.ca> Date: Tue, 6 Jun 2017 18:10:09 -0600 Subject: [PATCH 29/33] done guild upgrades API --- .../AsynchronousRequest.java | 30 +++ .../guildwars2wrapper/GuildWars2API.java | 8 + .../guildwars2wrapper/SynchronousRequest.java | 42 ++++- .../xhsun/guildwars2wrapper/model/Recipe.java | 2 +- .../model/guild/Upgrade.java | 177 ++++++++++++++++++ 5 files changed, 257 insertions(+), 2 deletions(-) create mode 100644 src/main/java/me/xhsun/guildwars2wrapper/model/guild/Upgrade.java diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 158693a..feeb342 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -8,6 +8,7 @@ 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; @@ -586,6 +587,35 @@ public void getAllGliderID(Callback<List<Integer>> callback) throws NullPointerE gw2API.getAllGliderIDs().enqueue(callback); } + //Guild Upgrades + + /** + * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> + * 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<List<Upgrade>> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getGuildUpgradeInfo(processIds(ids)).enqueue(callback); + } + + /** + * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> + * 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 Upgrade guild upgrade info + */ + public void getGuildUpgradeID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getGuildUpgradeIDs().enqueue(callback); + } + //Worlds /** * For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/> diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 3e1daba..853c221 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -7,6 +7,7 @@ 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; @@ -152,6 +153,13 @@ interface GuildWars2API { @GET("/v2/gliders") Call<List<Glider>> getGliderInfo(@Query("ids") String ids); + //Guild Upgrades + @GET("/v2/guild/upgrades") + Call<List<Integer>> getGuildUpgradeIDs(); + + @GET("/v2/guild/upgrades") + Call<List<Upgrade>> getGuildUpgradeInfo(@Query("ids") String ids); + //items @GET("/v2/items") Call<List<Integer>> getAllItemIDs(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 73d173c..6e3b3de 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -9,6 +9,7 @@ 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; @@ -428,7 +429,6 @@ public List<Integer> getUnlockedSkins(String API) throws GuildWars2Exception { /** * For more info on Account titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/account/titles">here</a><br/> * Get list of unlocked title id(s) linked to given API key - * TODO /v2/titles * * @param API API key * @return list of unlocked title id(s) @@ -786,6 +786,46 @@ public List<Integer> getAllGliderID() throws GuildWars2Exception { } } + //Guild Upgrades + + /** + * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> + * 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<Upgrade> getGuildUpgradeInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response<List<Upgrade>> 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()); + } + } + + /** + * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> + * 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<Integer> getGuildUpgradeID() throws GuildWars2Exception { + try { + Response<List<Integer>> response = gw2API.getGuildUpgradeIDs().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/> diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java index 904d356..8741727 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java @@ -26,7 +26,7 @@ public enum Flag {AutoLearned, LearnedFromItem} 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 int getId() { 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 + + '}'; + } + } +} From 0cc75bdd5d489fa0c02750e879b229dd2b00979a Mon Sep 17 00:00:00 2001 From: xhsun <xhsun@ucalgary.ca> Date: Tue, 6 Jun 2017 18:10:40 -0600 Subject: [PATCH 30/33] bump version to 0.4.0 --- comm.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comm.properties b/comm.properties index e74e3b6..2543d18 100644 --- a/comm.properties +++ b/comm.properties @@ -1,4 +1,4 @@ -currentVer=0.2.1 +currentVer=0.4.0 groupID='me.xhsun.gw2wrapper' siteUrl='https://github.com/xhsun/gw2wrapper' gitUrl='https://github.com/xhsun/gw2wrapper.git' \ No newline at end of file From 889231290a2bfccb271bfab05eb60a6d5acbb324 Mon Sep 17 00:00:00 2001 From: xhsun <xhsun@ucalgary.ca> Date: Tue, 6 Jun 2017 18:16:22 -0600 Subject: [PATCH 31/33] update readme to reflect new additions --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 34f09ea..530ec30 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,8 @@ So if you see anything I missed, please don't hesitate to create an issue to let + /v2/account/* ++ /v2/achievements + + /v2/characters/<name>/core + /v2/characters/<name>/inventory @@ -107,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 From 575ac880eb99b720ebecf42a03f35daf22e9d253 Mon Sep 17 00:00:00 2001 From: xhsun <xhsun@ucalgary.ca> Date: Tue, 6 Jun 2017 18:49:16 -0600 Subject: [PATCH 32/33] organized code in request --- .../AsynchronousRequest.java | 429 +++++++------ .../guildwars2wrapper/GuildWars2API.java | 24 +- .../guildwars2wrapper/SynchronousRequest.java | 589 +++++++++--------- .../model/account/AchievementProgression.java | 2 +- .../model/util/comm/Region.java | 6 +- 5 files changed, 542 insertions(+), 508 deletions(-) diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index feeb342..3bca50b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -32,7 +32,8 @@ public class AsynchronousRequest extends Request { super(gw2API); } - //Accounts + //Token info + /** * For more info on TokenInfo API go <a href="https://wiki.guildwars2.com/wiki/API:2/tokeninfo">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -48,6 +49,7 @@ public void getAPIInfo(String API, Callback<TokenInfo> callback) throws GuildWar gw2API.getAPIInfo(API).enqueue(callback); } + //Accounts /** * For more info on Account API go <a href="https://wiki.guildwars2.com/wiki/API:2/account">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -361,27 +363,27 @@ public void getWallet(String API, Callback<List<Wallet>> callback) throws GuildW * For more info on achievement API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements">here</a><br/> * 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<List<Achievement>> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ids)); - gw2API.getAchievementInfo(processIds(ids)).enqueue(callback); + public void getAllAchievementID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllAchievementIDs().enqueue(callback); } /** * For more info on achievement API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements">here</a><br/> * 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 getAllAchievementID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllAchievementIDs().enqueue(callback); + public void getAchievementInfo(int[] ids, Callback<List<Achievement>> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getAchievementInfo(processIds(ids)).enqueue(callback); } //Characters @@ -431,6 +433,36 @@ public void getCharacterInventory(String API, String name, Callback<CharacterInv gw2API.getCharacterInventory(name, API).enqueue(callback); } + //Colors + + /** + * For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/> + * 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<List<Integer>> callback) throws NullPointerException { + gw2API.getAllColorIDs().enqueue(callback); + } + + /** + * For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/> + * 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<List<Color>> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getColorInfo(processIds(ids)).enqueue(callback); + } + + //TP /** * For more info on Listing Price API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/prices">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -474,6 +506,20 @@ public void getPrices(int[] ids, Callback<List<Prices>> callback) throws GuildWa gw2API.getPrices(processIds(ids)).enqueue(callback); } + //Currencies + + /** + * For more info on Currency API go <a href="https://wiki.guildwars2.com/wiki/API:2/currencies">here</a><br/> + * 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<List<Integer>> callback) throws NullPointerException { + gw2API.getAllCurrencies().enqueue(callback); + } + /** * For more info on Currency API go <a href="https://wiki.guildwars2.com/wiki/API:2/currencies">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -489,19 +535,20 @@ public void getCurrencyInfo(int[] ids, Callback<List<Currency>> callback) throws gw2API.getCurrencyInfo(processIds(ids)).enqueue(callback); } + //Dungeons + /** - * For more info on Currency API go <a href="https://wiki.guildwars2.com/wiki/API:2/currencies">here</a><br/> + * For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/> * 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<List<Integer>> callback) throws NullPointerException { - gw2API.getAllCurrencies().enqueue(callback); + public void getAllDungeonName(Callback<List<String>> callback) throws NullPointerException { + gw2API.getAllDungeonName().enqueue(callback); } - //Dungeons /** * For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -517,20 +564,20 @@ public void getDungeonInfo(String[] ids, Callback<List<Dungeon>> callback) throw gw2API.getDungeonInfo(processIds(ids)).enqueue(callback); } + //Finishers + /** - * For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/> + * For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> * 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 Dungeon dungeon info + * @see Finisher finisher info */ - public void getAllDungeonName(Callback<List<String>> callback) throws NullPointerException { - gw2API.getAllDungeonName().enqueue(callback); + public void getAllFinisherID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllFinisherIDs().enqueue(callback); } - //Finishers - /** * For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -546,20 +593,20 @@ public void getFinisherInfo(int[] ids, Callback<List<Finisher>> callback) throws gw2API.getFinisherInfo(processIds(ids)).enqueue(callback); } + //Gliders + /** - * For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> + * For more info on gliders API go <a href="https://wiki.guildwars2.com/wiki/API:2/gliders">here</a><br/> * 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 Finisher finisher info + * @see Glider glider info */ - public void getAllFinisherID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllFinisherIDs().enqueue(callback); + public void getAllGliderID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllGliderIDs().enqueue(callback); } - //Gliders - /** * For more info on gliders API go <a href="https://wiki.guildwars2.com/wiki/API:2/gliders">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -575,20 +622,20 @@ public void getGliderInfo(int[] ids, Callback<List<Glider>> callback) throws Gui gw2API.getGliderInfo(processIds(ids)).enqueue(callback); } + //Guild Upgrades + /** - * For more info on gliders API go <a href="https://wiki.guildwars2.com/wiki/API:2/gliders">here</a><br/> + * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> * 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 Glider glider info + * @see Upgrade guild upgrade info */ - public void getAllGliderID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllGliderIDs().enqueue(callback); + public void getGuildUpgradeID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllGuildUpgradeIDs().enqueue(callback); } - //Guild Upgrades - /** * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -604,258 +651,269 @@ public void getGuildUpgradeInfo(int[] ids, Callback<List<Upgrade>> callback) thr gw2API.getGuildUpgradeInfo(processIds(ids)).enqueue(callback); } + //Items + /** - * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> + * For more info on Item API go <a href="https://wiki.guildwars2.com/wiki/API:2/items">here</a><br/> * 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 Upgrade guild upgrade info + * @see Item item info */ - public void getGuildUpgradeID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getGuildUpgradeIDs().enqueue(callback); + public void getAllItemID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllItemIDs().enqueue(callback); } - //Worlds /** - * For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/> + * For more info on Item API go <a href="https://wiki.guildwars2.com/wiki/API:2/items">here</a><br/> * 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 item 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 Item item info */ - public void getWorldInfo(int[] ids, Callback<List<World>> callback) throws GuildWars2Exception, NullPointerException { + public void getItemInfo(int[] ids, Callback<List<Item>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getWorldsInfo(processIds(ids)).enqueue(callback); + gw2API.getItemInfo(processIds(ids)).enqueue(callback); } + //Item Stats + /** - * For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/> + * For more info on Itemstat API go <a href="https://wiki.guildwars2.com/wiki/API:2/itemstats">here</a><br/> * 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 ItemStats itemstat info */ - public void getAllWorldID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllWorldsIDs().enqueue(callback); + public void getAllItemStatID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllItemStatIDs().enqueue(callback); } /** - * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> + * For more info on Itemstat API go <a href="https://wiki.guildwars2.com/wiki/API:2/itemstats">here</a><br/> * 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 itemstat 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 ItemStats itemstat info */ - public void getMaterialCategoryInfo(int[] ids, Callback<List<MaterialCategory>> callback) throws GuildWars2Exception, NullPointerException { + public void getItemStatInfo(int[] ids, Callback<List<ItemStats>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getMaterialBankInfo(processIds(ids)).enqueue(callback); + gw2API.getItemStatInfo(processIds(ids)).enqueue(callback); } + //Mail Carriers + /** - * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> + * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> * 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 MailCarrier mail carrier info */ - public void getAllMaterialCategoryID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllMaterialBankIDs().enqueue(callback); + public void getAllMailCarrierID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllMailCarrierIDs().enqueue(callback); } /** - * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> + * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> * 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 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 Skin skin info + * @see MailCarrier mail carrier info */ - public void getSkinInfo(int[] ids, Callback<List<Skin>> callback) throws GuildWars2Exception, NullPointerException { + public void getMailCarrierInfo(int[] ids, Callback<List<MailCarrier>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getSkinInfo(processIds(ids)).enqueue(callback); + gw2API.getMailCarrierInfo(processIds(ids)).enqueue(callback); } + //Masteries + /** - * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> + * or more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> * 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 Mastery mastery info */ - public void getAllSkinID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllSkinIDs().enqueue(callback); + public void getAllMasteryID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllMasteryIDs().enqueue(callback); } - //Items /** - * For more info on Item API go <a href="https://wiki.guildwars2.com/wiki/API:2/items">here</a><br/> + * or more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of item 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 Item item info + * @see Mastery mastery info */ - public void getItemInfo(int[] ids, Callback<List<Item>> callback) throws GuildWars2Exception, NullPointerException { + public void getMasteryInfo(int[] ids, Callback<List<Mastery>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getItemInfo(processIds(ids)).enqueue(callback); + gw2API.getMasteryInfo(processIds(ids)).enqueue(callback); } + //Material Categories + /** - * For more info on Item API go <a href="https://wiki.guildwars2.com/wiki/API:2/items">here</a><br/> + * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> * 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 MaterialCategory material category info */ - public void getAllItemID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllItemIDs().enqueue(callback); + public void getAllMaterialCategoryID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllMaterialBankIDs().enqueue(callback); } - //Item Stats /** - * For more info on Itemstat API go <a href="https://wiki.guildwars2.com/wiki/API:2/itemstats">here</a><br/> + * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of itemstat id + * @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 ItemStats itemstat info + * @see MaterialCategory material category info */ - public void getItemStatInfo(int[] ids, Callback<List<ItemStats>> callback) throws GuildWars2Exception, NullPointerException { + public void getMaterialCategoryInfo(int[] ids, Callback<List<MaterialCategory>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getItemStatInfo(processIds(ids)).enqueue(callback); + gw2API.getMaterialBankInfo(processIds(ids)).enqueue(callback); } + //Minis + /** - * For more info on Itemstat API go <a href="https://wiki.guildwars2.com/wiki/API:2/itemstats">here</a><br/> + * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> * 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 Mini mini info */ - public void getAllItemStatID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllItemStatIDs().enqueue(callback); + public void getAllMiniID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllMiniIDs().enqueue(callback); } - //Mail Carriers - /** - * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> + * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of mail carrier id + * @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 MailCarrier mail carrier info + * @see Mini mini info */ - public void getMailCarrierInfo(int[] ids, Callback<List<MailCarrier>> callback) throws GuildWars2Exception, NullPointerException { + public void getMiniInfo(int[] ids, Callback<List<Mini>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getMailCarrierInfo(processIds(ids)).enqueue(callback); + gw2API.getMiniInfo(processIds(ids)).enqueue(callback); } + //Outfits + /** - * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> + * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> * 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 MailCarrier mail carrier info + * @see Outfit outfit info */ - public void getAllMailCarrierID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllMailCarrierIDs().enqueue(callback); + public void getAllOutfitID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllOutfitIDs().enqueue(callback); } - //Masteries - /** - * or more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> + * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * - * @param ids list of mastery id + * @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 Mastery mastery info + * @see Outfit outfit info */ - public void getMasteryInfo(int[] ids, Callback<List<Mastery>> callback) throws GuildWars2Exception, NullPointerException { + public void getOutfitInfo(int[] ids, Callback<List<Outfit>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getMasteryInfo(processIds(ids)).enqueue(callback); + gw2API.getOutfitInfo(processIds(ids)).enqueue(callback); } + //PvP Heroes + /** - * or more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> + * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> * 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 Mastery mastery info + * @see Hero pvp hero info */ - public void getAllMasteryID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllMasteryIDs().enqueue(callback); + public void getAllPvPHeroID(Callback<List<String>> callback) throws NullPointerException { + gw2API.getAllPvPHeroIDs().enqueue(callback); } - //Colors /** - * For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/> + * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> * 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 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 Color color info + * @see Hero pvp hero info */ - public void getColorInfo(int[] ids, Callback<List<Color>> callback) throws GuildWars2Exception, NullPointerException { + public void getPvPHeroInfo(String[] ids, Callback<List<Hero>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getColorInfo(processIds(ids)).enqueue(callback); + gw2API.getPvPHeroInfo(processIds(ids)).enqueue(callback); } + //Raids + /** - * For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/> + * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> * 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 Raid raid info */ - public void getAllColorID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllColorIDs().enqueue(callback); + public void getAllRaidID(Callback<List<String>> callback) throws NullPointerException { + gw2API.getAllRaidIDs().enqueue(callback); } - //Recipes /** - * For more info on Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes">here</a><br/> + * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> * 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 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 Recipe recipe info + * @see Raid raid info */ - public void getRecipeInfo(int[] ids, Callback<List<Recipe>> callback) throws GuildWars2Exception, NullPointerException { + public void getRaidInfo(String[] ids, Callback<List<Raid>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getRecipeInfo(processIds(ids)).enqueue(callback); + gw2API.getRaidInfo(processIds(ids)).enqueue(callback); } + //Recipes + /** * For more info on Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes">here</a><br/> * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -868,161 +926,120 @@ public void getAllRecipeID(Callback<List<Integer>> callback) throws NullPointerE gw2API.getAllRecipeIDs().enqueue(callback); } - //Recipes Search - /** - * For more info on Recipes search API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes/search">here</a><br/> - * 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 Recipe recipe info - */ - public void searchRecipes(boolean isInput, int id, Callback<List<Integer>> callback) throws NullPointerException { - if (isInput) gw2API.searchInputRecipes(Integer.toString(id)).enqueue(callback); - else gw2API.searchOutputRecipes(Integer.toString(id)).enqueue(callback); - } - - //Titles - /** - * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> + * For more info on Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes">here</a><br/> * 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 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 Title title info + * @see Recipe recipe info */ - public void getTitleInfo(int[] ids, Callback<List<Title>> callback) throws GuildWars2Exception, NullPointerException { + public void getRecipeInfo(int[] ids, Callback<List<Recipe>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getTitleInfo(processIds(ids)).enqueue(callback); + gw2API.getRecipeInfo(processIds(ids)).enqueue(callback); } - /** - * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> - * 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 Title title info - */ - public void getAllTitleID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllTitleIDs().enqueue(callback); - } + //Recipes Search - //Minis /** - * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> + * For more info on Recipes search API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes/search">here</a><br/> * 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 + * @see Recipe recipe info */ - public void getMiniInfo(int[] ids, Callback<List<Mini>> callback) throws GuildWars2Exception, NullPointerException { - isParamValid(new ParamChecker(ids)); - gw2API.getMiniInfo(processIds(ids)).enqueue(callback); + public void searchRecipes(boolean isInput, int id, Callback<List<Integer>> 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 <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> + * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> * 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 Skin skin info */ - public void getAllMiniID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllMiniIDs().enqueue(callback); + public void getAllSkinID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllSkinIDs().enqueue(callback); } - //Outfits - /** - * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> + * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> * 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 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 Outfit outfit info + * @see Skin skin info */ - public void getOutfitInfo(int[] ids, Callback<List<Outfit>> callback) throws GuildWars2Exception, NullPointerException { + public void getSkinInfo(int[] ids, Callback<List<Skin>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getOutfitInfo(processIds(ids)).enqueue(callback); + gw2API.getSkinInfo(processIds(ids)).enqueue(callback); } + //Titles + /** - * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> + * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> * 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 + * @see Title title info */ - public void getAllOutfitID(Callback<List<Integer>> callback) throws NullPointerException { - gw2API.getAllOutfitIDs().enqueue(callback); + public void getAllTitleID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllTitleIDs().enqueue(callback); } - //PvP Heroes - /** - * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> + * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> * 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 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 Hero pvp hero info + * @see Title title info */ - public void getPvPHeroInfo(String[] ids, Callback<List<Hero>> callback) throws GuildWars2Exception, NullPointerException { + public void getTitleInfo(int[] ids, Callback<List<Title>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getPvPHeroInfo(processIds(ids)).enqueue(callback); + gw2API.getTitleInfo(processIds(ids)).enqueue(callback); } + //Worlds + /** - * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> + * For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/> * 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 + * @see World world info */ - public void getAllPvPHeroID(Callback<List<String>> callback) throws NullPointerException { - gw2API.getAllPvPHeroIDs().enqueue(callback); + public void getAllWorldID(Callback<List<Integer>> callback) throws NullPointerException { + gw2API.getAllWorldsIDs().enqueue(callback); } - //Raids - /** - * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> + * For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/> * 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 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 Raid raid info + * @see World world info */ - public void getRaidInfo(String[] ids, Callback<List<Raid>> callback) throws GuildWars2Exception, NullPointerException { + public void getWorldInfo(int[] ids, Callback<List<World>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); - gw2API.getRaidInfo(processIds(ids)).enqueue(callback); - } - - /** - * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> - * 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<List<String>> callback) throws NullPointerException { - gw2API.getAllRaidIDs().enqueue(callback); + gw2API.getWorldsInfo(processIds(ids)).enqueue(callback); } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 853c221..767ab7f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -27,6 +27,10 @@ * @since 2017-02-07 */ interface GuildWars2API { + //token info + @GET("/v2/tokeninfo") + Call<TokenInfo> getAPIInfo(@Query("access_token") String token); + //accounts @GET("/v2/account") Call<Account> getAccount(@Query("access_token") String token); @@ -155,7 +159,7 @@ interface GuildWars2API { //Guild Upgrades @GET("/v2/guild/upgrades") - Call<List<Integer>> getGuildUpgradeIDs(); + Call<List<Integer>> getAllGuildUpgradeIDs(); @GET("/v2/guild/upgrades") Call<List<Upgrade>> getGuildUpgradeInfo(@Query("ids") String ids); @@ -223,13 +227,6 @@ interface GuildWars2API { @GET("/v2/raids") Call<List<Raid>> getRaidInfo(@Query("ids") String ids); - //skins - @GET("/v2/skins") - Call<List<Integer>> getAllSkinIDs(); - - @GET("/v2/skins") - Call<List<Skin>> getSkinInfo(@Query("ids") String ids); - //recipes @GET("/v2/recipes") Call<List<Integer>> getAllRecipeIDs(); @@ -244,6 +241,13 @@ interface GuildWars2API { @GET("/v2/recipes/search") Call<List<Integer>> searchOutputRecipes(@Query("output") String id); + //skins + @GET("/v2/skins") + Call<List<Integer>> getAllSkinIDs(); + + @GET("/v2/skins") + Call<List<Skin>> getSkinInfo(@Query("ids") String ids); + //Titles @GET("/v2/titles") Call<List<Integer>> getAllTitleIDs(); @@ -251,10 +255,6 @@ interface GuildWars2API { @GET("/v2/titles") Call<List<Title>> getTitleInfo(@Query("ids") String ids); - //token info - @GET("/v2/tokeninfo") - Call<TokenInfo> getAPIInfo(@Query("access_token") String token); - //worlds @GET("/v2/worlds") Call<List<Integer>> getAllWorldsIDs(); diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index 6e3b3de..b5a3179 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -22,18 +22,17 @@ /** * This class contains all the method for accessing data synchronously - * TODO reorder methods + * * @author xhsun * @since 2017-06-04 */ public class SynchronousRequest extends Request { - SynchronousRequest(GuildWars2API gw2API) { super(gw2API); } - //Accounts + //Token info /** * For more info on TokenInfo API go <a href="https://wiki.guildwars2.com/wiki/API:2/tokeninfo">here</a><br/> * Get detailed info related to this API key from server @@ -54,6 +53,7 @@ public TokenInfo getAPIInfo(String API) throws GuildWars2Exception { } } + //Accounts /** * For more info on Account API go <a href="https://wiki.guildwars2.com/wiki/API:2/account">here</a><br/> * Get detailed info for account link to given API key @@ -469,17 +469,15 @@ public List<Wallet> getWallet(String API) throws GuildWars2Exception { //Achievements /** * For more info on achievement API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements">here</a><br/> - * Get list of achievement info corresponding to the given id(s) + * Get list of all available achievement id(s) * - * @param ids list of achievement id(s) - * @return list of achievement info + * @return list of achievement id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Achievement achievement info */ - public List<Achievement> getAchievementInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ids)); + public List<Integer> getAllAchievementID() throws GuildWars2Exception { try { - Response<List<Achievement>> response = gw2API.getAchievementInfo(processIds(ids)).execute(); + Response<List<Integer>> response = gw2API.getAllAchievementIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -489,15 +487,17 @@ public List<Achievement> getAchievementInfo(int[] ids) throws GuildWars2Exceptio /** * For more info on achievement API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements">here</a><br/> - * Get list of all available achievement id(s) + * Get list of achievement info corresponding to the given id(s) * - * @return list of achievement id(s) + * @param ids list of achievement id(s) + * @return list of achievement info * @throws GuildWars2Exception see {@link ErrorCode} for detail * @see Achievement achievement info */ - public List<Integer> getAllAchievementID() throws GuildWars2Exception { + public List<Achievement> getAchievementInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); try { - Response<List<Integer>> response = gw2API.getAllAchievementIDs().execute(); + Response<List<Achievement>> response = gw2API.getAchievementInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -568,6 +568,46 @@ public CharacterInventory getCharacterInventory(String API, String name) throws } } + //Colors + + /** + * For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/> + * Get list of all available color id(s) + * + * @return list of color id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Color color info + */ + public List<Integer> getAllColorID() throws GuildWars2Exception { + try { + Response<List<Integer>> response = gw2API.getAllColorIDs().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 <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/> + * Get color info for the given color id(s) + * + * @param ids array of color id + * @return list of color info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Color color info + */ + public List<Color> getColorInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response<List<Color>> response = gw2API.getColorInfo(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()); + } + } + //TP /** * For more info on Transaction API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/transactions">here</a><br/> @@ -629,6 +669,25 @@ public List<Prices> getPrices(int[] ids) throws GuildWars2Exception { } //Currencies + + /** + * For more info on Currency API go <a href="https://wiki.guildwars2.com/wiki/API:2/currencies">here</a><br/> + * Get all currency ids + * + * @return list of currency ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Currency currency info + */ + public List<Integer> getAllCurrencyID() throws GuildWars2Exception { + try { + Response<List<Integer>> 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 <a href="https://wiki.guildwars2.com/wiki/API:2/currencies">here</a><br/> * Get currency info for the given currency id(s) @@ -649,17 +708,19 @@ public List<Currency> getCurrencyInfo(int[] ids) throws GuildWars2Exception { } } + //Dungeons + /** - * For more info on Currency API go <a href="https://wiki.guildwars2.com/wiki/API:2/currencies">here</a><br/> - * Get all currency ids + * For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/> + * Get all dungeon name(s) * - * @return list of currency ids + * @return list of dungeon name(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Currency currency info + * @see Dungeon dungeon info */ - public List<Integer> getAllCurrencyID() throws GuildWars2Exception { + public List<String> getAllDungeonName() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllCurrencies().execute(); + Response<List<String>> response = gw2API.getAllDungeonName().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -667,7 +728,6 @@ public List<Integer> getAllCurrencyID() throws GuildWars2Exception { } } - //Dungeons /** * For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/> * Get dungeon info for the given dungeon id(s) @@ -688,17 +748,19 @@ public List<Dungeon> getDungeonInfo(String[] ids) throws GuildWars2Exception { } } + //Finishers + /** - * For more info on Dungeons API go <a href="https://wiki.guildwars2.com/wiki/API:2/dungeons">here</a><br/> - * Get all dungeon name(s) + * For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> + * Get all finisher id(s) * - * @return list of dungeon name(s) + * @return list of finisher id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Dungeon dungeon info + * @see Finisher finisher info */ - public List<String> getAllDungeonName() throws GuildWars2Exception { + public List<Integer> getAllFinisherID() throws GuildWars2Exception { try { - Response<List<String>> response = gw2API.getAllDungeonName().execute(); + Response<List<Integer>> response = gw2API.getAllFinisherIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -706,8 +768,6 @@ public List<String> getAllDungeonName() throws GuildWars2Exception { } } - //Finishers - /** * For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> * Get finisher info for the given finisher id(s) @@ -728,17 +788,19 @@ public List<Finisher> getFinisherInfo(int[] ids) throws GuildWars2Exception { } } + //Glider + /** - * For more info on Finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/finishers">here</a><br/> - * Get all finisher id(s) + * For more info on gliders API go <a href="https://wiki.guildwars2.com/wiki/API:2/gliders">here</a><br/> + * Get all glider id(s) * - * @return list of finisher id(s) + * @return list of glider id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Finisher finisher info + * @see Glider glider info */ - public List<Integer> getAllFinisherID() throws GuildWars2Exception { + public List<Integer> getAllGliderID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllFinisherIDs().execute(); + Response<List<Integer>> response = gw2API.getAllGliderIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -746,8 +808,6 @@ public List<Integer> getAllFinisherID() throws GuildWars2Exception { } } - //Glider - /** * For more info on gliders API go <a href="https://wiki.guildwars2.com/wiki/API:2/gliders">here</a><br/> * Get glider info for the given glider id(s) @@ -768,17 +828,19 @@ public List<Glider> getGliderInfo(int[] ids) throws GuildWars2Exception { } } + //Guild Upgrades + /** - * For more info on gliders API go <a href="https://wiki.guildwars2.com/wiki/API:2/gliders">here</a><br/> - * Get all glider id(s) + * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> + * Get all guild upgrade id(s) * - * @return list of glider id(s) + * @return list of guild upgrade id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Glider glider info + * @see Upgrade guild upgrade info */ - public List<Integer> getAllGliderID() throws GuildWars2Exception { + public List<Integer> getAllGuildUpgradeID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllGliderIDs().execute(); + Response<List<Integer>> response = gw2API.getAllGuildUpgradeIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -786,8 +848,6 @@ public List<Integer> getAllGliderID() throws GuildWars2Exception { } } - //Guild Upgrades - /** * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> * Get guild upgrade info for the given guild upgrade id(s) @@ -808,17 +868,19 @@ public List<Upgrade> getGuildUpgradeInfo(int[] ids) throws GuildWars2Exception { } } + //Items + /** - * For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> - * Get all guild upgrade id(s) + * For more info on Item API go <a href="https://wiki.guildwars2.com/wiki/API:2/items">here</a><br/> + * Get all available item ids * - * @return list of guild upgrade id(s) + * @return list of item ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Upgrade guild upgrade info + * @see Item item info */ - public List<Integer> getGuildUpgradeID() throws GuildWars2Exception { + public List<Integer> getAllItemID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getGuildUpgradeIDs().execute(); + Response<List<Integer>> response = gw2API.getAllItemIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -826,20 +888,19 @@ public List<Integer> getGuildUpgradeID() throws GuildWars2Exception { } } - //Worlds /** - * 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) + * For more info on Item API go <a href="https://wiki.guildwars2.com/wiki/API:2/items">here</a><br/> + * Get item info for the given item id(s) * - * @param ids list of world id - * @return list of world info + * @param ids list of item id + * @return list of item info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see World world info + * @see Item item info */ - public List<World> getWorldInfo(int[] ids) throws GuildWars2Exception { + public List<Item> getItemInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<World>> response = gw2API.getWorldsInfo(processIds(ids)).execute(); + Response<List<Item>> response = gw2API.getItemInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -847,17 +908,19 @@ public List<World> getWorldInfo(int[] ids) throws GuildWars2Exception { } } + //Item Stats + /** - * 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) + * For more info on Itemstat API go <a href="https://wiki.guildwars2.com/wiki/API:2/itemstats">here</a><br/> + * Get all available itemstat ids * - * @return list of world id + * @return list of itemstat ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see World world info + * @see ItemStats itemstat info */ - public List<Integer> getAllWorldID() throws GuildWars2Exception { + public List<Integer> getAllItemStatID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllWorldsIDs().execute(); + Response<List<Integer>> response = gw2API.getAllItemStatIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -866,18 +929,18 @@ public List<Integer> getAllWorldID() throws GuildWars2Exception { } /** - * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> - * Get material category info for the given category id(s) + * For more info on Itemstat API go <a href="https://wiki.guildwars2.com/wiki/API:2/itemstats">here</a><br/> + * Get itemstat info for the given itemstat id(s) * - * @param ids list of category id - * @return list of material category info + * @param ids list of itemstat id + * @return list of itemstat info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see MaterialCategory material category info + * @see ItemStats itemstat info */ - public List<MaterialCategory> getMaterialCategoryInfo(int[] ids) throws GuildWars2Exception { + public List<ItemStats> getItemStatInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<MaterialCategory>> response = gw2API.getMaterialBankInfo(processIds(ids)).execute(); + Response<List<ItemStats>> response = gw2API.getItemStatInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -885,17 +948,19 @@ public List<MaterialCategory> getMaterialCategoryInfo(int[] ids) throws GuildWar } } + //Mail Carriers + /** - * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> - * Get list of all available material category ids + * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> + * Get all mail carrier id(s) * - * @return list of material category id + * @return list of mail carrier info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see MaterialCategory material category info + * @see MailCarrier mail carrier info */ - public List<Integer> getAllMaterialCategoryID() throws GuildWars2Exception { + public List<Integer> getAllMailCarrierID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllMaterialBankIDs().execute(); + Response<List<Integer>> response = gw2API.getAllMailCarrierIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -904,18 +969,18 @@ public List<Integer> getAllMaterialCategoryID() throws GuildWars2Exception { } /** - * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> - * Get skin info for the given skin id(s) + * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> + * Get mail carrier info for the given mail carrier id(s) * - * @param ids list of skin id - * @return list of skin info + * @param ids list of mail carrier id + * @return list of mail carrier info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Skin skin info + * @see MailCarrier mail carrier info */ - public List<Skin> getSkinInfo(int[] ids) throws GuildWars2Exception { + public List<MailCarrier> getMailCarrierInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<Skin>> response = gw2API.getSkinInfo(processIds(ids)).execute(); + Response<List<MailCarrier>> response = gw2API.getMailCarrierInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -923,17 +988,19 @@ public List<Skin> getSkinInfo(int[] ids) throws GuildWars2Exception { } } + //Masteries + /** - * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> - * Get list of all available skin ids + * For more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> + * Get all mastery id(s) * - * @return list of skin ids + * @return list of mastery id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Skin skin info + * @see Mastery mastery info */ - public List<Integer> getAllSkinID() throws GuildWars2Exception { + public List<Integer> getAllMasteryID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllSkinIDs().execute(); + Response<List<Integer>> response = gw2API.getAllMasteryIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -941,20 +1008,19 @@ public List<Integer> getAllSkinID() throws GuildWars2Exception { } } - //Items /** - * For more info on Item API go <a href="https://wiki.guildwars2.com/wiki/API:2/items">here</a><br/> - * Get item info for the given item id(s) + * For more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> + * Get mastery info for the given mastery id(s) * - * @param ids list of item id - * @return list of item info + * @param ids list of mastery id + * @return list of mastery info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Item item info + * @see Mastery mastery info */ - public List<Item> getItemInfo(int[] ids) throws GuildWars2Exception { + public List<Mastery> getMasteryInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<Item>> response = gw2API.getItemInfo(processIds(ids)).execute(); + Response<List<Mastery>> response = gw2API.getMasteryInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -962,17 +1028,19 @@ public List<Item> getItemInfo(int[] ids) throws GuildWars2Exception { } } + //Material Categories + /** - * For more info on Item API go <a href="https://wiki.guildwars2.com/wiki/API:2/items">here</a><br/> - * Get all available item ids + * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> + * Get list of all available material category ids * - * @return list of item ids + * @return list of material category id * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Item item info + * @see MaterialCategory material category info */ - public List<Integer> getAllItemID() throws GuildWars2Exception { + public List<Integer> getAllMaterialCategoryID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllItemIDs().execute(); + Response<List<Integer>> response = gw2API.getAllMaterialBankIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -980,20 +1048,19 @@ public List<Integer> getAllItemID() throws GuildWars2Exception { } } - //Item Stats /** - * For more info on Itemstat API go <a href="https://wiki.guildwars2.com/wiki/API:2/itemstats">here</a><br/> - * Get itemstat info for the given itemstat id(s) + * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> + * Get material category info for the given category id(s) * - * @param ids list of itemstat id - * @return list of itemstat info + * @param ids list of category id + * @return list of material category info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see ItemStats itemstat info + * @see MaterialCategory material category info */ - public List<ItemStats> getItemStatInfo(int[] ids) throws GuildWars2Exception { + public List<MaterialCategory> getMaterialCategoryInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<ItemStats>> response = gw2API.getItemStatInfo(processIds(ids)).execute(); + Response<List<MaterialCategory>> response = gw2API.getMaterialBankInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1001,17 +1068,19 @@ public List<ItemStats> getItemStatInfo(int[] ids) throws GuildWars2Exception { } } + //Minis + /** - * For more info on Itemstat API go <a href="https://wiki.guildwars2.com/wiki/API:2/itemstats">here</a><br/> - * Get all available itemstat ids + * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> + * Get list of all available mini id(s) * - * @return list of itemstat ids + * @return list of mini id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see ItemStats itemstat info + * @see Mini mini info */ - public List<Integer> getAllItemStatID() throws GuildWars2Exception { + public List<Integer> getAllMiniID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllItemStatIDs().execute(); + Response<List<Integer>> response = gw2API.getAllMiniIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1019,21 +1088,19 @@ public List<Integer> getAllItemStatID() throws GuildWars2Exception { } } - //Mail Carriers - /** - * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> - * Get mail carrier info for the given mail carrier id(s) + * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> + * Get mini info for the given mini id(s) * - * @param ids list of mail carrier id - * @return list of mail carrier info + * @param ids list of mini id(s) + * @return list of mini info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see MailCarrier mail carrier info + * @see Mini mini info */ - public List<MailCarrier> getMailCarrierInfo(int[] ids) throws GuildWars2Exception { + public List<Mini> getMiniInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<MailCarrier>> response = gw2API.getMailCarrierInfo(processIds(ids)).execute(); + Response<List<Mini>> response = gw2API.getMiniInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1041,17 +1108,19 @@ public List<MailCarrier> getMailCarrierInfo(int[] ids) throws GuildWars2Exceptio } } + //Outfits + /** - * For more info on mail carriers API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">here</a><br/> - * Get all mail carrier id(s) + * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> + * Get all outfit id(s) * - * @return list of mail carrier info + * @return list of outfit id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see MailCarrier mail carrier info + * @see Outfit outfit info */ - public List<Integer> getAllMailCarrierID() throws GuildWars2Exception { + public List<Integer> getAllOutfitID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllMailCarrierIDs().execute(); + Response<List<Integer>> response = gw2API.getAllOutfitIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1059,21 +1128,19 @@ public List<Integer> getAllMailCarrierID() throws GuildWars2Exception { } } - //Masteries - /** - * For more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> - * Get mastery info for the given mastery id(s) + * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> + * Get outfit info for the given outfit id(s) * - * @param ids list of mastery id - * @return list of mastery info + * @param ids list of outfit id(s) + * @return list of outfit info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Mastery mastery info + * @see Outfit outfit info */ - public List<Mastery> getMasteryInfo(int[] ids) throws GuildWars2Exception { + public List<Outfit> getOutfitInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<Mastery>> response = gw2API.getMasteryInfo(processIds(ids)).execute(); + Response<List<Outfit>> response = gw2API.getOutfitInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1081,17 +1148,19 @@ public List<Mastery> getMasteryInfo(int[] ids) throws GuildWars2Exception { } } + //PvP Heroes + /** - * For more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/> - * Get all mastery id(s) + * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> + * Get all pvp hero id(s) * - * @return list of mastery id(s) + * @return list of pvp hero id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Mastery mastery info + * @see Hero pvp hero info */ - public List<Integer> getAllMasteryID() throws GuildWars2Exception { + public List<String> getAllPvPHeroID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllMasteryIDs().execute(); + Response<List<String>> response = gw2API.getAllPvPHeroIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1099,20 +1168,19 @@ public List<Integer> getAllMasteryID() throws GuildWars2Exception { } } - //Color /** - * For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/> - * Get color info for the given color id(s) + * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> + * Get pvp hero info for the given pvp hero id(s) * - * @param ids array of color id - * @return list of color info + * @param ids list of pvp hero id(s) + * @return list of pvp hero info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Color color info + * @see Hero pvp hero info */ - public List<Color> getColorInfo(int[] ids) throws GuildWars2Exception { + public List<Hero> getPvPHeroInfo(String[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<Color>> response = gw2API.getColorInfo(processIds(ids)).execute(); + Response<List<Hero>> response = gw2API.getPvPHeroInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1120,17 +1188,19 @@ public List<Color> getColorInfo(int[] ids) throws GuildWars2Exception { } } + //Raids + /** - * For more info on Color API go <a href="https://wiki.guildwars2.com/wiki/API:2/colors">here</a><br/> - * Get list of all available color id(s) + * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> + * Get all raid id(s) * - * @return list of color id(s) + * @return list of raid id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Color color info + * @see Raid raid info */ - public List<Integer> getAllColorID() throws GuildWars2Exception { + public List<String> getAllRaidID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllColorIDs().execute(); + Response<List<String>> response = gw2API.getAllRaidIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1138,20 +1208,19 @@ public List<Integer> getAllColorID() throws GuildWars2Exception { } } - //Recipes /** - * For more info on Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes">here</a><br/> - * Get recipe info for the given recipe id(s) + * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> + * Get raid info for the given raid id(s) * - * @param ids array of recipe id - * @return list of recipe info + * @param ids list of raid id(s) + * @return list of raid info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Recipe recipe info + * @see Raid raid info */ - public List<Recipe> getRecipeInfo(int[] ids) throws GuildWars2Exception { + public List<Raid> getRaidInfo(String[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<Recipe>> response = gw2API.getRecipeInfo(processIds(ids)).execute(); + Response<List<Raid>> response = gw2API.getRaidInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1159,6 +1228,8 @@ public List<Recipe> getRecipeInfo(int[] ids) throws GuildWars2Exception { } } + //Recipes + /** * For more info on Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes">here</a><br/> * Get list of all available recipe id(s) @@ -1177,42 +1248,19 @@ public List<Integer> getAllRecipeID() throws GuildWars2Exception { } } - //Recipes Search /** - * For more info on Recipes search API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes/search">here</a><br/> - * - * @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<Integer> searchRecipes(boolean isInput, int id) throws GuildWars2Exception { - try { - Response<List<Integer>> 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()); - } - } - - //Titles - - /** - * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> - * Get title info for the given title id(s) + * For more info on Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes">here</a><br/> + * Get recipe info for the given recipe id(s) * - * @param ids list of title id(s) - * @return list of title info + * @param ids array of recipe id + * @return list of recipe info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Title title info + * @see Recipe recipe info */ - public List<Title> getTitleInfo(int[] ids) throws GuildWars2Exception { + public List<Recipe> getRecipeInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<Title>> response = gw2API.getTitleInfo(processIds(ids)).execute(); + Response<List<Recipe>> response = gw2API.getRecipeInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1220,38 +1268,21 @@ public List<Title> getTitleInfo(int[] ids) throws GuildWars2Exception { } } - /** - * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> - * Get all title id(s) - * - * @return list of title id(s) - * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Title title info - */ - public List<Integer> getAllTitleID() throws GuildWars2Exception { - try { - Response<List<Integer>> 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()); - } - } + //Recipes Search - //Minis /** - * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> - * Get mini info for the given mini id(s) + * For more info on Recipes search API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes/search">here</a><br/> * - * @param ids list of mini id(s) - * @return list of mini info + * @param isInput is given id an ingredient + * @param id recipe id + * @return list of recipe id * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Mini mini info */ - public List<Mini> getMiniInfo(int[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ids)); + public List<Integer> searchRecipes(boolean isInput, int id) throws GuildWars2Exception { try { - Response<List<Mini>> response = gw2API.getMiniInfo(processIds(ids)).execute(); + Response<List<Integer>> 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) { @@ -1259,17 +1290,19 @@ public List<Mini> getMiniInfo(int[] ids) throws GuildWars2Exception { } } + //Skins + /** - * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> - * Get list of all available mini id(s) + * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> + * Get list of all available skin ids * - * @return list of mini id(s) + * @return list of skin ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Mini mini info + * @see Skin skin info */ - public List<Integer> getAllMiniID() throws GuildWars2Exception { + public List<Integer> getAllSkinID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllMiniIDs().execute(); + Response<List<Integer>> response = gw2API.getAllSkinIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1277,21 +1310,19 @@ public List<Integer> getAllMiniID() throws GuildWars2Exception { } } - //Outfits - /** - * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> - * Get outfit info for the given outfit id(s) + * For more info on Skin API go <a href="https://wiki.guildwars2.com/wiki/API:2/skins">here</a><br/> + * Get skin info for the given skin id(s) * - * @param ids list of outfit id(s) - * @return list of outfit info + * @param ids list of skin id + * @return list of skin info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Outfit outfit info + * @see Skin skin info */ - public List<Outfit> getOutfitInfo(int[] ids) throws GuildWars2Exception { + public List<Skin> getSkinInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<Outfit>> response = gw2API.getOutfitInfo(processIds(ids)).execute(); + Response<List<Skin>> response = gw2API.getSkinInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1299,17 +1330,19 @@ public List<Outfit> getOutfitInfo(int[] ids) throws GuildWars2Exception { } } + //Titles + /** - * For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/> - * Get all outfit id(s) + * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> + * Get all title id(s) * - * @return list of outfit id(s) + * @return list of title id(s) * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Outfit outfit info + * @see Title title info */ - public List<Integer> getAllOutfitID() throws GuildWars2Exception { + public List<Integer> getAllTitleID() throws GuildWars2Exception { try { - Response<List<Integer>> response = gw2API.getAllOutfitIDs().execute(); + Response<List<Integer>> response = gw2API.getAllTitleIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1317,21 +1350,19 @@ public List<Integer> getAllOutfitID() throws GuildWars2Exception { } } - //PvP Heroes - /** - * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> - * Get pvp hero info for the given pvp hero id(s) + * For more info on titles API go <a href="https://wiki.guildwars2.com/wiki/API:2/titles">here</a><br/> + * Get title info for the given title id(s) * - * @param ids list of pvp hero id(s) - * @return list of pvp hero info + * @param ids list of title id(s) + * @return list of title info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Hero pvp hero info + * @see Title title info */ - public List<Hero> getPvPHeroInfo(String[] ids) throws GuildWars2Exception { + public List<Title> getTitleInfo(int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response<List<Hero>> response = gw2API.getPvPHeroInfo(processIds(ids)).execute(); + Response<List<Title>> response = gw2API.getTitleInfo(processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1339,37 +1370,19 @@ public List<Hero> getPvPHeroInfo(String[] ids) throws GuildWars2Exception { } } - /** - * For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/> - * 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<String> getAllPvPHeroID() throws GuildWars2Exception { - try { - Response<List<String>> 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()); - } - } + //Worlds /** - * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> - * Get raid info for the given raid id(s) + * 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) * - * @param ids list of raid id(s) - * @return list of raid info + * @return list of world id * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Raid raid info + * @see World world info */ - public List<Raid> getRaidInfo(String[] ids) throws GuildWars2Exception { - isParamValid(new ParamChecker(ids)); + public List<Integer> getAllWorldID() throws GuildWars2Exception { try { - Response<List<Raid>> response = gw2API.getRaidInfo(processIds(ids)).execute(); + Response<List<Integer>> response = gw2API.getAllWorldsIDs().execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1378,16 +1391,18 @@ public List<Raid> getRaidInfo(String[] ids) throws GuildWars2Exception { } /** - * For more info on raids API go <a href="https://wiki.guildwars2.com/wiki/API:2/raids">here</a><br/> - * Get all raid id(s) + * 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) * - * @return list of raid id(s) + * @param ids list of world id + * @return list of world info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Raid raid info + * @see World world info */ - public List<String> getAllRaidID() throws GuildWars2Exception { + public List<World> getWorldInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); try { - Response<List<String>> response = gw2API.getAllRaidIDs().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/account/AchievementProgression.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java index 0ccd2f3..363959b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java @@ -15,7 +15,7 @@ public class AchievementProgression { private int max;//default -1 or 0 private boolean done; private long repeated; - private int[] bits; //TODO available in future updates + private int[] bits; public int getId() { return id; 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 index 34e8854..e383471 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Region.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Region.java @@ -1,8 +1,10 @@ package me.xhsun.guildwars2wrapper.model.util.comm; /** - * //TODO update this every time new mastery region is out - * Created by hannah on 06/06/17. + * Reminder: update this every time new mastery region is out + * + * @author xhsun + * @since 2017-06-06 */ public enum Region { Tyria, Maguuma From f785d410e91e1dca77ab683f74c0ed400a815f1d Mon Sep 17 00:00:00 2001 From: xhsun <xhsun@ucalgary.ca> Date: Tue, 6 Jun 2017 18:50:57 -0600 Subject: [PATCH 33/33] bump version to 0.4.1 --- comm.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comm.properties b/comm.properties index 2543d18..15b7009 100644 --- a/comm.properties +++ b/comm.properties @@ -1,4 +1,4 @@ -currentVer=0.4.0 +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