Ark Server API (ASA) - Wiki
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 ()
 
static bool DownloadFile (const std::string &url, const std::string &localPath, std::vector< std::string > headers={})
 

Private Attributes

std::unique_ptr< implpimpl
 

Detailed Description

Definition at line 11 of file Requests.h.

Constructor & Destructor Documentation

◆ Requests() [1/3]

API::Requests::Requests ( )

Definition at line 58 of file Requests.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~Requests()

API::Requests::~Requests ( )

Definition at line 72 of file Requests.cpp.

◆ 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 303 of file Requests.cpp.

◆ 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 140 of file Requests.cpp.

◆ 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 211 of file Requests.cpp.

◆ 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 173 of file Requests.cpp.

◆ 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 249 of file Requests.cpp.

◆ DownloadFile()

bool API::Requests::DownloadFile ( const std::string & url,
const std::string & localPath,
std::vector< std::string > headers = {} )
static

Definition at line 336 of file Requests.cpp.

◆ Get()

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

Definition at line 78 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 87 of file Requests.h.


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