Wrapper to the Discord REST API.
More...
Wrapper to the Discord REST API.
◆ discord_rest_init()
void discord_rest_init |
( |
struct discord_rest * |
rest, |
|
|
struct logconf * |
conf, |
|
|
const char |
token[] |
|
) |
| |
Initialize an REST handle.
Structure used for interfacing with the Discord's REST API
- Parameters
-
rest | the REST handle to be initialized |
conf | pointer to discord logging module |
token | the bot token |
◆ discord_rest_cleanup()
Free an REST handle.
- Parameters
-
◆ discord_rest_run()
Perform a request to Discord.
This functions is a selector over discord_rest_run() or discord_rest_run_requestor()
- Parameters
-
rest | the handle initialized with discord_rest_init() |
req | return object of request |
body | the body sent for methods that require (ex: post), leave as null if unecessary |
method | the method in opcode format of the request being sent |
endpoint_fmt | the printf-like endpoint formatting string |
- Returns
- CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
- Note
- if sync is set then this function will block the thread and perform it immediately
◆ discord_rest_stop_buckets()
Stop all bucket's on-going, pending and timed-out requests.
The requests will be moved over to client's 'queues->recycling' queue
- Parameters
-