Quick Overview
Universal Apps
In addition to being compatible with Portable Class Libraries, Tweetinvi can now be used in Universal Apps!Rate Limits
- Tweetinvi provide new tools for RateLimits// Enable Tweetinvi RateLimit Handler RateLimit.UseRateLimitAwaiter = true; // Get notified when your application is being stopped to wait for RateLimits to be available RateLimit.QueryAwaitingForRateLimit += (sender, args) => { Console.WriteLine("{0} is awaiting {1}ms for RateLimit to be available", args.Query, args.ResetInMilliseconds); }; // Get the RateLimit associated with a query, this can return nullvar queryRateLimit = RateLimit.GetQueryRateLimit("https://api.twitter.com/1.1/application/rate_limit_status.json"); // Pause the current thread until the specific RateLimit can be used RateLimit.AwaitForQueryRateLimit(queryRateLimit); // This stop the execution of the current thread until the RateLimits are available RateLimit.AwaitForQueryRateLimit("https://api.twitter.com/1.1/application/rate_limit_status.json"); // Tweetinvi uses a cache mechanism to store credentials RateLimits, this operation allows you to clear it.// If the UseRateLimitAwaiter option is enabled this will result in the RateLimits to be retrieved during the next query. RateLimit.ClearRateLimitCache();
- Removed the Contributors rate limit as they are no longer provided by Twitter.
Proxy
- It is now possible to add a username and password to use a proxy.// Proxy without authentication TweetinviConfig.CURRENT_PROXY_URL = "http://198.232.247.23:4829"; // Proxy with authentication TweetinviConfig.CURRENT_PROXY_URL = "http://user:pass@198.232.247.23:4829";
Tweets
- Added Symbols Entities.var tweet = Tweet.PublishTweet("Tweetinvi 0.9.5.0 is in the $bar!"); var tweetSymbols = tweet.Entities.Symbols; var tweetSymbols = tweet.ExtendedEntities.Symbols;
Messages
- You can now specify all the parameters available in the Twitter REST API to retrieve messages// Messages Receivedvar latestMessagesReceived = Message.GetLatestMessagesReceived(); var latestMessagesReceivedParameter = Message.GenerateGetLatestsReceivedRequestParameter(); latestMessagesReceivedParameter.SinceId = 10029230923; var latestMessagesReceivedFromParameter = Message.GetLatestMessagesReceived(latestMessagesReceivedParameter); // Messages Sentvar latestMessagesSent = Message.GetLatestMessagesSent(); var latestMessagesSentParameter = Message.GenerateGetLatestsSentRequestParameter(); latestMessagesSentParameter.PageNumber = 239823; var latestMessagesSentFromParameter = Message.GetLatestMessagesSent(latestMessagesSentParameter);
Streams
- Streams are now raising the StreamStopped event after no message has been received from Twitter. The disconnect message will have a code of 503 and a description of 'Timeout'.var stream = Stream.CreateFilteredStream(); stream.StreamStopped += (sender, args) => { if (args.DisconnectMessage != null&& args.DisconnectMessage.Code == 503) { // You have been disconnected } };
- User Stream now has additional parameters.
var us = Stream.CreateUserStream();
us.MessagesFilterType = MessagesFilterType.Followings;
us.RepliesFilterType = RepliesFilterType.RepliesToKnownUsers;
- Stream.FilterTweetsToBeIn() method has been renamed FilterTweetsLanguage
Global Events
- A new class called TweetinviEvents can be used to get global events related with the application
TweetinviEvents.QueryExecutedEventArgs += (sender, args) =>
{
Console.WriteLine("The query {0} has just been executed.", args.Query);
};