Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides a higher level interface to the rest functions. Preperly writes to the rate-limit loop. Creates separate MVars for each call
Synopsis
- module Discord.Internal.Types
- data RestChanHandle = RestChanHandle {}
- class Request a where
- majorRoute :: a -> String
- jsonRequest :: a -> JsonRequest
- writeRestCall :: (Request (r a), FromJSON a) => RestChanHandle -> r a -> IO (Either RestCallInternalException a)
- startRestThread :: Auth -> Chan Text -> IO (RestChanHandle, ThreadId)
- data RestCallInternalException
Documentation
module Discord.Internal.Types
data RestChanHandle Source #
Handle to the Rest Chan
class Request a where Source #
majorRoute :: a -> String Source #
used for putting a request into a rate limit bucket https://discord.com/developers/docs/topics/rate-limits#rate-limits
jsonRequest :: a -> JsonRequest Source #
build a JSON http request
Instances
writeRestCall :: (Request (r a), FromJSON a) => RestChanHandle -> r a -> IO (Either RestCallInternalException a) Source #
Execute a request blocking until a response is received
startRestThread :: Auth -> Chan Text -> IO (RestChanHandle, ThreadId) Source #
Starts the http request thread. Please only call this once
data RestCallInternalException Source #
An exception in a Rest call
RestCallInternalErrorCode Int ByteString ByteString | Error code from Discord |
RestCallInternalNoParse String ByteString | Couldn't parse the response |
RestCallInternalHttpException HttpException | Something went bad in the HTTP process |
Instances
Show RestCallInternalException Source # | |
Defined in Discord.Internal.Rest.HTTP showsPrec :: Int -> RestCallInternalException -> ShowS # show :: RestCallInternalException -> String # showList :: [RestCallInternalException] -> ShowS # |