void remove(ModelPtr model) { auto it = models.at(model->get_id()); if (it != models.end()) { models.erase(it); removed.trigger(*model); } }
void add(ModelPtr model) { auto it = models.at(model->get_id()); if (it == models.end()) { models.emplace(model->get_id(), model); added.trigger(*model); } }
Promise fetch() { auto request = Http::Request::get(get_url()); request->set_headers({{"Accept",Archive::mimetype}}); return request->send().then([this, request]() { auto response = request->get_response(); if (response->ok()) { if (response->has_body()) parse(response->get_response_text()); synced.trigger(); } }); }