From cbecb9fe3c81ebe4380013f2277caa17e76b5e3e Mon Sep 17 00:00:00 2001 From: kamathmanu <manuriddle@gmail.com> Date: Fri, 11 Dec 2020 14:20:46 -0500 Subject: [PATCH] Objects for filtering API events --- include/mtx/filters.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 include/mtx/filters.hpp diff --git a/include/mtx/filters.hpp b/include/mtx/filters.hpp new file mode 100644 index 000000000..1950f917d --- /dev/null +++ b/include/mtx/filters.hpp @@ -0,0 +1,30 @@ +#pragma once + +#if __has_include(<nlohmann/json_fwd.hpp>) +#include <nlohmann/json_fwd.hpp> +#else +#include <nlohmann/json.hpp> +#endif + +#include <string> + +//! Filters can be created on the server and can be +//! passed as a parameter to APIs which return events. + +namespace mtx { +namespace filters { + +struct Filter { + //! A string to search for in the room metadata, + //! e.g. name, topic, canonical alias etc. (Optional). + std::string generic_search_term; +}; + +void +from_json(const nlohmann::json &obj, Filter &res); + +void +to_json(nlohmann::json &obj, const Filter &res); + +} // namespace filters +} // namespace mtx -- GitLab