DiscordRateLimiterSpec
public protocol DiscordRateLimiterSpec
A DiscordRateLimiterSpec is in charge of making sure we don’t flood Discord with requests. It keeps a dictionary of DiscordRateLimitKeys and DiscordRateLimits. All requests to the REST api should be routed through a DiscordRateLimiterSpec.
-
The queue that request responses are called on.
Declaration
Swift
var callbackQueue: DispatchQueue
-
Whether or not this rate limiter should immediately callback on rate limits.
Declaration
Swift
var failFast: Bool
-
Executes a request through the rate limiter.
Declaration
Swift
func executeRequest(_ request: URLRequest, for endpointKey: DiscordRateLimitKey,
Parameters
request
The request to execute.
for
The endpoint key.
callback
The callback for this request.
-
Executes a request through the rate limiter.
Declaration
Swift
func executeRequest(endpoint: DiscordEndpoint,
Parameters
endpoint
The endpoint for this request.
token
The token to use in this request.
requestInfo
A
DiscordEndpoint.EndpointRequest
specifying the request info.callback
The callback for this request.