libkazv
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 
10 namespace Kazv::Api {
11 
12 struct Timeline
13 {
14 
17 
19  std::optional<bool> limited;
20 
23  std::optional<std::string> prevBatch;
24 };
25 
26 }
27 namespace nlohmann
28 {
29 using namespace Kazv;
30 using namespace Kazv::Api;
31 template<>
32 struct 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
Kazv::Api::Timeline::events
EventList events
List of events.
Definition: timeline_batch.hpp:20
types.hpp
nlohmann
Definition: location.hpp:26
event.hpp
Kazv::Api::Timeline::prevBatch
std::optional< std::string > prevBatch
A token that can be supplied to the from parameter of the /rooms/<room_id>/messages endpoint in order...
Definition: timeline_batch.hpp:27
Kazv::Api::Timeline
Definition: timeline_batch.hpp:14
Kazv
Definition: location.hpp:10
Kazv::Api::Timeline::limited
std::optional< bool > limited
True if the number of events returned was limited by the limit on the filter.
Definition: timeline_batch.hpp:23
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
Kazv::Api
Definition: location.hpp:10
Kazv::addToJsonIfNeeded
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
nlohmann::adl_serializer< Timeline >::from_json
static void from_json(const json &jo, Timeline &result)
Definition: timeline_batch.hpp:45
nlohmann::adl_serializer< Timeline >::to_json
static void to_json(json &jo, const Timeline &pod)
Definition: timeline_batch.hpp:33
Kazv::EventList
immer::flex_vector< Event > EventList
Definition: types.hpp:107