static YouTubeVideoService() { _requestTypes = new VideoRequestType[] { new MyVideosRequestType(), new MyFavoritesRequestType() }; }
public async Task <List <SearchResult> > SearchVideosAsync(string searchTerm, VideoRequestType type, int page) { var videos = await _youtubeClient.SearchAsync(searchTerm, type, page); return(videos.Select(SearchResult.From).ToList()); }
public async Task <List <YouTubeSearchResult> > SearchAsync(string searchTerm, VideoRequestType type, int page) { switch (type) { case VideoRequestType.Channel: var channelResults = await new ChannelSearch().GetChannelsPaged(searchTerm, page); return(channelResults.Select(YouTubeSearchResult.From).ToList()); case VideoRequestType.Playlist: var playlistResults = await new PlaylistSearch().GetPlaylistsPaged(searchTerm, page); return(playlistResults.Select(YouTubeSearchResult.From).ToList()); default: var videoResults = await new VideoSearch().GetVideosPaged(searchTerm, page); return(videoResults.Select(YouTubeSearchResult.From).ToList()); } }