private async void InitModel() { var home = await Client.GetHomeTimeline(); Home = new ObservableCollection <Status>(home); var homeStream = Client.GetUserStreaming(); homeStream.OnUpdate += HomeStream_OnUpdate; //homeStream.Start(); }
private async Task CreateStatusTiles(DateTime lastRefreshTime) { var statusList = await _client.GetHomeTimeline(); var newStatus = statusList.Where(node => node.CreatedAt > lastRefreshTime && (node.Sensitive == null || node.Sensitive.Value == false)); foreach (var status in newStatus) { NotifyStatusTile.CreateStatusLiveTile(status); } }
public async IAsyncEnumerable <StatusUpdate> GetStatusUpdatesAsync() { var self = await _client.GetCurrentUser(); string max_id = ""; while (true) { var statuses = await _client.GetHomeTimeline(max_id); if (!statuses.Any()) { break; } foreach (var s in statuses) { var author = new Author { Username = s.Account.UserName, AvatarUrl = s.Account.AvatarUrl, ProfileUrl = s.Account.ProfileUrl }; yield return(new StatusUpdate { Host = Host, Id = s.Id, CanDelete = s.Account.Id == self.Id, Author = author, Timestamp = s.CreatedAt, LinkUrl = s.Url, Html = !string.IsNullOrEmpty(s.SpoilerText) ? WebUtility.HtmlEncode(s.SpoilerText) : s.Content, AdditionalImages = s.MediaAttachments.Select(m => new StatusUpdateMedia { ImageUrl = m.Url, LinkUrl = m.Url, AltText = m.Description }).ToList(), RepostedFrom = s.Reblog?.Account?.UserName }); } max_id = statuses.NextPageMaxId; } }
public Task <Mastonet.Entities.MastodonList <Mastonet.Entities.Status> > GetHomeTimeLine() { return(client.GetHomeTimeline()); }
public async Task <IEnumerable <Status> > GetTimeLineAsync() { Logger.NLogInfo($"GetHomeTimeline on {Instance}."); return(await client.GetHomeTimeline()); }
/// <summary> /// ホームタイムラインを取得します。 /// </summary> /// <param name="maxId">取得するステータスの最大ID。</param> /// <param name="sinceId">取得するステータスの最小ID。</param> /// <param name="limit">取得するステータスの件数</param> /// <returns>取得したホームタイムライン。</returns> public async Task <List <TwitdonMastodonStatus> > GetHomeTimeline(int?maxId = null, int?sinceId = null, int?limit = null) { var response = await client.GetHomeTimeline(maxId, sinceId, limit); return(response.Select(x => new TwitdonMastodonStatus(x)).ToList()); }