libQuotient
A Qt library for building matrix clients
public_rooms_response.h
Go to the documentation of this file.
1 // THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2 
3 #pragma once
4 
5 #include <Quotient/converters.h>
6 
7 namespace Quotient {
8 
9 struct QUOTIENT_API PublicRoomsChunk {
10  //! The number of members joined to the room.
11  int numJoinedMembers;
12 
13  //! The ID of the room.
14  QString roomId;
15 
16  //! Whether the room may be viewed by guest users without joining.
17  bool worldReadable;
18 
19  //! Whether guest users may join the room and participate in it.
20  //! If they can, they will be subject to ordinary power level
21  //! rules like any other user.
22  bool guestCanJoin;
23 
24  //! The canonical alias of the room, if any.
25  QString canonicalAlias{};
26 
27  //! The name of the room, if any.
28  QString name{};
29 
30  //! The topic of the room, if any.
31  QString topic{};
32 
33  //! The URL for the room's avatar, if one is set.
34  QUrl avatarUrl{};
35 
36  //! The room's join rule. When not present, the room is assumed to
37  //! be `public`. Note that rooms with `invite` join rules are not
38  //! expected here, but rooms with `knock` rules are given their
39  //! near-public nature.
40  QString joinRule{};
41 
42  //! The `type` of room (from [`m.room.create`](/client-server-api/#mroomcreate)), if any.
43  QString roomType{};
44 };
45 
46 template <>
47 struct JsonObjectConverter<PublicRoomsChunk> {
48  static void dumpTo(QJsonObject& jo, const PublicRoomsChunk& pod)
49  {
50  addParam<>(jo, "num_joined_members"_L1, pod.numJoinedMembers);
51  addParam<>(jo, "room_id"_L1, pod.roomId);
52  addParam<>(jo, "world_readable"_L1, pod.worldReadable);
53  addParam<>(jo, "guest_can_join"_L1, pod.guestCanJoin);
54  addParam<IfNotEmpty>(jo, "canonical_alias"_L1, pod.canonicalAlias);
55  addParam<IfNotEmpty>(jo, "name"_L1, pod.name);
56  addParam<IfNotEmpty>(jo, "topic"_L1, pod.topic);
57  addParam<IfNotEmpty>(jo, "avatar_url"_L1, pod.avatarUrl);
58  addParam<IfNotEmpty>(jo, "join_rule"_L1, pod.joinRule);
59  addParam<IfNotEmpty>(jo, "room_type"_L1, pod.roomType);
60  }
61  static void fillFrom(const QJsonObject& jo, PublicRoomsChunk& pod)
62  {
63  fillFromJson(jo.value("num_joined_members"_L1), pod.numJoinedMembers);
64  fillFromJson(jo.value("room_id"_L1), pod.roomId);
65  fillFromJson(jo.value("world_readable"_L1), pod.worldReadable);
66  fillFromJson(jo.value("guest_can_join"_L1), pod.guestCanJoin);
67  fillFromJson(jo.value("canonical_alias"_L1), pod.canonicalAlias);
68  fillFromJson(jo.value("name"_L1), pod.name);
69  fillFromJson(jo.value("topic"_L1), pod.topic);
70  fillFromJson(jo.value("avatar_url"_L1), pod.avatarUrl);
71  fillFromJson(jo.value("join_rule"_L1), pod.joinRule);
72  fillFromJson(jo.value("room_type"_L1), pod.roomType);
73  }
74 };
75 
76 } // namespace Quotient