internal DisqusApiFactory(IDisqusAuthentication authentication, Uri domain) { UpdateAuthentication(authentication); var handler = new HttpClientHandler(); if (handler.SupportsAutomaticDecompression) { handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; } _client = new HttpClient(handler); _client.DefaultRequestHeaders.Referrer = domain; _client.DefaultRequestHeaders.Host = domain.DnsSafeHost; _client.DefaultRequestHeaders.UserAgent.ParseAdd(USER_AGENT); _client.DefaultRequestHeaders.Add("Origin", domain.OriginalString); }
public void UpdateAuthentication(IDisqusAuthentication authentication) { if (String.IsNullOrEmpty(authentication.AuthenticationToken)) { AuthMode = AuthenticationMode.None; } else if (authentication.AuthenticationToken == "self") { AuthMode = AuthenticationMode.Self; } else if (authentication.AuthenticationToken == "mod") { AuthMode = AuthenticationMode.Moderator; } else { AuthMode = AuthenticationMode.Authenticated; } }
public void UpdateAuthentication(IDisqusAuthentication authentication) { _authentication = authentication; }
public void UpdateAuthentication(IDisqusAuthentication authentication) { _factory.UpdateAuthentication(authentication); }
public DisqusApiService(IDisqusAuthentication authentication, Uri domain, IDisqusApiFactory factory = null) { _factory = factory ?? new DisqusApiFactory(authentication: authentication, domain: domain); }