-
Notifications
You must be signed in to change notification settings - Fork 220
Friendships
From a user account perspective another user can either be a follower or a person that you you follow also described as friend.
Rate Limit Considerations It is important to understand that due to Twitter REST API limits, you will have to consider using the RateLimit class to get all the followers of a famous person.
var user = User.GetUserFromScreenName("<user_screen_name>");
// Get the first 250 followers of the user
var followers = User.GetFollowers(<user_identifier>);
var followers = user.GetFollowers();
// Get the first 5000 followers' ids of the user
var followerIds = User.GetFollowerIds(<user_identifier>);
var followerIds = user.GetFollowerIds();
Please note that retrieving all the followers of a user might take a LOT of time. Please consider using Threads or Async Tasks.
The first and easiest way to get all the followers of a specific member is to use the TrackAndAwait
option of the RateLimit awaiter.
// Tweetinvi will now wait for tokens to be available before performing a request.
RateLimit.RateLimitTrackerOption = RateLimitTrackerOptions.TrackAndAwait;
// Get ALL the followers' ids of a specific user
var followerIds = User.GetFollowerIds(<user_identifier>, Int32.MaxValue);
var followerIds = user.GetFollowerIds(Int32.MaxValue);
This solution is more complex as it has not yet been implemented in Tweetinvi. We will need to use the appropriate tools to execute a cursor Custom Queries.
Rate Limit Considerations It is important to understand that due to Twitter REST API limits, you will have to consider using the RateLimit class to get all the friends of a famous person.
var user = User.GetUserFromScreenName("<user_screen_name>");
// Get the first 250 friends of the user
var friends = User.GetFriends(<user_identifier>);
var friends = user.GetFriends();
// Get the first 5000 friends' ids of the user
var friendIds = User.GetFriendIds(<user_identifier>);
var friendIds = user.GetFriendIds();
Please note that retrieving all the friends of a user might take a LOT of time. Please consider using Threads or Async Tasks.
The first and easiest way to get all the friends of a specific member is to use the TrackAndAwait
option of the RateLimit awaiter.
// Tweetinvi will now wait for tokens to be available before performing a request.
RateLimit.RateLimitTrackerOption = RateLimitTrackerOptions.TrackAndAwait;
// Get ALL the friends' ids of a specific user
var friendsIds = User.GetFriendIds(<user_identifier>, Int32.MaxValue);
var friendsIds = user.GetFriendIds(Int32.MaxValue);
This solution is more complex as it has not yet been implemented in Tweetinvi. We will need to use the appropriate tools to execute a cursor Custom Queries.
To get the relationship details between 2 members you can use the following code.
var relationshipDetails = Friendship.GetRelationshipDetailsBetween(<user_identifier_1>, <user_identifier_2>);