APIModule class abstract

A module of an API.

Mixed-in types
Implementers

Constructors

APIModule(APIRoot apiRoot, String name, {String? version})

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
cyclicDependencies → List<Initializable>
The dependencies of the current (or last) initialization attempt that were not waited for: they were (transitively) waiting for this instance (a cycle), so they may still be initializing when initialize runs or when this instance is initialized.
no setterinherited
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 if apiRequest 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.
addRouteHandler(APIRouteHandler routeHandler) → APIModule
Adds a routeHandler, 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({bool allowInProgress = true}) → void
Checks if this instance is initialized, initializing it if possible.
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. Same as ensureInitialized.
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 instance was 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>