2019-09-08 16:42:10 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "api.h"
|
|
|
|
|
|
|
|
#include <string>
|
2020-01-28 03:49:11 +00:00
|
|
|
#include <map>
|
2019-11-05 19:39:33 +00:00
|
|
|
#include <utility>
|
2019-09-08 16:42:10 +00:00
|
|
|
|
2019-10-03 22:43:39 +00:00
|
|
|
class Okapi : public Api {
|
2019-09-08 16:42:10 +00:00
|
|
|
private:
|
|
|
|
std::string url;
|
|
|
|
std::string key;
|
|
|
|
|
2020-01-25 15:49:32 +00:00
|
|
|
std::string service;
|
|
|
|
|
2019-09-08 16:42:10 +00:00
|
|
|
static size_t write_cb(char* ptr, size_t size, size_t nmemb, void* userdata);
|
2020-02-11 16:34:23 +00:00
|
|
|
std::string curl_post(const std::string& url, const std::string& post) const;
|
|
|
|
std::string get_user_caches_json(const std::string& uuid, int count = 0, int offset = 0) const;
|
|
|
|
// std::string get_cache_json(std::string code) const;
|
|
|
|
std::string get_caches_json(const std::string& codes) const;
|
2019-09-08 16:42:10 +00:00
|
|
|
|
2020-02-29 01:18:01 +00:00
|
|
|
const static int MAX_LOGS = 1000;
|
|
|
|
const static int MAX_CACHES = 500;
|
|
|
|
|
2019-09-08 16:42:10 +00:00
|
|
|
public:
|
2020-02-11 16:34:23 +00:00
|
|
|
Okapi(const std::string& server_url, const std::string& consumer_key);
|
2019-09-08 16:42:10 +00:00
|
|
|
|
|
|
|
// Cache get_cache(std::string code);
|
2020-02-29 22:05:11 +00:00
|
|
|
Caches get_caches(const std::set<std::string>& codes) const;
|
2020-02-11 16:37:01 +00:00
|
|
|
Caches get_user_caches(const std::string& uuid, int count = 0) const override;
|
2020-02-11 16:34:23 +00:00
|
|
|
std::string get_changelog_json(int revision) const;
|
2019-09-08 16:42:10 +00:00
|
|
|
|
2020-02-11 16:34:23 +00:00
|
|
|
std::string get_uuid(const std::string& username) const;
|
|
|
|
std::string get_profile_url(const std::string& uuid) const;
|
2019-09-08 16:42:10 +00:00
|
|
|
};
|