Releases: linvi/tweetinvi
Tweetinvi 0.9.13.0
Breaking changes
- Coordinates are now lat/long (instead of long/lat) as per the ISO_6709.
- Calling a method with invalid arguments will throw
ArgumentException
orArgumentNullException
. In release < 0.9.13.0, invalid arguments resulted in anull
result to be returned. IUser.ShowAllInlineMedia
andIUserDTO.ShowAllInlineMedia
have been removed.
Json Serialization
With the help of @tsconn23 we have started supporting json serialization of ITweetDTO
and IUserDTO
. Both have been tested and should work properly.
var json = JsonConvert.SerializeObject(tweet.TweetDTO);
You can learn more in the serialization wiki page.
As a reminder, Json serialization will be fully supported for version 1.1 (link).
RateLimits
RateLimits have been refactored entirely to use both the rate_limit_status endpoint available on the Twitter REST API and the headers received for each HttpRequest.
What it means for you is that the RateLimts will be more accurate than before when using the same credentials in concurrent running applications.
In addition to that we have added the newly added endpoint to the rate_limit_status.
Authentication Flow
The authentication flow has been improved to support more developers requirements.
AuthFlow.InitAuthenticationProcess
can now take a new string parameter authenticationIdentifier
. This 3rd parameter gives you the ability to specify the value of the callback url parameter authorization_id
. In addition to this, IAuthenticationContext.Token
has a new property AuthorizationUniqueIdentifier
containing the value of this authorization_id
parameter.
The benefit for the developers is that they can now store the Token.AuthorizationKey
and Token.AuthorizationSecret
inside their database with a primary key with a value equals to the authorization_id
.
We also added a new overload of the CreateCredentialsFromVerifierCode
taking a IAuthenticationToken
as a parameter.
This will give you the ability to execute the following code :
var token = new AuthenticationToken()
{
AuthorizationKey = "<from_db>",
AuthorizationSecret = "<from_db>",
ConsumerCredentials = creds
};
// And then instead of passing the AuthenticationContext, just pass the AuthenticationToken
var verifierCode = Request.Params.Get("oauth_verifier");
var userCreds = AuthFlow.CreateCredentialsFromVerifierCode(verifierCode, token);
Upload
Upload Status and Media Category
It is now possible to specify the media_category
of an upload. This will allow developers to publish promoted content such as video via the amplify_video
media category.
var media = Upload.UploadVideo(binary, "video/mp4", "amplify_video");
If you use amplify_video
you will have to wait a certain amount of time before you can use the media. This information is available in the new GetMediaStatus(IMedia media, bool waitForStatusToBeAvailable = true)
method.
The way to use this method is the following.
// The second parameter `waitForStatusToBeAvailable` set to true will make sure
// that tweetinvi waits few milliseconds before executing the query. This is required by Twitter.
var status = Upload.GetMediaStatus(media, true);
// If you want to wait yourself, you can use the media information as followed BEFORE executing
// the Upload.GetMediaStatus(media, false) method.
await TaskEx.Delay(media.UploadedMediaInfo.ProcessingInfo.CheckAfterInMilliseconds);
// When you have finally received the status, you have to wait for the upload
// to have been completed to use your media in a Tweet.
while (status.ProcessingInfo.ProgressPercentage != 100)
{
await TaskEx.Delay(1000);
status = Upload.GetMediaStatus(media);
}
var tweet = Tweet.PublishTweet("Love tweetinvi promoted video!", new PublishTweetOptionalParameters()
{
Medias = {media}
});
Upload Metadata
Tweetinvi now support the media/metadata/create endpoint. It gives you the ability to specify the alt
text displayed for a media that you uploaded.
var success = Upload.AddMediaMetadata(new MediaMetadata((long)media.MediaId, "Alternative Text"));
Other Improvements
GeoSearchParameters
now includes theaccuracy
parameter.- Added some documentation to the methods/properties.
- SearchParameter.SearchResultType is now an optional parameter.
Bug Fixes
- Fixed a bug that prevented user to publish tweets with media. This was the case for tweets with multiple media for example.
- Fixed bug that sometimes prevented
SearchTweets
to being correctly executed when usingGeoCode
. TwitterList
had various endpoints that did now worked properly, includingAddMultiple
andDestroyMultiple
. They have been fixed and improved.
Special thanks
I wanted to thanks everyone of you who reached us or helped us improve the library.
I would like to make a special note for :
- @haseeb1431 who has become a new valuable member of the team.
- @JoshKeegan for his great help on the issues while I was away.
- @tsconn23 for sharing his code on serialization.
Tweetinvi 0.9.12.0
Breaking Changes
CredentialsCreator
has now been renamedAuthFlow
.CredentialsCreator.GetAuthenticationURL
has been renamedInitAuthentication
. This new method no longer returns a URL but anAuthenticationContext
containing all the information required to properly execute the authentication flow.CredentialsCreator.GetCredentialsFromVerifierCode
has been renamedAuthFlow.CreateCredentialsFromVerifierCode
.CredentialsCreator.GetCredentialsFromCallbackURL
has been renamedAuthFlow.CreateCredentialsFromCallbackURL
.ApplicationCredentials
andCurrentThreadCredentials
properties are no longer directly exposed inTweetinviConfig
. The goal is to reduce the number of properties in order to make it easier for the developers to understand and access the properties.WebRequestTimeout
has been renamedHttpRequestTimeout
.
AuthFlow (old CredentialsCreator)
CredentialsCreator
has been renamed AuthFlow
. In the process we have improved the authentication mechanism to make it clearer for users how it works.
Tweetinvi < 0.9.12.0 authentication flow started by adding information to the credentials object provided to the CredentialsCreator.GetAuthenticationURL
.
In the new version the library now creates an AuthenticationContext
after invoking the InitAuthentication
method.
This object contains all the information necessary for a developer to execute the process the second step of the authentication. In more details, it now contains the AuthorizationURL
property pointing to the Twitter authentication page for your application.
Here is an authentication flow example for a console application via captcha :
var applicationCredentials = new ConsumerCredentials(consumerKey, consumerSecret);
var authenticationContext = AuthFlow.InitAuthentication(applicationCredentials);
Console.WriteLine("Go on : {0}", authenticationContext.AuthorizationURL);
Console.WriteLine("Enter the captcha : ");
var captcha = Console.ReadLine();
try
{
var newCredentials = AuthFlow.CreateCredentialsFromVerifierCode(captcha, authenticationContext);
Console.WriteLine("Access Token = {0}", newCredentials.AccessToken);
Console.WriteLine("Access Token Secret = {0}", newCredentials.AccessTokenSecret);
return newCredentials;
}
catch (Exception)
{
return null;
}
Account
- Implemented
UpdateProfile
. - Implemented
UpdateProfileImage
. - Implemented
UpdateProfileBanner
. - Implemented
RemoveProfileBanner
. - Implemented
UpdateProfileBackgrounImage
(please note that this has currently no effect similarly to the Twitter settings more info).
Tweetinvi Events
- Tweetinvi events can now be configured per thread. This is a great improvement because it will simplify various usages of the library. For example if you want to create an application running multiple threads with different credentials, you will now be able to configure your
RateLimit
logic per thread instead of globally.
// Listen to current thread events.
TweetinviEvents.CurrentThreadEvents.QueryBeforeExecute += (sender, args) =>
{
Console.WriteLine(args.QueryURL);
};
// Listen to the entire application events (NO CHANGE).
TweetinviEvents.QueryBeforeExecute += (sender, args) =>
{
Console.WriteLine(args.QueryURL);
};
Upload
- It now possible to configure the size of chunks for an upload globally.
- It is now possible to override the global
Timeout
property for aChunkUpload
. - It is now possible to specify a timeout
TimeSpan
after which an upload will fail (thisTimeSpan
is reset for each chunk).
var binary = new byte[1];
var uploadedMediaInfo = Upload.ChunkUploadBinary(new UploadQueryParameters()
{
Binaries = new List<byte[]> {binary},
Timeout = TimeSpan.FromSeconds(45),
MaxChunkSize = 4*1024*1024, // 4 MB
MediaType = "video/mp4"
});
- All the parameters for Upload request are now available. The INIT and APPEND parameters can now be extended.
Tweet
- Added
Tweet.Url
property. - Added
Tweet.GetRetweeterIds
giving access to a list of user ids who a tweet.
Saved Searches
- Saved searches now throw an exception if you try to create one that has a name bigger than 100 characters.
TweetinviConfig
- Created a new
UploadTimeout
property to allow the developers to distinguish an upload request from a simple http request.
// For uploads
var uploadTimeout = TweetinviConfig.ApplicationSettings.UploadTimeout;
// For all other requests
var requestTimeout = TweetinviConfig.ApplicationSettings.HttpRequestTimeout;
WebRequestTimeout
has been renamedHttpRequestTimeout
.- As mentioned in the Breaking Changes,
TweetinviConfig
no longer exposes all the properties ofApplicationCredentials
andCurrentThreadCredentials
.
// Old version
var proxy = TweetinviConfig.APPLICATION_PROXY_URL;
// New version
var proxy = TweetinviConfig.ApplicationSettings.ProxyURL;
Search
- Tweetinvi is now properly escaping the query. 401 exception is no longer happening with special characters.
- Tweetinvi now supports all the new
Filters
including : native_video, periscope, safe, twimg and vine. - You can now search geographical places. Please note that this endpoint being rarely used it is available from
Geo
and notSearch
in order to not pollute theSearch
class.
Trends
- Added the
GetAvailableTrends
to theTrends
static class. - Added the
GetClosestLocations
to theTrends
static class.
Minor Changes
IUser.LatestDirectMessagesReceived
has now a setter defined in the interface.Geo.SearchReverse
is now implemented to let the users use thereverse_geo
endpoint.Help.GetTermsOfService
is now implementing thehelp/tos.json
endpoint.TwitterAccessor.ExecuteMultipart
returning json is now publicly available.- Added/Removed various properties on objects that were updated by Twitter.
- Improved general documentation.
Stream.StreamStopped
event is no longer invoked if the stream is already stopped.
Bug Fixes
UserStream
is now using the properThreadCredentials
if no credentials have been configured.- Search.Filters created wrong http requests (problem with
HttpClient
in PCL). - Report Spam endpoint has been updated.
Tweetinvi 0.9.11.0
Breaking Changes
This version contains breaking changes specially because of naming improvements :
LoggedUser
=>AuthenticatedUser
.
The class and interface are now AuthenticatedUser
and IAuthenticatedUser
.
To get the authenticated user please do the same as before :
var authenticatedUser = User.GetAuthenticatedUser();
TokenRateLimits
=>CredentialsRateLimits
TokenRateLimit
=>EndpointRateLimits
Favourites
=>Favorites
IFilteredStream.MatchingTweetAndLocationReceived
have been removed (see more).- Settings.ShowDebug does no longer exist as all the information it provided are now available in the
TweetinviEvents
.
Tweet
- Updated
TweetLength
calculation to match the new Twitter calculation. - You now have access to the unretweet endpoint.
var success = = Tweet.UnRetweet(tweet);
// OR
var tweet = Tweet.GetTweet(...);
tweet.UnRetweet();
User.GetFavorites
can now take optional parameters.
User.GetFavoritedTweets("tweetinviapi", new GetUserFavoritesParameters()
{
MaximumNumberOfTweetsToRetrieve = 10,
IncludeEntities = true,
SinceId = 42,
MaxId = 4242
});
Filtered Streams
The matching mechanism has been improved to analyze all the different tweet fields that are used by the Twitter Stream API to filter tweets.
MatchOn
FilteredStream
now have a new MatchOn
property that specify which fields need to be analyzed to match Tweets. In Tweetinvi <= 0.9.10.2, the matching process only considered the Text
property.
In this new version, Tweetinvi matches with ALL the fields by default (MatchOn.Everything
).
// Match only on the Tweet Text or any of the entities of the tweet,
fs.MatchOn = MatchOn.TweetText | MatchOn.AllEntities;
MatchingTweetReceived
MatchingTweetReceived
event args now includes all the matching information that are used by Tweetinvi to detect if a Tweet is matching or not.
var tracks = args.MatchingTracks;
var followers = args.MatchingFollowers; // new
var locations = args.MatchingLocations; // new
The event args now also includes a new MatchOn
property that let you know which fields of the Tweet have been used to match the tweet.
Therefore if args.MatchOn == MatchOn.UrlEntities
it means that the tweet has been matched on a url but not via the text.
MatchingTweetAndLocationReceived
This event has been deleted because you can now access all the information in MatchingTweetReceived
as explained above.
Rate Limits
TwitterQuery
now includes 2 new fields that are QueryRateLimits
and CredentialsRateLimits
.
This can be quite useful when registering the TweetinviEvents
.
Videos Upload
- Videos are now automatically uploaded in chunks of 2 MB. This simplify the upload of videos > 5 MB.
Other improvements
- Improved the models documentation.
- Improved error handling.
UnBlockUser
is now accessible from theAuthenticatedUser
as well as the staticUser
class.
var success = User.UnBlockUser("bidochon");
// OR
var authenticatedUser = User.GetAuthenticatedUser();
authenticatedUser.UnBlockUser("bidochon");
ITrends
now includes thetweet_volume
field/
Bug Fixes
- Fixed potential deadlock when using tweetinvi
async
functions. - PublishTweet/Message failed when used with a mix of special characters.
- Tweet.GetTweets correctly returns collection with a single matching element.
Tweetinvi 0.9.10.1
Single DLL
When you add Tweetinvi via nuget you will have the joy to find out that there are no longer 9 DLLs but just a single one named Tweetinvi.dll. Though the nuget references to external libraries are still required.
Bugs Fixed
- Stream issues are no longer throwing exception from Tweetinvi, instead it is throwing Exception that can be understood by the developers.
- Custom Objects definition is now working properly
- Tweet Length calculation has been updated to match Twitter new media length
- Tweet Length is now calculated based on the UTF32 format and not UTF16
Retweeted_Count
is no longer throwing an exception randomlyTweetEntities
no longer have duplicates removed
Tweetinvi Builder
The builder has been greatly improved and any developer willing to build tweetinvi from the Source Code will be happy to discover all the new improvements performed by the tool.
Tweetinvi 0.9.10.0
Important
This release contains some minor breaking changes. Please take a look at them before migrating.
Overview
- Universal App 1.1
- Tweet
- User
- Streams
- Messages
- Events
- Languages support
- Documentation
- Windows Phone 8.1 Note
- Other
Breaking Changes
- Streams are now by default using the credentials of the thread they are created with.
User.ProfileImageFullSizeUrl
has been renamedUser.ProfileImageUrlFullSize
for naming consistency.- The
UserStream.StreamRunning
event has been renamedUserStream.StreamIsReady
to help distinguish it from the eventStreamStarted
.
Universal App 1.1
Tweetinvi has been upgraded to work with Windows universal apps 1.1.
Tweet
Tweet.TweeLength()
has now a new additional boolean parameterwillBePublishedWithMedia
. It give you the ability to calculate the lenght of a Tweet when publishing it with a media.
var tweetLength = Tweet.Length("hello", new PublishTweetOptionalParameters()
{
MediaIds = new List<long> { 42 }
});
User
- Improved retrieval of user profile images
User
static class now has a new static methodUser.FollowUser()
.
var success = User.FollowUser("tweetinviapi");
Streams
- Streams are now by default using the credentials of the thread they are created with.
var stream = Stream.CreateSampleStream(new TwitterCredentials(...));
- Streams have now a
Credentials
property that you can set up when the stream is not running.
var stream = Stream.CreateSampleStream();
stream.Credentials = new TwitterCredentials(...);
- The
UserStream.StreamRunning
event has been renamedUserStream.StreamIsReady
to help distinguish it from the eventStreamStarted
. - Very long
FilteredStream
query are now correctly being sent to Twitter (e.g. 5000 followers)! - Improvements of multi threaded streams
Messages
Messages now natively handle the FullText attribute which is set to true by default.
var messagesReceived = Message.GetLatestMessagesReceived(new MessagesReceivedParameters()
{
FullText = false
});
Events
A new event QueryBeforeExecuteAfterRateLimitAwait
has been added to TweetinviEvents
. It notifies you that a query is going to be executed right away.
The difference with QueryBeforeExecute
is that it is occuring after awaiting for RateLimits when the RateLimits is set to automatic.
Languages support
- Added language support for Japanese and Swedish.
Documentation
- Static classes of the Tweetinvi namespace now have documentation that should help you understand what it will do.
Windows Phone 8.1 - Note
Please note that Windows Phone 8.1 does not work with Streams.
A bug ticket is currently opened, you can follow it here
Other
- Reduced the number of object instantiation to improve memory and execution time.
TwitterNullCredentialsException
is now thrown if no credentials have been set up.- Added examples to publish/destroy a tweet in Examplinvi.Web
- Help has now a new field for the size of the Direct Message which is now of 10000.
Thank you!
Special thanks to @LeeC and @kom2009 for their generous donations :)
0.9.8.0
Tweetinvi Update 0.9.8.0
Welcome on Tweetinvi. 0.9.8.0 is the first version available on github!
- Full implementation of Twitter Lists
- Simplified construction of parameters
- Allowed users to configure the type of class returned by Tweetinvi
- Updated information available in Account Settings
For a full log please visit the codeplex download page.