Removed clipp dependency

This commit is contained in:
David Allen 2023-07-02 15:10:50 -06:00
parent 8869a84710
commit 0678eb12ca
10 changed files with 96 additions and 75 deletions

View file

@ -1 +0,0 @@
../modules/clipp/include/clipp.h

View file

@ -22,6 +22,7 @@ namespace gdpm::config{
table = 1,
};
struct context{
string username;
string password;
@ -44,6 +45,8 @@ namespace gdpm::config{
rest_api::request_params rest_api_params;
};
string from_style(const print_style& style);
print_style to_style(const string& s);
string to_json(const context& config, bool pretty_print = false);
error load(std::filesystem::path path, context& config);
error save(std::filesystem::path path, const context& config);

View file

@ -33,6 +33,8 @@ namespace gdpm::constants::error{
INVALID_KEY,
HTTP_RESPONSE_ERR,
SQLITE_ERR,
LIBZIP_ERR,
LIBCURL_ERR,
JSON_ERR,
STD_ERR
};

View file

@ -75,8 +75,8 @@ namespace gdpm::http{
LOOP_DETECTED = 508,
NOT_EXTENDED = 510,
NETWORK_AUTHENTICATION_REQUIRED = 511
};
struct response{
long code = 0;
string body{};

View file

@ -44,7 +44,6 @@ namespace gdpm::rest_api{
int type ;
int category;
int support;
string filter;
string user;
string godot_version;
int max_results;
@ -55,15 +54,15 @@ namespace gdpm::rest_api{
};
request_params make_from_config(const config::context& config);
request_params make_request_params(type_e type = GDPM_DEFAULT_ASSET_TYPE, int category = GDPM_DEFAULT_ASSET_CATEGORY, support_e support = GDPM_DEFAULT_ASSET_SUPPORT, const std::string& filter = GDPM_DEFAULT_ASSET_FILTER, const std::string& user = GDPM_DEFAULT_ASSET_USER, const std::string& godot_version = GDPM_DEFAULT_ASSET_GODOT_VERSION, int max_results = GDPM_DEFAULT_ASSET_MAX_RESULTS, int page = GDPM_DEFAULT_ASSET_PAGE, sort_e sort = GDPM_DEFAULT_ASSET_SORT, bool reverse = GDPM_DEFAULT_ASSET_REVERSE, int verbose = GDPM_DEFAULT_ASSET_VERBOSE);
request_params make_request_params(type_e type = GDPM_DEFAULT_ASSET_TYPE, int category = GDPM_DEFAULT_ASSET_CATEGORY, support_e support = GDPM_DEFAULT_ASSET_SUPPORT, const string& user = GDPM_DEFAULT_ASSET_USER, const string& godot_version = GDPM_DEFAULT_ASSET_GODOT_VERSION, int max_results = GDPM_DEFAULT_ASSET_MAX_RESULTS, int page = GDPM_DEFAULT_ASSET_PAGE, sort_e sort = GDPM_DEFAULT_ASSET_SORT, bool reverse = GDPM_DEFAULT_ASSET_REVERSE, int verbose = GDPM_DEFAULT_ASSET_VERBOSE);
string to_json(const rapidjson::Document& doc);
string to_string(type_e type);
string to_string(support_e support);
string to_string(sort_e sort);
void _print_params(const request_params& params);
void _print_params(const request_params& params, const string& filter);
rapidjson::Document _parse_json(const string& r, int verbose = 0);
string _prepare_request(const string& url, const request_params& context);
string _prepare_request(const string& url, const request_params& context, const string& filter);
bool register_account(const string& username, const string& password, const string& email);
bool login(const string& username, const string& password);
@ -71,8 +70,8 @@ namespace gdpm::rest_api{
rapidjson::Document configure(const string& url = constants::HostUrl, type_e type = any, int verbose = 0);
rapidjson::Document get_assets_list(const string& url = constants::HostUrl, type_e type = GDPM_DEFAULT_ASSET_TYPE, int category = GDPM_DEFAULT_ASSET_CATEGORY, support_e support = GDPM_DEFAULT_ASSET_SUPPORT, const string& filter = GDPM_DEFAULT_ASSET_FILTER, const std::string& user = GDPM_DEFAULT_ASSET_USER, const std::string& godot_version = GDPM_DEFAULT_ASSET_GODOT_VERSION, int max_results = GDPM_DEFAULT_ASSET_MAX_RESULTS, int page = GDPM_DEFAULT_ASSET_PAGE, sort_e sort = GDPM_DEFAULT_ASSET_SORT, bool reverse = GDPM_DEFAULT_ASSET_REVERSE, int verbose = GDPM_DEFAULT_ASSET_VERBOSE);
rapidjson::Document get_assets_list(const string& url, const request_params& params = {});
rapidjson::Document get_asset(const string& url, int asset_id, const request_params& params = {});
rapidjson::Document get_assets_list(const string& url, const request_params& params = {}, const string& filter = "");
rapidjson::Document get_asset(const string& url, int asset_id, const request_params& params = {}, const string& filter = "");
bool delete_asset(int asset_id); // ...for moderators
bool undelete_asset(int asset_id); // ...for moderators
bool set_support_level(int asset_id); // ...for moderators