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
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
namespace Sapphire
|
2018-10-28 21:53:21 +01:00
|
|
|
{
|
|
|
|
class Session;
|
|
|
|
}
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-06-07 18:12:35 +10:00
|
|
|
namespace Sapphire::Lobby
|
2017-08-08 13:53:47 +02:00
|
|
|
{
|
2018-10-28 21:53:21 +01:00
|
|
|
class LobbySession;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
class RestConnector
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RestConnector();
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
~RestConnector();
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
HttpResponse requestApi( std::string endpoint, std::string data );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
LobbySessionPtr getSession( char* sId );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
int32_t createCharacter( char* sId, std::string name, std::string infoJson );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
std::vector< std::tuple< std::string, uint32_t, uint64_t, std::string>> getCharList( char* sId );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool deleteCharacter( char* sId, std::string name );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
bool checkNameTaken( std::string name );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint32_t getNextCharId();
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint64_t getNextContentId();
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
std::string serverSecret;
|
|
|
|
std::string restHost;
|
|
|
|
|
|
|
|
};
|
2017-08-08 13:53:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|