示例#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);
        }
        public IHttpActionResult TweetThis(TweetInstruction tweetInstruction)
        {
            try
            {
                //read authenticated twitter account details
                var twitterAccount = getTwitterAccount(tweetInstruction.ContentId);

                if (twitterAccount != null)
                {
                    //get twitter service using authenticated twitter details
                    TwitterService service = twitterAccount.GetService();
                    TwitterStatusMessageResponse response = service.Statuses.PostStatusMessage(tweetInstruction.Message);
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(typeof(TweetThisApiController), "Error Tweeting Message", ex);
            }
            return(BadRequest("Error"));
        }
示例#3
0
 /// <summary>
 /// Posts the specified status message.
 /// </summary>
 /// <param name="options">The options for the call to the API.</param>
 public TwitterStatusMessageResponse PostStatusMessage(TwitterPostStatusMessageOptions options)
 {
     return(TwitterStatusMessageResponse.ParseResponse(Raw.PostStatusMessage(options)));
 }
示例#4
0
 /// <summary>
 /// Posts the specified status message.
 /// </summary>
 /// <param name="status">The status message to send.</param>
 /// <param name="replyTo">The ID of the status message to reply to.</param>
 public TwitterStatusMessageResponse PostStatusMessage(string status, long?replyTo)
 {
     return(TwitterStatusMessageResponse.ParseResponse(Raw.PostStatusMessage(status, replyTo)));
 }
示例#5
0
 /// <summary>
 /// Posts the specified status message.
 /// </summary>
 /// <param name="status">The status message to send.</param>
 public TwitterStatusMessageResponse PostStatusMessage(string status)
 {
     return(TwitterStatusMessageResponse.ParseResponse(Raw.PostStatusMessage(status)));
 }
示例#6
0
 /// <summary>
 /// Gets information about a status message (tweet) with the specified ID.
 /// </summary>
 /// <param name="statusId">The ID of the status message.</param>
 public TwitterStatusMessageResponse GetStatusMessage(long statusId)
 {
     return(TwitterStatusMessageResponse.ParseResponse(Raw.GetStatusMessage(new TwitterStatusMessageOptions(statusId))));
 }
示例#7
0
 /// <summary>
 /// Destroys the status with the specified <code>id</code>. The authenticating user must be the author of the
 /// specified status. Returns the destroyed status if successful.
 /// </summary>
 /// <param name="id">The ID of the status to be destroyed.</param>
 /// <param name="trimUser">When set to <code>true</code>, each tweet returned in a timeline will include a user
 /// object including only the status authors numerical ID. Omit this parameter to receive the complete user
 /// object.</param>
 /// <returns>Returns the response from the API.</returns>
 public TwitterStatusMessageResponse DestroyStatusMessage(long id, bool trimUser)
 {
     return(TwitterStatusMessageResponse.ParseResponse(Raw.DestroyStatusMessage(id, trimUser)));
 }
示例#8
0
 /// <summary>
 /// Retweets the status with the specified <code>id</code>.
 /// </summary>
 /// <param name="id">The ID of the tweet to be retweeted.</param>
 /// <param name="trimUser">When set to <code>true</code>, each tweet returned in a timeline will include a user
 /// object including only the status authors numerical ID. Omit this parameter to receive the complete user
 /// object.</param>
 /// <returns>Returns the response from the API.</returns>
 public TwitterStatusMessageResponse Retweet(long id, bool trimUser)
 {
     return(TwitterStatusMessageResponse.ParseResponse(Raw.Retweet(id, trimUser)));
 }
 /// <summary>
 /// Un-favorites the status message with the specified <code>statusId</code> as the authenticating user.
 /// </summary>
 /// <param name="statusId">The ID of the status message.</param>
 public TwitterStatusMessageResponse Destroy(long statusId)
 {
     return(TwitterStatusMessageResponse.ParseResponse(Raw.Destroy(statusId)));
 }
 /// <summary>
 /// Favorites the status message with the specified <code>statusId</code> as the authenticating user.
 /// </summary>
 /// <param name="statusId">The ID of the status message.</param>
 public TwitterStatusMessageResponse Create(long statusId)
 {
     return(TwitterStatusMessageResponse.ParseResponse(Raw.Create(statusId)));
 }