Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- module Discord.Types
- module Discord.Rest.Channel
- module Discord.Rest.Guild
- module Discord.Rest.User
- module Discord.Rest.Invite
- 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
- majorRoute :: a -> String
- jsonRequest :: a -> JsonRequest
- 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.Invite
module Discord.Rest.Emoji
Concurrency primitives that make up the gateway. Build a higher level interface over these
data RestCallException Source #
RestCallErrorCode Int ByteString ByteString | |
RestCallNoParse String ByteString | |
RestCallHttpException HttpException |
Instances
Show RestCallException Source # | |
Defined in Discord.Rest.HTTP showsPrec :: Int -> RestCallException -> ShowS # show :: RestCallException -> String # showList :: [RestCallException] -> ShowS # |
data GatewayException Source #
GatewayExceptionCouldNotConnect Text | |
GatewayExceptionEventParseError String Text | |
GatewayExceptionUnexpected GatewayReceivable Text | |
GatewayExceptionConnection ConnectionException Text |
Instances
Show GatewayException Source # | |
Defined in Discord.Gateway.EventLoop showsPrec :: Int -> GatewayException -> ShowS # show :: GatewayException -> String # showList :: [GatewayException] -> ShowS # |
class Request a where Source #
majorRoute :: a -> String Source #
jsonRequest :: a -> JsonRequest Source #
Instances
Request (UserRequest a) Source # | |
Defined in Discord.Rest.User majorRoute :: UserRequest a -> String Source # jsonRequest :: UserRequest a -> JsonRequest Source # | |
Request (InviteRequest a) Source # | |
Defined in Discord.Rest.Invite majorRoute :: InviteRequest a -> String Source # jsonRequest :: InviteRequest a -> JsonRequest Source # | |
Request (GuildRequest a) Source # | |
Defined in Discord.Rest.Guild majorRoute :: GuildRequest a -> String Source # jsonRequest :: GuildRequest a -> JsonRequest Source # | |
Request (EmojiRequest a) Source # | |
Defined in Discord.Rest.Emoji majorRoute :: EmojiRequest a -> String Source # jsonRequest :: EmojiRequest a -> JsonRequest Source # | |
Request (ChannelRequest a) Source # | |
Defined in Discord.Rest.Channel majorRoute :: ChannelRequest a -> String Source # jsonRequest :: ChannelRequest a -> JsonRequest 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