18 public List<Event<T>>
Events {
get;
private init; } = [];
23 public string Cursor {
get;
private init; } =
null!;
28 public bool HasNext {
get;
private init; }
33 public QueryStats
Stats {
get;
private init; }
37 var json = JsonSerializer.Deserialize<JsonElement>(body);
39 var err = GetError(json);
45 return new FeedPage<T>
48 Events = GetEvents(json, ctx),
49 Stats = GetStats(json),
50 HasNext = json.TryGetProperty(HasNextFieldName, out var elem) && elem.GetBoolean()
54 private static List<Event<T>> GetEvents(JsonElement json,
MappingContext ctx)
56 if (!json.TryGetProperty(EventsFieldName, out var elem))
58 return new List<Event<T>>();
61 var events = elem.EnumerateArray().Select(e =>
Event<T>.From(e, ctx)).ToList();
65 private static QueryStats GetStats(JsonElement json)
67 return json.TryGetProperty(StatsFieldName, out var elem) ? elem.Deserialize<QueryStats>() : default;
70 private static string GetCursor(JsonElement json)
72 return json.TryGetProperty(CursorFieldName, out var elem) ? elem.GetString()! :
null!;
75 private static ErrorInfo? GetError(JsonElement json)
77 return json.TryGetProperty(ErrorFieldName, out var elem) ? elem.Deserialize<ErrorInfo>() : null;
Represents the response from Fauna Event Feed requests.
List< Event< T > > Events
List of Events returned by the Feed.
bool HasNext
Indicates if there are more pages for pagination.
string Cursor
Cursor returned from the Feed.
QueryStats Stats
Stats returned from the Feed.
A class representing the mapping context to be used during serialization and deserialization.