public async Task <ActionResult> GameInfo([FromBody] PantherGameInfoRequest request) { //var steamUserTask = _steamClient.GetPlayerSummariesAsync(request.SteamId); var achievements = await _steamClient.GetPlayerAchievementsAsync(request.SteamId, request.AppId); if (achievements == null) { return(NotFound($"Game {request.AppId} does not exist or is not owned by user {request.SteamId}")); } var gameInfo = new PantherGameInfo { TotalAchievements = achievements.Achievements.Count, TotalUnlockedAchievements = achievements.Achievements.Where(a => a.Achieved).ToList().Count, AchievementList = achievements }; gameInfo.UnlockedAchievementsPercentage = Math.Round((Convert.ToDecimal(gameInfo.TotalUnlockedAchievements) / gameInfo.TotalAchievements), 2, MidpointRounding.AwayFromZero); return(Ok(gameInfo)); }
public async Task <IActionResult> GetPlayerAchievementsForGameAsync(string steamId, string appId) { GetPlayerAchievementsResponse response = await _steamClient.GetPlayerAchievementsAsync(steamId, appId); return(Ok(response)); }