From 32e1053c6b78266415a0404cb265da6822bdd105 Mon Sep 17 00:00:00 2001 From: Tomasz Golinski Date: Sat, 31 Oct 2020 21:51:25 +0100 Subject: [PATCH] geofriends: add missing okapi bits --- okapi.cpp | 8 ++++++++ okapi.h | 1 + 2 files changed, 9 insertions(+) diff --git a/okapi.cpp b/okapi.cpp index 30cafee..142a12b 100644 --- a/okapi.cpp +++ b/okapi.cpp @@ -251,6 +251,14 @@ Caches Okapi::get_user_caches(const std::string& uuid, int count) const { return cc; } +int Okapi::get_user_caches_no(const std::string& uuid) const { + std::string service = url + OKAPI_user; + std::string query = "consumer_key=" + key + "&user_uuid=" + uuid + "&fields=caches_hidden"; + curl_post(service, query); + json j = json::parse(curl_output); + return j["caches_hidden"]; +} + void Okapi::update_caches(Caches& cc) const { std::set codes; for (auto& i : cc) diff --git a/okapi.h b/okapi.h index 89334a5..42e7555 100644 --- a/okapi.h +++ b/okapi.h @@ -35,6 +35,7 @@ public: // Cache get_cache(std::string code); Caches get_caches(const std::set& codes) const; Caches get_user_caches(const std::string& uuid, int count = 0) const override; + int get_user_caches_no(const std::string& uuid) const; std::string get_changelog_json(int revision) const; void update_caches(Caches& cc) const;