Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides framework to interact with REST api gateways. Implementations specific to the Discord API are provided in Network.Discord.Rest.Channel, Network.Discord.Rest.Guild, and Network.Discord.Rest.User.
- fetch :: (DoFetch a, Hashable a) => a -> Proxy X () c' c DiscordM Fetched
- fetch' :: (DoFetch a, Hashable a) => a -> Proxy X () c' c DiscordM ()
- withApi :: Client Fetchable Fetched DiscordM Fetched -> Effect DiscordM ()
- restServer :: Fetchable -> Server Fetchable Fetched DiscordM Fetched
- getGateway :: IO URL
- readInteger :: String -> Integer
- baseURL :: String
- baseRequest :: DiscordM Options
- class RateLimit a where
- class DoFetch a where
- data Fetchable = (DoFetch a, Hashable a) => Fetch a
- data Fetched = FromJSON a => SyncFetched a
- data Range = Range {}
- toQueryString :: Range -> String
- module Network.Discord.Rest.Channel
- module Network.Discord.Rest.Guild
- module Network.Discord.Rest.User
Documentation
fetch :: (DoFetch a, Hashable a) => a -> Proxy X () c' c DiscordM Fetched Source #
Perform an API request.
fetch' :: (DoFetch a, Hashable a) => a -> Proxy X () c' c DiscordM () Source #
Perform an API request, ignoring the response
withApi :: Client Fetchable Fetched DiscordM Fetched -> Effect DiscordM () Source #
Alternative method of interacting with the REST api
restServer :: Fetchable -> Server Fetchable Fetched DiscordM Fetched Source #
Provides a pipe to perform REST actions
getGateway :: IO URL Source #
Obtains a new gateway to connect to.
readInteger :: String -> Integer Source #
Read function specialized for Integers
baseRequest :: DiscordM Options Source #
Construct base request with auth from Discord state
class RateLimit a where Source #
Class for rate-limitable actions
getRateLimit :: a -> DiscordM (Maybe Int) Source #
Return seconds to expiration if we're waiting for a rate limit to reset
setRateLimit :: a -> Int -> DiscordM () Source #
Set seconds to the next rate limit reset when we hit a rate limit
waitRateLimit :: a -> DiscordM () Source #
If we hit a rate limit, wait for it to reset
RateLimit (UserRequest a) Source # | |
RateLimit (GuildRequest a) Source # | |
RateLimit (ChannelRequest a) Source # | |
Polymorphic type for all DoFetch types
Represents a range of Snowflake
s
toQueryString :: Range -> String Source #
Convert a Range to a query string
module Network.Discord.Rest.Channel
module Network.Discord.Rest.Guild
module Network.Discord.Rest.User