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.