Helper Methods
Note: Current version does not support the full Twitter API.
The helper mainly consists of a Twitter.cshtml file that should be placed in the App_Code folder of your WebMatrix site, a TwitterApi.dll library to be added to the Bin folder, and a Twitter folder with styles and pages for handling authentication.
Method | Requires Initialization | |
---|---|---|
static void | Initialize (string consumerKey, string consumerSecret) | - |
Initializes the Twitter helper with the consumer key and secret values. Initialization is required to access the Twitter API methods. | ||
static OAuthToken | GetAccessToken () | Yes |
Returns the Access Token. This method should be called in the page corresponding to the callback url. | ||
static List<Status> | GetPublicTimeline ([bool trimUser], [bool includeEntities]) | Yes |
Returns the most recent statuses, including retweets if they exist, from non-protected users. | ||
static List<Status> | GetHomeTimeline (string token, string secret, [long sinceId], [long maxId], [int count], [int page], [bool trimUser], [bool includeEntities]) | Yes |
Returns the most recent statuses, including retweets if they exist, posted by the authenticating user and the user's they follow. | ||
static List<Status> | GetFriendsTimeline (string token, string secret, [long sinceId], [long maxId], [int count], [int page], [bool trimUser], [bool includeRetweets], [bool includeEntities]) | Yes |
Returns the most recent statuses posted by the authenticating user and the user's they follow. This method is identical to GetHomeTimeline(), except that this method will only include retweets if the includeRetweets parameter is set. | ||
static List<Status> | GetUserTimeline (string token, string secret, [long userId], [string screenName], [long sinceId], [long maxId], [int count], [int page], [bool trimUser], [bool includeRetweets], [bool includeEntities]) | Yes |
Returns the most recent statuses posted by the authenticating user. It is also possible to request another user's timeline by using the screen_name or user_id parameter. The other users timeline will only be visible if they are not protected, or if the authenticating user's follow request was accepted by the protected user. | ||
static List<Status> | GetUserTimeline ([long userId], [string screenName], [long sinceId], [long maxId], [int count], [int page], [bool trimUser], [bool includeRetweets], [bool includeEntities]) | Yes |
Returns the timeline of the specified user. The user's timeline will only be visible if they are not protected. | ||
static List<Status> | GetMentions (string token, string secret, [long sinceId], [long maxId], [int count], [int page], [bool trimUser], [bool includeRetweets], [bool includeEntities]) | Yes |
Returns the most recent mentions (status containing @username) for the authenticating user. | ||
static List<Retweet> | GetRetweetedByMe (string token, string secret, [long sinceId], [long maxId], [int count], [int page], [bool trimUser], [bool includeEntities]) | Yes |
Returns the most recent retweets posted by the authenticating user. | ||
static List<Retweet> | GetRetweetedToMe (string token, string secret, [long sinceId], [long maxId], [int count], [int page], [bool trimUser], [bool includeEntities]) | Yes |
Returns the most recent retweets posted by users the authenticating user follow. | ||
static List<Status> | GetRetweetsOfMe (string token, string secret, [long sinceId], [long maxId], [int count], [int page], [bool trimUser], [bool includeEntities]) | Yes |
Returns the most recent tweets of the authenticated user that have been retweeted by others. | ||
static DateTime | ParseDateTime (string date) | Yes |
Converts a datetime string from Twitter to a DateTime object. | ||
@helper | LoginButton ([string callbackUrl], [string buttonStyle], [string buttonSize]) | Yes |
Shows the Twitter login button. | ||
@helper | TweetButton ([DataCount dataCount], [string tweetText], [string url], [Languages language], [string username], [string relatedUsername], [string relatedUserDescription]) | No |
Shows the Tweet button. | ||
@helper | FollowButton (string username, [FollowStyles followStyle], [FollowColors followColor]) | No |
Shows the Follow button. | ||
@helper | Profile (string username, [int width], [int height], [string backgroundShellColor], [string shellColor], [string tweetsBackgroundColor], [string tweetsColor], [string tweetsLinksColor], [int numberOfTweets], [bool scrollBar], [bool loop], [bool live], [bool hashTags], [bool timestamp], [bool avatars], [WidgetBehaviors behavior], [int interval]) | No |
Shows the Twitter Profile widget. | ||
@helper | Search (string searchQuery, [int width], [int height], [string title], [string caption], [string backgroundShellColor], [string shellColor], [string tweetsBackgroundColor], [string tweetsColor], [string tweetsLinksColor], [bool scrollBar], [bool loop], [bool live], [bool hashTags], [bool timestamp], [bool avatars], [bool topTweets], [WidgetBehaviors behavior], [int interval]) | No |
Shows the Twitter Search widget. | ||
@helper | Faves (string username, [int width], [int height], [string title], [string caption], [string backgroundShellColor], [string shellColor], [string tweetsBackgroundColor], [string tweetsColor], [string tweetsLinksColor], [int numberOfTweets], [bool scrollBar], [bool loop], [bool live], [bool hashTags], [bool timestamp], [bool avatars], [bool topTweets], [WidgetBehaviors behavior], [int interval]) | No |
Shows the Twitter List widget. | ||
@helper | List (string username, string list, [int width], [int height], [string title], [string caption], [string backgroundShellColor], [string shellColor], [string tweetsBackgroundColor], [string tweetsColor], [string tweetsLinksColor], [int numberOfTweets], [bool scrollBar], [bool loop], [bool live], [bool hashTags], [bool timestamp], [bool avatars], [bool topTweets], [WidgetBehaviors behavior], [int interval]) | No |
Shows the Twitter List widget. | ||