mirror of
https://github.com/tribufu/sdk-cpp
synced 2025-06-17 02:24:18 +00:00
Remove old files
This commit is contained in:
51
src/api.cpp
51
src/api.cpp
@ -1,51 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/api.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
TribufuApi::TribufuApi()
|
||||
{
|
||||
}
|
||||
|
||||
TribufuApi::TribufuApi(std::string api_key)
|
||||
{
|
||||
this->options.api_key = api_key;
|
||||
}
|
||||
|
||||
TribufuApi::TribufuApi(TribufuApiOptions options)
|
||||
{
|
||||
this->options = options;
|
||||
}
|
||||
|
||||
TribufuApi::~TribufuApi()
|
||||
{
|
||||
}
|
||||
|
||||
TribufuApi TribufuApi::from_env()
|
||||
{
|
||||
return TribufuApi::from_env("");
|
||||
}
|
||||
|
||||
TribufuApi TribufuApi::from_env(std::string prefix)
|
||||
{
|
||||
std::string env_prefix = "";
|
||||
|
||||
if (prefix != "")
|
||||
{
|
||||
env_prefix = prefix + "_";
|
||||
}
|
||||
|
||||
size_t required_size;
|
||||
char api_key[64];
|
||||
|
||||
auto response = getenv_s(&required_size, api_key, sizeof(api_key), (env_prefix + "API_KEY").c_str());
|
||||
|
||||
if (response == 0 && required_size > 0)
|
||||
{
|
||||
return TribufuApi(api_key);
|
||||
}
|
||||
|
||||
return TribufuApi();
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/client.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
TribufuClient::TribufuClient(uint64_t client_id, const std::string &client_secret) : TribufuApi()
|
||||
{
|
||||
this->client_id = client_id;
|
||||
this->client_secret = client_secret;
|
||||
}
|
||||
|
||||
TribufuClient::~TribufuClient()
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t &TribufuClient::get_client_id()
|
||||
{
|
||||
return this->client_id;
|
||||
}
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
@ -1 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
100
src/oauth2.cpp
100
src/oauth2.cpp
@ -1,100 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/oauth2.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
OAuth2AuthorizeRequest::OAuth2AuthorizeRequest()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2AuthorizeRequest::OAuth2AuthorizeRequest(OAuth2ResponseType response_type, uint64_t client_id,
|
||||
const std::string &client_secret, const std::string &redirect_uri,
|
||||
const std::string &scope, const std::string &state)
|
||||
{
|
||||
this->response_type = response_type;
|
||||
this->client_id = client_id;
|
||||
this->client_secret = client_secret;
|
||||
this->redirect_uri = redirect_uri;
|
||||
this->scope = scope;
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
OAuth2AuthorizeRequest::~OAuth2AuthorizeRequest()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2CodeResponse::OAuth2CodeResponse()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2CodeResponse::OAuth2CodeResponse(const std::string &code, const std::string &state)
|
||||
{
|
||||
this->code = code;
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
OAuth2CodeResponse::~OAuth2CodeResponse()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2ErrorResponse::OAuth2ErrorResponse()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2ErrorResponse::OAuth2ErrorResponse(OAuth2AuthorizeError error, const std::string &error_description,
|
||||
const std::string &error_uri, const std::string &state)
|
||||
{
|
||||
this->error = error;
|
||||
this->error_description = error_description;
|
||||
this->error_uri = error_uri;
|
||||
this->state = state;
|
||||
}
|
||||
|
||||
OAuth2ErrorResponse::~OAuth2ErrorResponse()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2TokenRequest::OAuth2TokenRequest()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2TokenRequest::OAuth2TokenRequest(OAuth2GrantType grant_type, uint64_t client_id,
|
||||
const std::string &client_secret, const std::string &redirect_uri,
|
||||
const std::string &code, const std::string &refresh_token,
|
||||
const std::string &username, const std::string &password)
|
||||
{
|
||||
this->grant_type = grant_type;
|
||||
this->client_id = client_id;
|
||||
this->client_secret = client_secret;
|
||||
this->redirect_uri = redirect_uri;
|
||||
this->code = code;
|
||||
this->refresh_token = refresh_token;
|
||||
this->username = username;
|
||||
this->password = password;
|
||||
}
|
||||
|
||||
OAuth2TokenRequest::~OAuth2TokenRequest()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2TokenResponse::OAuth2TokenResponse()
|
||||
{
|
||||
}
|
||||
|
||||
OAuth2TokenResponse::OAuth2TokenResponse(OAuth2TokenType token_type, const std::string &access_token,
|
||||
const std::string &refresh_token, const std::string &scope,
|
||||
const std::string &state, uint64_t expires_in)
|
||||
{
|
||||
this->token_type = token_type;
|
||||
this->access_token = access_token;
|
||||
this->refresh_token = refresh_token;
|
||||
this->scope = scope;
|
||||
this->state = state;
|
||||
this->expires_in = expires_in;
|
||||
}
|
||||
|
||||
OAuth2TokenResponse::~OAuth2TokenResponse()
|
||||
{
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/options.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
TribufuApiOptions::TribufuApiOptions() : TribufuApiOptions(nullptr, nullptr, nullptr, 0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
TribufuApiOptions::TribufuApiOptions(std::string api_key) : TribufuApiOptions(api_key, nullptr, nullptr, 0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
TribufuApiOptions::TribufuApiOptions(std::string access_token, std::string refresh_token, float expires_in)
|
||||
: TribufuApiOptions(nullptr, access_token, refresh_token, expires_in)
|
||||
{
|
||||
}
|
||||
|
||||
TribufuApiOptions::TribufuApiOptions(std::string api_key, std::string access_token, std::string refresh_token,
|
||||
float expires_in)
|
||||
{
|
||||
this->api_key = api_key;
|
||||
this->access_token = access_token;
|
||||
this->refresh_token = refresh_token;
|
||||
this->expires_in = expires_in;
|
||||
}
|
||||
|
||||
TribufuApiOptions::~TribufuApiOptions()
|
||||
{
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
--- @diagnostic disable: undefined-global
|
||||
|
||||
project "tribufu_cpp"
|
||||
project "tribufu"
|
||||
location "."
|
||||
language "C++"
|
||||
|
||||
@ -31,8 +31,8 @@ project "tribufu_cpp"
|
||||
|
||||
libdirs
|
||||
{
|
||||
"../bin/%{cfg.platform:gsub('-', '/')}",
|
||||
"../vendor/*/lib/%{cfg.platform:gsub('-', '/')}",
|
||||
"../bin/%{cfg.platform}",
|
||||
"../vendor/*/lib/%{cfg.platform}",
|
||||
}
|
||||
|
||||
-- Profile
|
||||
@ -61,7 +61,7 @@ project "tribufu_cpp"
|
||||
|
||||
-- Platform
|
||||
|
||||
filter { "platforms:windows-*" }
|
||||
filter { "platforms:win-*" }
|
||||
kind "SharedLib"
|
||||
system "windows"
|
||||
systemversion "latest"
|
||||
@ -79,7 +79,6 @@ project "tribufu_cpp"
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_native.lib",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
@ -90,7 +89,7 @@ project "tribufu_cpp"
|
||||
{
|
||||
}
|
||||
|
||||
filter { "platforms:mac-*" }
|
||||
filter { "platforms:osx-*" }
|
||||
kind "SharedLib"
|
||||
system "macosx"
|
||||
systemversion "10.15"
|
||||
@ -108,7 +107,6 @@ project "tribufu_cpp"
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_native",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
@ -136,7 +134,6 @@ project "tribufu_cpp"
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_native",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
@ -164,7 +161,6 @@ project "tribufu_cpp"
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_native",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
@ -193,7 +189,6 @@ project "tribufu_cpp"
|
||||
|
||||
links
|
||||
{
|
||||
"tribufu_native",
|
||||
}
|
||||
|
||||
prelinkcommands
|
||||
@ -206,29 +201,29 @@ project "tribufu_cpp"
|
||||
|
||||
-- Architecture
|
||||
|
||||
filter { "platforms:*-i686" }
|
||||
filter { "platforms:*-x86" }
|
||||
architecture "x32"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_I686",
|
||||
"TRIBUFU_X86",
|
||||
"TRIBUFU_32BITS",
|
||||
}
|
||||
|
||||
filter { "platforms:*-x86_64" }
|
||||
filter { "platforms:*-x64" }
|
||||
architecture "x64"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_X8664",
|
||||
"TRIBUFU_X64",
|
||||
"TRIBUFU_64BITS",
|
||||
}
|
||||
|
||||
filter { "platforms:*-aarch64" }
|
||||
filter { "platforms:*-arm64" }
|
||||
architecture "ARM64"
|
||||
|
||||
defines
|
||||
{
|
||||
"TRIBUFU_AARCH64",
|
||||
"TRIBUFU_ARM64",
|
||||
"TRIBUFU_64BITS",
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/server.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
TribufuServer::TribufuServer(uint64_t server_id, uint64_t client_id, const std::string &client_secret)
|
||||
: TribufuClient(client_id, client_secret)
|
||||
{
|
||||
this->server_id = server_id;
|
||||
}
|
||||
|
||||
TribufuServer::~TribufuServer()
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t &TribufuServer::get_server_id()
|
||||
{
|
||||
return this->server_id;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/servers/server.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
Server::Server()
|
||||
{
|
||||
}
|
||||
|
||||
Server::Server(json data)
|
||||
{
|
||||
this->id = data["id"];
|
||||
this->name = data["name"];
|
||||
this->description = data["description"];
|
||||
this->address = data["address"];
|
||||
this->game_port = data["game_port"];
|
||||
this->query_port = data["query_port"];
|
||||
this->package_id = data["package_id"];
|
||||
}
|
||||
|
||||
Server::~Server()
|
||||
{
|
||||
}
|
||||
|
||||
json Server::to_json()
|
||||
{
|
||||
json data;
|
||||
data["id"] = this->id;
|
||||
data["name"] = this->name;
|
||||
data["description"] = this->description;
|
||||
data["address"] = this->address;
|
||||
data["game_port"] = this->game_port;
|
||||
data["query_port"] = this->query_port;
|
||||
data["package_id"] = this->package_id;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/users/profile.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
Profile::Profile()
|
||||
{
|
||||
}
|
||||
|
||||
Profile::Profile(json data)
|
||||
{
|
||||
this->id = data["id"];
|
||||
this->uuid = data["uuid"];
|
||||
this->name = data["name"];
|
||||
this->display_name = data["display_name"];
|
||||
this->type = data["type"];
|
||||
this->public_flags = data["public_flags"];
|
||||
this->verified = data["verified"];
|
||||
this->level = data["level"];
|
||||
this->experience = data["experience"];
|
||||
this->public_birthday = data["public_birthday"];
|
||||
this->points = data["points"];
|
||||
this->location = data["location"];
|
||||
this->photo_url = data["photo_url"];
|
||||
this->banner_url = data["banner_url"];
|
||||
this->last_online = data["last_online"];
|
||||
this->biography = data["biography"];
|
||||
this->view_count = data["view_count"];
|
||||
this->created = data["created"];
|
||||
this->updated = data["updated"];
|
||||
}
|
||||
|
||||
Profile::~Profile()
|
||||
{
|
||||
}
|
||||
|
||||
json Profile::to_json()
|
||||
{
|
||||
json data;
|
||||
data["id"] = this->id;
|
||||
data["uuid"] = this->uuid;
|
||||
data["name"] = this->name;
|
||||
data["display_name"] = this->display_name;
|
||||
data["type"] = this->type;
|
||||
data["public_flags"] = this->public_flags;
|
||||
data["verified"] = this->verified;
|
||||
data["level"] = this->level;
|
||||
data["experience"] = this->experience;
|
||||
data["public_birthday"] = this->public_birthday;
|
||||
data["points"] = this->points;
|
||||
data["location"] = this->location;
|
||||
data["photo_url"] = this->photo_url;
|
||||
data["banner_url"] = this->banner_url;
|
||||
data["last_online"] = this->last_online;
|
||||
data["biography"] = this->biography;
|
||||
data["view_count"] = this->view_count;
|
||||
data["created"] = this->created;
|
||||
data["updated"] = this->updated;
|
||||
return data;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user