libkazv
Loading...
Searching...
No Matches
client_event_without_room_id.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
9
10namespace Kazv::Api {
13{
14
16 std::optional<std::int_fast64_t> age;
17
20
24 std::optional<std::string> transactionId;
25
30};
31
32}
33namespace nlohmann
34{
35using namespace Kazv;
36using namespace Kazv::Api;
37template<>
38struct adl_serializer<UnsignedData> {
39 static void to_json(json& jo, const UnsignedData &pod)
40 {
41 if (! jo.is_object()) { jo = json::object(); }
42
43
44
45 addToJsonIfNeeded(jo, "age"s, pod.age);
46
47 addToJsonIfNeeded(jo, "redacted_because"s, pod.redactedBecause);
48
49 addToJsonIfNeeded(jo, "transaction_id"s, pod.transactionId);
50
51 addToJsonIfNeeded(jo, "prev_content"s, pod.prevContent);
52 }
53 static void from_json(const json &jo, UnsignedData& result)
54 {
55
56 if (jo.contains("age"s)) {
57 result.age = jo.at("age"s);
58 }
59 if (jo.contains("redacted_because"s)) {
60 result.redactedBecause = jo.at("redacted_because"s);
61 }
62 if (jo.contains("transaction_id"s)) {
63 result.transactionId = jo.at("transaction_id"s);
64 }
65 if (jo.contains("prev_content"s)) {
66 result.prevContent = jo.at("prev_content"s);
67 }
68
69 }
70};
71 }
72
73 namespace Kazv::Api
74 {
79{
80
82 std::string eventId;
83
85 std::string type;
86
88 std::string sender;
89
92 std::int_fast64_t originServerTs;
93
96
104 std::optional<std::string> stateKey;
105
107 std::optional<UnsignedData> unsignedData;
108};
109
110}
111namespace nlohmann
112{
113using namespace Kazv;
114using namespace Kazv::Api;
115template<>
116struct adl_serializer<ClientEventWithoutRoomID> {
117 static void to_json(json& jo, const ClientEventWithoutRoomID &pod)
118 {
119 if (! jo.is_object()) { jo = json::object(); }
120
121
122 jo["event_id"s] = pod.eventId;
123
124 jo["type"s] = pod.type;
125
126 jo["sender"s] = pod.sender;
127
128 jo["origin_server_ts"s] = pod.originServerTs;
129
130 jo["content"s] = pod.content;
131
132
133 addToJsonIfNeeded(jo, "state_key"s, pod.stateKey);
134
135 addToJsonIfNeeded(jo, "unsigned"s, pod.unsignedData);
136 }
137 static void from_json(const json &jo, ClientEventWithoutRoomID& result)
138 {
139
140 if (jo.contains("event_id"s)) {
141 result.eventId = jo.at("event_id"s);
142 }
143 if (jo.contains("type"s)) {
144 result.type = jo.at("type"s);
145 }
146 if (jo.contains("sender"s)) {
147 result.sender = jo.at("sender"s);
148 }
149 if (jo.contains("origin_server_ts"s)) {
150 result.originServerTs = jo.at("origin_server_ts"s);
151 }
152 if (jo.contains("content"s)) {
153 result.content = jo.at("content"s);
154 }
155 if (jo.contains("state_key"s)) {
156 result.stateKey = jo.at("state_key"s);
157 }
158 if (jo.contains("unsigned"s)) {
159 result.unsignedData = jo.at("unsigned"s);
160 }
161
162 }
163};
164 }
165
166 namespace Kazv::Api
167 {
168} // namespace Kazv::Api
Definition jsonwrap.hpp:23
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
Definition location.hpp:27
The format used for events when they are returned from API endpoints such as /sync,...
Definition client_event_without_room_id.hpp:79
std::string type
The type of the event.
Definition client_event_without_room_id.hpp:85
std::optional< UnsignedData > unsignedData
Contains optional extra information about the event.
Definition client_event_without_room_id.hpp:107
std::int_fast64_t originServerTs
Timestamp (in milliseconds since the unix epoch) on originating homeserver when this event was sent.
Definition client_event_without_room_id.hpp:92
std::string eventId
The globally unique identifier for this event.
Definition client_event_without_room_id.hpp:82
std::string sender
Contains the fully-qualified ID of the user who sent this event.
Definition client_event_without_room_id.hpp:88
std::optional< std::string > stateKey
Present if, and only if, this event is a state event.
Definition client_event_without_room_id.hpp:104
JsonWrap content
The body of this event, as created by the client which sent it.
Definition client_event_without_room_id.hpp:95
Contains optional extra information about the event.
Definition client_event_without_room_id.hpp:13
std::optional< std::int_fast64_t > age
The time in milliseconds that has elapsed since the event was sent. This field is generated by the lo...
Definition client_event_without_room_id.hpp:16
JsonWrap redactedBecause
The event that redacted this event, if any.
Definition client_event_without_room_id.hpp:19
JsonWrap prevContent
The previous content for this event.
Definition client_event_without_room_id.hpp:29
std::optional< std::string > transactionId
The client-supplied transaction ID, for example, provided via PUT /_matrix/client/v3/rooms/{roomId}/s...
Definition client_event_without_room_id.hpp:24
static void to_json(json &jo, const ClientEventWithoutRoomID &pod)
Definition client_event_without_room_id.hpp:117
static void from_json(const json &jo, ClientEventWithoutRoomID &result)
Definition client_event_without_room_id.hpp:137
static void to_json(json &jo, const UnsignedData &pod)
Definition client_event_without_room_id.hpp:39
static void from_json(const json &jo, UnsignedData &result)
Definition client_event_without_room_id.hpp:53