Files
sdk-cpp/src/client.cpp
Guilherme Werner d9c7010888 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
2023-12-08 17:03:09 -03:00

41 lines
1.0 KiB
C++

// Copyright (c) Tribufu. All Rights Reserved.
#include <tribufu/client.h>
namespace tribufu
{
TribufuClient::TribufuClient(uint64_t id, const std::string &secret)
{
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;
}
}
}