diff --git a/README.md b/README.md index ecb04a7..6cb105b 100644 --- a/README.md +++ b/README.md @@ -286,7 +286,7 @@ As a general rule of thumb, `com.atproto` endpoints (such as `com.atproto.sync`) | [app.bsky.feed.getPosts](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/feed/getPosts.json) | ✅ | | [app.bsky.feed.getFeed](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/feed/getFeed.json) | ✅ | | [app.bsky.feed.getFeedSkeleton](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/feed/getFeedSkeleton.json) | ❌ | -| [app.bsky.feed.getListFeed](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/feed/getListFeed.json) | ❌ | +| [app.bsky.feed.getListFeed](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/feed/getListFeed.json) | ✅ | | [app.bsky.feed.getSuggestedFeeds](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/feed/getSuggestedFeeds.json) | ❌ | | [app.bsky.feed.getActorFeeds](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/feed/getActorFeeds.json) | ❌ | diff --git a/samples/FishyFlipSamplesApp/Program.cs b/samples/FishyFlipSamplesApp/Program.cs index df9c60a..567daf2 100644 --- a/samples/FishyFlipSamplesApp/Program.cs +++ b/samples/FishyFlipSamplesApp/Program.cs @@ -173,6 +173,7 @@ async Task GetListViaATUri(ATProtocol protocol) defaultValue: "at://did:plc:yhgc5rlqhoezrx6fbawajxlh/app.bsky.graph.list/3kiwyqwydde2x", validators: new[] { Validators.Required() }); var lists = (await protocol.Graph.GetListAsync(ATUri.Create(uri))).HandleResult(); + var feed = (await protocol.Feed.GetListFeedAsync(ATUri.Create(uri))).HandleResult(); if (lists is null) { Console.WriteLine("No lists found."); @@ -185,6 +186,19 @@ async Task GetListViaATUri(ATProtocol protocol) Console.WriteLine(item.Subject.Handle); Console.WriteLine("-----"); } + + if (feed is null) + { + Console.WriteLine("No feed found."); + return; + } + + foreach (var item in feed.Feed) + { + Console.WriteLine(item.Post.Author); + Console.WriteLine(item.Post.IndexedAt); + Console.WriteLine("-----"); + } } async Task GetListsViaATIdent(ATProtocol protocol) diff --git a/src/FishyFlip/BlueskyFeed.cs b/src/FishyFlip/BlueskyFeed.cs index 19a0b7c..4e7e2f4 100644 --- a/src/FishyFlip/BlueskyFeed.cs +++ b/src/FishyFlip/BlueskyFeed.cs @@ -86,6 +86,17 @@ public async Task> GetLikesAsync(ATUri uri, int limit = 50, Ci error => error!); } + public async Task> GetListFeedAsync(ATUri uri, int limit = 30, CancellationToken cancellationToken = default) + { + string url = $"{Constants.Urls.Bluesky.Feed.GetListFeed}?list={uri.ToString()}&limit={limit}"; + + Multiple result = await this.Client.Get(url, this.Options.JsonSerializerOptions, cancellationToken, this.Options.Logger); + return result + .Match>( + timeline => (timeline ?? new ListFeed(Array.Empty(), null))!, + error => error!); + } + public async Task> GetAuthorFeedAsync(ATIdentifier handle, int limit = 50, string? cursor = default, CancellationToken cancellationToken = default) { string url = $"{Constants.Urls.Bluesky.Feed.GetAuthorFeed}?actor={handle.ToString()}&limit={limit}"; diff --git a/src/FishyFlip/Constants.cs b/src/FishyFlip/Constants.cs index 9f39649..1e9fd84 100644 --- a/src/FishyFlip/Constants.cs +++ b/src/FishyFlip/Constants.cs @@ -106,6 +106,7 @@ public static class Feed public const string GetFeedGenerator = "/xrpc/app.bsky.feed.getFeedGenerator"; public const string GetFeedGenerators = "/xrpc/app.bsky.feed.getFeedGenerators"; public const string GetFeed = "/xrpc/app.bsky.feed.getFeed"; + public const string GetListFeed = "/xrpc/app.bsky.feed.getListFeed"; public const string GetPosts = "/xrpc/app.bsky.feed.getPosts"; public const string GetLikes = "/xrpc/app.bsky.feed.getLikes"; public const string GetRepostedBy = "/xrpc/app.bsky.feed.getRepostedBy"; diff --git a/src/FishyFlip/Models/ListFeed.cs b/src/FishyFlip/Models/ListFeed.cs new file mode 100644 index 0000000..c954c73 --- /dev/null +++ b/src/FishyFlip/Models/ListFeed.cs @@ -0,0 +1,7 @@ +// +// Copyright (c) Drastic Actions. All rights reserved. +// + +namespace FishyFlip.Models; + +public record ListFeed(FeedViewPost[] Feed, string? Cursor);