libkazv
list_public_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"
9 
10 namespace Kazv::Api {
11 
17 public:
18 
19 
20 
21 class JobResponse : public Response
22 {
23 
24 public:
26  bool success() const;
27 
28  // Result properties
29 
30 
31 
32 
34 std::optional<std::string> visibility() const;
35 
36 };
37  static constexpr auto needsAuth() {
38  return
39  false;
40  }
41 
42 
43 // Construction/destruction
44 
50  explicit GetRoomVisibilityOnDirectoryJob(std::string serverUrl
51 
52  ,
53  std::string roomId
54  );
55 
56 
58  );
59 
60  static BaseJob::Body buildBody(std::string roomId);
61 
62 
63 
64 
65 
68  };
70  }
71  namespace nlohmann
72  {
73  using namespace Kazv;
74  using namespace Kazv::Api;
75 
76  }
77 
78  namespace Kazv::Api
79  {
80 
91 public:
92 
93 
94 
95 class JobResponse : public Response
96 {
97 
98 public:
100  bool success() const;
101 
102 };
103  static constexpr auto needsAuth() {
104  return true
105  ;
106  }
107 
108 
109 // Construction/destruction
110 
120  explicit SetRoomVisibilityOnDirectoryJob(std::string serverUrl
121  , std::string _accessToken
122  ,
123  std::string roomId , std::optional<std::string> visibility = std::nullopt
124  );
125 
126 
127  static BaseJob::Query buildQuery(
128  );
129 
130  static BaseJob::Body buildBody(std::string roomId, std::optional<std::string> visibility);
131 
132 
133 
134 
135 
137  SetRoomVisibilityOnDirectoryJob withData(JsonWrap j) const &;
138  };
140  }
141  namespace nlohmann
142  {
143  using namespace Kazv;
144  using namespace Kazv::Api;
145 
146  }
147 
148  namespace Kazv::Api
149  {
150 
158 class GetPublicRoomsJob : public BaseJob {
159 public:
160 
161 
162 
163 class JobResponse : public Response
164 {
165 
166 public:
168  bool success() const;
169 
170  // Result properties
171 
172 
173 
174 
176 immer::array<PublicRoomsChunk> chunk() const;
177 
178 
182 std::optional<std::string> nextBatch() const;
183 
184 
188 std::optional<std::string> prevBatch() const;
189 
190 
193 std::optional<int> totalRoomCountEstimate() const;
194 
195 };
196  static constexpr auto needsAuth() {
197  return
198  false;
199  }
200 
201 
202 // Construction/destruction
203 
219  explicit GetPublicRoomsJob(std::string serverUrl
220 
221  ,
222  std::optional<int> limit = std::nullopt, std::optional<std::string> since = std::nullopt, std::optional<std::string> server = std::nullopt
223  );
224 
225 
226  static BaseJob::Query buildQuery(
227  std::optional<int> limit, std::optional<std::string> since, std::optional<std::string> server);
228 
229  static BaseJob::Body buildBody(std::optional<int> limit, std::optional<std::string> since, std::optional<std::string> server);
230 
231 
232 
233 
234 
235  GetPublicRoomsJob withData(JsonWrap j) &&;
236  GetPublicRoomsJob withData(JsonWrap j) const &;
237  };
239  }
240  namespace nlohmann
241  {
242  using namespace Kazv;
243  using namespace Kazv::Api;
244 
245  }
246 
247  namespace Kazv::Api
248  {
249 
257 class QueryPublicRoomsJob : public BaseJob {
258 public:
259  // Inner data structures
260 
262  struct Filter
263  {
266  std::optional<std::string> genericSearchTerm;
267 
268  };
269 
270 
271 
272 class JobResponse : public Response
273 {
274 
275 public:
277  bool success() const;
278 
279  // Result properties
280 
281 
282 
283 
285 immer::array<PublicRoomsChunk> chunk() const;
286 
287 
291 std::optional<std::string> nextBatch() const;
292 
293 
297 std::optional<std::string> prevBatch() const;
298 
299 
302 std::optional<int> totalRoomCountEstimate() const;
303 
304 };
305  static constexpr auto needsAuth() {
306  return true
307  ;
308  }
309 
310 
311 // Construction/destruction
312 
339  explicit QueryPublicRoomsJob(std::string serverUrl
340  , std::string _accessToken
341  ,
342  std::optional<std::string> server = std::nullopt, std::optional<int> limit = std::nullopt, std::optional<std::string> since = std::nullopt, std::optional<Filter> filter = std::nullopt, std::optional<bool> includeAllNetworks = std::nullopt, std::optional<std::string> thirdPartyInstanceId = std::nullopt
343  );
344 
345 
346  static BaseJob::Query buildQuery(
347  std::optional<std::string> server);
348 
349  static BaseJob::Body buildBody(std::optional<std::string> server, std::optional<int> limit, std::optional<std::string> since, std::optional<Filter> filter, std::optional<bool> includeAllNetworks, std::optional<std::string> thirdPartyInstanceId);
350 
351 
352 
353 
354 
355  QueryPublicRoomsJob withData(JsonWrap j) &&;
356  QueryPublicRoomsJob withData(JsonWrap j) const &;
357  };
359  }
360  namespace nlohmann
361  {
362  using namespace Kazv;
363  using namespace Kazv::Api;
364  template<>
365  struct adl_serializer<QueryPublicRoomsJob::Filter> {
366 
367  static void to_json(json& jo, const QueryPublicRoomsJob::Filter &pod)
368  {
369  if (! jo.is_object()) { jo = json::object(); }
370 
371 
372 
373  addToJsonIfNeeded(jo, "generic_search_term"s, pod.genericSearchTerm);
374  }
375 
376  static void from_json(const json &jo, QueryPublicRoomsJob::Filter& result)
377  {
378 
379  if (jo.contains("generic_search_term"s)) {
380  result.genericSearchTerm = jo.at("generic_search_term"s);
381  }
382 
383  }
384 
385 };
386  }
387 
388  namespace Kazv::Api
389  {
390 
391 } // namespace Kazv::Api
Definition: list_public_rooms.hpp:164
Lists the public rooms on the server.
Definition: list_public_rooms.hpp:158
static constexpr auto needsAuth()
Definition: list_public_rooms.hpp:196
bool success() const
Definition: list_public_rooms.cpp:70
JobResponse(Response r)
Definition: list_public_rooms.cpp:67
std::optional< std::string > visibility() const
The visibility of the room in the directory.
Definition: list_public_rooms.cpp:80
Gets the visibility of a room in the directory.
Definition: list_public_rooms.hpp:16
static BaseJob::Query buildQuery()
Definition: list_public_rooms.cpp:13
static constexpr auto needsAuth()
Definition: list_public_rooms.hpp:37
GetRoomVisibilityOnDirectoryJob(std::string serverUrl, std::string roomId)
Gets the visibility of a room in the directory.
Definition: list_public_rooms.cpp:33
static BaseJob::Body buildBody(std::string roomId)
Definition: list_public_rooms.cpp:21
GetRoomVisibilityOnDirectoryJob withData(JsonWrap j) &&
Definition: list_public_rooms.cpp:53
Definition: list_public_rooms.hpp:273
Lists the public rooms on the server with optional filter.
Definition: list_public_rooms.hpp:257
static constexpr auto needsAuth()
Definition: list_public_rooms.hpp:305
Sets the visibility of a room in the room directory.
Definition: list_public_rooms.hpp:90
static constexpr auto needsAuth()
Definition: list_public_rooms.hpp:103
Definition: basejob.hpp:91
Definition: basejob.hpp:77
::Kazv::Body Body
Definition: basejob.hpp:100
Definition: jsonwrap.hpp:23
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
Definition: location.hpp:27
Definition: sync_filter.hpp:98
Filter to apply to the results.
Definition: list_public_rooms.hpp:263
std::optional< std::string > genericSearchTerm
A string to search for in the room metadata, e.g.
Definition: list_public_rooms.hpp:266
Definition: basejob.hpp:50
static void from_json(const json &jo, QueryPublicRoomsJob::Filter &result)
Definition: list_public_rooms.hpp:376
static void to_json(json &jo, const QueryPublicRoomsJob::Filter &pod)
Definition: list_public_rooms.hpp:367