Esempio n. 1
0
        public async Task <IDictionary <string, ChatSessionDto> > GetChatSessionsForFriendsById(string userId)
        {
            var friendships = await _usersApiClient.GetFriendshipsByUserId(userId);

            var sessions = new Dictionary <string, ChatSessionDto>();

            foreach (var friendship in friendships)
            {
                var friendId = friendship.User1.Id != userId ? friendship.User1.Id : friendship.User2.Id;
                try
                {
                    var session = await GetSessionAsync(friendId);

                    sessions[friendId] = session;
                }
                catch (SessionApiException e)
                {}
            }

            return(sessions);
        }