Skip to content
Snippets Groups Projects
Commit 0768a6e8 authored by kamathmanu's avatar kamathmanu
Browse files

Fix merge conflicts

parents 3993fb0a 0cde10fb
No related branches found
No related tags found
No related merge requests found
Pipeline #325 passed
......@@ -142,17 +142,18 @@ struct PublicRoomVisibility
void
to_json(json &obj, const PublicRoomVisibility &request);
struct PublicRoomsFilter {
//! A string to search for in the room metadata,
//! e.g. name, topic, canonical alias etc. (Optional).
std::string generic_search_term;
struct PublicRoomsFilter
{
//! A string to search for in the room metadata,
//! e.g. name, topic, canonical alias etc. (Optional).
std::string generic_search_term;
};
void
to_json(nlohmann::json &obj, const PublicRoomsFilter &req);
//! Request payload for the `POST /_matrix/client/r0/publicRooms` endpoint.
struct PublicRooms
struct PublicRooms
{
//! Limit the number of results returned.
int limit;
......
......@@ -14,9 +14,9 @@
#include "responses/messages.hpp"
#include "responses/notifications.hpp"
#include "responses/profile.hpp"
#include "responses/public_rooms.hpp"
#include "responses/register.hpp"
#include "responses/sync.hpp"
#include "responses/turn_server.hpp"
#include "responses/version.hpp"
#include "responses/well-known.hpp"
#include "responses/public_rooms.hpp"
#pragma once
#include <vector>
#include <string>
#include <optional>
#include <string>
#include <vector>
#include "mtx/common.hpp"
......@@ -27,26 +27,26 @@ from_json(const nlohmann::json &obj, PublicRoomVisibility &res);
struct PublicRoomsChunk
{
//! Aliases of the room. May be empty.
std::vector<std::string> aliases;
//! The canonical alias of the room, if any.
std::string canonical_alias = "";
//! The name of the room, if any.
std::string name;
//! **Required.** The number of members joined to the room.
size_t num_joined_members;
//! **Required.** The ID of the room.
std::string room_id;
//! The topic of the room, if any.
std::string topic;
//! **Required.** Whether the room may be viewed by guest users without joining.
bool world_readable;
//! **Required.** Whether guest users may join the room
//! and participate in it. If they can, they will be subject
//! to ordinary power level rules like any other user.
bool guest_can_join;
//! The URL for the room's avatar, if one is set.
std::string avatar_url;
//! Aliases of the room. May be empty.
std::vector<std::string> aliases;
//! The canonical alias of the room, if any.
std::string canonical_alias = "";
//! The name of the room, if any.
std::string name;
//! **Required.** The number of members joined to the room.
size_t num_joined_members;
//! **Required.** The ID of the room.
std::string room_id;
//! The topic of the room, if any.
std::string topic;
//! **Required.** Whether the room may be viewed by guest users without joining.
bool world_readable;
//! **Required.** Whether guest users may join the room
//! and participate in it. If they can, they will be subject
//! to ordinary power level rules like any other user.
bool guest_can_join;
//! The URL for the room's avatar, if one is set.
std::string avatar_url;
};
void
......@@ -60,7 +60,7 @@ struct PublicRooms
std::vector<PublicRoomsChunk> chunk;
//! A pagination token for the response. The absence
//! of this token means there are no more results to
//! fetch and the client should stop paginating.
//! fetch and the client should stop paginating.
std::string next_batch;
//! A pagination token that allows fetching previous results.
//! The absence of this token means there are no results
......
......@@ -466,15 +466,15 @@ public:
//! Lists the public rooms on the server. This API returns paginated responses.
//! The rooms are ordered by the number of joined members, with the largest rooms first.
void get_public_rooms(Callback<mtx::responses::PublicRooms> cb,
const std::string &server = "",
size_t limit = 0,
const std::string &since = "");
void get_public_rooms(Callback<mtx::responses::PublicRooms> cb,
const std::string &server = "",
size_t limit = 0,
const std::string &since = "");
//! Lists the public rooms on the server, with optional filter. POST Request.
void post_public_rooms(const mtx::requests::PublicRooms &req,
Callback<mtx::responses::PublicRooms> cb,
const std::string &server = "");
void post_public_rooms(const mtx::requests::PublicRooms &req,
Callback<mtx::responses::PublicRooms> cb,
const std::string &server = "");
//
// Group related endpoints.
......
......@@ -49,8 +49,10 @@ from_json(const nlohmann::json &obj, PublicRooms &publicRooms)
publicRooms.prev_batch = obj.at("prev_batch").get<std::string>();
}
publicRooms.total_room_count_estimate = obj.count("total_room_count_estimate") ?
std::optional<size_t>{obj.at("total_room_count_estimate").get<size_t>()} : std::nullopt;
publicRooms.total_room_count_estimate =
obj.count("total_room_count_estimate")
? std::optional<size_t>{obj.at("total_room_count_estimate").get<size_t>()}
: std::nullopt;
}
} // namespace responses
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment