예제 #1
0
        public static async Task Run([QueueTrigger("steam-users", Connection = "QUEUE_CONNECTION")] string user, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {user}");

            HttpResponseMessage gamesHttpResponse = await client.GetAsync(getOwnedGamesUri + $"&steamid={steamId}" + $"&key={key}");

            string temp = await gamesHttpResponse.Content.ReadAsStringAsync();

            SteamGamesResponseContainer gamesResponse = await gamesHttpResponse.Content.ReadAsAsync <SteamGamesResponseContainer>();

            // TODO: place holder to limit to 10 for now. Need to move to an async operation
            int i = 0;

            foreach (Game game in gamesResponse.Response.Games)
            {
                i++;
                HttpResponseMessage gamePageResponse = await client.GetAsync(steamStoreUri + game.AppId);

                string gamesPage = await gamePageResponse.Content.ReadAsStringAsync();

                SetTags(game, gamesPage);

                if (i > 10)
                {
                    break;
                }
            }
        }
예제 #2
0
        public async Task <List <Game> > GetGamesFor(string steamId)
        {
            HttpResponseMessage gamesHttpResponse = await client.GetAsync(getOwnedGamesUri + $"&steamid={steamId}" + $"&key={key}");

            string temp = await gamesHttpResponse.Content.ReadAsStringAsync();

            SteamGamesResponseContainer gamesResponse = await gamesHttpResponse.Content.ReadAsAsync <SteamGamesResponseContainer>();

            // TODO: place holder to limit to 10 for now. Need to move to an async operation
            int i = 0;

            foreach (Game game in gamesResponse.Response.Games)
            {
                i++;
                HttpResponseMessage gamePageResponse = await client.GetAsync(steamStoreUri + game.AppId);

                string gamesPage = await gamePageResponse.Content.ReadAsStringAsync();

                SetTags(game, gamesPage);

                if (i > 10)
                {
                    break;
                }
            }

            return(gamesResponse.Response.Games);
        }