private QueryResult <BaseItemDto> GetResultItems(GetSuggestedItems request) { var user = !request.UserId.Equals(Guid.Empty) ? _userManager.GetUserById(request.UserId) : null; var dtoOptions = GetDtoOptions(_authContext, request); var result = GetItems(request, user, dtoOptions); var dtoList = _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user); return(new QueryResult <BaseItemDto> { TotalRecordCount = result.TotalRecordCount, Items = dtoList }); }
private QueryResult <BaseItem> GetItems(GetSuggestedItems request, User user, DtoOptions dtoOptions) { return(_libraryManager.GetItemsResult(new InternalItemsQuery(user) { OrderBy = new[] { ItemSortBy.Random }.Select(i => new ValueTuple <string, SortOrder>(i, SortOrder.Descending)).ToArray(), MediaTypes = request.GetMediaTypes(), IncludeItemTypes = request.GetIncludeItemTypes(), IsVirtualItem = false, StartIndex = request.StartIndex, Limit = request.Limit, DtoOptions = dtoOptions, EnableTotalRecordCount = request.EnableTotalRecordCount, Recursive = true })); }
private QueryResult <BaseItem> GetItems(GetSuggestedItems request, User user, DtoOptions dtoOptions) { return(_libraryManager.GetItemsResult(new InternalItemsQuery(user) { SortBy = new string[] { ItemSortBy.Random }, MediaTypes = request.GetMediaTypes(), IncludeItemTypes = request.GetIncludeItemTypes(), IsVirtualItem = false, StartIndex = request.StartIndex, Limit = request.Limit, DtoOptions = dtoOptions, EnableTotalRecordCount = request.EnableTotalRecordCount, Recursive = true })); }
private QueryResult <BaseItemDto> GetResultItems(GetSuggestedItems request) { var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var dtoOptions = GetDtoOptions(_authContext, request); var result = GetItems(request, user, dtoOptions); var dtoList = _dtoService.GetBaseItemDtos(result.Items, dtoOptions, user); if (dtoList == null) { throw new InvalidOperationException("GetBaseItemDtos returned null"); } return(new QueryResult <BaseItemDto> { TotalRecordCount = result.TotalRecordCount, Items = dtoList }); }
public object Get(GetSuggestedItems request) { return(GetResultItems(request)); }
public async Task <object> Get(GetSuggestedItems request) { var result = await GetResultItems(request).ConfigureAwait(false); return(ToOptimizedResult(result)); }
public object Get(GetSuggestedItems request) { var result = GetResultItems(request); return ToOptimizedResult(result); }