[−][src]Module serenity::http
The HTTP module which provides functions for performing requests to endpoints in Discord's API.
An important function of the REST API is ratelimiting. Requests to endpoints are ratelimited to prevent spam, and once ratelimited Discord will stop performing requests. The library implements protection to pre-emptively ratelimit, to ensure that no wasted requests are made.
The HTTP module comprises of two types of requests:
- REST API requests, which require an authorization token;
- Other requests, which do not require an authorization token.
The former require a Client
to have logged in, while the latter may be
made regardless of any other usage of the library.
If a request spuriously fails, it will be retried once.
Note that you may want to perform requests through a models' instance methods where possible, as they each offer different levels of a high-level interface to the HTTP module.
Re-exports
pub use self::raw::*; |
Modules
ratelimiting | Routes are used for ratelimiting. These are to differentiate between the different types of routes - such as getting the current user's channels - for the most part, with the exception being major parameters. |
raw | |
request | |
routing |
Structs
StatusCode | An HTTP status code ( |
Enums
AttachmentType | Enum that allows a user to pass a |
GuildPagination | Representation of the method of a query to send for the |
HttpError | |
LightMethod | An method used for ratelimiting special routes. |
Traits
CacheHttp | This trait will be required by functions that need |