Skip to content
Snippets Groups Projects
Verified Commit 37df8236 authored by Joe Donofry's avatar Joe Donofry
Browse files

Add 'from' and 'only' params to notifications endpoint

parent 35b596a9
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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) {
......
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