mirror of
https://github.com/tribufu/sdk-cpp
synced 2025-06-17 04:54:19 +00:00
Use mintaka shared libraries (#1)
* Add libhv and test http client * Remove cpp-httplib * Update premake5.lua * Update client.cpp * Update premake5.lua * Add more windows libs * Use mintaka http client
This commit is contained in:
@ -8,9 +8,33 @@ namespace tribufu
|
||||
{
|
||||
this->id = id;
|
||||
this->secret = secret;
|
||||
this->http = HttpClient();
|
||||
}
|
||||
|
||||
TribufuClient::~TribufuClient()
|
||||
{
|
||||
}
|
||||
|
||||
void TribufuClient::get_token()
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string url = "https://api.tribufu.com/v1/servers";
|
||||
FHttpResponse response = this->http.get(url);
|
||||
std::cout << "status_code: " << response.status_code << std::endl;
|
||||
|
||||
if (response.body != nullptr)
|
||||
{
|
||||
json response_body = json::parse(response.body);
|
||||
std::string json_str = response_body.dump(4);
|
||||
std::cout << json_str << std::endl;
|
||||
}
|
||||
|
||||
mintaka_http_free_response(response);
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
std::cout << "exception: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user