Safe Haskell | None |
---|---|
Language | Haskell2010 |
- module Discord.Types
- module Discord.Rest.Channel
- module Discord.Rest.Guild
- module Discord.Rest.User
- module Discord.Rest.Emoji
- data Cache = Cache {}
- data Gateway = Gateway {}
- newtype RestChan = RestChan (Chan (String, JsonRequest, MVar (Either RestCallException ByteString)))
- data RestCallException
- data GatewayException
- class Request a where
- data ThreadIdType
- restCall :: (FromJSON a, Request (r a)) => (RestChan, y, z) -> r a -> IO (Either RestCallException a)
- nextEvent :: (x, Gateway, z) -> IO (Either GatewayException Event)
- sendCommand :: (x, Gateway, z) -> GatewaySendable -> IO ()
- readCache :: (RestChan, Gateway, z) -> IO (Either GatewayException Cache)
- stopDiscord :: (x, y, [ThreadIdType]) -> IO ()
- loginRest :: Auth -> IO (RestChan, NotLoggedIntoGateway, [ThreadIdType])
- loginRestGateway :: Auth -> IO (RestChan, Gateway, [ThreadIdType])
Documentation
module Discord.Types
module Discord.Rest.Channel
module Discord.Rest.Guild
module Discord.Rest.User
module Discord.Rest.Emoji
Concurrency primitives that make up the gateway. Build a higher level interface over these
data RestCallException Source #
data GatewayException Source #
class Request a where Source #
majorRoute :: a -> String Source #
jsonRequest :: a -> JsonRequest Source #
Request (UserRequest a) Source # | |
Request (GuildRequest a) Source # | |
Request (EmojiRequest a) Source # | |
Request (ChannelRequest a) Source # | |
data ThreadIdType Source #
Thread Ids marked by what type they are
restCall :: (FromJSON a, Request (r a)) => (RestChan, y, z) -> r a -> IO (Either RestCallException a) Source #
Execute one http request and get a response
nextEvent :: (x, Gateway, z) -> IO (Either GatewayException Event) Source #
Block until the gateway produces another event. Once an exception is returned, only return that exception
sendCommand :: (x, Gateway, z) -> GatewaySendable -> IO () Source #
Send a GatewaySendable, but not Heartbeat, Identify, or Resume
readCache :: (RestChan, Gateway, z) -> IO (Either GatewayException Cache) Source #
Access the current state of the gateway cache
stopDiscord :: (x, y, [ThreadIdType]) -> IO () Source #
Stop all the background threads
loginRest :: Auth -> IO (RestChan, NotLoggedIntoGateway, [ThreadIdType]) Source #
Start HTTP rest handler background threads
loginRestGateway :: Auth -> IO (RestChan, Gateway, [ThreadIdType]) Source #
Start HTTP rest handler and gateway background threads