![]() |
Ark Server API 3.54
Serverside plugin support for Ark Survival Evolved.
|
#include <Requests.h>
Classes | |
class | impl |
Public Member Functions | |
Requests () | |
~Requests () | |
Requests (const Requests &)=delete | |
Requests (Requests &&)=delete | |
Requests & | operator= (const Requests &)=delete |
Requests & | operator= (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::string &post_data, std::vector< std::string > headers={}) |
Creates an async POST Request with application/x-www-form-urlencoded content type 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::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. | |
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. | |
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 thread. | |
Static Public Member Functions | |
static ARK_API Requests & | Get () |
Private Attributes | |
std::unique_ptr< impl > | pimpl |
Definition at line 10 of file Requests.h.
API::Requests::Requests | ( | ) |
Definition at line 50 of file Requests.cpp.
References API::game_api, Poco::Net::SSLManager::initializeClient(), Poco::Net::initializeSSL(), Poco::Net::SSLManager::instance(), pimpl, Poco::Net::Context::TLS_CLIENT_USE, API::Requests::impl::Update(), and Poco::Net::Context::VERIFY_NONE.
API::Requests::~Requests | ( | ) |
Definition at line 61 of file Requests.cpp.
References API::game_api, and Poco::Net::uninitializeSSL().
|
delete |
|
delete |
bool API::Requests::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 thread.
request | URL |
the | callback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise |
included | headers |
Definition at line 292 of file Requests.cpp.
References callback, Poco::Exception::displayText(), Log::GetLog(), Poco::Net::HTTPResponse::getStatus(), Poco::Net::HTTPResponse::HTTP_BAD_REQUEST, Poco::Net::HTTPRequest::HTTP_DELETE, pimpl, and Poco::Net::HTTPClientSession::sendRequest().
bool API::Requests::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.
request | URL |
the | callback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise |
included | headers |
Definition at line 129 of file Requests.cpp.
References callback, Poco::Exception::displayText(), Log::GetLog(), Poco::Net::HTTPResponse::getStatus(), Poco::Net::HTTPResponse::HTTP_BAD_REQUEST, Poco::Net::HTTPRequest::HTTP_GET, pimpl, and Poco::Net::HTTPClientSession::sendRequest().
bool API::Requests::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.
request | URL |
the | callback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise |
data | to post |
content | type |
included | headers |
Definition at line 200 of file Requests.cpp.
References callback, Poco::Exception::displayText(), Log::GetLog(), Poco::Net::HTTPResponse::getStatus(), Poco::Net::HTTPResponse::HTTP_BAD_REQUEST, Poco::Net::HTTPRequest::HTTP_POST, pimpl, Poco::Net::HTTPClientSession::sendRequest(), Poco::Net::HTTPMessage::setContentLength(), and Poco::Net::HTTPMessage::setContentType().
bool API::Requests::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 another thread but calls the callback from the main thread.
request | URL |
the | callback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise |
data | to post |
included | headers |
Definition at line 162 of file Requests.cpp.
References callback, Poco::Exception::displayText(), Log::GetLog(), Poco::Net::HTTPResponse::getStatus(), Poco::Net::HTTPResponse::HTTP_BAD_REQUEST, Poco::Net::HTTPRequest::HTTP_POST, pimpl, Poco::Net::HTTPClientSession::sendRequest(), Poco::Net::HTTPMessage::setContentLength(), and Poco::Net::HTTPMessage::setContentType().
bool API::Requests::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.
request | URL |
the | callback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise |
data | key |
data | value |
included | headers |
Definition at line 238 of file Requests.cpp.
References callback, Poco::Exception::displayText(), Poco::UTF8::escape(), fmt::format(), Log::GetLog(), Poco::Net::HTTPResponse::getStatus(), Poco::Net::HTTPResponse::HTTP_BAD_REQUEST, Poco::Net::HTTPRequest::HTTP_POST, pimpl, Poco::Net::HTTPClientSession::sendRequest(), Poco::Net::HTTPMessage::setContentLength(), and Poco::Net::HTTPMessage::setContentType().
|
static |
Definition at line 67 of file Requests.cpp.
|
private |
Definition at line 84 of file Requests.h.
Referenced by CreateDeleteRequest(), CreateGetRequest(), CreatePostRequest(), and Requests().