コード例 #1
0
        public async Task <bool> Run(string tweetText)
        {
            bool   isTweetSuccess = false;
            string twitterURL     = "https://api.twitter.com/1.1/statuses/update.json";

            string oauth_token        = "oauth_token";
            string oauth_token_secret = "oauth_token_secret";

            // create oauth signature
            //string baseFormat = "oauth_consumer_key={0}&oauth_nonce={1}&oauth_signature_method={2}" + "&oauth_timestamp={3}&oauth_token={4}&oauth_version={5}&status={6}";

            //string baseString = string.Format(
            //    baseFormat,
            //    oauth_consumer_key,
            //    oauth_nonce,
            //    oauth_signature_method,
            //    oauth_timestamp, oauth_token,
            //    oauth_version,
            //    Uri.EscapeDataString(tweetText)
            //);

            string authHeader = TwitterCommonServices.GetRequestAuthHeader(twitterURL, "POST", oauth_token, oauth_token_secret);

            var response = TwitterCommonServices.ProcessWebRequest(authHeader, "GET", twitterURL);

            return(isTweetSuccess);
        }
コード例 #2
0
        public List <TwitterUserTweeModel> Run(string tweetId)
        {
            List <TwitterUserTweeModel> userTweets = new List <TwitterUserTweeModel>();

            string resourceUrlFormat = "https://api.twitter.com/1.1/statuses/retweets/{0}.json";
            var    retweetsUrl       = string.Format(resourceUrlFormat, tweetId);

            // oauth application keys
            var oauth_token        = "xxx";
            var oauth_token_secret = "xxx";

            string authHeader = TwitterCommonServices.GetRequestAuthHeader(retweetsUrl, "GET", oauth_token, oauth_token_secret);
            var    response   = TwitterCommonServices.ProcessWebRequest(authHeader, "GET", retweetsUrl);

            return(userTweets);
        }
コード例 #3
0
        public List <TwitterUserTweeModel> Run(string screen_name, int maxNumberOfTweets)
        {
            List <TwitterUserTweeModel> userTweets = new List <TwitterUserTweeModel>();

            string resource_url = "https://api.twitter.com/1.1/statuses/user_timeline.json";

            // oauth application keys
            var oauth_token        = "xxx";
            var oauth_token_secret = "xxx";

            string authHeader = TwitterCommonServices.GetRequestAuthHeader(resource_url, "GET", oauth_token, oauth_token_secret);

            // make the request
            var postBody = "screen_name =" + Uri.EscapeDataString(screen_name) + "&count =" + maxNumberOfTweets;

            resource_url += "?" + postBody;

            var response = TwitterCommonServices.ProcessWebRequest(authHeader, "GET", resource_url);

            return(userTweets);
        }