steam-condenser
steam-condenser copied to clipboard
Provide WebAPI method to retrieve full JSON response
At the moment, the following two lines have to be called when retrieving the full JSON response:
String data = getJSON(apiInterface, method, version, params);
JSONObject jsonData = new JSONObject(data);
I have refactored this out into a new method in WebAPI (getJSONResponse) so that only one line is required. Since this can be used for other WebAPI calls, I thought it made sense to provide it as a separate pull request rather than providing it in the ISteamUserStats changes.
Unfortunately the getJSONData method is not suitable for all WebAPI calls. For example, a bad GetServersAtAddress call returns the error detail as "message", not "statusDetail" as expected.
Whilst this is ultimately a flaw with the WebAPI response setup itself, I have resorted to retrieving the full JSON response and to handle any error response within the builder itself (see the buildPlayerAchievements in UserStatsBuilder).