WaApiController class
The WaApiController
class is responsible for managing API routes and generating
OpenAPI documentation for the API.
This controller extends the WaController
and includes functionality for
configuring API routes, generating Swagger UI documentation, and handling
security settings.
Example usage:
WaApiController(
rq,
router: myRouter,
title: 'My API',
security: 'apiKey',
);
- Inheritance
-
- Object
- WaController
- WaApiController
Constructors
- WaApiController(WebRequest rq, {required WaServer server, required String title, String security = 'apiKey'})
-
Constructs a WaApiController with the given request
rq
, router, title, and optional security scheme.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- rq ↔ WebRequest
-
The WebRequest object representing the current web request.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- security ↔ String
-
The security scheme used for the API. Defaults to
'apiKey'
.getter/setter pair - server ↔ WaServer
-
A list of functions that return a list of WebRoute objects based on the
incoming WebRequest
rq
.getter/setter pair - title ↔ String
-
The title of the API, used in generated documentation.
getter/setter pair
Methods
-
index(
{bool showPublic = false}) → Future< String> -
Generates and returns OpenAPI documentation as a JSON string.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
swagger(
String docUrl, {String swaggerUIPath = '/swagger', bool showPublic = false}) → Future< String> - Renders the Swagger UI for the API documentation.
-
toString(
{dynamic short = false}) → String -
Returns a string representation of the controller.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited