/// <summary> /// Creates an Instance of the TwitchAPI 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 TwitchAPI(ILoggerFactory loggerFactory = null, IRateLimiter rateLimiter = null, IApiSettings settings = null, IHttpCallHandler http = null) { _logger = loggerFactory?.CreateLogger <TwitchAPI>(); var _rateLimiter = rateLimiter ?? BypassLimiter.CreateLimiterBypassInstance(); var _http = http ?? new TwitchHttpClient(loggerFactory?.CreateLogger <TwitchHttpClient>()); Settings = settings ?? new ApiSettings(); Helix = new Helix.Helix(loggerFactory, rateLimiter, Settings, _http); V5 = new V5.V5(loggerFactory, _rateLimiter, Settings, _http); ThirdParty = new ThirdParty.ThirdParty(Settings, _rateLimiter, _http); Undocumented = new Undocumented(Settings, _rateLimiter, _http); }
/// <summary> /// Creates an Instance of the TwitchAPI 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 TwitchAPI(ILoggerFactory loggerFactory = null, IRateLimiter rateLimiter = null, IApiSettings settings = null, IHttpCallHandler http = null) { _logger = loggerFactory?.CreateLogger <TwitchAPI>(); rateLimiter = rateLimiter ?? BypassLimiter.CreateLimiterBypassInstance(); http = http ?? new TwitchHttpClient(loggerFactory?.CreateLogger <TwitchHttpClient>()); Settings = settings ?? new ApiSettings(); Auth = new Auth.Auth(Settings, rateLimiter, http); Helix = new Helix.Helix(loggerFactory, rateLimiter, Settings, http); ThirdParty = new ThirdParty.ThirdParty(Settings, rateLimiter, http); Undocumented = new Undocumented(Settings, rateLimiter, http); Settings.PropertyChanged += SettingsPropertyChanged; }