dpp::http_request
queues.h
std::unique_ptr< https_client > std::unique_ptr<https_client> dpp::http_request::cli cli dpp::http_request::cli

HTTPS client.

std::mutex std::mutex dpp::http_request::cli_mutex cli_mutex dpp::http_request::cli_mutex

Client mutex.

http_completion_event http_completion_event dpp::http_request::complete_handler complete_handler dpp::http_request::complete_handler

Completion callback.

std::atomic< bool > std::atomic<bool> dpp::http_request::completed completed dpp::http_request::completed

True if request has been made.

bool bool dpp::http_request::non_discord non_discord dpp::http_request::non_discord

True for requests that are not going to discord (rate limits code skipped).

bool bool dpp::http_request::this_captured this_captured dpp::http_request::this_captured {false}

True if this is currently captured in a lambda and cannot be deleted.

std::mutex std::mutex dpp::http_request::this_captured_mutex this_captured_mutex dpp::http_request::this_captured_mutex

Mutex for this_captured_signal and this_captured.

std::condition_variable std::condition_variable dpp::http_request::this_captured_signal this_captured_signal dpp::http_request::this_captured_signal

Condition variable to signal this is no longer captured by an ongoing lambda.

std::string std::string dpp::http_request::endpoint endpoint dpp::http_request::endpoint

Endpoint name e.g. /api/users.

std::vector< std::string > std::vector<std::string> dpp::http_request::file_content file_content dpp::http_request::file_content

Upload file contents (binary).

std::vector< std::string > std::vector<std::string> dpp::http_request::file_mimetypes file_mimetypes dpp::http_request::file_mimetypes

Upload file mime types. application/octet-stream if unspecified.

std::vector< std::string > std::vector<std::string> dpp::http_request::file_name file_name dpp::http_request::file_name

Upload file name (server side).

http_method http_method dpp::http_request::method method dpp::http_request::method

HTTP method for request.

std::string std::string dpp::http_request::mimetype mimetype dpp::http_request::mimetype

Request mime type.

std::string std::string dpp::http_request::parameters parameters dpp::http_request::parameters

Major and minor parameters.

std::string std::string dpp::http_request::postdata postdata dpp::http_request::postdata

Postdata for POST and PUT.

std::string std::string dpp::http_request::protocol protocol dpp::http_request::protocol

HTTP protocol.

std::string std::string dpp::http_request::reason reason dpp::http_request::reason

Audit log reason for Discord requests, if non-empty.

std::multimap< std::string, std::string > std::multimap<std::string, std::string> dpp::http_request::req_headers req_headers dpp::http_request::req_headers

Request headers (non-discord requests only).

bool bool dpp::http_request::waiting waiting dpp::http_request::waiting

Waiting for rate limit to expire.

dpp::http_request::http_request
(const std::string &_endpoint, const std::string &_parameters, http_completion_event completion, const std::string &_postdata="", http_method method=m_get, const std::string &audit_reason="", const std::string &filename="", const std::string &filecontent="", const std::string &filemimetype="", const std::string &http_protocol="1.1")
http_request
dpp::http_request::http_request
const std::string & _endpoint
const std::string & _parameters
http_completion_event completion
const std::string & _postdata ""
http_method method m_get
const std::string & audit_reason ""
const std::string & filename ""
const std::string & filecontent ""
const std::string & filemimetype ""
const std::string & http_protocol "1.1"

Constructor. When constructing one of these objects it should be passed to request_queue::post_request().

_endpoint

The API endpoint, e.g. /api/guilds

_parameters

Major and minor parameters for the endpoint e.g. a user id or guild id

completion

completion event to call when done

_postdata

Data to send in POST and PUT requests

method

The HTTP method to use from dpp::http_method

audit_reason

Audit log reason to send, empty to send none

filename

The filename (server side) of any uploaded file

filecontent

The binary content of any uploaded file for the request

filemimetype

The MIME type of any uploaded file for the request

http_protocol

HTTP protocol

dpp::http_request::http_request
(const std::string &_endpoint, const std::string &_parameters, http_completion_event completion, const std::string &_postdata="", http_method method=m_get, const std::string &audit_reason="", const std::vector< std::string > &filename={}, const std::vector< std::string > &filecontent={}, const std::vector< std::string > &filemimetypes={}, const std::string &http_protocol="1.1")
http_request
dpp::http_request::http_request
const std::string & _endpoint
const std::string & _parameters
http_completion_event completion
const std::string & _postdata ""
http_method method m_get
const std::string & audit_reason ""
const std::vector< std::string > & filename {}
const std::vector< std::string > & filecontent {}
const std::vector< std::string > & filemimetypes {}
const std::string & http_protocol "1.1"

