mirror of
https://github.com/davidallendj/gdpm.git
synced 2025-12-19 19:17:01 -07:00
- Updated `.gitignore` file - Updated `CMakeLists.txt` to build static exectuable - Changed some `Doxyfile` configurations to build more robust and complete documentation (WIP) - Changed how `remote` works to better reflect `git`'s API (WIP) - Changed how error handling works - Improved `bin/compile.sh` script - Improved `bin/lines.sh` script (kinda) - Removed some instances of `fmt` in favor of `std` string functions - Restructed style for better readibility
31 lines
No EOL
766 B
C++
31 lines
No EOL
766 B
C++
#pragma once
|
|
|
|
#include "constants.hpp"
|
|
#include "types.hpp"
|
|
#include <unordered_map>
|
|
|
|
namespace gdpm::http{
|
|
using headers_t = std::unordered_map<string, string>;
|
|
enum response_code{
|
|
OK = 200,
|
|
NOT_FOUND = 400
|
|
};
|
|
struct response{
|
|
long code = 0;
|
|
string body{};
|
|
headers_t headers{};
|
|
error error();
|
|
};
|
|
|
|
|
|
struct params {
|
|
size_t timeout = GDPM_CONFIG_TIMEOUT_MS;
|
|
int verbose = 0;
|
|
};
|
|
|
|
string url_escape(const string& url);
|
|
response request_get(const string& url, const http::params& params = http::params());
|
|
response request_post(const string& url, const char *post_fields="", const http::params& params = http::params());
|
|
response download_file(const string& url, const string& storage_path, const http::params& params = http::params());
|
|
|
|
} |