summaryrefslogtreecommitdiff
path: root/Feed.cs
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2026-05-13 00:47:55 +1000
committerJake Mannens <jake@asger.xyz>2026-05-13 00:47:55 +1000
commit532b46dfe288e31607f0362626d6b7b81b3c2948 (patch)
treec27b4ee076642cb5dd97eb5fb788977a22d7d419 /Feed.cs
parent477c6c7a4f2ccb2123a89dce1cc51db2dc643833 (diff)
v0.16av0.16a
Diffstat (limited to 'Feed.cs')
-rw-r--r--Feed.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/Feed.cs b/Feed.cs
new file mode 100644
index 0000000..e6492ff
--- /dev/null
+++ b/Feed.cs
@@ -0,0 +1,63 @@
+using HyperBooru.ApiModels;
+using System.Net.Http.Json;
+
+namespace HyperBooru.ApiClient;
+
+public class Feed {
+ private HBSession session;
+
+ internal Feed(HBSession session) =>
+ this.session = session;
+
+ public async Task<Guid[]> LoadChunkAsync(
+ bool selectIngest = false,
+ bool includeNsfw = false,
+ int count = 50,
+ SortOrder sortOrder = SortOrder.ObjectId,
+ Guid? continuationToken = null
+ ) => await LoadChunkAsync(new FeedRequest {
+ SelectIngest = selectIngest,
+ IncludeNsfw = includeNsfw,
+ Count = count,
+ SortOrder = sortOrder,
+ ContinuationToken = continuationToken
+ });
+
+ public async Task<Guid[]> LoadChunkAsync(
+ Guid tagId,
+ bool selectIngest = false,
+ bool includeNsfw = false,
+ int count = 50,
+ SortOrder sortOrder = SortOrder.ObjectId,
+ Guid? continuationToken = null
+ ) => await LoadChunkAsync(new FeedTagRequest {
+ SelectIngest = selectIngest,
+ IncludeNsfw = includeNsfw,
+ Count = count,
+ SortOrder = sortOrder,
+ ContinuationToken = continuationToken,
+ TagId = tagId
+ });
+
+ public async Task<Guid[]> LoadChunkAsync(
+ string query,
+ bool selectIngest = false,
+ bool includeNsfw = false,
+ int count = 50,
+ SortOrder sortOrder = SortOrder.ObjectId,
+ Guid? continuationToken = null
+ ) => await LoadChunkAsync(new FeedSearchRequest {
+ SelectIngest = selectIngest,
+ IncludeNsfw = includeNsfw,
+ Count = count,
+ SortOrder = sortOrder,
+ ContinuationToken = continuationToken,
+ Query = query
+ });
+
+ public async Task<Guid[]> LoadChunkAsync(FeedRequest feedRequest) {
+ var response = await session.HttpClient.PostAsJsonAsync("/api/feed", feedRequest);
+
+ return (await response.Content.ReadFromJsonAsync<Guid[]>())!;
+ }
+}