Track token rate limits per endpoint

This commit is contained in:
Zed
2022-01-05 22:48:45 +01:00
parent d726894555
commit dd71e60f35
5 changed files with 79 additions and 58 deletions

View File

@@ -8,12 +8,25 @@ type
RateLimitError* = object of CatchableError
InternalError* = object of CatchableError
Token* = ref object
tok*: string
Api* {.pure.} = enum
userShow
photoRail
timeline
search
tweet
list
listBySlug
listMembers
RateLimit* = object
remaining*: int
reset*: Time
Token* = ref object
tok*: string
init*: Time
lastUse*: Time
apis*: Table[Api, RateLimit]
Error* = enum
null = 0