Constructor. When constructing one of these objects it should be passed to request_queue::post_request().

_endpoint

The API endpoint, e.g. /api/guilds

_parameters

Major and minor parameters for the endpoint e.g. a user id or guild id

completion

completion event to call when done

_postdata

Data to send in POST and PUT requests

method

The HTTP method to use from dpp::http_method

audit_reason

Audit log reason to send, empty to send none

filename

The filename (server side) of any uploaded file

filecontent

The binary content of any uploaded file for the request

filemimetypes

The MIME type of any uploaded file for the request

http_protocol

HTTP protocol

dpp::http_request::http_request
(const std::string &_url, http_completion_event completion, http_method method=m_get, const std::string &_postdata="", const std::string &_mimetype="text/plain", const std::multimap< std::string, std::string > &_headers={}, const std::string &http_protocol="1.1")
http_request
dpp::http_request::http_request
const std::string & _url
http_completion_event completion
http_method method m_get
const std::string & _postdata ""
const std::string & _mimetype "text/plain"
const std::multimap< std::string, std::string > & _headers {}
const std::string & http_protocol "1.1"

Constructor. When constructing one of these objects it should be passed to request_queue::post_request().

_url

Raw HTTP url

completion

completion event to call when done

method

The HTTP method to use from dpp::http_method

_postdata

Data to send in POST and PUT requests

_mimetype

POST data mime type

_headers

HTTP headers to send

http_protocol

HTTP protocol

dpp::http_request::~http_request
()
~http_request
dpp::http_request::~http_request

Destroy the http request object.

void void dpp::http_request::complete (const http_request_completion_t &c) complete dpp::http_request::complete const http_request_completion_t & c

Call the completion callback, if the request is complete.

c

callback to call

https_client * https_client * dpp::http_request::get_client () const get_client dpp::http_request::get_client

Get the HTTPS client used to perform this request, or nullptr if there is none.

https_client object

bool bool dpp::http_request::is_completed () is_completed dpp::http_request::is_completed

Returns true if the request is complete.

True if completed

http_request_completion_t http_request_completion_t dpp::http_request::run (class request_concurrency_queue *processor, class cluster *owner) run dpp::http_request::run class request_concurrency_queue * processor class cluster * owner

Execute the HTTP request and mark the request complete.

processor

Request concurrency queue this request was created by

owner

creating cluster

A HTTP request.

You should instantiate one of these objects via its constructor, and pass a pointer to it into an instance of request_queue. Although you can directly call the run() method of the object and it will make a HTTP call, be aware that if you do this, it will be a BLOCKING call (not asynchronous) and will not respect rate limits, as both of these functions are managed by the request_queue class.

K
T
bool
dpp::http_request
endpoint
mimetype
parameters
postdata
protocol
reason
method
file_content
file_mimetypes
file_name
req_headers
waiting
http_method
std::basic_string< Char >
std::multimap< K, T >
keys
elements
std::multimap< std::string, std::string >
< std::string, std::string >
std::string
std::vector< T >
elements
std::vector< std::string >
elements
< std::string >
- dpp::http_request
  cli
- dpp::http_request
  cli_mutex
- dpp::http_request
  complete
- dpp::http_request
  complete_handler
- dpp::http_request
  completed
- dpp::http_request
  endpoint
- dpp::http_request
  file_content
- dpp::http_request
  file_mimetypes
- dpp::http_request
  file_name
- dpp::http_request
  get_client
- dpp::http_request
  http_request
- dpp::http_request
  http_request
- dpp::http_request
  http_request
- dpp::http_request
  is_completed
- dpp::http_request
  method
- dpp::http_request
  mimetype
- dpp::http_request
  non_discord
- dpp::http_request
  parameters
- dpp::http_request
  postdata
- dpp::http_request
  protocol
- dpp::http_request
  reason
- dpp::http_request
  req_headers
- dpp::http_request
  run
- dpp::http_request
  this_captured
- dpp::http_request
  this_captured_mutex
- dpp::http_request
  this_captured_signal
- dpp::http_request
  waiting
- dpp::http_request
  ~http_request