2016-09-15 19:53:01 +00:00
|
|
|
library angel_framework.http.metadata;
|
2016-05-02 22:28:14 +00:00
|
|
|
|
2016-12-10 14:05:40 +00:00
|
|
|
import 'hooked_service.dart' show HookedServiceEventListener;
|
|
|
|
|
2016-06-21 22:56:04 +00:00
|
|
|
/// Annotation to map middleware onto a handler.
|
2016-05-02 22:28:14 +00:00
|
|
|
class Middleware {
|
|
|
|
final List handlers;
|
|
|
|
|
2016-12-10 14:05:40 +00:00
|
|
|
const Middleware(this.handlers);
|
2016-05-02 22:28:14 +00:00
|
|
|
}
|
|
|
|
|
2016-12-10 14:05:40 +00:00
|
|
|
/// Attaches hooks to a [HookedService].
|
|
|
|
class Hooks {
|
|
|
|
final List<HookedServiceEventListener> before;
|
|
|
|
final List<HookedServiceEventListener> after;
|
|
|
|
|
|
|
|
const Hooks({this.before: const [], this.after: const []});
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Exposes a [Controller] to the Internet.
|
2016-06-27 00:20:42 +00:00
|
|
|
class Expose {
|
|
|
|
final String method;
|
|
|
|
final Pattern path;
|
|
|
|
final List middleware;
|
|
|
|
final String as;
|
|
|
|
final List<String> allowNull;
|
|
|
|
|
2016-12-10 14:05:40 +00:00
|
|
|
const Expose(this.path,
|
|
|
|
{this.method: "GET",
|
|
|
|
this.middleware: const [],
|
|
|
|
this.as: null,
|
|
|
|
this.allowNull: const []});
|
|
|
|
}
|