private async Task<IEnumerable<ChannelItemInfo>> GetChannels(CancellationToken cancellationToken) { var downloader = new TwitchChannelDownloader(_logger, _jsonSerializer, _httpClient); var channels = await downloader.GetTwitchChannelList(cancellationToken); return channels.top.Select(i => new ChannelItemInfo { Type = ChannelItemType.Category, ImageUrl = i.game.box.large, Name = i.game.name, Id = i.game.name }); }
private async Task<ChannelItemResult> GetChannelsInternal(InternalChannelItemQuery query, CancellationToken cancellationToken) { var offset = query.StartIndex.GetValueOrDefault(); var downloader = new TwitchChannelDownloader(_logger, _jsonSerializer, _httpClient); var channels = await downloader.GetTwitchChannelList(offset, cancellationToken); var items = channels.top.OrderByDescending(x => x.viewers) .Select(i => new ChannelItemInfo { Type = ChannelItemType.Folder, ImageUrl = i.game.box.large, Name = i.game.name, Id = i.game.name, CommunityRating = Convert.ToSingle(i.viewers), }); return new ChannelItemResult { Items = items.ToList(), TotalRecordCount = channels._total }; }
private async Task <ChannelItemResult> GetChannelsInternal(InternalChannelItemQuery query, CancellationToken cancellationToken) { var offset = query.StartIndex.GetValueOrDefault(); var downloader = new TwitchChannelDownloader(_logger, _jsonSerializer, _httpClient); var channels = await downloader.GetTwitchChannelList(offset, cancellationToken); var items = channels.top.OrderByDescending(x => x.viewers) .Select(i => new ChannelItemInfo { Type = ChannelItemType.Folder, ImageUrl = i.game.box.large, Name = i.game.name, Id = i.game.name, CommunityRating = Convert.ToSingle(i.viewers), }); return(new ChannelItemResult { Items = items.ToList(), TotalRecordCount = channels._total }); }