public object Get(GetChannelItems request) { var result = _channelManager.GetChannelItems(new ChannelItemQuery { Limit = request.Limit, StartIndex = request.StartIndex, UserId = request.UserId, ChannelId = request.Id, CategoryId = request.CategoryId }, CancellationToken.None).Result; return(ToOptimizedResult(result)); }
public async Task <object> Get(GetChannelItems request) { var result = await _channelManager.GetChannelItems(new ChannelItemQuery { Limit = request.Limit, StartIndex = request.StartIndex, UserId = request.UserId, ChannelId = request.Id, FolderId = request.FolderId, OrderBy = request.GetOrderBy(), Filters = request.GetFilters().ToArray(), Fields = request.GetItemFields() }, CancellationToken.None).ConfigureAwait(false); return(ToOptimizedResult(result)); }
public async Task <object> Get(GetChannelItems request) { var result = await _channelManager.GetChannelItems(new ChannelItemQuery { Limit = request.Limit, StartIndex = request.StartIndex, UserId = request.UserId, ChannelId = request.Id, FolderId = request.FolderId, SortOrder = request.SortOrder, SortBy = (request.SortBy ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(), Filters = request.GetFilters().ToArray(), Fields = request.GetItemFields() }, CancellationToken.None).ConfigureAwait(false); return(ToOptimizedResult(result)); }
public async Task <object> Get(GetChannelItems request) { var user = string.IsNullOrEmpty(request.UserId) ? null : _userManager.GetUserById(request.UserId); var query = new InternalItemsQuery(user) { Limit = request.Limit, StartIndex = request.StartIndex, ChannelIds = new string[] { request.Id }, ParentId = string.IsNullOrWhiteSpace(request.FolderId) ? (Guid?)null : new Guid(request.FolderId), OrderBy = request.GetOrderBy(), DtoOptions = new Controller.Dto.DtoOptions { Fields = request.GetItemFields() } }; foreach (var filter in request.GetFilters()) { switch (filter) { case ItemFilter.Dislikes: query.IsLiked = false; break; case ItemFilter.IsFavorite: query.IsFavorite = true; break; case ItemFilter.IsFavoriteOrLikes: query.IsFavoriteOrLiked = true; break; case ItemFilter.IsFolder: query.IsFolder = true; break; case ItemFilter.IsNotFolder: query.IsFolder = false; break; case ItemFilter.IsPlayed: query.IsPlayed = true; break; case ItemFilter.IsResumable: query.IsResumable = true; break; case ItemFilter.IsUnplayed: query.IsPlayed = false; break; case ItemFilter.Likes: query.IsLiked = true; break; } } var result = await _channelManager.GetChannelItems(query, CancellationToken.None).ConfigureAwait(false); return(ToOptimizedResult(result)); }