/
SteamWebApiVersion.java
93 lines (84 loc) · 2.3 KB
/
SteamWebApiVersion.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.lukaspradel.steamapi.webapi.core;
/**
* Wraps the currently supported versions of the various Web API Interface
* methods.
*
* @author lpradel
*
*/
public enum SteamWebApiVersion {
VERSION_ONE("v0001"), VERSION_TWO("v0002");
private final String version;
private SteamWebApiVersion(String version) {
this.version = version;
}
/**
* Returns the most current version of the given Web API Interface method.
*
* @param interfaceMethod
* The Web API Interface method.
* @return The most current version of the given Web API Interface method.
*/
public static SteamWebApiVersion getCurrentVersionForWebApiInterfaceMethod(
SteamWebApiInterfaceMethod interfaceMethod) {
if (interfaceMethod == null) {
throw new IllegalArgumentException(
"Unsupported Web API Interface method!");
}
switch (interfaceMethod) {
case GET_FRIEND_LIST:
return VERSION_ONE;
case GET_GLOBAL_ACHIEVEMENT_PERCENTAGES_FOR_APP:
return VERSION_TWO;
case GET_GLOBAL_STATS_FOR_GAME:
return VERSION_ONE;
case GET_NEWS_FOR_APP:
return VERSION_TWO;
case GET_OWNED_GAMES:
return VERSION_ONE;
case GET_PLAYER_ACHIEVEMENTS:
return VERSION_ONE;
case GET_PLAYER_SUMMARIES:
return VERSION_TWO;
case GET_RECENTLY_PLAYED_GAMES:
return VERSION_ONE;
case GET_USER_STATS_FOR_GAME:
return VERSION_TWO;
case IS_PLAYING_SHARED_GAME:
return VERSION_ONE;
case GET_SCHEMA_FOR_GAME:
return VERSION_TWO;
case GET_PLAYER_BANS:
return VERSION_ONE;
case GET_HEROES:
return VERSION_ONE;
case GET_MATCH_DETAILS:
return VERSION_ONE;
case GET_MATCH_HISTORY:
return VERSION_ONE;
case GET_LEAGUE_LISTING:
return VERSION_ONE;
case GET_LIVE_LEAGUE_GAMES:
return VERSION_ONE;
case GET_MATCH_HISTORY_BY_SEQUENCE_NUM:
return VERSION_ONE;
case GET_TEAM_INFO_BY_TEAM_ID:
return VERSION_ONE;
case GET_GAME_ITEMS:
return VERSION_ONE;
case GET_PRO_PLAYER_LIST:
return VERSION_ONE;
case GET_PLAYER_OFFICIAL_INFO:
return VERSION_ONE;
case GET_FANTASY_PLAYER_STATS:
return VERSION_ONE;
default:
throw new IllegalArgumentException(
"Unsupported Web API Interface method!");
}
}
@Override
public String toString() {
return version;
}
}