kopia lustrzana https://gitlab.com/tomaszg/geostat
46 wiersze
1.3 KiB
C++
46 wiersze
1.3 KiB
C++
#pragma once
|
|
|
|
#include "api.h"
|
|
|
|
#include <string>
|
|
#include <map>
|
|
#include <utility>
|
|
|
|
typedef void CURL;
|
|
|
|
class Okapi : public Api {
|
|
private:
|
|
std::string url;
|
|
std::string key;
|
|
|
|
std::string service;
|
|
|
|
CURL* curl;
|
|
mutable std::string curl_output;
|
|
|
|
static size_t write_cb(char* ptr, size_t size, size_t nmemb, void* userdata);
|
|
void curl_post(const std::string& url, const std::string& post) const;
|
|
void get_user_caches_json(const std::string& uuid, int count = 0, int offset = 0) const;
|
|
// std::string get_cache_json(std::string code) const;
|
|
void get_caches_json(const std::string& codes) const;
|
|
void get_caches_ratings_json(const std::string& codes) const;
|
|
|
|
const static int MAX_LOGS = 1000;
|
|
const static int MAX_CACHES = 500;
|
|
|
|
public:
|
|
Okapi(const std::string& server_url, const std::string& consumer_key);
|
|
~Okapi();
|
|
|
|
// Cache get_cache(std::string code);
|
|
Caches get_caches(const std::set<std::string>& 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;
|
|
void update_caches_ratings(Caches& cc) const;
|
|
std::string get_uuid(const std::string& username) const;
|
|
std::string get_profile_url(const std::string& uuid) const;
|
|
};
|