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 ID 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.

    See more

    Declaration

    Swift

    public struct DiscordRateLimitURLParts : OptionSet
  • id

    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