libkazv
kazvevents.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of libkazv.
3  * SPDX-FileCopyrightText: 2020 Tusooa Zhu
4  * SPDX-License-Identifier: AGPL-3.0-or-later
5  */
6 
7 
8 #pragma once
9 #include "libkazv-config.hpp"
10 #include <variant>
11 #include "types.hpp"
12 #include "event.hpp"
13 #include "basejob.hpp"
14 
15 namespace Kazv
16 {
17  struct LoginSuccessful {};
18 
19  struct LoginFailed
20  {
21  std::string errorCode;
22  std::string error;
23  };
24 
26  {
27  std::string nextToken;
28  };
29 
30  struct SyncFailed
31  {
32  };
33 
35  {
36  };
37 
39  {
40  std::string errorCode;
41  std::string error;
42  };
43 
45 
47 
50  std::string roomId;
51  };
52 
55  std::string roomId;
56  };
57 
60  std::string roomId;
61  };
62 
64  {
66  };
67 
70  std::string roomId;
71  };
72 
74  {
75  std::string roomId;
76  };
77 
79  {
80  std::string roomId;
81  };
82 
84  {
85  std::string roomId;
86  };
87 
89  {
90  std::string errorCode;
91  std::string error;
92  };
93 
95  {
96  std::string roomId;
97  std::string userId;
98  };
99 
101  {
102  std::string roomId;
103  std::string userId;
104  std::string errorCode;
105  std::string error;
106  };
107 
109  {
110  std::string roomIdOrAlias;
111  };
112 
114  {
115  std::string roomIdOrAlias;
116  std::string errorCode;
117  std::string error;
118  };
119 
121  {
122  std::string roomId;
123  };
124 
126  {
127  std::string roomId;
128  std::string errorCode;
129  std::string error;
130  };
131 
133  {
134  std::string roomId;
135  };
136 
138  {
139  std::string roomId;
140  std::string errorCode;
141  std::string error;
142  };
143 
145  {
146  std::string roomId;
147  std::string eventId;
148  };
149 
151  {
152  std::string roomId;
153  std::string errorCode;
154  std::string error;
155  };
156 
158  {
159  immer::map<std::string, immer::flex_vector<std::string>> devicesToSend;
160  std::string txnId;
161  };
162 
164  {
165  immer::map<std::string, immer::flex_vector<std::string>> devicesToSend;
166  std::string txnId;
167  std::string errorCode;
168  std::string error;
169  };
170 
172  {
173  };
174 
176  {
177  std::string roomId;
178  };
179 
181  {
182  std::string roomId;
183  std::string errorCode;
184  std::string error;
185  };
186 
188  {
189  std::string roomId;
191  };
192 
194  {
195  std::string roomId;
196  std::string errorCode;
197  std::string error;
198  };
199 
201  {
202  std::string roomId;
203  std::string eventId;
204  std::string eventType;
205  std::string stateKey;
206  };
207 
209  {
210  std::string roomId;
211  std::string eventType;
212  std::string stateKey;
213  std::string errorCode;
214  std::string error;
215  };
216 
218  {
219  std::string roomId;
220  };
221 
223  {
224  std::string roomId;
225  std::string errorCode;
226  std::string error;
227  };
228 
230  {
231  std::string roomId;
232  };
233 
235  {
236  std::string roomId;
237  std::string errorCode;
238  std::string error;
239  };
240 
242  {
243  std::string roomId;
244  };
245 
247  {
248  std::string roomId;
249  std::string errorCode;
250  std::string error;
251  };
252 
254  {
255  std::string mxcUri;
256  std::string uploadId;
257  };
258 
260  {
261  std::string uploadId;
262  std::string errorCode;
263  std::string error;
264  };
265 
267  {
268  std::string mxcUri;
269  immer::box<Bytes> content;
270  std::optional<std::string> filename;
271  std::optional<std::string> contentType;
272  };
273 
275  {
276  std::string mxcUri;
277  std::string errorCode;
278  std::string error;
279  };
280 
282  {
283  std::string mxcUri;
284  immer::box<Bytes> content;
285  std::optional<std::string> contentType;
286  };
287 
289  {
290  std::string mxcUri;
291  std::string errorCode;
292  std::string error;
293  };
294 
296  {
297  };
298 
300  {
301  std::string errorCode;
302  std::string error;
303  };
304 
306  {
307  };
308 
310  {
311  std::string errorCode;
312  std::string error;
313  };
314 
316  {
318  immer::map<std::string, immer::flex_vector<std::string>> devicesToSend;
319  };
320 
322  {
323  std::string errorCode;
324  std::string error;
325  };
326 
328  {
330  };
331 
332 
334  {
336  };
337 
338  using KazvEvent = std::variant<
339  // use this for placeholder of "no events yet"
340  // otherwise the first LoginSuccessful event cannot be detected
341  std::monostate,
342 
343  // matrix events
351 
352  // auth
354  // sync
357  // paginate
359  // membership
365  // send
369  // states
373  // ephemeral
377  // content
381  // encryption
385 
386  // general
389 
390  >;
391 
392  using KazvEventList = immer::flex_vector<KazvEvent>;
393 }
Definition: event.hpp:21
Definition: jsonwrap.hpp:23
Definition: location.hpp:10
immer::flex_vector< KazvEvent > KazvEventList
Definition: kazvevents.hpp:392
std::variant< std::monostate, ReceivingPresenceEvent, ReceivingAccountDataEvent, ReceivingRoomTimelineEvent, ReceivingRoomStateEvent, RoomMembershipChanged, ReceivingRoomAccountDataEvent, ReceivingToDeviceMessage, LoginSuccessful, LoginFailed, SyncSuccessful, SyncFailed, PostInitialFiltersSuccessful, PostInitialFiltersFailed, PaginateSuccessful, PaginateFailed, CreateRoomSuccessful, CreateRoomFailed, InviteUserSuccessful, InviteUserFailed, JoinRoomSuccessful, JoinRoomFailed, LeaveRoomSuccessful, LeaveRoomFailed, ForgetRoomSuccessful, ForgetRoomFailed, SendMessageSuccessful, SendMessageFailed, SendToDeviceMessageSuccessful, SendToDeviceMessageFailed, InvalidMessageFormat, GetRoomStatesSuccessful, GetRoomStatesFailed, GetStateEventSuccessful, GetStateEventFailed, SendStateEventSuccessful, SendStateEventFailed, SetTypingSuccessful, SetTypingFailed, PostReceiptSuccessful, PostReceiptFailed, SetReadMarkerSuccessful, SetReadMarkerFailed, UploadContentSuccessful, UploadContentFailed, DownloadContentSuccessful, DownloadContentFailed, DownloadThumbnailSuccessful, DownloadThumbnailFailed, UploadIdentityKeysSuccessful, UploadIdentityKeysFailed, UploadOneTimeKeysSuccessful, UploadOneTimeKeysFailed, ClaimKeysSuccessful, ClaimKeysFailed, UnrecognizedResponse, ShouldQueryKeys > KazvEvent
Definition: kazvevents.hpp:390
RoomMembership
Definition: types.hpp:128
Definition: kazvevents.hpp:322
std::string errorCode
Definition: kazvevents.hpp:323
std::string error
Definition: kazvevents.hpp:324
Definition: kazvevents.hpp:316
immer::map< std::string, immer::flex_vector< std::string > > devicesToSend
Definition: kazvevents.hpp:318
Event eventToSend
Definition: kazvevents.hpp:317
Definition: kazvevents.hpp:89
std::string errorCode
Definition: kazvevents.hpp:90
std::string error
Definition: kazvevents.hpp:91
Definition: kazvevents.hpp:84
std::string roomId
Definition: kazvevents.hpp:85
Definition: kazvevents.hpp:275
std::string mxcUri
Definition: kazvevents.hpp:276
std::string errorCode
Definition: kazvevents.hpp:277
std::string error
Definition: kazvevents.hpp:278
Definition: kazvevents.hpp:267
std::optional< std::string > filename
Definition: kazvevents.hpp:270
immer::box< Bytes > content
Definition: kazvevents.hpp:269
std::optional< std::string > contentType
Definition: kazvevents.hpp:271
std::string mxcUri
Definition: kazvevents.hpp:268
Definition: kazvevents.hpp:289
std::string error
Definition: kazvevents.hpp:292
std::string mxcUri
Definition: kazvevents.hpp:290
std::string errorCode
Definition: kazvevents.hpp:291
Definition: kazvevents.hpp:282
immer::box< Bytes > content
Definition: kazvevents.hpp:284
std::string mxcUri
Definition: kazvevents.hpp:283
std::optional< std::string > contentType
Definition: kazvevents.hpp:285
Definition: kazvevents.hpp:138
std::string roomId
Definition: kazvevents.hpp:139
std::string error
Definition: kazvevents.hpp:141
std::string errorCode
Definition: kazvevents.hpp:140
Definition: kazvevents.hpp:133
std::string roomId
Definition: kazvevents.hpp:134
Definition: kazvevents.hpp:181
std::string errorCode
Definition: kazvevents.hpp:183
std::string error
Definition: kazvevents.hpp:184
std::string roomId
Definition: kazvevents.hpp:182
Definition: kazvevents.hpp:176
std::string roomId
Definition: kazvevents.hpp:177
Definition: kazvevents.hpp:194
std::string error
Definition: kazvevents.hpp:197
std::string errorCode
Definition: kazvevents.hpp:196
std::string roomId
Definition: kazvevents.hpp:195
Definition: kazvevents.hpp:188
JsonWrap content
Definition: kazvevents.hpp:190
std::string roomId
Definition: kazvevents.hpp:189
Definition: kazvevents.hpp:172
Definition: kazvevents.hpp:101
std::string roomId
Definition: kazvevents.hpp:102
std::string userId
Definition: kazvevents.hpp:103
std::string error
Definition: kazvevents.hpp:105
std::string errorCode
Definition: kazvevents.hpp:104
Definition: kazvevents.hpp:95
std::string userId
Definition: kazvevents.hpp:97
std::string roomId
Definition: kazvevents.hpp:96
Definition: kazvevents.hpp:114
std::string error
Definition: kazvevents.hpp:117
std::string roomIdOrAlias
Definition: kazvevents.hpp:115
std::string errorCode
Definition: kazvevents.hpp:116
Definition: kazvevents.hpp:109
std::string roomIdOrAlias
Definition: kazvevents.hpp:110
Definition: kazvevents.hpp:126
std::string error
Definition: kazvevents.hpp:129
std::string errorCode
Definition: kazvevents.hpp:128
std::string roomId
Definition: kazvevents.hpp:127
Definition: kazvevents.hpp:121
std::string roomId
Definition: kazvevents.hpp:122
Definition: kazvevents.hpp:20
std::string errorCode
Definition: kazvevents.hpp:21
std::string error
Definition: kazvevents.hpp:22
Definition: kazvevents.hpp:17
Definition: kazvevents.hpp:79
std::string roomId
Definition: kazvevents.hpp:80
Definition: kazvevents.hpp:74
std::string roomId
Definition: kazvevents.hpp:75
Definition: kazvevents.hpp:39
std::string errorCode
Definition: kazvevents.hpp:40
std::string error
Definition: kazvevents.hpp:41
Definition: kazvevents.hpp:35
Definition: kazvevents.hpp:235
std::string roomId
Definition: kazvevents.hpp:236
std::string error
Definition: kazvevents.hpp:238
std::string errorCode
Definition: kazvevents.hpp:237
Definition: kazvevents.hpp:230
std::string roomId
Definition: kazvevents.hpp:231
Definition: kazvevents.hpp:46
Event event
Definition: kazvevents.hpp:46
Definition: kazvevents.hpp:44
Event event
Definition: kazvevents.hpp:44
Definition: kazvevents.hpp:58
std::string roomId
Definition: kazvevents.hpp:60
Event event
Definition: kazvevents.hpp:59
Definition: kazvevents.hpp:48
Event event
Definition: kazvevents.hpp:49
std::string roomId
Definition: kazvevents.hpp:50
Definition: kazvevents.hpp:53
std::string roomId
Definition: kazvevents.hpp:55
Event event
Definition: kazvevents.hpp:54
Definition: kazvevents.hpp:64
Event event
Definition: kazvevents.hpp:65
Definition: basejob.hpp:50
Definition: kazvevents.hpp:68
std::string roomId
Definition: kazvevents.hpp:70
RoomMembership membership
Definition: kazvevents.hpp:69
Definition: kazvevents.hpp:151
std::string roomId
Definition: kazvevents.hpp:152
std::string error
Definition: kazvevents.hpp:154
std::string errorCode
Definition: kazvevents.hpp:153
Definition: kazvevents.hpp:145
std::string roomId
Definition: kazvevents.hpp:146
std::string eventId
Definition: kazvevents.hpp:147
Definition: kazvevents.hpp:209
std::string errorCode
Definition: kazvevents.hpp:213
std::string roomId
Definition: kazvevents.hpp:210
std::string error
Definition: kazvevents.hpp:214
std::string eventType
Definition: kazvevents.hpp:211
std::string stateKey
Definition: kazvevents.hpp:212
Definition: kazvevents.hpp:201
std::string eventId
Definition: kazvevents.hpp:203
std::string stateKey
Definition: kazvevents.hpp:205
std::string roomId
Definition: kazvevents.hpp:202
std::string eventType
Definition: kazvevents.hpp:204
Definition: kazvevents.hpp:164
immer::map< std::string, immer::flex_vector< std::string > > devicesToSend
Definition: kazvevents.hpp:165
std::string errorCode
Definition: kazvevents.hpp:167
std::string txnId
Definition: kazvevents.hpp:166
std::string error
Definition: kazvevents.hpp:168
Definition: kazvevents.hpp:158
immer::map< std::string, immer::flex_vector< std::string > > devicesToSend
Definition: kazvevents.hpp:159
std::string txnId
Definition: kazvevents.hpp:160
Definition: kazvevents.hpp:247
std::string roomId
Definition: kazvevents.hpp:248
std::string error
Definition: kazvevents.hpp:250
std::string errorCode
Definition: kazvevents.hpp:249
Definition: kazvevents.hpp:242
std::string roomId
Definition: kazvevents.hpp:243
Definition: kazvevents.hpp:223
std::string error
Definition: kazvevents.hpp:226
std::string roomId
Definition: kazvevents.hpp:224
std::string errorCode
Definition: kazvevents.hpp:225
Definition: kazvevents.hpp:218
std::string roomId
Definition: kazvevents.hpp:219
Definition: kazvevents.hpp:334
bool isInitialSync
Definition: kazvevents.hpp:335
Definition: kazvevents.hpp:31
Definition: kazvevents.hpp:26
std::string nextToken
Definition: kazvevents.hpp:27
Definition: kazvevents.hpp:328
Response response
Definition: kazvevents.hpp:329
Definition: kazvevents.hpp:260
std::string uploadId
Definition: kazvevents.hpp:261
std::string error
Definition: kazvevents.hpp:263
std::string errorCode
Definition: kazvevents.hpp:262
Definition: kazvevents.hpp:254
std::string mxcUri
Definition: kazvevents.hpp:255
std::string uploadId
Definition: kazvevents.hpp:256
Definition: kazvevents.hpp:300
std::string errorCode
Definition: kazvevents.hpp:301
std::string error
Definition: kazvevents.hpp:302
Definition: kazvevents.hpp:296
Definition: kazvevents.hpp:310
std::string error
Definition: kazvevents.hpp:312
std::string errorCode
Definition: kazvevents.hpp:311
Definition: kazvevents.hpp:306