-
Notifications
You must be signed in to change notification settings - Fork 221
Twitter Lists
Lists
in Twitter could have been called feeds. A List
is an aggregation of multiple users timelines.
Lists can be either public or private. When a list is public, other users can subscribe and see the tweets from your list.
- Manage Lists
- Create a List
- Get a List
- Update a List
- Delete a List
- Get Tweets from a List
- Additional features
Contrary to other objects in Twitter, lists can be identified in 2 different ways. In Tweetinvi you will be able to use either of the following objects to as <list_identifier>
.
- Lists can be retrieved from their unique Identifier (
Id
). - Lists can also be retrieved by specifying the name (
Slug
) and the owner (User
) of the list. - A
TwitterList
object itself.
To begin working with lists, let's create our first list.
var list = TwitterList.CreateList("<name>", PrivacyMode.Public, "<description>");
As mentioned just above we can get a List from its Id
, Slug+Owner
or from a TwitterListIdentifier
.
// From the List Identifier (*long*)
var list = TwitterList.GetExistingList(<list_id>);
// From the Slug and Owner
var list = TwitterList.GetExistingList("<list_name>", <owner,id,screenName>);
// From an existing object (usually not populated)
var list = TwitterList.GetExistingList(<list_object>);
You can also modify some details of a TwitterList.
var updateParameter = new TwitterListUpdateParameters()
{
Name = "<new_name>",
Description = "<new_description>",
PrivacyMode = PrivacyMode.Public
};
// From a List object
var success = list.Update(updateParameter);
// From Static TwitterList
var success = TwitterList.UpdateList(list, updateParameter);
You can only delete a that the authenticatedUser user owns.
// From a List object
var success = list.Destroy();
// From Static TwitterList
var success = TwitterList.DestroyList(<list_identifier>);
This method can be accessed from a List object or the static class TwitterList.
// From a list object
var tweets = list.GetTweets();
// From static TwitterList
var tweets = TwitterList.GetTweetsFromList();
You can specify optional parameters to retrieve tweets from a list.
var getTweetsParameters = new GetTweetsFromListParameters()
{
MaximumNumberOfTweetsToRetrieve = 100,
IncludeRetweets = true,
IncludeEntities = true,
SinceId = 1784,
MaxId = 487247
};
var tweets = list.GetTweets(getTweetsParameters);