ApiEndpoint class abstract

A RequestHandler with a RoutePattern to match against.

ApiEndpoint provides basic error response conversion. To use it, override any of the get, post, put, patch, delete methods. It is safe to throw exceptions inside of them.

A ApiRequestException thrown from inside of the handler methods will result in the corresponding ApiResponse.

Any other Exception thrown will be converted to a response with status code 500. If DataHub runs in Environment.dev configuration, the exception and its stack trace will be included as text in the response. (See DebugResponse.)

Implementers

Constructors

ApiEndpoint(RoutePattern routePattern)

Properties

hashCode int
The hash code for this object.
no setterinherited
routePattern RoutePattern
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

before(ApiRequest request) Future
This method gets called before every call to get, post, put, patch or delete. If this method throws an exception or returns anything other than null, the result is treated as response and the subsequent call to get, post, etc. will be skipped. (Useful for checking authorization.)
delete(ApiRequest request) Future
get(ApiRequest request) Future
handleRequest(ApiRequest request) Future<ApiResponse>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch(ApiRequest request) Future
post(ApiRequest request) Future
put(ApiRequest request) Future
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited