APIModule class abstract
A module of an API.
- Mixed-in types
- Implementers
Properties
-
allRoutesNames
→ Set<
String> -
Returns all the routes names.
no setter
- apiConfig → APIConfig
-
The APIConfig from apiRoot.
no setter
- apiRoot → APIRoot
-
The API root, that is loading this module.
final
- authenticationRoute → String
-
no setter
- defaultRouteName → String?
-
The default route to use when the request doesn't match.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- initializationStatus → InitializationStatus
-
Returns the current InitializationStatus.
no setterinherited
- isAsyncInitialization → bool
-
Returns
true
if this instance initialization was asynchronous.no setterinherited - isInitialized → bool
-
Returns
true
if this instance is already initialized.no setterinherited - isInitializing → bool
-
Returns
true
if this instance is in the middle of the initialization process.no setterinherited - name → String
-
The name of this API module.
final
-
routes
→ APIRouteBuilder<
APIModule> -
Returns the routes builder of this module.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- security → APISecurity?
-
no setter
- version → String?
-
Optional module version.
final
Methods
-
acceptsRequest(
APIRequest apiRequest) → bool -
Returns
true
ifapiRequest
is an accepted route/call for this module. -
addRoute(
APIRequestMethod? method, String name, APIRouteFunction function, {Map< String, TypeInfo> ? parameters, Iterable<APIRouteRule> ? rules, APIRouteConfig? config}) → APIModule -
Adds a route, of
name
, to this module. -
apiInfo(
[APIRequest? apiRequest]) → APIModuleInfo - Returns a APIModuleInfo.
-
call<
T> (APIRequest request) → FutureOr< APIResponse< T> > -
Calls a route for
request
. -
checkInitialized(
) → void -
Checks if this instance is initialized.
inherited
-
configure(
) → void - Configures this API module. Usually defines the routes of this instance.
-
doInitialization(
{Initializable? parent}) → FutureOr< InitializationResult> -
Initialize this instance if is not initialized yet.
inherited
-
ensureConfigured(
) → void -
ensureInitialized(
{Initializable? parent}) → FutureOr< InitializationResult> -
Ensures that this instance is initialized.
inherited
-
ensureInitializedAsync(
{Initializable? parent}) → FutureOr< InitializationResult> -
Ensures that this instance is initialized. If is not
initialized yet it will force an asynchronous initialization
and return a Future.
inherited
-
executeInitialized<
R> (ExecuteInitializedCallback< R> callback, {Initializable? parent}) → FutureOr<R> -
Executes the
callback
ensuring that this instances was fully initialized.inherited -
getRouteHandler<
T> (String name, [APIRequestMethod? method]) → APIRouteHandler< T> ? -
Returns a route handler for
name
. -
getRouteHandlerByRequest<
T> (APIRequest request, [String? routeName]) → APIRouteHandler< T> ? -
Returns a route handler for
request
. -
getRoutesHandlersNames(
{APIRequestMethod? method}) → Iterable< String> -
Returns the routes names for
method
. -
initialize(
) → FutureOr< InitializationResult> -
Initialization implementation. Do not call it directly, use doInitialization.
override
-
initializeDependencies(
) → FutureOr< List< Initializable> > -
Return a List of Initializable instances that need to be initialized
BEFORE initialize this instance.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolveRoute(
APIRequest request) → String -
Resolves the route name of the
request
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
-
interfaceMethodsNames
→ const Set<
String>