Skip to content

Instantly share code, notes, and snippets.

@MartinZikmund
Created December 3, 2024 14:24
Show Gist options
  • Save MartinZikmund/9314afbf39f9f7aa93d1729d5c12fa26 to your computer and use it in GitHub Desktop.
Save MartinZikmund/9314afbf39f9f7aa93d1729d5c12fa26 to your computer and use it in GitHub Desktop.
public record class FeedItemViewModel(string Author, string Text, long Likes, long Reposts, long Replies);
var items = timelineData.Feed
.Select(f => f.Post)
.Where(p => p is not null)
.Select(post => new FeedItemViewModel(
post!.Author?.DisplayName ?? "",
(post.Record as Post)?.Text ?? "",
post.LikeCount ?? 0,
post.RepostCount ?? 0,
post.ReplyCount ?? 0)).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment