Init rate limiter

This commit is contained in:
Tobe O 2019-08-14 14:46:53 -04:00
parent 3bab3b2d57
commit f738a6016b

14
lib/src/rate_limiter.dart Normal file
View file

@ -0,0 +1,14 @@
import 'package:angel_framework/angel_framework.dart';
/// A base class that facilitates rate limiting API's or endpoints,
/// typically to prevent spam and abuse.
abstract class RateLimiter {
/// The maximum number of requests allowed within the given [window].
final int maxRequestsPerWindow;
/// The amount of time, during which, a user is not allowed to send
/// more than [maxRequestsPerWindow].
final Duration window;
RateLimiter(this.maxRequestsPerWindow, this.window);
}