public ValueTask <TwitterStatus> UpdateStatus(string text, string?replyToStatusId, string?attachmentUrl, string[]?mediaIds) { var parameters = new List <(string, string)> { TwitterOptions.Status(text), TwitterOptions.ExtendedTweetMode() }; if (!string.IsNullOrEmpty(replyToStatusId)) { parameters.Add(TwitterOptions.ReplyStatusId(replyToStatusId)); parameters.Add(TwitterOptions.AutoPopulateReplyMetadata()); } if (!string.IsNullOrEmpty(attachmentUrl)) { parameters.Add(TwitterOptions.AttachmentUrl(attachmentUrl)); } if (mediaIds?.Length > 0) { parameters.Add(TwitterOptions.MediaIds(mediaIds)); } return(oAuthApiRequest .Post <TwitterStatus>("https://api.twitter.com/1.1/statuses/update.json", parameters)); }
public ValueTask <TwitterStatus> GetStatus(string statusId) { return(oAuthApiRequest .GetAsync <TwitterStatus>("https://api.twitter.com/1.1/statuses/show.json", new[] { TwitterOptions.Id(statusId), TwitterOptions.IncludeEntities(), TwitterOptions.ExtendedTweetMode() })); }
public ValueTask <User> UserInfo(string screenName) { return(oAuthApiRequest .Get <User>("https://api.twitter.com/1.1/users/show.json", new[] { TwitterOptions.IncludeEntities(), TwitterOptions.ExtendedTweetMode(), TwitterOptions.ScreenName(screenName) })); }
public ValueTask <Tweet> Search(string query) { return(oAuthApiRequest .GetAsync <Tweet>("https://api.twitter.com/1.1/search/tweets.json", new[] { TwitterOptions.Count(100), TwitterOptions.Query(query), TwitterOptions.IncludeEntities(), TwitterOptions.ExtendedTweetMode() })); }
public ValueTask <IEnumerable <TwitterStatus> > GetUserTimeline(string screenName) { return(oAuthApiRequest .GetAsync <IEnumerable <TwitterStatus> >("https://api.twitter.com/1.1/statuses/user_timeline.json", new[] { TwitterOptions.ScreenName(screenName), TwitterOptions.Count(25), TwitterOptions.IncludeEntities(), TwitterOptions.IncludeRetweets(), TwitterOptions.ExtendedTweetMode() })); }
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); var userConnections = UserConnectionsService.LookupUserConnections(user.Id); user.IsFollowing = userConnections?.IsFollowing ?? false; user.IsFollowedBy = userConnections?.IsFollowedBy ?? false; return(user); }