diff --git a/lib/angel_security.dart b/lib/angel_security.dart index b4f2c0d5..2f1b6977 100644 --- a/lib/angel_security.dart +++ b/lib/angel_security.dart @@ -1 +1,2 @@ -export 'src/rate_limiter.dart'; \ No newline at end of file +export 'src/rate_limiter.dart'; +export 'src/rate_limiting_window.dart'; \ No newline at end of file diff --git a/lib/src/rate_limiting_window.dart b/lib/src/rate_limiting_window.dart new file mode 100644 index 00000000..37cc7cbc --- /dev/null +++ b/lib/src/rate_limiting_window.dart @@ -0,0 +1,15 @@ +/// A representation of the abstract "rate-limiting window" in which +/// a [user] is accessing some API or endpoint. +class RateLimitingWindow { + /// The user who is accessing the endpoint. + final User user; + + /// The time at which the user's current window began. + final DateTime start; + + /// The number of requests the user has already sent within + /// the current window. + final int requestCount; + + RateLimitingWindow(this.user, this.start, this.requestCount); +}