Module serenity::http

source ·
Available on crate feature http only.
Expand description

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.

Structs§

Enums§

Traits§

  • This trait will be required by functions that need Http and can optionally use a Cache to potentially avoid REST-requests.

Functions§

Type Aliases§