Ejemplo n.º 1
0
        public static TwitterStatusMessageResponse PostTweet(object OAuthValue, string tweet)
        {
            TwitterOAuthData twitter = OAuthValue as TwitterOAuthData;

            // Check whether the OAuth data is valid
            if (twitter != null && twitter.IsValid)
            {
                // Gets an instance of TwitterService based on the OAuth data
                TwitterService service = twitter.GetService();
                // Post tweet
                TwitterStatusMessageResponse response = service.Statuses.PostStatusMessage(tweet);
                // Return response if successful
                return(response);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public static IEnumerable <TwitterStatusMessage> GetLastestTwitterPosts(object OAuthValue)
        {
            // Check whether the OAuth data is valid
            TwitterOAuthData twitter = OAuthValue as TwitterOAuthData;

            // Check whether the OAuth data is valid
            if (twitter != null && twitter.IsValid)
            {
                // Gets an instance of TwitterService based on the OAuth data
                TwitterService service = twitter.GetService();

                // Get information about the authenticated user
                TwitterUser user = service.Users.GetUser(twitter.Id).Body;

                // Get recent status messages (tweets) from the authenticated user
                return(service.Statuses.GetUserTimeline(user.Id).Body);
            }
            return(null);
        }