A Java wrapper for SteamGridDB's API
You can generate an API key on your user preferences page.
importcom.SteamGridDB.*;
importcom.SteamGridDB.Enums.*;
importcom.SteamGridDB.Connection.*;SGDBConnectionManager.initialize("https://www.steamgriddb.com/api/v2", "myAuthKey");// Get an ArrayList of games that match the search termvargames = Search.searchGamesByName("cyberpunk");
// Get a JSONObject containing the response from the API [Can be converted to string using .toString()]vargamesJson = Search.searchGamesByNameJSON("cyberpunk");// Get a Game using a GameIdvargame = Game.getGameByGameId("1234");
// Get a Game using a SteamAppIdvargame = Game.getGameBySteamAppId("567890");
// Get a Game using an EgsIdvargame = Game.getGameByEgsId("77f2b98e2cef40c8a7437518bf420e47");
// Get a Game using an OriginIdvargame = Game.getGameByOriginId("OFB-EAST:57557");
// Get a Game using an UplayIdvargame = Game.getGameByUplayId("4a1562a4-c4d2-4bc5-a85e-f3db588b0072");
// Get a Game using an GogIdvargame = Game.getGameByGogId("2031519202");
// Get a Game using its constructorvargame = newGame("567890", SGDBIdTypes.SteamAppId);
// Get a JSONObject containing the response from the APIvargameJson = Search.getGameJSONBySteamAppId("567890");// Get a Game's NamevargameName = game.getName();
// Get a Game's stylesvarstylesArray = game.getStyles();// Get grids by game IDvargrid = Grid.getGridsByGameId("1234");
// Get grids by Steam App Idvargrids = Grid.getGridsBySteamAppId("1234");
// Alternatively, you can do it like this:vargrids = Grid.getGridsById("1234", SGDBIdTypes.GameId);
// Get a JSONObject containing the response from the APIvargridJson = Search.getGridJSONBySteamAppId("567890");// Create an SGDBStyles arraySGDBStylesstyles[] = {SGDBStyles.Alternate, SGDBStyles.NoLogo};
// Same as before, but using the styles filtervargrid = Grid.getGridsByGameId("1234", styles);
vargrids = Grid.getGridsBySteamAppId("1234", styles);
vargrids = Grid.getGridsById("1234", SGDBIdTypes.GameId, styles);// Get the first Grid's scorevargridScore = grids.get(0).getScore();
// Get the same Grid's Author's usernamevarauthorName = grids.get(0).getAuthor().getName();// Upvote the first grid of the game with ID 1234vargrid = Grid.getGridsByGameId("1234").get(0);
grid.upvote();
// Downvote the same gridvargrid = Grid.getGridsByGameId("1234").get(0);
grid.upvote();
// Alternatively, use the Grid's ID (80 in this case) to vote:Grid.upvoteById("80");
Grid.downvoteById("80");// Upload a blurred grid to Half-Life 2 (2254)Grid.upload("2254", SGDBStyles.Blurred, "path/of/image.img");// Delete a grid by IDGrid.deleteByGridID(gameID);
// Delete multiple grids by IDvargameIDs = {"123", "456"};
Grid.deleteByGridIDs(gameIDs);
// Delete a Grid objectvargrid = Grid.getGridsByGameId("1234").get(0);
grid.delete();