calamity-0.1.28.1: 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.1.28.1-PJj5hR9THTEjfa8poqgUG" '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.1.28.1-PJj5hR9THTEjfa8poqgUG" 'False) (C1 ('MetaCons "RateLimitState" 'PrefixI 'True) (S1 ('MetaSel ('Just "bucketKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Map Route 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

ExhaustedBucket

We got a response but also exhausted the bucket

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

data Bucket Source #

Constructors

Bucket 

Fields

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.1.28.1-PJj5hR9THTEjfa8poqgUG" 'False) (C1 ('MetaCons "Bucket" 'PrefixI 'True) (S1 ('MetaSel ('Just "lock") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Lock) :*: S1 ('MetaSel ('Just "state") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TVar BucketState))))

data BucketState Source #

Constructors

BucketState 

Fields

  • resetTime :: UTCTime

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

  • remaining :: Maybe Int

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

Instances

Instances details
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

type Rep BucketState = D1 ('MetaData "BucketState" "Calamity.HTTP.Internal.Types" "calamity-0.1.28.1-PJj5hR9THTEjfa8poqgUG" 'False) (C1 ('MetaCons "BucketState" 'PrefixI 'True) (S1 ('MetaSel ('Just "resetTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "remaining") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int))))

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.1.28.1-PJj5hR9THTEjfa8poqgUG" 'True) (C1 ('MetaCons "GatewayResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "url") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))