QueryController<InstanceType extends ManagedObject> class
Null safety
A partial class for implementing an ResourceController that has a few conveniences for executing Querys.
Instances of QueryController are ResourceControllers that have a pre-baked Query available. This Query's type -
the ManagedObject type is operates on - is defined by InstanceType
.
The values of query are set based on the HTTP method, HTTP path and request body. Prior to executing an operation method in subclasses of QueryController, the query will have the following attributes under the following conditions:
- The Query will always have a type argument that matches
InstanceType
. - If the request contains a path variable that matches the name of the primary key of
InstanceType
, the Query will set its Query.where to match on the ManagedObject whose primary key is that value of the path parameter. - If the Request contains a body, it will be decoded per the acceptedContentTypes and deserialized into the Query.values property via ManagedObject.readFromMap.
- Inheritance
-
- Object
- Controller
- ResourceController
- QueryController
Constructors
- QueryController(ManagedContext context)
- Create an instance of QueryController.
Properties
-
acceptedContentTypes
↔ List<
ContentType> -
Types of content this ResourceController will accept.
read / writeinherited
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- logger → Logger
-
An instance of the 'conduit' logger.
read-onlyinherited
- nextController → Controller?
-
Receives requests that this controller does not respond to.
read-onlyinherited
-
pathVariables
→ Map<
String?, String> ? -
Parameters parsed from the URI of the request, if any exist.
read-onlyinherited
- policy ↔ CORSPolicy?
-
The CORS policy of this controller.
read / writeinherited
-
query
↔ Query<
InstanceType> ? -
A query representing the values received from the request being processed.
read / write
- recycledState → void
-
Returns state information that is reused across instances of this type.
read-onlyinherited
- request ↔ Request?
-
The request being processed by this ResourceController.
read / writeinherited
- responseContentType ↔ ContentType
-
The default content type of responses from this ResourceController.
read / writeinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
applyCORSHeadersIfNecessary(
Request req, Response resp) → void -
inherited
-
didAddToChannel(
) → void -
Lifecycle callback, invoked after added to channel, but before any requests are served.
inherited
-
didDecodeRequestBody(
RequestBody body) → void -
Callback to indicate when a request body has been processed.
override
-
documentComponents(
APIDocumentContext context) → void -
Tells this object to add its components to
context
.inherited -
documentOperationDescription(
APIDocumentContext context, Operation? operation) → String? -
Returns a documented description for
operation
.inherited -
documentOperationParameters(
APIDocumentContext context, Operation? operation) → List< APIParameter?> ? -
Returns a documented list of
APIParameter
foroperation
.inherited -
documentOperationRequestBody(
APIDocumentContext context, Operation? operation) → APIRequestBody? -
Returns a documented request body for
operation
.inherited -
documentOperationResponses(
APIDocumentContext context, Operation operation) → Map< String, APIResponse> -
Returns a map of possible responses for
operation
.inherited -
documentOperations(
APIDocumentContext context, String route, APIPath path) → Map< String, APIOperation> -
Tells this object to return all
APIOperation
s it handles.inherited -
documentOperationSummary(
APIDocumentContext context, Operation? operation) → String? -
Returns a documented summary for
operation
.inherited -
documentOperationTags(
APIDocumentContext context, Operation? operation) → List< String> -
Returns a list of tags for
operation
.inherited -
documentPaths(
APIDocumentContext context) → Map< String, APIPath> -
Tells this object to return all
APIPath
s it handles.inherited -
handle(
Request request) → FutureOr< RequestOrResponse?> -
The primary request handling method of this object.
inherited
-
handleError(
Request request, dynamic caughtValue, StackTrace trace) → Future -
Sends an HTTP response for a request that yields an exception or error.
inherited
-
link(
Controller instantiator()) → Linkable? -
Links a controller to the receiver to form a request channel.
inherited
-
linkFunction(
FutureOr< RequestOrResponse?> handle(Request request)) → Linkable? -
Links a function controller to the receiver to form a request channel.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
receive(
Request req) → Future? -
Delivers
req
to this instance to be processed.inherited -
restore(
void state) → void -
Provides a instance of this type with the recycledState of this type.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
willDecodeRequestBody(
RequestBody body) → void -
Callback invoked prior to decoding a request body.
inherited
-
willProcessRequest(
Request req) → FutureOr< RequestOrResponse> -
Executed prior to handling a request, but after the request has been set.
override
-
willSendResponse(
Response response) → void -
Executed prior to Response being sent.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited