Exemplo n.º 1
0
        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));
        }