Skip to content

Commit

Permalink
Start adding more Graph Endpoints for List
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Jan 15, 2024
1 parent c850674 commit 010df34
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ As a general rule of thumb, `com.atproto` endpoints (such as `com.atproto.sync`)
| Endpoint | Implemented
|----------|----------|
| [app.bsky.graph.getSuggestedFollowsByActor](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/getSuggestedFollowsByActor.json) ||
| [app.bsky.graph.unmuteActorList](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/unmuteActorList.json) | |
| [app.bsky.graph.unmuteActorList](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/unmuteActorList.json) | |
| [app.bsky.graph.getListBlocks](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/getListBlocks.json) ||
| [app.bsky.graph.muteActorList](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/muteActorList.json) | |
| [app.bsky.graph.muteActorList](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/muteActorList.json) | |
| [app.bsky.graph.getLists](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/getLists.json) ||
| [app.bsky.graph.getFollowers](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/getFollowers.json) ||
| [app.bsky.graph.muteActor](https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/graph/muteActor.json) ||
Expand Down
16 changes: 14 additions & 2 deletions src/FishyFlip/BlueskyGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal BlueskyGraph(ATProtocol proto)

return await this.Client.Get<ActorFollows>(url, this.Options.JsonSerializerOptions, cancellationToken, this.Options.Logger);
}

public async Task<Result<ActorFollowers?>> GetFollowersAsync(
ATIdentifier identifier,
int limit = 50,
Expand Down Expand Up @@ -98,6 +98,18 @@ public Task<Result<Success>> UnmuteActorAsync(ATDid did, CancellationToken cance
return this.Client.Post<CreateMuteRecord, Success>(Constants.Urls.Bluesky.Graph.UnmuteActor, this.Options.JsonSerializerOptions, muteRecord, cancellationToken, this.Options.Logger);
}

public Task<Result<Success>> MuteActorListAsync(ATUri list, CancellationToken cancellationToken = default)
{
var muteRecord = new CreateMuteListRecord(list);
return this.Client.Post<CreateMuteListRecord, Success>(Constants.Urls.Bluesky.Graph.MuteActorList, this.Options.JsonSerializerOptions, muteRecord, cancellationToken, this.Options.Logger);
}

public Task<Result<Success>> UnmuteActorListAsync(ATUri list, CancellationToken cancellationToken = default)
{
var muteRecord = new CreateMuteListRecord(list);
return this.Client.Post<CreateMuteListRecord, Success>(Constants.Urls.Bluesky.Graph.UnmuteActorList, this.Options.JsonSerializerOptions, muteRecord, cancellationToken, this.Options.Logger);
}

public async Task<Result<ListViewRecord?>> GetListsAsync(ATIdentifier identifier, int limit = 50, string? cursor = default, CancellationToken cancellationToken = default)
{
var url = Constants.Urls.Bluesky.Graph.GetLists + $"?actor={identifier}&limit={limit}";
Expand All @@ -121,7 +133,7 @@ public Task<Result<Success>> UnmuteActorAsync(ATDid did, CancellationToken cance

return await this.Client.Get<ListViewRecord>(url, this.Options.JsonSerializerOptions, cancellationToken, this.Options.Logger);
}

public async Task<Result<ListViewRecord?>> GetListBlocksAsync(int limit = 50, string? cursor = default, CancellationToken cancellationToken = default)
{
var url = Constants.Urls.Bluesky.Graph.GetListBlocks + $"?limit={limit}";
Expand Down
2 changes: 2 additions & 0 deletions src/FishyFlip/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public static class Graph
public const string GetMutes = "/xrpc/app.bsky.graph.getMutes";
public const string MuteActor = "/xrpc/app.bsky.graph.muteActor";
public const string UnmuteActor = "/xrpc/app.bsky.graph.unmuteActor";
public const string MuteActorList = "/xrpc/app.bsky.graph.muteActorList";
public const string UnmuteActorList = "/xrpc/app.bsky.graph.unmuteActorList";
public const string Block = "/xrpc/app.bsky.graph.block";
public const string Follow = "/xrpc/app.bsky.graph.follow";
}
Expand Down
4 changes: 3 additions & 1 deletion src/FishyFlip/Models/Internal/CreateMuteRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

namespace FishyFlip.Models.Internal;

public record CreateMuteRecord(ATDid Actor);
public record CreateMuteRecord(ATDid Actor);

public record CreateMuteListRecord(ATUri List);

0 comments on commit 010df34

Please sign in to comment.