<commit_before>﻿using TwitchDotNet.Enums;
using TwitchDotNet.Helpers;
using TwitchDotNet.Interfaces;
using System.Net.Http;
using System;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using System.Net;
using System.Threading.Tasks;

namespace TwitchDotNet.Clients {

    /// <summary>
    /// Authenticated TwitchClient
    /// Provides an interface for an authenticated session to retrieve data from Twitch API's (where authentication is required)
    /// </summary>
    public class TwitchClientAuthenticated : TwitchClient, ITwitchClientAuthenticated {

        /// <summary>
        /// Initialise HttpClient for authenticated requests
        /// </summary>
        /// <param name="_baseUrl">Base Twitch API url</param>
        /// <param name="_clientId">Client Id header</param>
        /// <param name="_oauthToken">OAuth Token header</param>
        public TwitchClientAuthenticated(string _baseUrl, string _clientId, string _oauthToken) : base(_baseUrl, _clientId) {
            // Add authentication header to HttpHelper client
            httpHelperClient.AddHttpClientHeader("Authorization", $"OAuth {_oauthToken}");
        }

        #region General - https://dev.twitch.tv/docs/v5/guides/using-the-twitch-api/

        /// <summary>
        /// Check token status using Root Url.
        /// https://dev.twitch.tv/docs/v5/guides/using-the-twitch-api#root-url
        /// </summary>
        /// <returns>Token status</returns>
        public async Task<dynamic> GetRoot() {
            var request = httpHelperClient.CreateHttpRequest($"kraken", HttpMethod.Get);
            return await httpHelperClient.ExecuteRequest(request);
        }

        #endregion

        #region ChannelFeed - Https://dev.twitch.tv/docs/v5/reference/channel-feed/

        /// <summary><commit_msg>Added ITwitchClient interface to TwitchClientAuthenticated to expose ITwitchClient base (unauth) methods<commit_after>﻿using TwitchDotNet.Enums;
using TwitchDotNet.Helpers;
using TwitchDotNet.Interfaces;
using System.Net.Http;
using System;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using System.Net;
using System.Threading.Tasks;

namespace TwitchDotNet.Clients {

    /// <summary>
    /// Authenticated TwitchClient
    /// Provides an interface for an authenticated session to retrieve data from Twitch API's (where authentication is required)
    /// </summary>
    public class TwitchClientAuthenticated : TwitchClient, ITwitchClientAuthenticated, ITwitchClient {

        /// <summary>
        /// Initialise HttpClient for authenticated requests
        /// </summary>
        /// <param name="_baseUrl">Base Twitch API url</param>
        /// <param name="_clientId">Client Id header</param>
        /// <param name="_oauthToken">OAuth Token header</param>
        public TwitchClientAuthenticated(string _baseUrl, string _clientId, string _oauthToken) : base(_baseUrl, _clientId) {
            // Add authentication header to HttpHelper client
            httpHelperClient.AddHttpClientHeader("Authorization", $"OAuth {_oauthToken}");
        }

        #region General - https://dev.twitch.tv/docs/v5/guides/using-the-twitch-api/

        /// <summary>
        /// Check token status using Root Url.
        /// https://dev.twitch.tv/docs/v5/guides/using-the-twitch-api#root-url
        /// </summary>
        /// <returns>Token status</returns>
        public async Task<dynamic> GetRoot() {
            var request = httpHelperClient.CreateHttpRequest($"kraken", HttpMethod.Get);
            return await httpHelperClient.ExecuteRequest(request);
        }

        #endregion

        #region ChannelFeed - Https://dev.twitch.tv/docs/v5/reference/channel-feed/

        /// <summary>
{'fraction_non_alphanumeric': 0.11568730325288562, 'fraction_numerical': 0.0015739769150052466, 'mean_word_length': 2.875, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7052430', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1060, 'n_words': 246}