NEW VERSION 0.9.9.7 (multithreading fix)
This release contains a large number of breaking changes regarding authentication and credentials.
With the intention of improving the web logic layer, I have also performed some important refactoring as well as changes in the parameters order. Please carefully read the changes section.
Tweetinvi 0.9.9.x introduces various break changes that were considered necessary as part of 4 different work items:
- Implementation of Application Only Authentication
- Refactor of Tweet Publish
- Simplify the request of credentials via the Credentials Creator
- Complete rewriting of the Authentication Process
Please read carefully the list of changes:
- IMPORTANT : Auth.SetUserCredentials now takes the consumer key and consumer secret as FIRST parameters. As opposed as the old `TwitterCredentials.SetCredentials` that took the access token and access token secret as first parameters.
- Tweet are no longer being published with different methods. Only `Tweet.Publish` is now available. In addition we introduced a `TweetPublishParameters` that sets all additional information that you want the tweet to contain.
- ITweet.Length is no longer calculating a tweet size before publishing it. Instead the static Tweet class now contains a `Length()` method calculating the size of a tweet based on publication parameters.
- The static class `Tweetinvi.TwitterCredentials` has now become `Tweetinvi.Auth`.
- `TwitterCredentials.SetCredentials` has now become `Auth.SetUserCredentials` when used with 4 credentials information.
- `TwitterCredentials.SetCredentials` has now become `Auth.SetCredentials` when used with an ITwitterCredentials.
- The `OAuthCredentials` class can now be new up and is now called `TwitterCredentials`
- The new `TwitterCredentials` now contains additional information used for the login process or the application only authentication.
- TokenRateLimits.AccessToken has been changed to RateLimitContext
Windows 10 universal apps are now supported. Examplinvi.UniversalApp is a project that could inspire you to develop your own solution.
To help our community we have created 2 very basic projects using Tweetinvi.
- Examplinvi.Web demonstrates how to authenticate a user with Twitter
- Examplinvi.UniversalApp demonstrates how to set up a Windows 10 universal app with Tweetinvi
Publish Tweets has been completely refactored in order to: improve usability; allow developers to publish tweet with any combination; make publish future proof.
// You can still publish simple tweets as you did before
var tweet = Tweet.PublishTweet("hello tweetinvi");
// But if you want more control, you will need to instantiate a PublishTweetOptionalParameters
// Many new options have been added so feel free to try them!
var tweet = Tweet.PublishTweet("hello tweetinvi", new PublishTweetOptionalParameters()
PossiblySensitive = true
// As you can no longer create a temporary tweet that will be published, you will now rely on
// Tweet.Length() to calculate the length of a tweet before it is published
var publishParameter = new PublishTweetParameters("hello tweetinvi", new PublishTweetOptionalParameters
QuotedTweet = existingTweet
var publicationLength = Tweet.Length(publishParameter);
Application Only Authentication
Application only authentication is now supported by Tweetinvi. This feature is now available with the following code.
// If you do not have a Bearer Token stored
Auth.SetApplicationOnlyCredentials("CONSUMER_KEY", "CONSUMER_SECRET", true);
// If you already have a Bearer Token
var bearerToken = "some_value_that_you_stored_in_your_db";
Auth.SetApplicationOnlyCredentials("CONSUMER_KEY", "CONSUMER_SECRET", bearerToken);
Tweetinvi now simulates the Quoted Tweet behavior introduced by the Twitter team. It allows to create a comment to another tweet.
QuotedTweet = existingTweet
Tweetinvi now officially supports chunked uploads and therefore video upload on Twitter.
// Simple Video Upload
var media = Upload.UploadVideo(videoBinary);
Sometimes you will need to upload some content in multiple chunks. Here is how you can do this.
var uploader = Upload.CreateChunkedUploader();
// Initialize the upload
var initSucceeded = uploader.Init("video/mp4", totalBinaryLength);
// Upload your different chunks
var success1 = uploader.Append(firstChunk);
var success2 = uploader.Append(secondChunk);
// When you have uploaded all your chunks
var media = uploader.Complete();
With the refactor of the Web logic Tweetinvi is now capable of using the proxy settings on the following:
- Authentication requests
- Upload requests
Tweetinvi still does not support proxy for Streams.
As part of the Application Only Credentials, it is now possible for developers to invalidate a specific token using the following code:
var success = Auth.InvalidateCredentials(credentials);
The `TwitterClientHandler` is a new class simplifying the implementation of custom `HttpHandlers`.
If you intend to add specific logic to `HttpHandlers` that is not supported by Tweetinvi please follow these instructions :
1. Create a sub-class of `TwitterClientHandler`.
2. Override `Task<HttpResponseMessage> SendAsync(ITwitterQuery twitterQuery, HttpRequestMessage request, CancellationToken cancellationToken)`.
3. Implement this method and update the request based on your context and the incoming ITwitterQuery.
Please note that you should not need to store any additional information in your custom `HttpHandler`. The ITwitterQuery should provide all the information you need to set up your request.
- Fixed a 'bug' in FilteredStream that resulted in Tweetinvi to not return tweets which bounding box overlapped a location filter.
- Fixed a bug that could prevent a query from executing in an ASP.NET project.
- Bug fix of Timeout that could have the value of 0
- 0.9.9.7 : Bug fixes related with ASP.NET multi threaded application
- 0.9.9.6 : Bug fixes for webrequest that could hang and improvements of RateLimits.
- 0.9.9.3 : Bug fix to allow users with specific language region to post a tweet with specific coordinates
- 0.9.9.2 : Bug fix to prevent RateLimit to throw json serialization exception -
- 0.9.9.1 : Bug fix that could result in mutli-threading application to use different default configuration.
Special thanks to JKeegan for his feedbacks.