예제 #1
0
        public void Authenticate(IRecepient recepient)
        {
            //get request_token

            _client.Authenticator = RestSharp.Authenticators.OAuth1Authenticator.ForRequestToken(_authInfo.ConsumerKey, _authInfo.ConsumerSecret, _authInfo.CallbackUrl);
            var request = new ShyBotRestRequest(_authInfo.AuthRequestTokenUrl, Method.POST, recepient);

            _client.ExecuteAsync(request, Authenticate_CallBack);
        }
예제 #2
0
        public void GetTwittsByTag(string tag, IRecepient recepient, Twitt lastTwitt = null)
        {
            //get data

            _client.Authenticator = RestSharp.Authenticators.OAuth1Authenticator.ForProtectedResource(_authInfo.ConsumerKey, _authInfo.ConsumerSecret, _authInfo.OauthToken, _authInfo.OauthTokenSecret);
            var request = new ShyBotRestRequest("1.1/search/tweets.json", Method.GET, recepient);

            request.AddParameter("q", tag);
            if (lastTwitt != null)
            {
                request.AddParameter("max_id", lastTwitt.id_str);
            }

            _client.ExecuteAsync(request, GetTwittsByTag_CallBack);
        }
예제 #3
0
        public void Authorize(string query, IRecepient recepient)
        {
            //authorize user
            if (query.Contains("oauth_verifier"))
            {
                _authParser.ParseResponse(query);


                _client.Authenticator = RestSharp.Authenticators.OAuth1Authenticator.ForAccessToken(_authInfo.ConsumerKey, _authInfo.ConsumerSecret, _authInfo.OauthToken,
                                                                                                    _authInfo.OauthTokenSecret, _authInfo.OauthVerifier);
                var request = new ShyBotRestRequest(_authInfo.AuthAccessTokenUrl, Method.POST, recepient);

                _client.ExecuteAsync(request, Authorize_CallBack);
            }
        }