| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Discord.Internal.Rest
Description
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 #
Constructors
| RestChanHandle | |
| Fields | |
class Request a where Source #
Methods
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 #
Constructors
| RestCallInternalErrorCode Int ByteString ByteString | |
| RestCallInternalNoParse String ByteString | |
| RestCallInternalHttpException HttpException | 
Instances
| Show RestCallInternalException Source # | |
| Defined in Discord.Internal.Rest.HTTP Methods showsPrec :: Int -> RestCallInternalException -> ShowS # show :: RestCallInternalException -> String # showList :: [RestCallInternalException] -> ShowS # | |