using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using VDownload.Common; using VDownload.Common.Exceptions; using VDownload.Common.Models; using VDownload.Common.Services; using VDownload.Services.HttpClient; using VDownload.Sources.Twitch.Api; using VDownload.Sources.Twitch.Api.GQL.GetVideoToken.Response; using VDownload.Sources.Twitch.Api.Helix.GetVideos.Response; using VDownload.Sources.Twitch.Authentication; using VDownload.Sources.Twitch.Configuration; namespace VDownload.Sources.Twitch.Search { public interface ITwitchSearchService : ISourceSearchService { Task SearchVideo(string url); Task SearchPlaylist(string url, int maxVideoCount); } public class TwitchSearchService : ITwitchSearchService { #region SERVICES private readonly TwitchApiHelixConfiguration _apiHelixConfiguration; private readonly TwitchApiGQLConfiguration _apiGQLConfiguration; private readonly TwitchSearchConfiguration _searchConfiguration; private readonly ITwitchApiService _apiService; private readonly ITwitchAuthenticationService _twitchAuthenticationService; #endregion #region CONSTRUCTORS public TwitchSearchService(TwitchConfiguration configuration, ITwitchApiService apiService, ITwitchAuthenticationService twitchAuthenticationService) { _apiHelixConfiguration = configuration.Api.Helix; _apiGQLConfiguration = configuration.Api.GQL; _searchConfiguration = configuration.Search; _apiService = apiService; _twitchAuthenticationService = twitchAuthenticationService; } #endregion #region PUBLIC METHODS async Task