1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00
sapphire/src/lobby/RestConnector.h

52 lines
1,005 B
C
Raw Normal View History

2017-08-08 13:53:47 +02:00
#ifndef _RESTCONNECTOR_H_
#define _RESTCONNECTOR_H_
#include <string>
#include <map>
#include "client_http.hpp"
#include "Forwards.h"
2018-10-28 21:53:21 +01:00
using HttpClient = SimpleWeb::Client< SimpleWeb::HTTP >;
using HttpResponse = std::shared_ptr< SimpleWeb::ClientBase< SimpleWeb::HTTP >::Response >;
2017-08-08 13:53:47 +02:00
namespace Sapphire
2018-10-28 21:53:21 +01:00
{
class Session;
}
namespace Sapphire::Lobby
2017-08-08 13:53:47 +02:00
{
2018-10-28 21:53:21 +01:00
class LobbySession;
2018-10-28 21:53:21 +01:00
class RestConnector
{
public:
RestConnector();
2018-10-28 21:53:21 +01:00
~RestConnector();
2018-10-28 21:53:21 +01:00
HttpResponse requestApi( std::string endpoint, std::string data );
2018-10-28 21:53:21 +01:00
LobbySessionPtr getSession( char* sId );
2018-10-28 21:53:21 +01:00
int32_t createCharacter( char* sId, std::string name, std::string infoJson );
2018-10-28 21:53:21 +01:00
std::vector< std::tuple< std::string, uint32_t, uint64_t, std::string>> getCharList( char* sId );
2018-10-28 21:53:21 +01:00
bool deleteCharacter( char* sId, std::string name );
2018-10-28 21:53:21 +01:00
bool checkNameTaken( std::string name );
2018-10-28 21:53:21 +01:00
uint32_t getNextCharId();
2018-10-28 21:53:21 +01:00
uint64_t getNextContentId();
2018-10-28 21:53:21 +01:00
std::string serverSecret;
std::string restHost;
};
2017-08-08 13:53:47 +02:00
}
#endif