19#ifndef Foundation_Foundation_INCLUDED
20#define Foundation_Foundation_INCLUDED
26#include "Poco/Config.h"
32#if defined(_WIN32
) && defined(_DLL)
33 #if !defined(POCO_DLL) && !defined(POCO_STATIC)
47#if (defined(_WIN32
) || defined(_WIN32_WCE)) && defined(POCO_DLL)
48 #if defined(Foundation_EXPORTS)
49 #define Foundation_API __declspec(dllexport)
51 #define Foundation_API __declspec(dllimport)
56#if !defined(Foundation_API)
57 #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4
)
58 #define Foundation_API __attribute__ ((visibility ("default")))
60 #define Foundation_API
71 #define POCO_LIB_SUFFIX "d.lib"
73 #define POCO_LIB_SUFFIX ".lib"
77 #define POCO_LIB_SUFFIX "mdd.lib"
79 #define POCO_LIB_SUFFIX "md.lib"
83 #define POCO_LIB_SUFFIX "mtd.lib"
85 #define POCO_LIB_SUFFIX "mt.lib"
89 #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Foundation_EXPORTS)
90 #pragma comment(lib, "PocoFoundation" POCO_LIB_SUFFIX
)
98#include "Poco/Platform.h"
100 #include "Poco/Platform_WIN32.h"
101#elif defined(POCO_VXWORKS)
102 #include "Poco/Platform_VX.h"
103#elif defined(POCO_OS_FAMILY_UNIX)
104 #include "Poco/Platform_POSIX.h"
111#include "Poco/Alignment.h"
116#ifdef POCO_OS_FAMILY_WINDOWS
117 #if defined(POCO_NO_WSTRING)
118 #error POCO_NO_WSTRING is not supported on Windows.
134#define POCO_DO_JOIN2(X, Y) X##Y
143#if defined(POCO_NO_DEPRECATED)
144#define POCO_DEPRECATED
146#define POCO_DEPRECATED __attribute__((deprecated))
147#elif defined(__clang__
)
148#define POCO_DEPRECATED __attribute__((deprecated))
149#elif defined(_MSC_VER)
150#define POCO_DEPRECATED __declspec(deprecated)
152#define POCO_DEPRECATED
159#include "Poco/Bugcheck.h"
160#include "Poco/Types.h"
#define POCO_DO_JOIN2(X, Y)
#define POCO_DO_JOIN(X, Y)
virtual std::unique_ptr< ArkApi::ICommands > & GetCommands()=0
void WriteRequest(std::function< void(bool, std::string)> callback, bool success, std::string result)
std::string GetResponse(Poco::Net::HTTPClientSession *session, Poco::Net::HTTPResponse &response)
Poco::Net::HTTPRequest ConstructRequest(const std::string &url, Poco::Net::HTTPClientSession *&session, const std::vector< std::string > &headers, const std::string &request_type)
std::vector< RequestData > RequestsVec_
Requests(Requests &&)=delete
ARK_API bool CreateGetRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, std::vector< std::string > headers={})
Creates an async GET Request that runs in another thread but calls the callback from the main thread.
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::vector< std::string > &post_ids, const std::vector< std::string > &post_data, std::vector< std::string > headers={})
Creates an async POST Request that runs in another thread but calls the callback from the main thread...
Requests & operator=(Requests &&)=delete
ARK_API bool CreateDeleteRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, std::vector< std::string > headers={})
Creates an async DELETE Request that runs in another thread but calls the callback from the main thre...
Requests & operator=(const Requests &)=delete
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::string &post_data, std::vector< std::string > headers={})
Creates an async POST Request with application/x-www-form-urlencoded content type that runs in anothe...
static ARK_API Requests & Get()
ARK_API bool CreatePostRequest(const std::string &url, const std::function< void(bool, std::string)> &callback, const std::string &post_data, const std::string &content_type, std::vector< std::string > headers={})
Creates an async POST Request that runs in another thread but calls the callback from the main thread...
std::unique_ptr< impl > pimpl
Requests(const Requests &)=delete
virtual void AddOnTickCallback(const FString &id, const std::function< void(float)> &callback)=0
Added function will be called every frame.
virtual bool RemoveOnTickCallback(const FString &id)=0
Removes a on-tick callback.
static std::shared_ptr< spdlog::logger > & GetLog()
std::string displayText() const
Returns the exception code if defined.
virtual std::istream & receiveResponse(HTTPResponse &response)
virtual std::ostream & sendRequest(HTTPRequest &request)
Returns the connection timeout for HTTP connections.
static const std::string HTTP_1_1
void setContentLength(std::streamsize length)
Returns the HTTP version for this message.
HTTPRequest(const std::string &method, const std::string &uri, const std::string &version)
Creates a HTTP/1.0 request with the given method and URI.
static const std::string HTTP_GET
static const std::string HTTP_DELETE
static const std::string HTTP_POST
const std::string & getReason() const
Sets the HTTP reason phrase.
HTTPResponse(HTTPStatus status)
HTTPStatus getStatus() const
HTTPSClientSession(const std::string &host, Poco::UInt16 port, Context::Ptr pContext, Session::Ptr pSession)
std::string proxyRequestPrefix() const
Sends the given HTTPRequest over an existing connection.
HTTPSClientSession(Context::Ptr pContext, Session::Ptr pSession)
Session::Ptr sslSession()
HTTPSClientSession(Context::Ptr pContext)
Creates a HTTPSClientSession using the given host and port.
void proxyAuthenticate(HTTPRequest &request)
Checks if we can reuse a persistent connection.
int read(char *buffer, std::streamsize length)
HTTPSClientSession(const HTTPSClientSession &)
void connect(const SocketAddress &address)
Refills the internal buffer.
HTTPSClientSession(const SecureStreamSocket &socket, Session::Ptr pSession)
X509Certificate serverCertificate()
HTTPSClientSession & operator=(const HTTPSClientSession &)
HTTPSClientSession(const std::string &host, Poco::UInt16 port=HTTPS_PORT)
HTTPSClientSession(const SecureStreamSocket &socket)
Creates an unconnected HTTPSClientSession.
HTTPSClientSession(const std::string &host, Poco::UInt16 port, Context::Ptr pContext)
RejectCertificateHandler(bool handleErrorsOnServerSide)
void initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassphraseHandler, InvalidCertificateHandlerPtr ptrHandler, Context::Ptr ptrContext)
static SSLManager & instance()
This stream discards all characters written to it.
static std::streamsize copyStream(std::istream &istr, std::ostream &ostr, std::size_t bufferSize=8192)
const std::string & getHost() const
Sets the user-info part of the URI.
const std::string & getScheme() const
URI(const std::string &uri)
Creates an empty URI.
unsigned short getPort() const
Sets the host part of the URI.
std::string getPathAndQuery() const
Returns the encoded path, query and fragment parts of the URI.
std::unique_ptr< IBaseApi > game_api
void NetSSL_API initializeSSL()
void Net_API uninitializeNetwork()
void Net_API initializeNetwork()
void NetSSL_API uninitializeSSL()
std::function< void(bool, std::string)> callback
static std::string escape(const std::string &s, bool strictJSON=false)