1 | /****************************************************************************** |
2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
3 | */ |
4 | |
5 | #pragma once |
6 | |
7 | #include <Quotient/jobs/basejob.h> |
8 | |
9 | namespace Quotient { |
10 | |
11 | /*! \brief Create a new mapping from room alias to room ID. |
12 | * |
13 | */ |
14 | class QUOTIENT_API SetRoomAliasJob : public BaseJob { |
15 | public: |
16 | /*! \brief Create a new mapping from room alias to room ID. |
17 | * |
18 | * \param roomAlias |
19 | * The room alias to set. Its format is defined |
20 | * [in the appendices](/appendices/#room-aliases). |
21 | * |
22 | * \param roomId |
23 | * The room ID to set. |
24 | */ |
25 | explicit SetRoomAliasJob(const QString& roomAlias, const QString& roomId); |
26 | }; |
27 | |
28 | /*! \brief Get the room ID corresponding to this room alias. |
29 | * |
30 | * Requests that the server resolve a room alias to a room ID. |
31 | * |
32 | * The server will use the federation API to resolve the alias if the |
33 | * domain part of the alias does not correspond to the server's own |
34 | * domain. |
35 | */ |
36 | class QUOTIENT_API GetRoomIdByAliasJob : public BaseJob { |
37 | public: |
38 | /*! \brief Get the room ID corresponding to this room alias. |
39 | * |
40 | * \param roomAlias |
41 | * The room alias. Its format is defined |
42 | * [in the appendices](/appendices/#room-aliases). |
43 | */ |
44 | explicit GetRoomIdByAliasJob(const QString& roomAlias); |
45 | |
46 | /*! \brief Construct a URL without creating a full-fledged job object |
47 | * |
48 | * This function can be used when a URL for GetRoomIdByAliasJob |
49 | * is necessary but the job itself isn't. |
50 | */ |
51 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomAlias); |
52 | |
53 | // Result properties |
54 | |
55 | /// The room ID for this room alias. |
56 | QString roomId() const { return loadFromJson<QString>(keyName: "room_id"_ls ); } |
57 | |
58 | /// A list of servers that are aware of this room alias. |
59 | QStringList servers() const |
60 | { |
61 | return loadFromJson<QStringList>(keyName: "servers"_ls ); |
62 | } |
63 | }; |
64 | |
65 | /*! \brief Remove a mapping of room alias to room ID. |
66 | * |
67 | * Remove a mapping of room alias to room ID. |
68 | * |
69 | * Servers may choose to implement additional access control checks here, for |
70 | * instance that room aliases can only be deleted by their creator or a server |
71 | * administrator. |
72 | * |
73 | * **Note:** |
74 | * Servers may choose to update the `alt_aliases` for the |
75 | * `m.room.canonical_alias` state event in the room when an alias is removed. |
76 | * Servers which choose to update the canonical alias event are recommended to, |
77 | * in addition to their other relevant permission checks, delete the alias and |
78 | * return a successful response even if the user does not have permission to |
79 | * update the `m.room.canonical_alias` event. |
80 | */ |
81 | class QUOTIENT_API DeleteRoomAliasJob : public BaseJob { |
82 | public: |
83 | /*! \brief Remove a mapping of room alias to room ID. |
84 | * |
85 | * \param roomAlias |
86 | * The room alias to remove. Its format is defined |
87 | * [in the appendices](/appendices/#room-aliases). |
88 | */ |
89 | explicit DeleteRoomAliasJob(const QString& roomAlias); |
90 | |
91 | /*! \brief Construct a URL without creating a full-fledged job object |
92 | * |
93 | * This function can be used when a URL for DeleteRoomAliasJob |
94 | * is necessary but the job itself isn't. |
95 | */ |
96 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomAlias); |
97 | }; |
98 | |
99 | /*! \brief Get a list of local aliases on a given room. |
100 | * |
101 | * Get a list of aliases maintained by the local server for the |
102 | * given room. |
103 | * |
104 | * This endpoint can be called by users who are in the room (external |
105 | * users receive an `M_FORBIDDEN` error response). If the room's |
106 | * `m.room.history_visibility` maps to `world_readable`, any |
107 | * user can call this endpoint. |
108 | * |
109 | * Servers may choose to implement additional access control checks here, |
110 | * such as allowing server administrators to view aliases regardless of |
111 | * membership. |
112 | * |
113 | * **Note:** |
114 | * Clients are recommended not to display this list of aliases prominently |
115 | * as they are not curated, unlike those listed in the `m.room.canonical_alias` |
116 | * state event. |
117 | */ |
118 | class QUOTIENT_API GetLocalAliasesJob : public BaseJob { |
119 | public: |
120 | /*! \brief Get a list of local aliases on a given room. |
121 | * |
122 | * \param roomId |
123 | * The room ID to find local aliases of. |
124 | */ |
125 | explicit GetLocalAliasesJob(const QString& roomId); |
126 | |
127 | /*! \brief Construct a URL without creating a full-fledged job object |
128 | * |
129 | * This function can be used when a URL for GetLocalAliasesJob |
130 | * is necessary but the job itself isn't. |
131 | */ |
132 | static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId); |
133 | |
134 | // Result properties |
135 | |
136 | /// The server's local aliases on the room. Can be empty. |
137 | QStringList aliases() const |
138 | { |
139 | return loadFromJson<QStringList>(keyName: "aliases"_ls ); |
140 | } |
141 | }; |
142 | |
143 | } // namespace Quotient |
144 | |