summaryrefslogtreecommitdiff
path: root/Feed.cs
blob: 11d877add782c42ff3489621e9134842f0fc010e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Text.Json.Serialization;

namespace HyperBooru.ApiModels;

public enum SortOrder {
    ObjectId,
    LastWriteTime,
    Random,
}

[JsonPolymorphic]
[JsonDerivedType(typeof(FeedSearchRequest), "FeedSearchRequest")]
[JsonDerivedType(typeof(FeedTagRequest),    "FeedTagRequest")]
public record FeedRequest {
    public bool      SelectIngest { get; init; }
    public bool      IncludeNsfw  { get; init; }
    public Media?    Key          { get; init; } = null;
    public int       Count        { get; init; } = 50;
    public SortOrder SortOrder    { get; init; } = SortOrder.ObjectId;
}

public record FeedSearchRequest : FeedRequest {
    public string Query { get; init; }
}

public record FeedTagRequest : FeedRequest {
    public Guid TagId { get; init; }
}