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
- type DiscordHandleRestChan = Chan (String, JsonRequest, MVar (Either RestCallInternalException ByteString))
- class Request a where
- majorRoute :: a -> String
- jsonRequest :: a -> JsonRequest
- writeRestCall :: (Request (r a), FromJSON a) => DiscordHandleRestChan -> r a -> IO (Either RestCallInternalException a)
- startRestThread :: Auth -> Chan Text -> IO (DiscordHandleRestChan, ThreadId)
- data RestCallInternalException
Documentation
module Discord.Internal.Types
type DiscordHandleRestChan = Chan (String, JsonRequest, MVar (Either RestCallInternalException ByteString)) Source #
class Request a where Source #
majorRoute :: a -> String Source #
jsonRequest :: a -> JsonRequest Source #
Instances
writeRestCall :: (Request (r a), FromJSON a) => DiscordHandleRestChan -> r a -> IO (Either RestCallInternalException a) Source #
Execute a request blocking until a response is received
startRestThread :: Auth -> Chan Text -> IO (DiscordHandleRestChan, ThreadId) Source #
Starts the http request thread. Please only call this once
data RestCallInternalException Source #
RestCallInternalErrorCode Int ByteString ByteString | |
RestCallInternalNoParse String ByteString | |
RestCallInternalHttpException HttpException |
Instances
Show RestCallInternalException Source # | |
Defined in Discord.Internal.Rest.HTTP showsPrec :: Int -> RestCallInternalException -> ShowS # show :: RestCallInternalException -> String # showList :: [RestCallInternalException] -> ShowS # |