diff --git a/include/mtxclient/http/client.hpp b/include/mtxclient/http/client.hpp index 00376a25dbec32cccf5bb53f3beae6a118ebf4bf..49fb9b944bc8870e6422a0f10d9534f67e8998e8 100644 --- a/include/mtxclient/http/client.hpp +++ b/include/mtxclient/http/client.hpp @@ -167,7 +167,10 @@ public: //! Paginate through the list of events that the user has been, //! or would have been notified about. - void notifications(uint64_t limit, Callback<mtx::responses::Notifications> cb); + void notifications(uint64_t limit, + const std::string &from, + const std::string &only, + Callback<mtx::responses::Notifications> cb); //! Perform logout. void logout(Callback<mtx::responses::Logout> cb); diff --git a/lib/http/client.cpp b/lib/http/client.cpp index 23e877630ac1582f756e44ee940f79fe85362e2f..f7ced1b597814d60ec56f68338d33b229d1f8589 100644 --- a/lib/http/client.cpp +++ b/lib/http/client.cpp @@ -151,11 +151,22 @@ Client::logout(Callback<mtx::responses::Logout> callback) } void -Client::notifications(uint64_t limit, Callback<mtx::responses::Notifications> cb) +Client::notifications(uint64_t limit, + const std::string &from, + const std::string &only, + Callback<mtx::responses::Notifications> cb) { std::map<std::string, std::string> params; params.emplace("limit", std::to_string(limit)); + if (!from.empty()) { + params.emplace("from", from); + } + + if (!only.empty()) { + params.emplace("only", only); + } + get<mtx::responses::Notifications>( "/client/r0/notifications?" + mtx::client::utils::query_params(params), [cb](const mtx::responses::Notifications &res, HeaderFields, RequestErr err) {