libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
list_public_rooms.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/csapi/definitions/public_rooms_response.h>
6
7#include <Quotient/jobs/basejob.h>
8
9namespace Quotient {
10
11//! \brief Gets the visibility of a room in the directory
12//!
13//! Gets the visibility of a given room on the server's public room directory.
15public:
16 //! \param roomId
17 //! The room ID.
19
20 //! \brief Construct a URL without creating a full-fledged job object
21 //!
22 //! This function can be used when a URL for GetRoomVisibilityOnDirectoryJob
23 //! is necessary but the job itself isn't.
25
26 // Result properties
27
28 //! The visibility of the room in the directory.
29 QString visibility() const { return loadFromJson<QString>("visibility"_L1); }
30};
31
32inline auto collectResponse(const GetRoomVisibilityOnDirectoryJob* job)
33{
34 return job->visibility();
35}
36
37//! \brief Sets the visibility of a room in the room directory
38//!
39//! Sets the visibility of a given room in the server's public room
40//! directory.
41//!
42//! Servers may choose to implement additional access control checks
43//! here, for instance that room visibility can only be changed by
44//! the room creator or a server administrator.
46public:
47 //! \param roomId
48 //! The room ID.
49 //!
50 //! \param visibility
51 //! The new visibility setting for the room.
52 //! Defaults to 'public'.
54};
55
56//! \brief Lists the public rooms on the server.
57//!
58//! Lists the public rooms on the server.
59//!
60//! This API returns paginated responses. The rooms are ordered by the number
61//! of joined members, with the largest rooms first.
63public:
64 //! \param limit
65 //! Limit the number of results returned.
66 //!
67 //! \param since
68 //! A pagination token from a previous request, allowing clients to
69 //! get the next (or previous) batch of rooms.
70 //! The direction of pagination is specified solely by which token
71 //! is supplied, rather than via an explicit flag.
72 //!
73 //! \param server
74 //! The server to fetch the public room lists from. Defaults to the
75 //! local server. Case sensitive.
76 explicit GetPublicRoomsJob(std::optional<int> limit = std::nullopt, const QString& since = {},
77 const QString& server = {});
78
79 //! \brief Construct a URL without creating a full-fledged job object
80 //!
81 //! This function can be used when a URL for GetPublicRoomsJob
82 //! is necessary but the job itself isn't.
84 const QString& since = {}, const QString& server = {});
85
86 // Result properties
87
88 //! A paginated chunk of public rooms.
90 {
91 return loadFromJson<QVector<PublicRoomsChunk>>("chunk"_L1);
92 }
93
94 //! A pagination token for the response. The absence of this token
95 //! means there are no more results to fetch and the client should
96 //! stop paginating.
97 QString nextBatch() const { return loadFromJson<QString>("next_batch"_L1); }
98
99 //! A pagination token that allows fetching previous results. The
100 //! absence of this token means there are no results before this
101 //! batch, i.e. this is the first batch.
102 QString prevBatch() const { return loadFromJson<QString>("prev_batch"_L1); }
103
104 //! An estimate on the total number of public rooms, if the
105 //! server has an estimate.
107 {
108 return loadFromJson<std::optional<int>>("total_room_count_estimate"_L1);
109 }
110
111 struct Response {
112 //! A paginated chunk of public rooms.
114
115 //! A pagination token for the response. The absence of this token
116 //! means there are no more results to fetch and the client should
117 //! stop paginating.
119
120 //! A pagination token that allows fetching previous results. The
121 //! absence of this token means there are no results before this
122 //! batch, i.e. this is the first batch.
124
125 //! An estimate on the total number of public rooms, if the
126 //! server has an estimate.
128 };
129};
130
132constexpr inline auto doCollectResponse<JobT> = [](JobT* j) -> GetPublicRoomsJob::Response {
133 return { j->chunk(), j->nextBatch(), j->prevBatch(), j->totalRoomCountEstimate() };
134};
135
136//! \brief Lists the public rooms on the server with optional filter.
137//!
138//! Lists the public rooms on the server, with optional filter.
139//!
140//! This API returns paginated responses. The rooms are ordered by the number
141//! of joined members, with the largest rooms first.
143public:
144 // Inner data structures
145
146 //! Filter to apply to the results.
148 //! An optional string to search for in the room metadata, e.g. name,
149 //! topic, canonical alias, etc.
151
152 //! An optional list of [room types](/client-server-api/#types) to search
153 //! for. To include rooms without a room type, specify `null` within this
154 //! list. When not specified, all applicable rooms (regardless of type)
155 //! are returned.
157 };
158
159 // Construction/destruction
160
161 //! \param server
162 //! The server to fetch the public room lists from. Defaults to the
163 //! local server. Case sensitive.
164 //!
165 //! \param limit
166 //! Limit the number of results returned.
167 //!
168 //! \param since
169 //! A pagination token from a previous request, allowing clients
170 //! to get the next (or previous) batch of rooms. The direction
171 //! of pagination is specified solely by which token is supplied,
172 //! rather than via an explicit flag.
173 //!
174 //! \param filter
175 //! Filter to apply to the results.
176 //!
177 //! \param includeAllNetworks
178 //! Whether or not to include all known networks/protocols from
179 //! application services on the homeserver. Defaults to false.
180 //!
181 //! \param thirdPartyInstanceId
182 //! The specific third-party network/protocol to request from the
183 //! homeserver. Can only be used if `include_all_networks` is false.
184 explicit QueryPublicRoomsJob(const QString& server = {},
185 std::optional<int> limit = std::nullopt, const QString& since = {},
186 const std::optional<Filter>& filter = std::nullopt,
188 const QString& thirdPartyInstanceId = {});
189
190 // Result properties
191
192 //! A paginated chunk of public rooms.
194 {
195 return loadFromJson<QVector<PublicRoomsChunk>>("chunk"_L1);
196 }
197
198 //! A pagination token for the response. The absence of this token
199 //! means there are no more results to fetch and the client should
200 //! stop paginating.
201 QString nextBatch() const { return loadFromJson<QString>("next_batch"_L1); }
202
203 //! A pagination token that allows fetching previous results. The
204 //! absence of this token means there are no results before this
205 //! batch, i.e. this is the first batch.
206 QString prevBatch() const { return loadFromJson<QString>("prev_batch"_L1); }
207
208 //! An estimate on the total number of public rooms, if the
209 //! server has an estimate.
211 {
212 return loadFromJson<std::optional<int>>("total_room_count_estimate"_L1);
213 }
214
215 struct Response {
216 //! A paginated chunk of public rooms.
218
219 //! A pagination token for the response. The absence of this token
220 //! means there are no more results to fetch and the client should
221 //! stop paginating.
223
224 //! A pagination token that allows fetching previous results. The
225 //! absence of this token means there are no results before this
226 //! batch, i.e. this is the first batch.
228
229 //! An estimate on the total number of public rooms, if the
230 //! server has an estimate.
232 };
233};
234
236constexpr inline auto doCollectResponse<JobT> = [](JobT* j) -> QueryPublicRoomsJob::Response {
237 return { j->chunk(), j->nextBatch(), j->prevBatch(), j->totalRoomCountEstimate() };
238};
239
240template <>
242 static void dumpTo(QJsonObject& jo, const QueryPublicRoomsJob::Filter& pod)
243 {
244 addParam<IfNotEmpty>(jo, "generic_search_term"_L1, pod.genericSearchTerm);
245 addParam<IfNotEmpty>(jo, "room_types"_L1, pod.roomTypes);
246 }
247};
248
249} // namespace Quotient
Lists the public rooms on the server.
Gets the visibility of a room in the directory.
Lists the public rooms on the server with optional filter.
Sets the visibility of a room in the room directory.
auto collectResponse(const GetAccountDataJob *job)
#define QUOTIENT_API