libkazv
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 
10 namespace Kazv::Api {
11 
17 class GetOneRoomEventJob : public BaseJob {
18 public:
19 
20 
21 
22 class JobResponse : public Response
23 {
24 
25 public:
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 
98 public:
99 
100 
101 
102 class JobResponse : public Response
103 {
104 
105 public:
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 
137  static BaseJob::Query buildQuery(
138  );
139 
140  static BaseJob::Body buildBody(std::string roomId, std::string eventType, std::string stateKey);
141 
142 
143 
144 
145 
146  GetRoomStateWithKeyJob withData(JsonWrap j) &&;
147  GetRoomStateWithKeyJob withData(JsonWrap j) const &;
148  };
150  }
151  namespace nlohmann
152  {
153  using namespace Kazv;
154  using namespace Kazv::Api;
155 
156  }
157 
158  namespace Kazv::Api
159  {
160 
165 class GetRoomStateJob : public BaseJob {
166 public:
167 
168 
169 
170 class JobResponse : public Response
171 {
172 
173 public:
175  bool success() const;
176 
177  // Result properties
178 
179 
181 
182  EventList data() const
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 
211  static BaseJob::Query buildQuery(
212  );
213 
214  static BaseJob::Body buildBody(std::string roomId);
215 
216 
217 
218 
219 
220  GetRoomStateJob withData(JsonWrap j) &&;
221  GetRoomStateJob withData(JsonWrap j) const &;
222  };
224  }
225  namespace nlohmann
226  {
227  using namespace Kazv;
228  using namespace Kazv::Api;
229 
230  }
231 
232  namespace Kazv::Api
233  {
234 
239 class GetMembersByRoomJob : public BaseJob {
240 public:
241 
242 
243 
244 class JobResponse : public Response
245 {
246 
247 public:
249  bool success() const;
250 
251  // Result properties
252 
253 
254 
255 
257 EventList 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 
296  static BaseJob::Query buildQuery(
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 
305  GetMembersByRoomJob withData(JsonWrap j) &&;
306  GetMembersByRoomJob withData(JsonWrap j) const &;
307  };
309  }
310  namespace nlohmann
311  {
312  using namespace Kazv;
313  using namespace Kazv::Api;
314 
315  }
316 
317  namespace Kazv::Api
318  {
319 
325 public:
326  // Inner data structures
327 
329  struct RoomMember
330  {
332  std::optional<std::string> displayName;
334  std::optional<std::string> avatarUrl;
335 
336  };
337 
338 
339 
340 class JobResponse : public Response
341 {
342 
343 public:
345  bool success() const;
346 
347  // Result properties
348 
349 
350 
351 
353 immer::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 
376  static BaseJob::Query buildQuery(
377  );
378 
379  static BaseJob::Body buildBody(std::string roomId);
380 
381 
382 
383 
384 
385  GetJoinedMembersByRoomJob withData(JsonWrap j) &&;
386  GetJoinedMembersByRoomJob withData(JsonWrap j) const &;
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 
408  static void from_json(const json &jo, GetJoinedMembersByRoomJob::RoomMember& result)
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
Gets the list of currently joined users and their profile data.
Definition: rooms.hpp:324
static constexpr auto needsAuth()
Definition: rooms.hpp:356
Get the m.room.member events for the room.
Definition: rooms.hpp:239
static constexpr auto needsAuth()
Definition: rooms.hpp:260
JobResponse(Response r)
Definition: rooms.cpp:67
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
GetOneRoomEventJob(std::string serverUrl, std::string _accessToken, std::string roomId, std::string eventId)
Get a single event by event ID.
Definition: rooms.cpp:33
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
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
Get the state identified by the type and key.
Definition: rooms.hpp:97
static constexpr auto needsAuth()
Definition: rooms.hpp:110
Definition: basejob.hpp:91
Definition: basejob.hpp:77
::Kazv::Body Body
Definition: basejob.hpp:100
Definition: jsonwrap.hpp:23
const json & get() const
Definition: jsonwrap.hpp:38
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:50
JsonWrap jsonBody() const
Definition: basejob.cpp:139
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