Tweetinvi Update 0.9.8.0
Quick Overview
Library Changes
- The static TweetList class has been renamed TwitterList
- Please be aware of the changes affecting the methods that used "subjects" into their parameter objects (e.g. UserTimeline). More information.
- Tweet.Creator has been renamed Tweet.CreatedBy
- TwitterList.User has been renamed TwitterList.Owner
Twitter Lists
The most obvious update is that the static class TweetList has been renamed into TwitterList.This new version complete the implementation of all the methods related with Twitter Lists.
It includes the following :
- User Owned Lists
- User Subscribed Lists
var newList = TwitterList.CreateList("<name>", PrivacyMode.Public, "<description>"); var list = TwitterList.GetExistingList(listId); var updatedList = TwitterList.UpdateList(listId, new TwitterListUpdateParameters {Description = "<new description>"}); var destroySucceeded = TwitterList.DestroyList(listId);
- Get Tweets From List
- Get List Members
- Add Member to List
- Remove Member from List
- Verify user membership
- Get List Subscribers
- Subscribe Current Logged User to List
- Unsubscribe Current Logged User from List
- Verify user subscription
Parameters
New them up!
Parameters have been updated so that developers no longer need to use a factory to generate them.Any type of parameter can now be created using the "new" keyword easily. In addition, the parameters classes now live in Tweetinvi.Core.Parameters. This mean that you will no longer need to reference the Tweetinvi.Logic dll to new these up.
I hope this change will improve the readability and ease of access of 'advanced' requests.
// Example with update Account Settings// ***** Tweetinvi 0.9.7.1 - OLD *****var updateAccountParameter = Account.CreateUpdateAccountSettingsRequestParameters(); // ***** Tweetinvi 0.9.8.0 - NEW *****var updateAccountParameter = new AccountSettingsRequestParameters { Languages = new List<Language> { Language.English }};
Please find the objects you can now simply "new" up.
- IDENTIFIERS : TweetIdentifier, TwitterListIdentifier, UserIdentifier
- OBJECTS : Coordinates, GeoCode
- TIMELINE PARAMETERS : HomeTimelineParameters; UserTimelineParameters; MentionsTimelineParameters; RetweetsOfMeTimelineRequestParameter;
- SEARCH PARAMETERS : TweetSearchParameters; UserSearchParameters;
- ACCOUNT PARAMETERS : AccountSettingsRequestParameters;
- MESSAGE PARAMETERS : MessageGetLatestsReceivedRequestParameters; MessageGetLatestsSentRequestParameters;
- TWITTER LIST PARAMETERS : GetTweetsFromListParameters; TwitterListUpdateParameters
Parameters no longer store operation "subjects"
Parameters classes no longer contains the subject of a request. Instead they now only contain the parameters affecting the method.Let's see what this changes with an example:
var tweetinvi = User.GetUserFromScreenName("TweetinviAPI"); // ***** Tweetinvi 0.9.7.1 - OLD *****// We create a parameters class that contains the subject which is the user 'tweetinvi'.var userTimelineParameters = Timeline.CreateUserTimelineRequestParameter(tweetinvi) // The request is performed only with the parameters class.var tweets = Timeline.GetUserTimeline(userTimelineParameters); // ***** Tweetinvi 0.9.8.0 - NEW *****// We create parameters class that only contains the parameters that affect how the query is performed. // Not the subject of this query.var userTimelineParameters = new UserTimelineParameters { MaximumNumberOfTweetsToRetrieve = 100 }; // The request is performed by specifying both the subject (the user 'tweetinvi') and the parameters.var tweets = Timeline.GetUserTimeline(tweetinvi, userTimelineParameters);
User Suggestions
Developers can now access user's suggestions.var suggestedUsers = Account.GetSuggestedUsers("tweetinvi", Language.English); var suggestedCategories = Account.GetSuggestedCategories(Language.Japanese); var suggestedUsersWithHydratedStatus = Account.GetSuggestedUsersWithTheirLatestTweet("tweetinvi");
Allow direct messages from anyone
Tweetinvi is now ready to update the AccountSettings to use the AllowDirectMessages from anyone that has been released earlier this month.For some reason, this feature is not working and we are waiting for some news from the developers.
If you want to see any progress on this issue please look on the TwitterCommunity post(https://twittercommunity.com/t/set-of-allow-dms-from-fails-and-return-code-87-client-is-not-permitted-to-perform-this-action/38343).
// When the REST API will be ready please use the following line of codevar updateAccountSettings = new AccountSettingsRequestParameters { AllowDirectMessagesFrom = AllowDirectMessagesFrom.All };
Minor Updates
- LoggedUser can now update their account settings.
- Tweet.Creator has been renamed Tweet.CreatedBy
- TwitterList.User has been renamed TwitterList.Owner
Bug Fixes
- Fixed MultiThreading issue that resulted in streams to behave incorrectly when stopped and restarted.
- SearchJson no longer throws a NullReferenceException when invoked from a thread that is not the main thread.