private async ValueTask <IEnumerable <TwitterStatus> > UpdateUserConnections(IEnumerable <TwitterStatus> statuses) { // The timeline API's no longer report Following and FollowedBy status and the // friendship lookup connections API is rate limited. Keep a cached list and update the // fields accordingly. await UserConnectionsService .AddUserIdsAsync(statuses.Select(status => status.OriginatingStatus.User.Id), this) .ConfigureAwait(false); // Needed to set the Following and FollowedBy properties because the // timeline API's no longer report these fields foreach (var status in statuses) { status.UpdateFromStatus(status); } return(statuses); }
public async ValueTask <User> UserInfo(string screenName) { var user = await oAuthApiRequest .GetAsync <User>("https://api.twitter.com/1.1/users/show.json", new[] { TwitterOptions.IncludeEntities(), TwitterOptions.ExtendedTweetMode(), TwitterOptions.ScreenName(screenName) }) .ConfigureAwait(false); if (UserConnectionsService.LookupUserConnections(user.Id) is { } userConnections) { user.IsFollowing = userConnections.IsFollowing; user.IsFollowedBy = userConnections.IsFollowedBy; } return(user); }