Visit Tweetinvi 0.9.6.x Work Items
The goal of such a feature is to give the ability to developers to quickly add new parameters to existing Endpoints. This is required so that they do not have to wait for the next release of Tweetinvi to use such parameters.
If you only want to upload media, you can now do it and get back the upload id from it.
A previous property called TweetSearchFilters has been renamed to TweetSearchType. This property allows to specify which type of Tweet we want to receive from the Search.
The Filters property just filter the content based on its type or its content.
Instead, the Entities property will now return the ExtendedEntities. If the ExtendedEntities are not available in the json, the Entities property will return the LegacyEntities.
In addition Tweetinvi now supports the Video entities.
It means that you will be able to modify the query, cancel a query or change the credentials you want to use for a specific query within the BeforeQueryExecute event.
This advance feature will allow some developers to gain more granular control over the RateLimit of Twitter.
Custom Parameters
When an action can be performed with a 'RequestParameters' class (e.g. Search, Timeline, Message...), you will now be able to specify CustomQueryParameters.The goal of such a feature is to give the ability to developers to quickly add new parameters to existing Endpoints. This is required so that they do not have to wait for the next release of Tweetinvi to use such parameters.
var searchParameters = Search.CreateTweetSearchParameter("hello"); searchParameters.AddCustomQueryParameter("include_entities", "false");
RateLimit Tracker
You will now be able to track the RateLimits but handle them yourself. A third option called TrackOnly will no longer await for the RateLimits to be available but will still continue to keep track of the RateLimits within the application.// The previous code RateLimit.UseRateLimitAwaiter = true; // Has now been changed into RateLimit.RateLimitTrackerOption = RateLimitTrackerOptions.TrackAndAwait; // The new feature is now available with the TrackOnly option RateLimit.RateLimitTrackerOption = RateLimitTrackerOptions.TrackOnly;
Upload
Upload now uses the new Twitter endpoint. This update will result in developers to be able to publish up to 4 images in a single tweet.byte[] file1 = File.ReadAllBytes("filepath1"); byte[] file2 = File.ReadAllBytes("filepath2"); var helloTweet = Tweet.CreateTweet("hello"); helloTweet.AddMedia(file1); helloTweet.AddMedia(file2); // It will now publish 2 images helloTweet.Publish();
If you only want to upload media, you can now do it and get back the upload id from it.
byte[] file1 = File.ReadAllBytes("filepath1"); var uploadInfo = Upload.UploadBinary(file1); var uploadId = uploadInfo.UploadedMediaInfo.MediaId;
Search Filters
This new release introduces the Search Filters (Images, Videos, Hashtags, Links, News, Replies, Verified).A previous property called TweetSearchFilters has been renamed to TweetSearchType. This property allows to specify which type of Tweet we want to receive from the Search.
The Filters property just filter the content based on its type or its content.
// This code will return the tweets in relation with manga but all this tweet will contain a video.var searchParameter = Search.CreateTweetSearchParameter("manga"); // Add some filters to the query searchParameter.Filters = TweetSearchFilters.Videos; // Specify which mode of search we want to use searchParameter.SearchType = SearchResultType.Popular; // Specify which type of tweets needs to be retrieved searchParameter.TweetSearchType = TweetSearchType.OriginalTweetsOnly;
Entities Update & Video
Tweet Entities have been modified "significantly". The previous property ExtendedEntities has been removed.Instead, the Entities property will now return the ExtendedEntities. If the ExtendedEntities are not available in the json, the Entities property will return the LegacyEntities.
In addition Tweetinvi now supports the Video entities.
var tweet = Tweet.GetTweet(tweetWithVideoId); var media = tweet.Entities.Medias[0]; if (media.MediaType == "video") { var duration = media.VideoDetails.DurationInMilliseconds; }
Stream
Added parameters
var s = Stream.CreateSampleStream(); // This parameter allow you to filter the tweets by using Twitter filter model s.FilterLevel = StreamFilterLevel.Low; // I do not advise disabling the Stall warnings but it is no longer forced// This will result in the StallWarnings event to not be raised anymore s.StallWarnings = false;
Multiple languages support
Tweetinvi now supports multiple languages with a new set of methods.var stream = Stream.CreateSampleStream(); // Add multiple languages stream.AddTweetLanguageFilter(Language.French); stream.AddTweetLanguageFilter(Language.English); stream.AddTweetLanguageFilter(Language.Spanish); // Remove a language from the list stream.RemoveTweetLanguageFilter(Language.Spanish); // Access the languages set for the streamvar filteredLanguages = stream.FilteredLanguages; // Remove all languages filters to get everything stream.ClearTweetLanguageFilters();
Report User For Spam
It is now possible to report a user for spam.User.ReportUserForSpam(23829382);
Tweetinvi Events and TwitterQuery
The events have been reordered so that the AfterQueryExecute is now invoked after the RateLimit has been updated.QueryBeforeExecuteEventArgs
QueryBeforeExecuteEventArgs now has a Cancel property that allow you to prevent a query for being executed.TweetinviEvents.QueryBeforeExecute += (sender, args) => { if (args.QueryURL == "This is a crazy query!") { // I want to cancel this query cause its crazy to execute it! args.Cancel = true; } };
TwitterQuery can now be modified
TwitterQuery can now be modified before performing the query.It means that you will be able to modify the query, cancel a query or change the credentials you want to use for a specific query within the BeforeQueryExecute event.
var myBackupCredentials = TwitterCredentials.CreateCredentials("at", "ats", "ck", "cs"); TweetinviEvents.QueryBeforeExecute += (sender, args) => { args.TwitterQuery.OAuthCredentials = myBackupCredentials; };
This advance feature will allow some developers to gain more granular control over the RateLimit of Twitter.
Twitter Configuration
Users now have access to the Twitter Configuration endpoint as requested.var configuration = Help.GetTwitterConfiguration();