calamity-0.8.0.0: A library for writing discord bots in haskell
Safe HaskellSafe-Inferred
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

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
(k ~ An_Iso, a ~ TVar BucketState, b ~ TVar BucketState) => LabelOptic "state" k Bucket Bucket a b Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

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

(k ~ A_Lens, a ~ Int, b ~ Int) => LabelOptic "limit" k BucketState BucketState a b Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

(k ~ A_Lens, a ~ Int, b ~ Int) => LabelOptic "ongoing" k BucketState BucketState a b Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

(k ~ A_Lens, a ~ Int, b ~ Int) => LabelOptic "remaining" k BucketState BucketState a b Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

(k ~ A_Lens, a ~ Int, b ~ Int) => LabelOptic "resetKey" k BucketState BucketState a b Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types

(k ~ A_Lens, a ~ Maybe UTCTime, b ~ Maybe UTCTime) => LabelOptic "resetTime" k BucketState BucketState a b Source # 
Instance details

Defined in Calamity.HTTP.Internal.Types