Пример #1
0
 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]);
     }
 }
Пример #2
0
        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));
        }