discord-hs-0.1.3: An API wrapper for Discord in Haskell

Safe HaskellNone
LanguageHaskell2010

Network.Discord.Rest

Description

Provides framework to interact with REST api gateways. Implementations specific to the Discord API are provided in Network.Discord.Rest.Channel, Network.Discord.Rest.Guild, and Network.Discord.Rest.User.

Synopsis

Documentation

fetch :: (DoFetch a, Hashable a) => a -> Proxy X () c' c DiscordM Fetched Source #

Perform an API request.

fetch' :: (DoFetch a, Hashable a) => a -> Proxy X () c' c DiscordM () Source #

Perform an API request, ignoring the response

withApi :: Client Fetchable Fetched DiscordM Fetched -> Effect DiscordM () Source #

Alternative method of interacting with the REST api

restServer :: Fetchable -> Server Fetchable Fetched DiscordM Fetched Source #

Provides a pipe to perform REST actions

getGateway :: IO URL Source #

Obtains a new gateway to connect to.

readInteger :: String -> Integer Source #

Read function specialized for Integers

baseURL :: String Source #

The base url for API requests

baseRequest :: DiscordM Options Source #

Construct base request with auth from Discord state

class RateLimit a where Source #

Class for rate-limitable actions

Minimal complete definition

getRateLimit, setRateLimit

Methods

getRateLimit :: a -> DiscordM (Maybe Int) Source #

Return seconds to expiration if we're waiting for a rate limit to reset

setRateLimit :: a -> Int -> DiscordM () Source #

Set seconds to the next rate limit reset when we hit a rate limit

waitRateLimit :: a -> DiscordM () Source #

If we hit a rate limit, wait for it to reset

class DoFetch a where Source #

Class over which performing a data retrieval action is defined

Minimal complete definition

doFetch

data Fetchable Source #

Polymorphic type for all DoFetch types

Constructors

(DoFetch a, Hashable a) => Fetch a 

data Fetched Source #

Result of a data retrieval action

Constructors

FromJSON a => SyncFetched a 

data Range Source #

Represents a range of Snowflakes

Constructors

Range 

Instances

toQueryString :: Range -> String Source #

Convert a Range to a query string