Exemple #1
0
        /// <summary>
        /// Creates an Instance of the Helix Class.
        /// </summary>
        /// <param name="loggerFactory">Instance Of LoggerFactory, otherwise no logging is used, </param>
        /// <param name="rateLimiter">Instance Of RateLimiter, otherwise no ratelimiter is used.</param>
        /// <param name="settings">Instance of ApiSettings, otherwise defaults used, can be changed later</param>
        /// <param name="http">Instance of HttpCallHandler, otherwise default handler used</param>
        public Helix(ILoggerFactory loggerFactory = null, IRateLimiter rateLimiter = null, IApiSettings settings = null, IHttpCallHandler http = null)
        {
            _logger     = loggerFactory?.CreateLogger <Helix>();
            rateLimiter = rateLimiter ?? BypassLimiter.CreateLimiterBypassInstance();
            http        = http ?? new TwitchHttpClient(loggerFactory?.CreateLogger <TwitchHttpClient>());
            Settings    = settings ?? new ApiSettings();

            Analytics     = new Analytics(Settings, rateLimiter, http);
            Ads           = new Ads(Settings, rateLimiter, http);
            Bits          = new Bits(Settings, rateLimiter, http);
            Chat          = new Chat(Settings, rateLimiter, http);
            Channels      = new Channels(Settings, rateLimiter, http);
            ChannelPoints = new ChannelPoints(Settings, rateLimiter, http);
            Clips         = new Clips(Settings, rateLimiter, http);
            Entitlements  = new Entitlements(Settings, rateLimiter, http);
            EventSub      = new EventSub(Settings, rateLimiter, http);
            Extensions    = new Extensions(Settings, rateLimiter, http);
            Games         = new Games(Settings, rateLimiter, http);
            HypeTrain     = new HypeTrain(Settings, rateLimiter, http);
            Moderation    = new Moderation(Settings, rateLimiter, http);
            Polls         = new Polls(Settings, rateLimiter, http);
            Predictions   = new Predictions(Settings, rateLimiter, http);
            Schedule      = new Schedule(Settings, rateLimiter, http);
            Search        = new Search(Settings, rateLimiter, http);
            Streams       = new Streams(Settings, rateLimiter, http);
            Subscriptions = new Subscriptions(Settings, rateLimiter, http);
            Tags          = new Tags(Settings, rateLimiter, http);
            Teams         = new Teams(Settings, rateLimiter, http);
            Users         = new Users(Settings, rateLimiter, http);
            Videos        = new Videos(Settings, rateLimiter, http);
            Webhooks      = new Webhooks(Settings, rateLimiter, http);
        }
        /// <summary>
        /// Creates an Instance of the Helix Class.
        /// </summary>
        /// <param name="loggerFactory">Instance Of LoggerFactory, otherwise no logging is used, </param>
        /// <param name="rateLimiter">Instance Of RateLimiter, otherwise no ratelimiter is used.</param>
        /// <param name="settings">Instance of ApiSettings, otherwise defaults used, can be changed later</param>
        /// <param name="http">Instance of HttpCallHandler, otherwise default handler used</param>
        public Helix(ILoggerFactory loggerFactory = null, IRateLimiter rateLimiter = null, IApiSettings settings = null, IHttpCallHandler http = null)
        {
            _logger     = loggerFactory?.CreateLogger <Helix>();
            rateLimiter = rateLimiter ?? BypassLimiter.CreateLimiterBypassInstance();
            http        = http ?? new TwitchHttpClient(loggerFactory?.CreateLogger <TwitchHttpClient>());
            Settings    = settings ?? new ApiSettings();

            Analytics    = new Analytics(Settings, rateLimiter, http);
            Bits         = new Bits(Settings, rateLimiter, http);
            Clips        = new Clips(Settings, rateLimiter, http);
            Entitlements = new Entitlements(Settings, rateLimiter, http);
            Games        = new Games(Settings, rateLimiter, http);
            Streams      = new Streams(Settings, rateLimiter, http);
            Users        = new Users(Settings, rateLimiter, http);
            Videos       = new Videos(Settings, rateLimiter, http);
            Webhooks     = new Webhooks(Settings, rateLimiter, http);
        }