Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 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);
 }