public override DelegatingHandler Setup(TumblrClientDetail clientDetail, TumblrClientCredentials client, HttpMessageHandler handler)
        {
            if (string.IsNullOrWhiteSpace(AccessToken))
            {
                clientDetail.UseApiKey = true;
            }

            return(handler == null ? new OAuth2HeaderHandler(this) : new OAuth2HeaderHandler(this, handler));
        }
Example #2
0
        public override DelegatingHandler Setup(TumblrClientDetail clientDetail, TumblrClientCredentials client, HttpMessageHandler handler)
        {
            if (string.IsNullOrWhiteSpace(Key) || string.IsNullOrWhiteSpace(Secret))
            {
                clientDetail.UseApiKey = true;
            }
            else
            {
                clientDetail.AccessToken = new AccessToken(Key, Secret);
            }

            return(handler == null
                ? new OAuthMessageHandler(client, clientDetail.AccessToken)
                : new OAuthMessageHandler(handler, client, clientDetail.AccessToken));
        }
        public TumblrClient(HttpMessageHandler handler, TumblrClientCredentials client, TumblrBaseCredentials token)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            ClientDetail = new TumblrClientDetail
            {
                ClientCreds = client
            };

            if (token != null)
            {
                handler = token.Setup(ClientDetail, client, handler);
            }
            else
            {
                ClientDetail.UseApiKey = true;
            }

            ClientDetail.Client  = handler == null ? new HttpClient() : new HttpClient(handler);
            ClientDetail.OnError = HandleError;
        }
Example #4
0
 public TumblrPostMethods(Post post, TumblrClientDetail clientDetail)
 {
     Post         = post;
     ClientDetail = clientDetail;
 }
 public static Dictionary <string, string> AddNpf(this Dictionary <string, string> query, TumblrClientDetail detail, string key = "npf")
 {
     if (detail.UseNpf)
     {
         query.Add(key, true.ToString().ToLower());
     }
     return(query);
 }
 public TumblrBlogMethods(string blogName, TumblrClientDetail clientDetail)
 {
     BlogName     = blogName;
     FullBlogName = $"{blogName}{(!blogName.Contains(".") ? ".tumblr.com" : string.Empty)}";
     ClientDetail = clientDetail;
 }
Example #7
0
 public abstract DelegatingHandler Setup(TumblrClientDetail clientDetail, TumblrClientCredentials client,
                                         HttpMessageHandler handler);
Example #8
0
 public TumblrUserMethods(TumblrClientDetail detail)
 {
     ClientDetail = detail;
 }