예제 #1
0
        /// <summary>
        /// Gets the search hints async.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{IEnumerable{SearchHintResult}}.</returns>
        private SearchHintResult GetSearchHintsAsync(GetSearchHints request)
        {
            var result = _searchEngine.GetSearchHints(new SearchQuery
            {
                Limit            = request.Limit,
                SearchTerm       = request.SearchTerm,
                IncludeArtists   = request.IncludeArtists,
                IncludeGenres    = request.IncludeGenres,
                IncludeMedia     = request.IncludeMedia,
                IncludePeople    = request.IncludePeople,
                IncludeStudios   = request.IncludeStudios,
                StartIndex       = request.StartIndex,
                UserId           = request.UserId,
                IncludeItemTypes = ApiEntryPoint.Split(request.IncludeItemTypes, ',', true),
                ExcludeItemTypes = ApiEntryPoint.Split(request.ExcludeItemTypes, ',', true),
                MediaTypes       = ApiEntryPoint.Split(request.MediaTypes, ',', true),
                ParentId         = request.ParentId,

                IsKids   = request.IsKids,
                IsMovie  = request.IsMovie,
                IsNews   = request.IsNews,
                IsSeries = request.IsSeries,
                IsSports = request.IsSports
            });

            return(new SearchHintResult
            {
                TotalRecordCount = result.TotalRecordCount,

                SearchHints = result.Items.Select(GetSearchHintResult).ToArray()
            });
        }
예제 #2
0
        /// <summary>
        /// Gets the search hints async.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{IEnumerable{SearchHintResult}}.</returns>
        private async Task <SearchHintResult> GetSearchHintsAsync(GetSearchHints request)
        {
            var result = await _searchEngine.GetSearchHints(new SearchQuery
            {
                Limit            = request.Limit,
                SearchTerm       = request.SearchTerm,
                IncludeArtists   = request.IncludeArtists,
                IncludeGenres    = request.IncludeGenres,
                IncludeMedia     = request.IncludeMedia,
                IncludePeople    = request.IncludePeople,
                IncludeStudios   = request.IncludeStudios,
                StartIndex       = request.StartIndex,
                UserId           = request.UserId,
                IncludeItemTypes = (request.IncludeItemTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),
                ExcludeItemTypes = (request.ExcludeItemTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),
                MediaTypes       = (request.MediaTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),
                ParentId         = request.ParentId,

                IsKids   = request.IsKids,
                IsMovie  = request.IsMovie,
                IsNews   = request.IsNews,
                IsSeries = request.IsSeries,
                IsSports = request.IsSports
            }).ConfigureAwait(false);

            return(new SearchHintResult
            {
                TotalRecordCount = result.TotalRecordCount,

                SearchHints = result.Items.Select(GetSearchHintResult).ToArray()
            });
        }
예제 #3
0
        public ActionResult <SearchHintResult> Get(
            [FromQuery] int?startIndex,
            [FromQuery] int?limit,
            [FromQuery] Guid?userId,
            [FromQuery, Required] string searchTerm,
            [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] includeItemTypes,
            [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] BaseItemKind[] excludeItemTypes,
            [FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] string[] mediaTypes,
            [FromQuery] Guid?parentId,
            [FromQuery] bool?isMovie,
            [FromQuery] bool?isSeries,
            [FromQuery] bool?isNews,
            [FromQuery] bool?isKids,
            [FromQuery] bool?isSports,
            [FromQuery] bool includePeople  = true,
            [FromQuery] bool includeMedia   = true,
            [FromQuery] bool includeGenres  = true,
            [FromQuery] bool includeStudios = true,
            [FromQuery] bool includeArtists = true)
        {
            var result = _searchEngine.GetSearchHints(new SearchQuery
            {
                Limit            = limit,
                SearchTerm       = searchTerm,
                IncludeArtists   = includeArtists,
                IncludeGenres    = includeGenres,
                IncludeMedia     = includeMedia,
                IncludePeople    = includePeople,
                IncludeStudios   = includeStudios,
                StartIndex       = startIndex,
                UserId           = userId ?? Guid.Empty,
                IncludeItemTypes = includeItemTypes,
                ExcludeItemTypes = excludeItemTypes,
                MediaTypes       = mediaTypes,
                ParentId         = parentId,

                IsKids   = isKids,
                IsMovie  = isMovie,
                IsNews   = isNews,
                IsSeries = isSeries,
                IsSports = isSports
            });

            return(new SearchHintResult
            {
                TotalRecordCount = result.TotalRecordCount,
                SearchHints = result.Items.Select(GetSearchHintResult).ToArray()
            });
        }
예제 #4
0
        public ActionResult <SearchHintResult> Get(
            [FromQuery] int?startIndex,
            [FromQuery] int?limit,
            [FromQuery] Guid?userId,
            [FromQuery, Required] string searchTerm,
            [FromQuery] string?includeItemTypes,
            [FromQuery] string?excludeItemTypes,
            [FromQuery] string?mediaTypes,
            [FromQuery] string?parentId,
            [FromQuery] bool?isMovie,
            [FromQuery] bool?isSeries,
            [FromQuery] bool?isNews,
            [FromQuery] bool?isKids,
            [FromQuery] bool?isSports,
            [FromQuery] bool includePeople  = true,
            [FromQuery] bool includeMedia   = true,
            [FromQuery] bool includeGenres  = true,
            [FromQuery] bool includeStudios = true,
            [FromQuery] bool includeArtists = true)
        {
            var result = _searchEngine.GetSearchHints(new SearchQuery
            {
                Limit            = limit,
                SearchTerm       = searchTerm,
                IncludeArtists   = includeArtists,
                IncludeGenres    = includeGenres,
                IncludeMedia     = includeMedia,
                IncludePeople    = includePeople,
                IncludeStudios   = includeStudios,
                StartIndex       = startIndex,
                UserId           = userId ?? Guid.Empty,
                IncludeItemTypes = RequestHelpers.Split(includeItemTypes, ',', true),
                ExcludeItemTypes = RequestHelpers.Split(excludeItemTypes, ',', true),
                MediaTypes       = RequestHelpers.Split(mediaTypes, ',', true),
                ParentId         = parentId,

                IsKids   = isKids,
                IsMovie  = isMovie,
                IsNews   = isNews,
                IsSeries = isSeries,
                IsSports = isSports
            });

            return(new SearchHintResult
            {
                TotalRecordCount = result.TotalRecordCount,
                SearchHints = result.Items.Select(GetSearchHintResult).ToArray()
            });
        }
예제 #5
0
        /// <summary>
        /// Gets the search hints async.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Task{IEnumerable{SearchHintResult}}.</returns>
        private async Task <SearchHintResult> GetSearchHintsAsync(GetSearchHints request)
        {
            var result = await _searchEngine.GetSearchHints(new SearchQuery
            {
                Limit          = request.Limit,
                SearchTerm     = request.SearchTerm,
                IncludeArtists = request.IncludeArtists,
                IncludeGenres  = request.IncludeGenres,
                IncludeMedia   = request.IncludeMedia,
                IncludePeople  = request.IncludePeople,
                IncludeStudios = request.IncludeStudios,
                StartIndex     = request.StartIndex,
                UserId         = request.UserId
            }).ConfigureAwait(false);

            return(new SearchHintResult
            {
                TotalRecordCount = result.TotalRecordCount,

                SearchHints = result.Items.Select(GetSearchHintResult).ToArray()
            });
        }