Skip to content
Permalink
Browse files

Merge pull request #7 from Pazus/dota2-api-requests

Dota2 Api
  • Loading branch information
lpradel committed Apr 16, 2017
2 parents 7c8a9c1 + 6857a59 commit 6299bf2e5db2e016cb9f75f40735470abb810136
Showing with 93,244 additions and 6 deletions.
  1. +111 −0 pom.xml
  2. +25 −1 src/main/java/com/lukaspradel/steamapi/webapi/core/SteamWebApiInterface.java
  3. +24 −1 src/main/java/com/lukaspradel/steamapi/webapi/core/SteamWebApiInterfaceMethod.java
  4. +22 −0 src/main/java/com/lukaspradel/steamapi/webapi/core/SteamWebApiVersion.java
  5. +5 −0 ...main/java/com/lukaspradel/steamapi/webapi/request/builders/AbstractSteamWebApiRequestBuilder.java
  6. +91 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/builders/SteamWebApiRequestFactory.java
  7. +117 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetFantasyPlayerStatsRequest.java
  8. +56 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetGameItemsRequest.java
  9. +91 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetHeroesRequest.java
  10. +69 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetLeagueListingRequest.java
  11. +49 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetLiveLeagueGamesRequest.java
  12. +60 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetMatchDetailsRequest.java
  13. +77 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetMatchHistoryBySequenceNumRequest.java
  14. +207 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetMatchHistoryRequest.java
  15. +60 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetPlayerOfficialInfoRequest.java
  16. +49 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetProPlayerListRequest.java
  17. +77 −0 src/main/java/com/lukaspradel/steamapi/webapi/request/dota2/GetTeamInfoByTeamIDRequest.java
  18. +88 −0 ...ces/com/lukaspradel/steamapi/schema/dota2/getfantasyplayerstats/getfantasyplayerstats.schema.json
  19. +49 −0 src/main/resources/com/lukaspradel/steamapi/schema/dota2/getgameitems/getgameitems.schema.json
  20. +43 −0 src/main/resources/com/lukaspradel/steamapi/schema/dota2/getheroes/getheroes.schema.json
  21. +42 −0 ...ain/resources/com/lukaspradel/steamapi/schema/dota2/getleaguelisting/getleaguelisting.schema.json
  22. +463 −0 ...resources/com/lukaspradel/steamapi/schema/dota2/getliveleaguegames/getliveleaguegames.schema.json
  23. +220 −0 src/main/resources/com/lukaspradel/steamapi/schema/dota2/getmatchdetails/getmatchdetails.schema.json
  24. +82 −0 src/main/resources/com/lukaspradel/steamapi/schema/dota2/getmatchhistory/getmatchhistory.schema.json
  25. +204 −0 ...radel/steamapi/schema/dota2/getmatchhistorybysequencenum/getmatchhistorybysequencenum.schema.json
  26. +26 −0 ...ces/com/lukaspradel/steamapi/schema/dota2/getplayerofficialinfo/getplayerofficialinfo.schema.json
  27. +59 −0 ...ain/resources/com/lukaspradel/steamapi/schema/dota2/getproplayerlist/getproplayerlist.schema.json
  28. +86 −0 ...sources/com/lukaspradel/steamapi/schema/dota2/getteaminfobyteamid/getteaminfobyteamid.schema.json
  29. +234 −0 src/test/java/com/lukaspradel/steamapi/webapi/client/SteamWebApiClientTest.java
  30. +39 −0 src/test/java/com/lukaspradel/steamapi/webapi/core/SteamWebApiVersionTest.java
  31. +79 −0 src/test/java/com/lukaspradel/steamapi/webapi/request/builders/SteamWebApiRequestBuilderTest.java
  32. +164 −4 src/test/java/com/lukaspradel/steamapi/webapi/request/builders/SteamWebApiRequestFactoryTest.java
  33. +68,653 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetFantasyPlayerStats.json
  34. +2,255 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetGameItems.json
  35. +452 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetHeroes.json
  36. +111 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetLeagueListing.json
  37. +8,870 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetLiveLeagueGames.json
  38. +334 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetMatchDetails.json
  39. +450 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetMatchHistory.json
  40. +661 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetMatchHistoryBySequenceNum.json
  41. +9 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetPlayerOfficialInfo.json
  42. +6,250 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetProPlayerList.json
  43. +2,131 −0 src/test/resources/com/lukaspradel/steamapi/webapi/client/dota2/GetTeamInfoByTeamID.json
