Skip to content

Commit fc35ba5

Browse files
author
Damian Staszewski
committed
fixing usage on HiRezAPI class
1 parent a900f91 commit fc35ba5

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

src/main/java/pl/stachu540/hirezstudios/HiRezAPI.java

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,63 @@
44
import pl.stachu540.hirezstudios.games.Paladins;
55
import pl.stachu540.hirezstudios.games.Smite;
66

7+
import java.util.Arrays;
8+
79
/**
810
* @author Damian Staszewski <[email protected]>
911
* @since 1.8
1012
*/
1113
public class HiRezAPI {
14+
/**
15+
* Developer ID (DevId)
16+
* @see HiRezAPI#HiRezAPI(String, String)
17+
*/
1218
private final String devId;
19+
/**
20+
* Authorization Key (AuthKey)
21+
* @see HiRezAPI#HiRezAPI(String, String)
22+
*/
1323
private final String authKey;
1424

25+
/**
26+
* Smite API
27+
* @see Smite
28+
*/
1529
public Smite smite;
30+
/**
31+
* Paladins API
32+
* @see Paladins
33+
*/
1634
public Paladins paladins;
1735

36+
/**
37+
* Initialize Hi-Rez API. All stuff will delivered by Hi-Rez employer via E-Mail.
38+
* Please fill <a href="https://fs12.formsite.com/HiRez/form48/secure_index.html">this form first</a> to using script.
39+
* After acceptation your request, you can proceed to action.
40+
* @param devId Developer ID (DevId)
41+
* @param authKey Authorization Key (AuthKey)
42+
*/
1843
public HiRezAPI(@NotNull String devId, @NotNull String authKey) {
1944
this.devId = devId;
2045
this.authKey = authKey;
46+
setPlatform("pc");
2147
}
2248

23-
public String getDevId() {
24-
return devId;
25-
}
26-
27-
public String getAuthKey() {
28-
return authKey;
49+
/**
50+
* Before using variables {@link #smite} and {@link #paladins} define platform first. (Default platform is "PC")
51+
* You can use it with variables mentioned above.
52+
* Example:
53+
* <blockqote>
54+
* HiRezAPI hirez = new HiRezAPI("1004","23DF3C7E9BD14D84BF892AD206B6755C");
55+
* hirez.setPlatform("xbox").smite.getPlayer("stachu Official");
56+
* </blockquote>
57+
* @param platform Platform name <b>PC</b>/<b>XBOX</b>/<b>PS4</b>
58+
*/
59+
public HiRezAPI setPlatform(String platform) {
60+
smite = new Smite(devId, authKey, Arrays.stream(Smite.Endpoint.values())
61+
.filter(endpoint -> (endpoint.name().toLowerCase().equals(platform.toLowerCase()))).findFirst().get());
62+
paladins = new Paladins(devId, authKey, Arrays.stream(Paladins.Endpoint.values())
63+
.filter(endpoint -> endpoint.name().toLowerCase().equals(platform.toLowerCase())).findFirst().get());
64+
return this;
2965
}
3066
}

0 commit comments

Comments
 (0)