mirror of
https://github.com/tribufu/sdk-cpp
synced 2025-06-16 14:54:22 +00:00
Use mintaka http client
This commit is contained in:
@ -1,7 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/defines.h>
|
||||
#include <tribufu/platform/platform.h>
|
||||
#include <tribufu/std.h>
|
@ -2,9 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/base.h>
|
||||
#include <tribufu/json.h>
|
||||
#include <tribufu/http.h>
|
||||
#include <tribufu/prelude.h>
|
||||
|
||||
const char *VERSION = "0.0.4";
|
||||
|
||||
@ -15,7 +13,7 @@ namespace tribufu
|
||||
private:
|
||||
uint64_t id;
|
||||
std::string secret;
|
||||
hv::HttpClient http;
|
||||
HttpClient http;
|
||||
|
||||
public:
|
||||
TribufuClient(uint64_t id, const std::string &secret);
|
||||
|
@ -1,61 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef EXTERN_C
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C extern "C"
|
||||
#define TRIBUFU_CPP
|
||||
#else
|
||||
#define EXTERN_C
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Declare Enum
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define TRIBUFU_ENUM_START(name) enum class name {
|
||||
#define TRIBUFU_ENUM_END(name) }
|
||||
|
||||
#else
|
||||
|
||||
#define TRIBUFU_ENUM_START(name) typedef enum name {
|
||||
#define TRIBUFU_ENUM_END } name
|
||||
|
||||
#endif
|
||||
|
||||
#define TRIBUFU_DECLARE_ENUM(name, ...) TRIBUFU_ENUM_START(name) __VA_ARGS__ TRIBUFU_ENUM_END
|
||||
|
||||
// Declare Struct
|
||||
|
||||
#define TRIBUFU_PASTE(...) __VA_ARGS__
|
||||
|
||||
#define TRIBUFU_DECLARE_STRUCT(name, body) \
|
||||
EXTERN_C typedef struct name \
|
||||
{ \
|
||||
TRIBUFU_PASTE body \
|
||||
} name
|
||||
|
||||
// Experimental
|
||||
|
||||
#define TRIBUFU_CLASS(...)
|
||||
#define TRIBUFU_STRUCT(...)
|
||||
#define TRIBUFU_ENUM(...)
|
||||
#define TRIBUFU_FUNCTION(...)
|
||||
#define TRIBUFU_PROPERTY(...)
|
||||
|
||||
// Import/Export API
|
||||
|
||||
#define NATIVE_API EXTERN_C
|
||||
|
||||
#ifdef TRIBUFU_LIBRARY
|
||||
#define TRIBUFU_API DLLEXPORT
|
||||
#else
|
||||
#define TRIBUFU_API DLLIMPORT
|
||||
#endif
|
||||
|
||||
// Macros Utils
|
||||
|
||||
#define TRIBUFU_EXPAND_MACRO(x) x
|
||||
#define TRIBUFU_STRINGIFY_MACRO(x) #x
|
@ -1,7 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
18
include/tribufu/macros.h
Normal file
18
include/tribufu/macros.h
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define TRIBUFU_CPP
|
||||
#endif
|
||||
|
||||
#ifdef TRIBUFU_LIBRARY
|
||||
#define TRIBUFU_API DLLEXPORT
|
||||
#else
|
||||
#define TRIBUFU_API DLLIMPORT
|
||||
#endif
|
||||
|
||||
// Macros Utils
|
||||
|
||||
#define TRIBUFU_EXPAND_MACRO(x) x
|
||||
#define TRIBUFU_STRINGIFY_MACRO(x) #x
|
@ -2,4 +2,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hv/requests.h>
|
||||
#include <tribufu/prelude.h>
|
@ -2,7 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/base.h>
|
||||
#include <tribufu/prelude.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/platform/unix.h>
|
||||
|
||||
#ifndef TRIBUFU_ANDROID
|
||||
#define TRIBUFU_ANDROID
|
||||
#endif
|
||||
|
||||
#ifndef TRIBUFU_MOBILE
|
||||
#define TRIBUFU_MOBILE
|
||||
#endif
|
@ -1,10 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef TRIBUFU_APPLE
|
||||
#define TRIBUFU_APPLE
|
||||
#endif
|
||||
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#define DLLIMPORT __attribute__((visibility("default")))
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/platform/unix.h>
|
||||
|
||||
#ifndef TRIBUFU_FREEBSD
|
||||
#define TRIBUFU_FREEBSD
|
||||
#endif
|
||||
|
||||
#ifndef TRIBUFU_DESKTOP
|
||||
#define TRIBUFU_DESKTOP
|
||||
#endif
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/platform/apple.h>
|
||||
|
||||
#ifndef TRIBUFU_IOS
|
||||
#define TRIBUFU_IOS
|
||||
#endif
|
||||
|
||||
#ifndef TRIBUFU_MOBILE
|
||||
#define TRIBUFU_MOBILE
|
||||
#endif
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/platform/unix.h>
|
||||
|
||||
#ifndef TRIBUFU_LINUX
|
||||
#define TRIBUFU_LINUX
|
||||
#endif
|
||||
|
||||
#ifndef TRIBUFU_DESKTOP
|
||||
#define TRIBUFU_DESKTOP
|
||||
#endif
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/platform/apple.h>
|
||||
|
||||
#ifndef TRIBUFU_MAC
|
||||
#define TRIBUFU_MAC
|
||||
#endif
|
||||
|
||||
#ifndef TRIBUFU_DESKTOP
|
||||
#define TRIBUFU_DESKTOP
|
||||
#endif
|
@ -1,14 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef TRIBUFU_MSVC
|
||||
#define TRIBUFU_MSVC
|
||||
#endif
|
||||
|
||||
#ifndef TRIBUFU_MICROSOFT
|
||||
#define TRIBUFU_MICROSOFT
|
||||
#endif
|
||||
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#define DLLIMPORT __declspec(dllimport)
|
@ -1,30 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <tribufu/platform/windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MACH__
|
||||
#include <tribufu/platform/mac.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <tribufu/platform/linux.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <tribufu/platform/freebsd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <tribufu/platform/android.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
// #include <TargetConditionals.h>
|
||||
#ifdef TARGET_OS_IPHONE
|
||||
#include <tribufu/platform/ios.h>
|
||||
#endif
|
||||
#endif
|
@ -1,10 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef TRIBUFU_UNIX
|
||||
#define TRIBUFU_UNIX
|
||||
#endif
|
||||
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#define DLLIMPORT __attribute__((visibility("default")))
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/platform/msvc.h>
|
||||
|
||||
#ifndef TRIBUFU_WINDOWS
|
||||
#define TRIBUFU_WINDOWS
|
||||
#endif
|
||||
|
||||
#ifndef TRIBUFU_DESKTOP
|
||||
#define TRIBUFU_DESKTOP
|
||||
#endif
|
13
include/tribufu/prelude.h
Normal file
13
include/tribufu/prelude.h
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <mintaka/framework.h>
|
||||
#include <tribufu/macros.h>
|
||||
#include <tribufu/native.h>
|
||||
|
||||
#ifdef TRIBUFU_CPP
|
||||
|
||||
using namespace mintaka;
|
||||
|
||||
#endif
|
27
include/tribufu/servers/server.h
Normal file
27
include/tribufu/servers/server.h
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/prelude.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
class TRIBUFU_API Server
|
||||
{
|
||||
private:
|
||||
uint64_t id;
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::string address;
|
||||
uint16_t game_port;
|
||||
uint16_t query_port;
|
||||
uint64_t package_id;
|
||||
|
||||
public:
|
||||
Server();
|
||||
Server(json data);
|
||||
~Server();
|
||||
|
||||
json to_json();
|
||||
};
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef TRIBUFU_CPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#endif
|
46
include/tribufu/users/profile.h
Normal file
46
include/tribufu/users/profile.h
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/prelude.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
enum class UserType
|
||||
{
|
||||
User,
|
||||
Bot,
|
||||
Org,
|
||||
};
|
||||
|
||||
class TRIBUFU_API Profile
|
||||
{
|
||||
private:
|
||||
uint64_t id;
|
||||
std::string uuid;
|
||||
std::string name;
|
||||
std::string display_name;
|
||||
UserType type;
|
||||
uint64_t public_flags;
|
||||
bool verified;
|
||||
uint32_t level;
|
||||
double experience;
|
||||
bool public_birthday;
|
||||
double points;
|
||||
std::string location;
|
||||
std::string photo_url;
|
||||
std::string banner_url;
|
||||
std::string last_online;
|
||||
std::string biography;
|
||||
uint32_t view_count;
|
||||
std::string created;
|
||||
std::string updated;
|
||||
|
||||
public:
|
||||
Profile();
|
||||
Profile(json data);
|
||||
~Profile();
|
||||
|
||||
json to_json();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user