Skip to content

Tweetinvi 2.1

Compare
Choose a tag to compare
@linvi linvi released this 30 Oct 00:35

Async

TweetinviSettings is now being set with the same settings used by the Thread invoking any async action with Sync.ExecuteTaskAsync.

TweetinviSettings.TweetMode = TweetMode.Compat;

var homeTimeline = await Sync.ExecuteTaskAsync(() => 
{
    // Here the tweets will be retrieved with TweetMode.Compat
    // because the calling thread uses such config
    return Timeline.GetHomeTimeline();
});

Custom Http Headers

You can now add your own http headers to any query performed by the library using TweetinviEvents.

// Use the gzip compression

TweetinviEvents.QueryBeforeExecute += (e, args) => 
{
    args.TwitterQuery.CustomHeaders.Add("Accept-Encoding", "gzip");
}

Emoji and Tweet Length

Tweetinvi length calculation used to check for character size based on the number of bytes that each grapheme required.

With further investigation it appeared that Twitter is not handling some Emojis the same way.

I have therefore tried to improve the logic to match the logic from Twitter.

This is particularly relevant for some of the new extended tweets properties like Suffix and DisplayRange.

If you encounter some mismatch between what Twitter is returning and what Tweetinvi returns in terms of a Tweet Text please open an issue.

Upload

When uploading content you can now pick the type of content you want to send from the UploadMediaCategory enum.

In addition to this, Upload.UploadVideo is no longer using amplify_video by default but tweet_video
which is the only one supporting video larger than 15mb.

A new static method has been added to Upload so that you can specify the type of media category you wish to use.

IMedia UploadVideo(byte[] binary, UploadMediaCategory mediaCategory)

Exception Handler

TweetinviEvents.QueryAfterExecute will now provide the actual exception if any occurred.

Previously only the status code of the error was returned. This should simplify error logging for some developers.

TweetinviEvents.QueryAfterExecute += (e, args) => 
{
     var exception = args.Exception;
    // Do whatever you want with it :)
};

List memberships

List memberships endpoint is now part of the library :

var twitterMemberships = TwitterList.GetUserListMemberships("twitter");

Examplinvi

All the example projects have been retested, upgraded and description have been added.
All the projects compatible with Visual Studio for Mac have also been tested.

The Universal App project has been tested on Raspberry Pi 3 with Windows 10 iot.

You will also find 2 new projects for

  • WPF
  • Winforms

.NETCore dll not found exceptions

In order for the library to be the most compatible with the different application types and versions of .NET, I have removed the dependency to System.Type.Primitives

Bug Fixes

  • Tweet.Suffix for tweets with a display range length of 0 is now properly returned.
  • AuthFlow.InitAuthenticationProcess is now supporting oauth_callback_confirmed being
    returned as a string.
  • TwitterList.GetExistingList is now properly validating the provided parameters (either the id or slugname needs to be provided).