예제 #1
0
        private static async Task <StatusModel> SendDraft(DraftModel item)
        {
            var medias = new List <AttachmentModel>();

            if (item.Medias?.Count > 0)
            {
                foreach (var media in item.Medias)
                {
                    if (!string.IsNullOrEmpty(media.SavedFile))
                    {
                        medias.Add(await Media.Uploading(item.Domain, item.AccessToken, await StorageFileHelper.ReadBytesFromLocalFileAsync(media.SavedFile)));
                    }
                    else
                    {
                        medias.Add(await Media.Uploading(item.Domain, item.AccessToken, media.Data));
                    }
                }
            }
            return(await Statuses.Posting(item.Domain, item.AccessToken, item.Status, item.ReplyStatus?.InReplyToId ?? 0, item.Sensitive, item.SpoilerText, item.Visibility, medias.Select(m => m.Id).ToArray()));
        }