public RecentlyPlayedGames(RecentlyPlayedGamesResponse response) { TotalCount = response.total_count; Games = new Game[response.games.Length]; for (int i = 0; i < response.games.Length; i++) { Games[i] = new Game(response.games[i]); } }
public IActionResult GetRecentlyPlayedGames(string userid) { WebClient webClient = new WebClient(); string reqUrl = SteamUrlBuilders.BuildPlayerServiceRequestUrl(SteamEnums.Methods.GetRecentlyPlayedGames, userid, _apiKeys.SteamApiKey, steamBaseUrl); _logger.LogInformation($"Sending request to {reqUrl}"); string jsonResponse = webClient.DownloadString(reqUrl); _logger.LogInformation($"Response got: {jsonResponse}"); RecentlyPlayedGamesResponse recentlyPlayedGames = JsonConvert.DeserializeObject <RecentlyPlayedGamesResponse>(jsonResponse); return(Ok(recentlyPlayedGames)); }