Esempio n. 1
0
        /// <summary>
        /// Retrieves the list of friends for a user.
        /// </summary>
        /// <param name="steamId">User's Steam ID.</param>
        /// <returns>List of friends.</returns>
        public async Task <FriendsList> GetFriendList(string steamId)
        {
            if (string.IsNullOrEmpty(steamId))
            {
                throw new ArgumentNullException(nameof(steamId));
            }

            var response = await _apiRepository.ApiCall(
                _servicename,
                "GetFriendList",
                "v0001",
                $"steamid={steamId}&relationship=friend"
                ).ConfigureAwait(false);

            var model = JsonConvert.DeserializeObject <GetFriendListResponse>(response);

            return(model.FriendsList);
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieves the list of recently played games for a user.
        /// </summary>
        /// <remarks>
        /// https://wiki.teamfortress.com/wiki/WebAPI/GetRecentlyPlayedGames
        /// </remarks>
        /// <param name="steamId">User's Steam ID.</param>
        /// <returns>Total count and list of games.</returns>
        public async Task <List <Game> > GetRecentlyPlayedGames(string steamId)
        {
            if (string.IsNullOrEmpty(steamId))
            {
                return(null);
            }

            var response = await _apiRepository.ApiCall(
                _serviceName,
                "GetRecentlyPlayedGames",
                "v1",
                $"steamid={steamId}"
                ).ConfigureAwait(false);

            var model = JsonConvert.DeserializeObject <GetRecentlyPlayedGamesResponse>(response);

            return(model.RecentlyPlayedGames.Games);
        }