DiscordRateLimitKey
public struct DiscordRateLimitKey : Hashable
An endpoint is made up of a REST api endpoint and any major parameters in that endpoint. Ex. /channels/232184444340011009/messages and /channels/186926276592795659/messages Are considered different endpoints
-
URL Parts for the purpose of rate limiting. Combine all the parts of the URL into a list of which parts exist Ex. /channels/232184444340011009/messages would be represented by [.channels, .channelID, .messages] Anything that ends in
See moreID
represents the existence of a snowflake id, but the actual ID should be stored separately if needed. Technically, the .guildID and .channelID fields aren’t needed since the full ID will also be stored, but they’re included to make the system more straightforward.Declaration
Swift
public struct DiscordRateLimitURLParts : OptionSet
-
The guild or channel ID in this endpoint (or 0 if neither) There should never be a time when you need both the channel and guild id since every channel is bound to exactly one guild
Declaration
Swift
public let id: Snowflake
-
The list of parts that the URL contains
Declaration
Swift
public let urlParts: DiscordRateLimitURLParts
-
The hash of the key.
Declaration
Swift
public var hashValue: Int
-
Creates a new endpoint key.
Declaration
Swift
public init(id: Snowflake = 0, urlParts: DiscordRateLimitURLParts)
-
Whether two keys are equal.
Declaration
Swift
public static func ==(lhs: DiscordRateLimitKey, rhs: DiscordRateLimitKey) -> Bool