calamity-0.3.0.0: A library for writing discord bots in haskell
Safe HaskellNone
LanguageHaskell2010

Calamity.HTTP.Internal.Types

Description

Types for the http lib

Documentation

data RestError Source #

Constructors

HTTPError

An error response from discord

Fields

InternalClientError Text

Something failed while making the request (after retrying a few times)

Instances

Instances details
Show RestError Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

Generic RestError Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

Associated Types

type Rep RestError :: Type -> Type #

type Rep RestError Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

type Rep RestError = D1 ('MetaData "RestError" "Calamity.HTTP.Internal.Types" "calamity-0.3.0.0-inplace" 'False) (C1 ('MetaCons "HTTPError" 'PrefixI 'True) (S1 ('MetaSel ('Just "status") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "response") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Value))) :+: C1 ('MetaCons "InternalClientError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))

data RateLimitState Source #

Instances

Instances details
Generic RateLimitState Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

Associated Types

type Rep RateLimitState :: Type -> Type #

type Rep RateLimitState Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

type Rep RateLimitState = D1 ('MetaData "RateLimitState" "Calamity.HTTP.Internal.Types" "calamity-0.3.0.0-inplace" 'False) (C1 ('MetaCons "RateLimitState" 'PrefixI 'True) (S1 ('MetaSel ('Just "bucketKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Map RouteKey ByteString)) :*: (S1 ('MetaSel ('Just "buckets") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Map ByteString Bucket)) :*: S1 ('MetaSel ('Just "globalLock") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Event))))

data DiscordResponseType Source #

Constructors

Good

A good response

Fields

Ratelimited

We hit a 429, no response and ratelimited

Fields

ServerError Int

Discord's error, we should retry (HTTP 5XX)

ClientError Int ByteString

Our error, we should fail

InternalResponseError Text

Something went wrong with the http client

newtype Bucket Source #

Constructors

Bucket 

Instances

Instances details
Generic Bucket Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

Associated Types

type Rep Bucket :: Type -> Type #

Methods

from :: Bucket -> Rep Bucket x #

to :: Rep Bucket x -> Bucket #

type Rep Bucket Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

type Rep Bucket = D1 ('MetaData "Bucket" "Calamity.HTTP.Internal.Types" "calamity-0.3.0.0-inplace" 'True) (C1 ('MetaCons "Bucket" 'PrefixI 'True) (S1 ('MetaSel ('Just "state") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TVar BucketState))))

data BucketState Source #

Constructors

BucketState 

Fields

  • resetTime :: Maybe UTCTime

    The time when the bucket resets, used to heuristically wait out ratelimits

  • resetKey :: Int

    The X-Ratelimit-Reset value discord gave us

  • remaining :: Int

    The number of uses left in the bucket, used to heuristically wait out ratelimits

  • limit :: Int

    The total number of uses for this bucket

  • ongoing :: Int

    How many ongoing requests

Instances

Instances details
Show BucketState Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

Generic BucketState Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

Associated Types

type Rep BucketState :: Type -> Type #

type Rep BucketState Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

data GatewayResponse Source #

Instances

Instances details
Show GatewayResponse Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

Generic GatewayResponse Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

Associated Types

type Rep GatewayResponse :: Type -> Type #

FromJSON GatewayResponse Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

type Rep GatewayResponse Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

type Rep GatewayResponse = D1 ('MetaData "GatewayResponse" "Calamity.HTTP.Internal.Types" "calamity-0.3.0.0-inplace" 'True) (C1 ('MetaCons "GatewayResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))