Video adding and subscriptions finished

This commit is contained in:
2022-05-11 20:50:50 +02:00
Unverified
parent 7a57fb65f3
commit 7acaeb24de
92 changed files with 3917 additions and 3314 deletions

View File

@@ -0,0 +1,32 @@
using System.Net;
using System.Threading.Tasks;
using VDownload.Core.Exceptions;
namespace VDownload.Core.Services.Sources.Twitch.Helpers
{
internal static class Client
{
internal static async Task<WebClient> Helix()
{
string accessToken = await Authorization.ReadAccessTokenAsync();
if (accessToken == null) throw new TwitchAccessTokenNotFoundException();
var twitchAccessTokenValidation = await Authorization.ValidateAccessTokenAsync(accessToken);
if (!twitchAccessTokenValidation.IsValid) throw new TwitchAccessTokenNotValidException();
WebClient client = new WebClient();
client.Headers.Add("Authorization", $"Bearer {accessToken}");
client.Headers.Add("Client-Id", Authorization.ClientID);
return client;
}
internal static WebClient GQL()
{
WebClient client = new WebClient();
client.Headers.Add("Client-Id", Authorization.GQLApiClientID);
return client;
}
}
}