libkazv
Loading...
Searching...
No Matches
rooms.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 "basejob.hpp"
8
9
10namespace Kazv::Api {
11
18public:
19
20
21
22class JobResponse : public Response
23{
24
25public:
27 bool success() const;
28
29 // Result properties
30
31
33
34 JsonWrap data() const
35 {
36 return
37 std::move(jsonBody().get()).get<JsonWrap>()
38 ;
39 }
40
41
42};
43 static constexpr auto needsAuth() {
44 return true
45 ;
46 }
47
48
49// Construction/destruction
50
59 explicit GetOneRoomEventJob(std::string serverUrl
60 , std::string _accessToken
61 ,
62 std::string roomId , std::string eventId
63 );
64
65
67 );
68
69 static BaseJob::Body buildBody(std::string roomId, std::string eventId);
70
71
72
73
74
77 };
79 }
80 namespace nlohmann
81 {
82 using namespace Kazv;
83 using namespace Kazv::Api;
84
85 }
86
87 namespace Kazv::Api
88 {
89
98public:
99
100
101
102class JobResponse : public Response
103{
104
105public:
107 bool success() const;
108
109};
110 static constexpr auto needsAuth() {
111 return true
112 ;
113 }
114
115
116// Construction/destruction
117
130 explicit GetRoomStateWithKeyJob(std::string serverUrl
131 , std::string _accessToken
132 ,
133 std::string roomId , std::string eventType , std::string stateKey
134 );
135
136
138 );
139
140 static BaseJob::Body buildBody(std::string roomId, std::string eventType, std::string stateKey);
141
142
143
144
145
148 };
150 }
151 namespace nlohmann
152 {
153 using namespace Kazv;
154 using namespace Kazv::Api;
155
156 }
157
158 namespace Kazv::Api
159 {
160
165class GetRoomStateJob : public BaseJob {
166public:
167
168
169
170class JobResponse : public Response
171{
172
173public:
175 bool success() const;
176
177 // Result properties
178
179
181
183 {
184 return
185 std::move(jsonBody().get()).get<EventList>()
186 ;
187 }
188
189
190};
191 static constexpr auto needsAuth() {
192 return true
193 ;
194 }
195
196
197// Construction/destruction
198
204 explicit GetRoomStateJob(std::string serverUrl
205 , std::string _accessToken
206 ,
207 std::string roomId
208 );
209
210
212 );
213
214 static BaseJob::Body buildBody(std::string roomId);
215
216
217
218
219
222 };
224 }
225 namespace nlohmann
226 {
227 using namespace Kazv;
228 using namespace Kazv::Api;
229
230 }
231
232 namespace Kazv::Api
233 {
234
240public:
241
242
243
244class JobResponse : public Response
245{
246
247public:
249 bool success() const;
250
251 // Result properties
252
253
254
255
257EventList chunk() const;
258
259};
260 static constexpr auto needsAuth() {
261 return true
262 ;
263 }
264
265
266// Construction/destruction
267
289 explicit GetMembersByRoomJob(std::string serverUrl
290 , std::string _accessToken
291 ,
292 std::string roomId , std::optional<std::string> at = std::nullopt, std::optional<std::string> membership = std::nullopt, std::optional<std::string> notMembership = std::nullopt
293 );
294
295
297 std::optional<std::string> at, std::optional<std::string> membership, std::optional<std::string> notMembership);
298
299 static BaseJob::Body buildBody(std::string roomId, std::optional<std::string> at, std::optional<std::string> membership, std::optional<std::string> notMembership);
300
301
302
303
304
307 };
309 }
310 namespace nlohmann
311 {
312 using namespace Kazv;
313 using namespace Kazv::Api;
314
315 }
316
317 namespace Kazv::Api
318 {
319
325public:
326 // Inner data structures
327
330 {
332 std::optional<std::string> displayName;
334 std::optional<std::string> avatarUrl;
335
336 };
337
338
339
340class JobResponse : public Response
341{
342
343public:
345 bool success() const;
346
347 // Result properties
348
349
350
351
353immer::map<std::string, RoomMember> joined() const;
354
355};
356 static constexpr auto needsAuth() {
357 return true
358 ;
359 }
360
361
362// Construction/destruction
363
369 explicit GetJoinedMembersByRoomJob(std::string serverUrl
370 , std::string _accessToken
371 ,
372 std::string roomId
373 );
374
375
377 );
378
379 static BaseJob::Body buildBody(std::string roomId);
380
381
382
383
384
387 };
389 }
390 namespace nlohmann
391 {
392 using namespace Kazv;
393 using namespace Kazv::Api;
394 template<>
395 struct adl_serializer<GetJoinedMembersByRoomJob::RoomMember> {
396
398 {
399 if (! jo.is_object()) { jo = json::object(); }
400
401
402
403 addToJsonIfNeeded(jo, "display_name"s, pod.displayName);
404
405 addToJsonIfNeeded(jo, "avatar_url"s, pod.avatarUrl);
406 }
407
409 {
410
411 if (jo.contains("display_name"s)) {
412 result.displayName = jo.at("display_name"s);
413 }
414 if (jo.contains("avatar_url"s)) {
415 result.avatarUrl = jo.at("avatar_url"s);
416 }
417
418 }
419
420};
421 }
422
423 namespace Kazv::Api
424 {
425
426} // namespace Kazv::Api
bool success() const
Definition rooms.cpp:358
immer::map< std::string, RoomMember > joined() const
A map from user ID to a RoomMember object.
Definition rooms.cpp:368
Gets the list of currently joined users and their profile data.
Definition rooms.hpp:324
static constexpr auto needsAuth()
Definition rooms.hpp:356
static BaseJob::Query buildQuery()
Definition rooms.cpp:301
static BaseJob::Body buildBody(std::string roomId)
Definition rooms.cpp:309
GetJoinedMembersByRoomJob withData(JsonWrap j) &&
Definition rooms.cpp:341
bool success() const
Definition rooms.cpp:279
EventList chunk() const
Get the list of members for this room.
Definition rooms.cpp:289
Get the m.room.member events for the room.
Definition rooms.hpp:239
static constexpr auto needsAuth()
Definition rooms.hpp:260
static BaseJob::Body buildBody(std::string roomId, std::optional< std::string > at, std::optional< std::string > membership, std::optional< std::string > notMembership)
Definition rooms.cpp:230
GetMembersByRoomJob withData(JsonWrap j) &&
Definition rooms.cpp:262
static BaseJob::Query buildQuery(std::optional< std::string > at, std::optional< std::string > membership, std::optional< std::string > notMembership)
Definition rooms.cpp:217
bool success() const
Definition rooms.cpp:70
JsonWrap data() const
The full event.
Definition rooms.hpp:34
Get a single event by event ID.
Definition rooms.hpp:17
static BaseJob::Query buildQuery()
Definition rooms.cpp:13
static constexpr auto needsAuth()
Definition rooms.hpp:43
GetOneRoomEventJob withData(JsonWrap j) &&
Definition rooms.cpp:53
static BaseJob::Body buildBody(std::string roomId, std::string eventId)
Definition rooms.cpp:21
bool success() const
Definition rooms.cpp:206
EventList data() const
The current state of the room.
Definition rooms.hpp:182
Get all state events in the current state of a room.
Definition rooms.hpp:165
static constexpr auto needsAuth()
Definition rooms.hpp:191
GetRoomStateJob withData(JsonWrap j) &&
Definition rooms.cpp:189
static BaseJob::Query buildQuery()
Definition rooms.cpp:149
static BaseJob::Body buildBody(std::string roomId)
Definition rooms.cpp:157
bool success() const
Definition rooms.cpp:138
Get the state identified by the type and key.
Definition rooms.hpp:97
static BaseJob::Query buildQuery()
Definition rooms.cpp:81
static BaseJob::Body buildBody(std::string roomId, std::string eventType, std::string stateKey)
Definition rooms.cpp:89
GetRoomStateWithKeyJob withData(JsonWrap j) &&
Definition rooms.cpp:121
static constexpr auto needsAuth()
Definition rooms.hpp:110
Definition basejob.hpp:94
Definition basejob.hpp:68
::Kazv::Body Body
Definition basejob.hpp:103
Definition jsonwrap.hpp:23
const json & get() const
Definition jsonwrap.hpp:40
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
This API returns a map of MXIDs to member info objects for members of the room. The current user must...
Definition rooms.hpp:330
std::optional< std::string > displayName
The display name of the user this object is representing.
Definition rooms.hpp:332
std::optional< std::string > avatarUrl
The mxc avatar url of the user this object is representing.
Definition rooms.hpp:334
Definition basejob.hpp:49
JsonWrap jsonBody() const
Definition basejob.cpp:141
static void from_json(const json &jo, GetJoinedMembersByRoomJob::RoomMember &result)
Definition rooms.hpp:408
static void to_json(json &jo, const GetJoinedMembersByRoomJob::RoomMember &pod)
Definition rooms.hpp:397