libkazv
Loading...
Searching...
No Matches
timeline_batch.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include "types.hpp"
8#include "event.hpp"
9
10namespace Kazv::Api {
11
13{
14
17
19 std::optional<bool> limited;
20
23 std::optional<std::string> prevBatch;
24};
25
26}
27namespace nlohmann
28{
29using namespace Kazv;
30using namespace Kazv::Api;
31template<>
32struct adl_serializer<Timeline> {
33 static void to_json(json& jo, const Timeline &pod)
34 {
35 if (! jo.is_object()) { jo = json::object(); }
36
37
38 jo["events"s] = pod.events;
39
40
41 addToJsonIfNeeded(jo, "limited"s, pod.limited);
42
43 addToJsonIfNeeded(jo, "prev_batch"s, pod.prevBatch);
44 }
45 static void from_json(const json &jo, Timeline& result)
46 {
47
48 if (jo.contains("events"s)) {
49 result.events = jo.at("events"s);
50 }
51 if (jo.contains("limited"s)) {
52 result.limited = jo.at("limited"s);
53 }
54 if (jo.contains("prev_batch"s)) {
55 result.prevBatch = jo.at("prev_batch"s);
56 }
57
58 }
59};
60 }
61
62 namespace Kazv::Api
63 {
64} // namespace Kazv::Api
Definition location.hpp:10
Definition location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition types.hpp:80
nlohmann::json json
Definition jsonwrap.hpp:20
immer::flex_vector< Event > EventList
Definition types.hpp:107
Definition location.hpp:27
Definition timeline_batch.hpp:13
std::optional< bool > limited
True if the number of events returned was limited by the limit on the filter.
Definition timeline_batch.hpp:19
std::optional< std::string > prevBatch
A token that can be supplied to the from parameter of the `/rooms/<room_id>/messages` endpoint in ord...
Definition timeline_batch.hpp:23
EventList events
List of events.
Definition timeline_batch.hpp:16
static void to_json(json &jo, const Timeline &pod)
Definition timeline_batch.hpp:33
static void from_json(const json &jo, Timeline &result)
Definition timeline_batch.hpp:45