Ejemplo n.º 1
0
        public static IObservable<Tuple<AccessToken, ApiResponse<User>>> AccountGenerate(
            this AccessToken info,
            Consumer newConsumer,
            string screenName,
            string email,
            string password,
            string name,
            string lang = null,
            string timeZone = null)
        {
            var param = new ParameterCollection()
            {
                {"screen_name", screenName},
                {"email", email},
                {"password", password},
                {"name", name},
                {"lang", lang},
                {"time_zone", timeZone}
            };

            return info
                .GetClient()
                .SetEndpoint(Endpoints.AccountGenerate, HttpMethod.Post)
                .SetParameters(param)
                .GetResponse()
                .ReadResponse<User>()
                .Select(res =>
                {
                    string accessToken = res.ResponseHeaders["X-Twitter-New-Account-OAuth-Access-Token"].First();
                    string accessSecret = res.ResponseHeaders["X-Twitter-New-Account-OAuth-Secret"].First();

                    return new Tuple<AccessToken, ApiResponse<User>>(new AccessToken(newConsumer, accessToken, accessSecret), res);
                });
        }
Ejemplo n.º 2
0
 public OAuthMessageHandler(Consumer consumer, TokenBase token, string realm, IEnumerable<Parameter> addParam, HttpMessageHandler innerHandler)
     : base(innerHandler)
 {
     _Consumer = consumer;
     _Token = token;
     _AddParam = addParam;
     _Realm = realm;
 }
Ejemplo n.º 3
0
        protected TokenBase(Consumer consumer, string token, string secret)
        {
            if (consumer == null)
            {
                throw new ArgumentNullException("consumer");
            }
            if (token == null)
            {
                throw new ArgumentNullException("token");
            }
            if (secret == null)
            {
                throw new ArgumentNullException("secret");
            }

            this.Consumer = consumer;
            this.Token = token;
            this.Secret = secret;
        }
Ejemplo n.º 4
0
        // Signup
        public IObservable<AccessToken> Signup(Consumer newConsumer, string screenName, string email, string password, string fullname, string lang, string timeZone)
        {
            var parameters = new ParameterCollection
            {
                { "screen_name", screenName },
                { "email", email },
                { "password", password },
                { "fullname", fullname },
                { "lang", lang },
                { "time_zone", timeZone }
            };

            return OAuthCommon.GetTokenResponse(
                consumer: this,
                token: null,
                url: Endpoints.OAuthSignupUrl,
                parameters: parameters,
                tokenFactory: (key, secret) => new AccessToken(newConsumer, key, secret),
                realm: "http://api.twitter.com/");
        }
Ejemplo n.º 5
0
 public RequestToken(Consumer consumer, string token, string secret)
     : base(consumer, token, secret)
 {
 }
Ejemplo n.º 6
0
 public AccessToken(Consumer consumer, string token, string secret)
     : base(consumer, token, secret)
 {
 }
Ejemplo n.º 7
0
 public OAuthClient(Consumer consumer, TokenBase token)
 {
     _Consumer = consumer;
     _OAuthToken = token;
 }