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 .PostAsync <TwitterStatus>("https://api.twitter.com/1.1/statuses/update.json", parameters)); }
public ValueTask <IEnumerable <UserConnection> > GetFriendships(IEnumerable <string> ids) { return(oAuthApiRequest .GetAsync <IEnumerable <UserConnection> >("https://api.twitter.com/1.1/friendships/lookup.json", new[] { TwitterOptions.UserIds(ids) })); }
public ValueTask <UploadMedia> UploadMediaFinalize(string mediaId) { return(oAuthApiRequest .PostAsync <UploadMedia>(UploadMediaUrl, new[] { TwitterOptions.Command("FINALIZE"), TwitterOptions.MediaId(mediaId) })); }
public ValueTask <UploadMedia> UploadMediaStatus(string mediaId) { return(oAuthApiRequest .GetAsync <UploadMedia>(UploadMediaUrl, new[] { TwitterOptions.Command("STATUS"), TwitterOptions.MediaId(mediaId) })); }
public async ValueTask <IEnumerable <TwitterStatus> > FavoritesTimeline() { var statuses = await oAuthApiRequest .GetAsync <IEnumerable <TwitterStatus> >("https://api.twitter.com/1.1/favorites/list.json", TwitterOptions.Default()) .ConfigureAwait(false); return(await UpdateUserConnections(statuses).ConfigureAwait(false)); }
public async ValueTask <IEnumerable <TwitterStatus> > MentionsTimeline(int count) { var statuses = await oAuthApiRequest .GetAsync <IEnumerable <TwitterStatus> >("https://api.twitter.com/1.1/statuses/mentions_timeline.json", TwitterOptions.Default(count)) .ConfigureAwait(false); return(await UpdateUserConnections(statuses).ConfigureAwait(false)); }
public ValueTask <UploadMedia> UploadMediaInit(int totalBytes, string mediaType) { return(oAuthApiRequest .PostAsync <UploadMedia>(UploadMediaUrl, new[] { TwitterOptions.Command("INIT"), TwitterOptions.TotalBytes(totalBytes), TwitterOptions.MediaType(mediaType) })); }
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 <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 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)); }
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); }
public ValueTask Unfollow(string screenName) { return(oAuthApiRequest .PostAsync("https://api.twitter.com/1.1/friendships/destroy.json", new[] { TwitterOptions.ScreenName(screenName) })); }
public ValueTask DestroyFavorite(string statusId) { return(oAuthApiRequest .PostAsync("https://api.twitter.com/1.1/favorites/destroy.json", new[] { TwitterOptions.Id(statusId) })); }