111 pom.xml
@@ -254,6 +254,117 @@
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/getplayerbans</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getheroes</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getheroes</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getheroes</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getmatchdetails</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getmatchdetails</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getmatchdetails</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getmatchhistory</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getmatchhistory</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getmatchhistory</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getleaguelisting</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getleaguelisting</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getleaguelisting</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getliveleaguegames</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getliveleaguegames</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getliveleaguegames</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getmatchhistorybysequencenum</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getmatchhistorybysequencenum</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getmatchhistorybysequencenum</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getteaminfobyteamid</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getteaminfobyteamid</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getteaminfobyteamid</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getgameitems</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getgameitems</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getgameitems</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getproplayerlist</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getproplayerlist</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getproplayerlist</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getplayerofficialinfo</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getplayerofficialinfo</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getplayerofficialinfo</sourceDirectory>
</configuration>
</execution>
<execution>
<id>generate-getfantasyplayerstats</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<targetPackage>com.lukaspradel.steamapi.data.json.dota2.getfantasyplayerstats</targetPackage>
<sourceDirectory>${basedir}/src/main/resources/com/lukaspradel/steamapi/schema/dota2/getfantasyplayerstats</sourceDirectory>
</configuration>
</execution>

</executions>
</plugin>
</plugins>
@@ -12,7 +12,9 @@
public enum SteamWebApiInterface {

I_STEAM_NEWS("ISteamNews"), I_PLAYER_SERVICE("IPlayerService"), I_STEAM_USER(
"ISteamUser"), I_STEAM_USER_STATS("ISteamUserStats");
"ISteamUser"), I_STEAM_USER_STATS("ISteamUserStats"), I_ECON_DOTA2(
"IEconDOTA2_570"), I_DOTA2_MATCH("IDOTA2Match_570"), I_DOTA2_FANTASY(
"IDOTA2Fantasy_570");

private final String apiInterface;

