lpradel / steam-web-api-java

:steam_locomotive: Java library to provide access to the data available from Valve's Steam API
Apache License 2.0
78 stars 16 forks source link

After processing GetOwnedGames request and trying to access a single game field, its name is null. #19

Closed giovanni-grieco closed 1 year ago

giovanni-grieco commented 1 year ago

As per title. I can't seem to get the steam App name. GetOwnedGamesRequest request = SteamWebApiRequestFactory.createGetOwnedGamesRequest("/YOURSTEAMID/"); GetOwnedGames gog = SteamAPI.client.processRequest(request); for(com.lukaspradel.steamapi.data.json.ownedgames.Game apiGame : gog.getResponse().getGames() ){ System.out.println(apiGame.getName()); }

The output of this foreach loop is null :( The appID field is fine though.

image

lpradel commented 1 year ago

Hi Giovanni,

please see this answer in a similar issue: https://github.com/lpradel/steam-web-api-java/issues/4#issuecomment-167119315

In short, do the following:

GetOwnedGamesRequest request = new GetOwnedGamesRequest.GetOwnedGamesRequestBuilder( "steam-id").includeAppInfo(true).buildRequest();

Or use the other factory method SteamWebApiRequestFactory.createGetOwnedGamesRequest(String steamId, boolean includeAppInfo, boolean includePlayedFreeGames, List<Integer> appIdsFilter) which accepts includeAppInfo.

See Steam API documentation for GetOwnedGames

See also this SO comment explaining it: https://stackoverflow.com/a/73028555/1055743

giovanni-grieco commented 1 year ago

Alright, thank you for the quick reply.