@@ -38,6 +38,13 @@ public class DestinyAPI {
3838
3939 private static HttpUtils httpUtils ;
4040
41+ // Force set API key
42+ private DestinyAPI () {}
43+
44+ public DestinyAPI (String apiKey ) {
45+ setApiKey (apiKey );
46+ }
47+
4148 /**
4249 * Set the api key used by the DestinyAPI
4350 */
@@ -52,66 +59,82 @@ public DestinyAPI setApiKey(String apiKey) {
5259 return this ;
5360 }
5461
62+ /**
63+ * Sets the internal client ID, needed for OAuth generation
64+ * @param clientId The client ID
65+ * @return This DestinyAPI instance
66+ */
5567 public DestinyAPI setClientID (String clientId ) {
5668 DestinyAPI .clientId = clientId ;
5769 return this ;
5870 }
5971
72+ /**
73+ * Sets the internal client secret
74+ * @param clientSecret The client secret
75+ * @return This DestinyAPI instance
76+ */
6077 public DestinyAPI setClientSecret (String clientSecret ) {
6178 DestinyAPI .clientSecret = clientSecret ;
6279 return this ;
6380 }
6481
82+ /**
83+ * Set the oauth code used to generate access and refresh tokens
84+ * @param oauthCode The oauth code
85+ * @return This DestinyAPI instance
86+ */
6587 public DestinyAPI setOauthCode (String oauthCode ) {
6688 DestinyAPI .oauthCode = oauthCode ;
6789 return this ;
6890 }
6991
70- public DestinyAPI setAccessToken (String accessToken ) {
92+ /**
93+ * Sets the OAuth Access token. This is typically an internal function only, but is provided for convenience.
94+ * @param accessToken The OAuth access token
95+ * @return This DestinyAPI instance
96+ */
97+ public static void setAccessToken (String accessToken ) {
7198 DestinyAPI .accessToken = accessToken ;
7299 if (hasOauthManager ()) {
73100 oam .setAccessToken (accessToken );
74101 }
75- return this ;
76102 }
77103
78- public DestinyAPI setRefreshToken (String refreshToken ) {
104+ /**
105+ * Sets the OAuth refresh token. This is typically an internal function only, but is provided for convenience.
106+ * @param refreshToken The OAuth refresh token
107+ * @return This DestinyAPI instance
108+ */
109+ public static void setRefreshToken (String refreshToken ) {
79110 DestinyAPI .refreshToken = refreshToken ;
80111 if (hasOauthManager ()) {
81112 oam .setRefreshToken (refreshToken );
82113 }
83- return this ;
84114 }
85115
86116 /**
87- * Debug mode prints all requests and their responses to the console
88- * This is very useful for feature development
117+ * Debug mode prints all requests and their responses to the console.
118+ * <br>
119+ * WARNING: This could expose sensitive information, this is for development ONLY
89120 */
90- public DestinyAPI enableDebugMode () {
121+ public static void enableDebugMode () {
91122 DestinyAPI .debugEnabled = true ;
92-
93- return this ;
94123 }
95124
96125 /**
97126 * Disable debug mode
98127 */
99- public DestinyAPI disableDebugMode () {
128+ public static void disableDebugMode () {
100129 DestinyAPI .debugEnabled = false ;
101-
102- return this ;
103130 }
104131
105132 /**
106133 * Set the OAuth management class
107134 * The class passed in this parameter must "extends OAuthManager"
108135 */
109- public DestinyAPI setOauthManager (OAuthManager oam ) {
136+ public static void setOauthManager (OAuthManager oam ) {
110137 DestinyAPI .oam = oam ;
111- // setApiKey(oam.getAPIToken());
112- // setAccessToken(oam.getAccessToken());
113-
114- return this ;
115138 }
116139
117140 /**
@@ -225,8 +248,9 @@ public static BungieUser getUserWithName(String nameAndDiscrim) throws APIExcept
225248 * Search users across all platforms for anyone with that name.
226249 * <p>
227250 * Searching "dec4234" will return an array containing a single
228- * BungieUser. While searching "Gladd" or "Datto" should return
229- * multiple.
251+ * BungieUser. While searching "Gladd" or "Datto" should return many users.
252+ * <p>
253+ * // TODO: Issue #16
230254 */
231255 public static List <BungieUser > searchUsers (String name ) throws APIException {
232256 List <BungieUser > users = new ArrayList <>();
0 commit comments