Ejemplo n.º 1
0
        public async Task <IActionResult> Get([FromQuery] VimeoMovieTrailerQuery query)
        {
            var movieList = await mediator.Send(query);

            queue.QueueBackgroundWorkItem((token) => mediator.Send(new SaveOrUpdateMovieTrailerCommand(movieList), token));
            return(Ok(movieList));
        }
        public async Task <IEnumerable <MovieTrailer> > Handle(VimeoMovieTrailerQuery request, CancellationToken cancellationToken)
        {
            var searchResult = await httpClient
                               .GetAsync <SearchResultModel>(vimeoSettings.Value.ApiUrl +
                                                             $"?per_page={request.ItemsPerPage}&query={request.Search}",
                                                             vimeoSettings.Value.AuthorizationToken, vimeoSettings.Value.AuthorizationMethod);

            return(searchResult?.Data.Select(item => new MovieTrailer()
            {
                Link = item.Link, Title = item.Name, Provider = Vimeo
            }));
        }