Skip to content

Commit b11ffdf

Browse files
author
Damian Staszewski
committed
added batching matches
- IMPORTANT: you can batching max 10 matches.
1 parent d360580 commit b11ffdf

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/main/java/pl/stachuofficial/hirezstudios/HiRezGames.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,39 @@ public StringData getItems() {
121121

122122
/**
123123
* Getting match details.
124+
* <i><b>NOTE</b> There is a byte limit to the amount of data returned; please limit the CSV parameter to 5 to 10 matches because of this and for Hi-Rez DB Performance reasons.</i>
124125
* @param match_id The id of the match. Can be obtained from <b>{@link #getMatchHistory(String)}</b>, <b>{@link #getTopMatches()}</b> &amp; <b>{@link #getMatchIDsByQueue}</b>.
125126
* @return Returns the statistics for a particular completed match.
126127
*/
127-
public StringData getMatchDetails(String match_id) {
128-
return get("getmatchdetails", match_id);
128+
public StringData getMatchDetails(String... match_id) {
129+
if (match_id.length <= 10 && match_id.length > 1) {
130+
return get("getmatchdetailsbatch", String.join(",", match_id));
131+
} else if (match_id.length == 1) return getMatchDetails(match_id[0]);
132+
else return new StringData("You cannot batching more than 10 matches.");
129133
}
130134

135+
/**
136+
* Getting match details.
137+
* <i><b>NOTE</b> There is a byte limit to the amount of data returned; please limit the CSV parameter to 5 to 10 matches because of this and for Hi-Rez DB Performance reasons.</i>
138+
* @param match_id The id of the match. Can be obtained from <b>{@link #getMatchHistory(String)}</b>, <b>{@link #getTopMatches()}</b> &amp; <b>{@link #getMatchIDsByQueue}</b>.
139+
* @return Returns the statistics for a particular completed match.
140+
*/
141+
public StringData getMatchDetails(int... match_id) {
142+
String[] ids = new String[match_id.length];
143+
for (int id = 0; id < match_id.length; id++) {
144+
ids[id] = Integer.toString(match_id[id]);
145+
}
146+
return getMatchDetails(ids);
147+
}
148+
149+
150+
/**
151+
* Getting match details.
152+
* @param match_id The id of the match. Can be obtained from <b>{@link #getMatchHistory(String)}</b>, <b>{@link #getTopMatches()}</b> &amp; <b>{@link #getMatchIDsByQueue}</b>.
153+
* @return Returns the statistics for a particular completed match.
154+
*/
155+
public StringData getMatchDetails(String match_id) { return get("getmatchdetails", match_id); }
156+
131157
/**
132158
* Getting match details.
133159
* @param match_id The id of the match. Can be obtained from <b>{@link #getMatchHistory(String)}</b>, <b>{@link #getTopMatches()}</b> &amp; <b>{@link #getMatchIDsByQueue}</b>.

0 commit comments

Comments
 (0)