示例#1
0
 public async ValueTask <IEnumerable <TwitterStatus> > GetUserTimeline(string screenName)
 {
     return(await oAuthApiRequest
            .GetAsync <IEnumerable <TwitterStatus> >("https://api.twitter.com/1.1/statuses/user_timeline.json",
                                                     new[] {
         TwitterOptions.ScreenName(screenName),
         TwitterOptions.Count(50),
         TwitterOptions.IncludeEntities(),
         TwitterOptions.IncludeRetweets(),
         TwitterOptions.ExtendedTweetMode()
     })
            .ConfigureAwait(false));
 }
示例#2
0
        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);
        }
示例#3
0
 public ValueTask Unfollow(string screenName)
 {
     return(oAuthApiRequest
            .PostAsync("https://api.twitter.com/1.1/friendships/destroy.json",
                       new[] { TwitterOptions.ScreenName(screenName) }));
 }