Ark Server API 3.54
Serverside plugin support for Ark Survival Evolved.
Loading...
Searching...
No Matches
API::Requests Class Reference

#include <Requests.h>

Classes

class  impl
 

Public Member Functions

 Requests ()
 
 ~Requests ()
 
 Requests (const Requests &)=delete
 
 Requests (Requests &&)=delete
 
Requestsoperator= (const Requests &)=delete
 
Requestsoperator= (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 RequestsGet ()
 

Private Attributes

std::unique_ptr< implpimpl
 

Detailed Description

Definition at line 10 of file Requests.h.

Constructor & Destructor Documentation

◆ Requests() [1/3]

◆ ~Requests()

API::Requests::~Requests ( )

Definition at line 61 of file Requests.cpp.

References API::game_api, and Poco::Net::uninitializeSSL().

◆ Requests() [2/3]

API::Requests::Requests ( const Requests )
delete

◆ Requests() [3/3]

API::Requests::Requests ( Requests &&  )
delete

Member Function Documentation

◆ CreateDeleteRequest()

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.

Parameters
requestURL
thecallback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise
includedheaders

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().

◆ CreateGetRequest()

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.

Parameters
requestURL
thecallback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise
includedheaders

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().

◆ CreatePostRequest() [1/3]

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.

Parameters
requestURL
thecallback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise
datato post
contenttype
includedheaders

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().

◆ CreatePostRequest() [2/3]

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.

Parameters
requestURL
thecallback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise
datato post
includedheaders

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().

◆ CreatePostRequest() [3/3]

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.

Parameters
requestURL
thecallback function, binds sucess(bool) and result(string), result is error code if request failed and the response otherwise
datakey
datavalue
includedheaders

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().

◆ Get()

Requests & API::Requests::Get ( )
static

Definition at line 67 of file Requests.cpp.

◆ operator=() [1/2]

Requests & API::Requests::operator= ( const Requests )
delete

◆ operator=() [2/2]

Requests & API::Requests::operator= ( Requests &&  )
delete

Member Data Documentation

◆ pimpl

std::unique_ptr<impl> API::Requests::pimpl
private

Definition at line 84 of file Requests.h.

Referenced by CreateDeleteRequest(), CreateGetRequest(), CreatePostRequest(), and Requests().


The documentation for this class was generated from the following files: