new_version_init
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiAuthConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string TokenSchema { get; protected set; }
|
||||
public string ClientId { get; protected set; }
|
||||
public TwitchApiAuthEndpointsConfiguration Endpoints { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiAuthConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
TokenSchema = configuration["token_schema"];
|
||||
ClientId = configuration["client_id"];
|
||||
Endpoints = new TwitchApiAuthEndpointsConfiguration(configuration.GetSection("endpoints"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiAuthEndpointsConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string Validate { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiAuthEndpointsConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
Validate = configuration["validate"];
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public TwitchApiAuthConfiguration Auth { get; protected set; }
|
||||
public TwitchApiHelixConfiguration Helix { get; protected set; }
|
||||
public TwitchApiGQLConfiguration GQL { get; protected set; }
|
||||
public TwitchApiUsherConfiguration Usher { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
Auth = new TwitchApiAuthConfiguration(configuration.GetSection("auth"));
|
||||
Helix = new TwitchApiHelixConfiguration(configuration.GetSection("helix"));
|
||||
GQL = new TwitchApiGQLConfiguration(configuration.GetSection("gql"));
|
||||
Usher = new TwitchApiUsherConfiguration(configuration.GetSection("usher"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiGQLConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string ClientId { get; protected set; }
|
||||
public string Endpoint { get; protected set; }
|
||||
public TwitchApiGQLQueriesConfiguration Queries { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiGQLConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
ClientId = configuration["client_id"];
|
||||
Endpoint = configuration["endpoint"];
|
||||
Queries = new TwitchApiGQLQueriesConfiguration(configuration.GetSection("queries"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiGQLQueriesConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public TwitchApiGQLQueriesQueryExtendedConfiguration GetVideoToken { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiGQLQueriesConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
GetVideoToken = new TwitchApiGQLQueriesQueryExtendedConfiguration(configuration.GetSection("get_video_token"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiGQLQueriesQueryConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string Query { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiGQLQueriesQueryConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
Query = configuration["query"];
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiGQLQueriesQueryExtendedConfiguration : TwitchApiGQLQueriesQueryConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string OperationName { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiGQLQueriesQueryExtendedConfiguration(IConfigurationSection configuration) : base(configuration)
|
||||
{
|
||||
OperationName = configuration["operation_name"];
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiHelixConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string TokenSchema { get; protected set; }
|
||||
public string ClientId { get; protected set; }
|
||||
public TwitchApiHelixEndpointsConfiguration Endpoints { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiHelixConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
TokenSchema = configuration["token_schema"];
|
||||
ClientId = configuration["client_id"];
|
||||
Endpoints = new TwitchApiHelixEndpointsConfiguration(configuration.GetSection("endpoints"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiHelixEndpointsConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string GetVideos { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiHelixEndpointsConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
GetVideos = configuration["get_videos"];
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiUsherConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public TwitchApiUsherEndpointsConfiguration Endpoints { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiUsherConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
Endpoints = new TwitchApiUsherEndpointsConfiguration(configuration.GetSection("endpoints"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchApiUsherEndpointsConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string GetVideoPlaylist { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchApiUsherEndpointsConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
GetVideoPlaylist = configuration["get_video_playlist"];
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchAuthenticationConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string Url { get; protected set; }
|
||||
public string RedirectUrl { get; protected set; }
|
||||
public Regex RedirectUrlRegex { get; protected set; }
|
||||
public string ClientId { get; protected set; }
|
||||
public string ResponseType { get; protected set; }
|
||||
public IEnumerable<string> Scopes { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchAuthenticationConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
Url = configuration["url"];
|
||||
RedirectUrl = configuration["redirect_url"];
|
||||
RedirectUrlRegex = new Regex(configuration["redirect_url_regex"]);
|
||||
ClientId = configuration["client_id"];
|
||||
ResponseType = configuration["response_type"];
|
||||
Scopes = configuration.GetSection("scopes").Get<IEnumerable<string>>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public TwitchApiConfiguration Api { get; protected set; }
|
||||
public TwitchSearchConfiguration Search { get; protected set; }
|
||||
public TwitchAuthenticationConfiguration Authentication { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public TwitchConfiguration(IConfiguration configuration)
|
||||
{
|
||||
IConfigurationSection section = configuration.GetSection("sources").GetSection("twitch");
|
||||
Api = new TwitchApiConfiguration(section.GetSection("api"));
|
||||
Search = new TwitchSearchConfiguration(section.GetSection("search"));
|
||||
Authentication = new TwitchAuthenticationConfiguration(section.GetSection("authentication"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VDownload.Sources.Twitch.Configuration
|
||||
{
|
||||
public class TwitchSearchConfiguration
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public IEnumerable<Regex> GeneralRegexes { get; protected set; }
|
||||
public IEnumerable<Regex> VodRegexes { get; protected set; }
|
||||
public Regex VodStreamPlaylistRegex { get; protected set; }
|
||||
public int VodThumbnailWidth { get; protected set; }
|
||||
public int VodThumbnailHeight { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
internal TwitchSearchConfiguration(IConfigurationSection configuration)
|
||||
{
|
||||
GeneralRegexes = configuration.GetSection("general_regexes").Get<IEnumerable<string>>().Select(x => new Regex(x));
|
||||
VodRegexes = configuration.GetSection("vod_regexes").Get<IEnumerable<string>>().Select(x => new Regex(x));
|
||||
VodStreamPlaylistRegex = new Regex(configuration["vod_stream_playlist_regex"]);
|
||||
VodThumbnailWidth = int.Parse(configuration["vod_thumbnail_width"]);
|
||||
VodThumbnailHeight = int.Parse(configuration["vod_thumbnail_height"]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user