-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07cf799
commit 1fa2df0
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// <copyright file="BlueskyUnspecced.cs" company="Drastic Actions"> | ||
// Copyright (c) Drastic Actions. All rights reserved. | ||
// </copyright> | ||
|
||
namespace FishyFlip; | ||
|
||
/// <summary> | ||
/// Bluesky Unspecced. | ||
/// </summary> | ||
public sealed class BlueskyUnspecced | ||
{ | ||
private ATProtocol proto; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BlueskyUnspecced"/> class. | ||
/// </summary> | ||
/// <param name="proto"><see cref="ATProtocol"/>.</param> | ||
internal BlueskyUnspecced(ATProtocol proto) | ||
{ | ||
this.proto = proto; | ||
} | ||
|
||
private ATProtocolOptions Options => this.proto.Options; | ||
|
||
private HttpClient Client => this.proto.Client; | ||
|
||
public async Task<Result<FeedResultList>> GetPopularFeedGeneratorsAsync(int limit = 50, string? cursor = default, CancellationToken cancellationToken = default) | ||
{ | ||
string url = $"{Constants.Urls.Bluesky.Unspecced.GetPopularFeedGenerators}?limit={limit}"; | ||
if (cursor is not null) | ||
{ | ||
url += $"&cursor={cursor}"; | ||
} | ||
|
||
Multiple<FeedResultList?, Error> result = await this.Client.Get<FeedResultList>(url, this.Options.JsonSerializerOptions, cancellationToken, this.Options.Logger); | ||
return result | ||
.Match<Result<FeedResultList>>( | ||
timeline => (timeline ?? new FeedResultList(Array.Empty<FeedRecord>(), null))!, | ||
error => error!); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// <copyright file="FeedRecord.cs" company="Drastic Actions"> | ||
// Copyright (c) Drastic Actions. All rights reserved. | ||
// </copyright> | ||
|
||
namespace FishyFlip.Models; | ||
|
||
public record FeedRecord(ATUri Uri, ATDid Did, string Avatar, FeedCreator Creator, Cid Cid, string DisplayName, Viewer Viewer, int LikeCount, DateTime IndexedAt, string Description) | ||
{ | ||
} | ||
|
||
public record FeedGeneratorRecord(bool IsOnline, bool IsValid, FeedRecord View); | ||
|
||
public record FeedPostList(FeedPost[] Feed, string? Cursor); | ||
|
||
public record FeedPost(PostView Post); | ||
|
||
public record FeedResultList(FeedRecord[] Feeds, string? Cursor); | ||
|
||
public record FeedCreator(string Did, | ||
string Handle, | ||
string DisplayName, | ||
string Avatar, | ||
Viewer Viewer, | ||
IReadOnlyList<Label> Labels); |