diff --git a/pom.xml b/pom.xml
index d70d635..672f543 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,25 +29,10 @@
test
-
- com.tinkerpop
- gremlin-core
- 3.0.0.M7
-
-
-
-
- org.apache.tinkerpop
- gremlin-driver
- 3.3.3
-
-
-
-
- org.apache.tinkerpop
- tinkergraph-gremlin
- 3.3.3
+ org.janusgraph
+ janusgraph-berkeleyje
+ 0.3.1
diff --git a/src/main/java/net/jrtechs/www/SteamAPI/APIConnection.java b/src/main/java/net/jrtechs/www/SteamAPI/APIConnection.java
index fe2e760..9d32b7a 100644
--- a/src/main/java/net/jrtechs/www/SteamAPI/APIConnection.java
+++ b/src/main/java/net/jrtechs/www/SteamAPI/APIConnection.java
@@ -1,5 +1,6 @@
package net.jrtechs.www.SteamAPI;
+import net.jrtechs.www.server.Game;
import net.jrtechs.www.server.Player;
import net.jrtechs.www.utils.ConfigLoader;
@@ -8,14 +9,19 @@ import net.jrtechs.www.webCrawler.APIThrottler;
import org.json.JSONArray;
import org.json.JSONObject;
+import javax.json.JsonArray;
+import javax.json.JsonObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.IntStream;
/**
* Class which is used to pull information from the Steam api
*
+ * Documentation at https://developer.valvesoftware.com/wiki/Steam_Web_API
+ *
* @author Jeffery Russell 5-26-18
*/
public class APIConnection
@@ -28,6 +34,8 @@ public class APIConnection
private final String friendListURL = "/ISteamUser/GetFriendList/v0001/";
+ private final String gamesListURL = "/IPlayerService/GetOwnedGames/v0001/";
+
/** Path to conf file(from within the conf folder) **/
private final String confPath = "SteamAPIKey.json";
@@ -57,6 +65,7 @@ public class APIConnection
*/
public String querySteamAPI(String url)
{
+ System.out.println(url);
boolean downloaded = false;
String apiData = "";
while(!downloaded)
@@ -111,6 +120,29 @@ public class APIConnection
}
+ public List getGames(String steamID)
+ {
+ List games = new ArrayList<>();
+ String apiData = this.querySteamAPI(this.baseURL + this.gamesListURL +
+ this.apiKey + "&steamid=" + steamID +
+ "&include_appinfo=true&include_played_free_games=true");
+
+ if(apiData.isEmpty())
+ return games;
+
+ JSONObject object = new JSONObject(apiData);
+ System.out.println(object);
+
+ if(object.has("response"))
+ {
+ JSONArray gamesJ = object.getJSONObject("response").getJSONArray("games");
+ IntStream.range(0, gamesJ.length()).forEach(i ->
+ games.add(new Game(gamesJ.getJSONObject(i))));
+ }
+ return games;
+ }
+
+
/**
* Returns a list of the UIDs of all the players friends
*
@@ -257,8 +289,9 @@ public class APIConnection
APIConnection con = new APIConnection();
//steam id of jrtechs
- con.getFriends("76561198188400721").forEach(System.out::println);
+ //con.getFriends("76561198188400721").forEach(System.out::println);
- System.out.println(con.getSingle("76561198188400721"));
+ //System.out.println(con.getSingle("76561198188400721"));
+ System.out.println(con.getGames("76561198188400721"));
}
}
\ No newline at end of file
diff --git a/src/main/java/net/jrtechs/www/server/Game.java b/src/main/java/net/jrtechs/www/server/Game.java
new file mode 100644
index 0000000..5f024f0
--- /dev/null
+++ b/src/main/java/net/jrtechs/www/server/Game.java
@@ -0,0 +1,50 @@
+package net.jrtechs.www.server;
+
+
+import org.json.JSONObject;
+
+import javax.json.JsonObject;
+
+/**
+ * Example URL: http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=XXXXXXXXXXXXXXXXX&steamid=76561197960434622&format=json
+ */
+public class Game
+{
+ public static String KEY_DB = "game";
+ public static String KEY_STEAM_GAME_ID = "appid";
+ public static String KEY_GAME_NAME = "name";
+ public static String KEY_GAME_ICON = "img_icon_url";
+ public static String KEY_GAME_LOGO = "img_logo_url";
+
+ //other
+ public static String KEY_PLAY_TIME = "playtime_forever";
+
+ private Integer appID;
+ private String icon;
+ private String logo;
+ private String name;
+
+ private Integer timePlayed;
+
+ public Game(JSONObject g)
+ {
+ this.appID = g.getInt(Game.KEY_STEAM_GAME_ID);
+ this.name = g.getString(KEY_GAME_NAME);
+ this.icon = g.getString(KEY_GAME_ICON);
+ this.logo = g.getString(KEY_GAME_LOGO);
+ this.timePlayed = g.getInt(KEY_PLAY_TIME);
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return "Game{" +
+ "appID=" + appID +
+ ", icon='" + icon + '\'' +
+ ", logo='" + logo + '\'' +
+ ", name='" + name + '\'' +
+ ", timePlayed=" + timePlayed +
+ '}';
+ }
+}