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")); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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)))); }
/// <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))); }
/// <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))); }