@@ -61,6 +63,28 @@ public static SteamWebApiInterface getInterfaceForMethod(
return I_STEAM_USER_STATS;
case GET_PLAYER_BANS:
return I_STEAM_USER;
case GET_HEROES:
return I_ECON_DOTA2;
case GET_MATCH_HISTORY:
return I_DOTA2_MATCH;
case GET_MATCH_DETAILS:
return I_DOTA2_MATCH;
case GET_LEAGUE_LISTING:
return I_DOTA2_MATCH;
case GET_LIVE_LEAGUE_GAMES:
return I_DOTA2_MATCH;
case GET_MATCH_HISTORY_BY_SEQUENCE_NUM:
return I_DOTA2_MATCH;
case GET_TEAM_INFO_BY_TEAM_ID:
return I_DOTA2_MATCH;
case GET_GAME_ITEMS:
return I_ECON_DOTA2;
case GET_PRO_PLAYER_LIST:
return I_DOTA2_FANTASY;
case GET_PLAYER_OFFICIAL_INFO:
return I_DOTA2_FANTASY;
case GET_FANTASY_PLAYER_STATS:
return I_DOTA2_FANTASY;
default:
throw new IllegalArgumentException(
"Unsupported Web API Interface method!");
@@ -2,6 +2,8 @@

import com.lukaspradel.steamapi.data.json.achievementpercentages.GetGlobalAchievementPercentagesForApp;
import com.lukaspradel.steamapi.data.json.appnews.GetNewsForApp;
import com.lukaspradel.steamapi.data.json.dota2.fantasyplayerstats.GetFantasyPlayerStats;
import com.lukaspradel.steamapi.data.json.dota2.playerofficialinfo.GetPlayerOfficialInfo;
import com.lukaspradel.steamapi.data.json.friendslist.GetFriendList;
import com.lukaspradel.steamapi.data.json.getglobalstatsforgame.GetGlobalStatsForGame;
import com.lukaspradel.steamapi.data.json.getplayerbans.GetPlayerBans;
@@ -12,6 +14,15 @@
import com.lukaspradel.steamapi.data.json.playerstats.GetUserStatsForGame;
import com.lukaspradel.steamapi.data.json.playersummaries.GetPlayerSummaries;
import com.lukaspradel.steamapi.data.json.recentlyplayedgames.GetRecentlyPlayedGames;
import com.lukaspradel.steamapi.data.json.dota2.heroes.GetHeroes;
import com.lukaspradel.steamapi.data.json.dota2.matchdetails.GetMatchDetails;
import com.lukaspradel.steamapi.data.json.dota2.matchhistory.GetMatchHistory;
import com.lukaspradel.steamapi.data.json.dota2.leaguelisting.GetLeagueListing;
import com.lukaspradel.steamapi.data.json.dota2.liveleaguegames.GetLiveLeagueGames;
import com.lukaspradel.steamapi.data.json.dota2.matchhistorybysequencenum.GetMatchHistoryBySequenceNum;
import com.lukaspradel.steamapi.data.json.dota2.teaminfobyteamid.GetTeamInfoByTeamID;
import com.lukaspradel.steamapi.data.json.dota2.gameitems.GetGameItems;
import com.lukaspradel.steamapi.data.json.dota2.proplayerlist.GetProPlayerList;

/**
* Currently supported Steam Web API Interface Methods as listed on Valve's Dev
@@ -37,7 +48,19 @@
"GetRecentlyPlayedGames", GetRecentlyPlayedGames.class), IS_PLAYING_SHARED_GAME(
"IsPlayingSharedGame", IsPlayingSharedGame.class), GET_SCHEMA_FOR_GAME(
"GetSchemaForGame", GetSchemaForGame.class), GET_PLAYER_BANS(
"GetPlayerBans", GetPlayerBans.class);
"GetPlayerBans", GetPlayerBans.class), GET_HEROES(
"GetHeroes",GetHeroes.class), GET_MATCH_DETAILS(
"GetMatchDetails",GetMatchDetails.class), GET_MATCH_HISTORY(
"GetMatchHistory",GetMatchHistory.class), GET_LEAGUE_LISTING(
"GetLeagueListing",GetLeagueListing.class), GET_LIVE_LEAGUE_GAMES(
"GetLiveLeagueGames",GetLiveLeagueGames.class), GET_MATCH_HISTORY_BY_SEQUENCE_NUM(
"GetMatchHistoryBySequenceNum",GetMatchHistoryBySequenceNum.class), GET_TEAM_INFO_BY_TEAM_ID(
"GetTeamInfoByTeamID",GetTeamInfoByTeamID.class), GET_GAME_ITEMS(
"GetGameItems",GetGameItems.class), GET_PRO_PLAYER_LIST(
"GetProPlayerList",GetProPlayerList.class), GET_PLAYER_OFFICIAL_INFO(
"GetPlayerOfficialInfo",GetPlayerOfficialInfo.class), GET_FANTASY_PLAYER_STATS(
"GetFantasyPlayerStats",GetFantasyPlayerStats.class)
;

private final String interfaceMethod;

@@ -58,6 +58,28 @@ public static SteamWebApiVersion getCurrentVersionForWebApiInterfaceMethod(
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!");
@@ -41,6 +41,11 @@ protected void addParameter(String name, Integer value) {
parameters.put(name, String.valueOf(value));
}

protected void addParameter(String name, Long value) {

parameters.put(name, value.toString());
}

/**
* Adds List-parameter as comma-separated strings
*
@@ -1,5 +1,7 @@
package com.lukaspradel.steamapi.webapi.request.builders;

import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

import com.lukaspradel.steamapi.webapi.request.GetFriendListRequest;
@@ -28,6 +30,18 @@
import com.lukaspradel.steamapi.webapi.request.IsPlayingSharedGameRequest;
import com.lukaspradel.steamapi.webapi.request.IsPlayingSharedGameRequest.IsPlayingSharedGameRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.SteamWebApiRequest;
import com.lukaspradel.steamapi.webapi.request.dota2.*;
import com.lukaspradel.steamapi.webapi.request.dota2.GetGameItemsRequest.GetGameItemsRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetHeroesRequest.GetHeroesRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetLeagueListingRequest.GetLeagueListingRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetLiveLeagueGamesRequest.GetLiveLeagueGamesRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetMatchDetailsRequest.GetMatchDetailsRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetMatchHistoryBySequenceNumRequest.GetMatchHistoryBySequenceNumRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetMatchHistoryRequest.GetMatchHistoryRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetTeamInfoByTeamIDRequest.GetTeamInfoByTeamIDRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetFantasyPlayerStatsRequest.GetFantasyPlayerStatsRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetPlayerOfficialInfoRequest.GetPlayerOfficialInfoRequestBuilder;
import com.lukaspradel.steamapi.webapi.request.dota2.GetProPlayerListRequest.GetProPlayerListRequestBuilder;

/**
* Convenience class to create instances of {@link SteamWebApiRequest}.
@@ -156,4 +170,81 @@ public static GetPlayerBansRequest createGetPlayerBansRequest(

return new GetPlayerBansRequestBuilder(steamIds).buildRequest();
}

public static GetGameItemsRequest createGetGameItemsRequest() {
return new GetGameItemsRequestBuilder().buildRequest();
}

public static GetHeroesRequest createGetHeroesRequest() {
return new GetHeroesRequestBuilder().language("en").buildRequest();
}

public static GetLeagueListingRequest createGetLeagueListingRequest() {
return new GetLeagueListingRequestBuilder().language("en").buildRequest();
}

public static GetLiveLeagueGamesRequest createGetLiveLeagueGamesRequest() {
return new GetLiveLeagueGamesRequestBuilder().buildRequest();
}

public static GetMatchDetailsRequest createGetMatchDetailsRequest(String matchId) {
return new GetMatchDetailsRequestBuilder(matchId).buildRequest();
}

public static GetMatchHistoryBySequenceNumRequest createGetMatchHistoryBySequenceNumRequest(Long startAtMatchSeqMum,Integer matchesRequested ) {
return new GetMatchHistoryBySequenceNumRequestBuilder()
.startAtMatchSeqNum(startAtMatchSeqMum)
.matchesRequested(matchesRequested)
.buildRequest();
}

public static GetMatchHistoryRequest createGetMatchHistoryRequest(String accountId, GetMatchHistoryRequest.GameMode gameMode) {
return new GetMatchHistoryRequestBuilder()
.gameMode(gameMode)
.accountId(accountId)
.buildRequest();
}

public static GetTeamInfoByTeamIDRequest createGetTeamInfoByTeamIDRequest(Long teamId) {
return new GetTeamInfoByTeamIDRequestBuilder()
.startAtTeamId(teamId)
.teamsRequested(1)
.buildRequest();
}

public static GetFantasyPlayerStatsRequest createGetFantasyPlayerStatsRequest(String fantasyLeagueId) {
return new GetFantasyPlayerStatsRequestBuilder(fantasyLeagueId).buildRequest();
}

public static GetFantasyPlayerStatsRequest createGetFantasyPlayerStatsRequest(String fantasyLeagueId, Date startTime, Date endTime, String playerAccountID) {
return new GetFantasyPlayerStatsRequestBuilder(fantasyLeagueId)
.startTime(startTime)
.endTime(endTime)
.playerAccountID(playerAccountID)
.buildRequest();
}

public static GetFantasyPlayerStatsRequest createGetFantasyPlayerStatsRequest(String fantasyLeagueId, Integer seriesId, String playerAccountID) {
return new GetFantasyPlayerStatsRequestBuilder(fantasyLeagueId)
.seriesID(seriesId)
.playerAccountID(playerAccountID)
.buildRequest();
}


public static GetFantasyPlayerStatsRequest createGetFantasyPlayerStatsRequest(String fantasyLeagueId, String matchId, String playerAccountID) {
return new GetFantasyPlayerStatsRequestBuilder(fantasyLeagueId)
.matchId(matchId)
.playerAccountID(playerAccountID)
.buildRequest();
}


public static GetPlayerOfficialInfoRequest createGetPlayerOfficialInfoRequest(String accountId) {
return new GetPlayerOfficialInfoRequestBuilder(accountId).buildRequest();
}

public static GetProPlayerListRequest createGetProPlayerListRequest() {
return new GetProPlayerListRequestBuilder().buildRequest();
}
}

0 comments on commit 6299bf2

Please sign in to comment.
You can’t perform that action at this time.