Skip to content

Tweetinvi 0.9.12.0

Compare
Choose a tag to compare
@linvi linvi released this 17 Apr 02:20
· 916 commits to master since this release

Breaking Changes

  • CredentialsCreator has now been renamed AuthFlow.
  • CredentialsCreator.GetAuthenticationURL has been renamed InitAuthentication. This new method no longer returns a URL but an AuthenticationContext containing all the information required to properly execute the authentication flow.
  • CredentialsCreator.GetCredentialsFromVerifierCode has been renamed AuthFlow.CreateCredentialsFromVerifierCode.
  • CredentialsCreator.GetCredentialsFromCallbackURL has been renamed AuthFlow.CreateCredentialsFromCallbackURL.
  • ApplicationCredentials and CurrentThreadCredentials properties are no longer directly exposed in TweetinviConfig. 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 renamed HttpRequestTimeout.

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 a ChunkUpload.
  • It is now possible to specify a timeout TimeSpan after which an upload will fail (this TimeSpan 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 renamed HttpRequestTimeout.
  • As mentioned in the Breaking Changes, TweetinviConfig no longer exposes all the properties of ApplicationCredentials and CurrentThreadCredentials.
// 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 not Search in order to not pollute the Search class.

Trends

  • Added the GetAvailableTrends to the Trends static class.
  • Added the GetClosestLocations to the Trends static class.

Minor Changes

  • IUser.LatestDirectMessagesReceived has now a setter defined in the interface.
  • Geo.SearchReverse is now implemented to let the users use the reverse_geo endpoint.
  • Help.GetTermsOfService is now implementing the help/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 proper ThreadCredentials if no credentials have been configured.
  • Search.Filters created wrong http requests (problem with HttpClient in PCL).
  • Report Spam endpoint has been updated.