controllers#
Superuser administration controllers for audit logs, dashboard stats, queues, teams, and users.
Admin domain controllers.
- class app.domain.admin.controllers.AdminQueueController(owner: Router)[source]#
Bases:
SecureControllerSuperuser queue monitoring and task cancellation endpoints.
Initialize a controller.
Should only be called by routers as part of controller registration.
- Parameters:
owner – An instance of
Router
- path#
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- tags#
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- guards#
A sequence of
Guardcallables.
- after_request#
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response#
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request#
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control#
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dependencies#
A string keyed dictionary of dependency
Providerinstances.
- dto#
AbstractDTOto use for (de)serializing and validation of request data.
- etag#
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers#
A map of handler functions to status codes and/or exception types.
- include_in_schema#
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware#
A sequence of
Middleware.
- opt#
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner#
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters#
A mapping of
Parameterdefinitions available to all application paths.
- request_class#
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size#
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class#
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies#
A list of
Cookieinstances.
- response_headers#
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto#
AbstractDTOto use for serializing outbound response data.
- security#
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace#
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types#
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- type_decoders#
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders#
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class#
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class app.domain.admin.controllers.AdminTeamsController(owner: Router)[source]#
Bases:
SecureControllerSuperuser team administration endpoints.
Initialize a controller.
Should only be called by routers as part of controller registration.
- Parameters:
owner – An instance of
Router
- path#
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- tags#
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- guards#
A sequence of
Guardcallables.
- dependencies#
A string keyed dictionary of dependency
Providerinstances.
- after_request#
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response#
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request#
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control#
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dto#
AbstractDTOto use for (de)serializing and validation of request data.
- etag#
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers#
A map of handler functions to status codes and/or exception types.
- include_in_schema#
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware#
A sequence of
Middleware.
- opt#
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner#
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters#
A mapping of
Parameterdefinitions available to all application paths.
- request_class#
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size#
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class#
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies#
A list of
Cookieinstances.
- response_headers#
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto#
AbstractDTOto use for serializing outbound response data.
- security#
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace#
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types#
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- type_decoders#
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders#
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class#
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class app.domain.admin.controllers.AdminUsersController(owner: Router)[source]#
Bases:
SecureControllerSuperuser user account administration endpoints.
Initialize a controller.
Should only be called by routers as part of controller registration.
- Parameters:
owner – An instance of
Router
- path#
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- tags#
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- guards#
A sequence of
Guardcallables.
- dependencies#
A string keyed dictionary of dependency
Providerinstances.
- after_request#
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response#
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request#
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control#
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dto#
AbstractDTOto use for (de)serializing and validation of request data.
- etag#
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers#
A map of handler functions to status codes and/or exception types.
- include_in_schema#
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware#
A sequence of
Middleware.
- opt#
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner#
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters#
A mapping of
Parameterdefinitions available to all application paths.
- request_class#
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size#
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class#
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies#
A list of
Cookieinstances.
- response_headers#
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto#
AbstractDTOto use for serializing outbound response data.
- security#
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace#
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types#
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- type_decoders#
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders#
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class#
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class app.domain.admin.controllers.AuditController(owner: Router)[source]#
Bases:
SecureControllerSuperuser audit log inspection endpoints.
Initialize a controller.
Should only be called by routers as part of controller registration.
- Parameters:
owner – An instance of
Router
- path#
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- tags#
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- guards#
A sequence of
Guardcallables.
- dependencies#
A string keyed dictionary of dependency
Providerinstances.
- after_request#
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response#
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request#
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control#
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dto#
AbstractDTOto use for (de)serializing and validation of request data.
- etag#
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers#
A map of handler functions to status codes and/or exception types.
- include_in_schema#
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware#
A sequence of
Middleware.
- opt#
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner#
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters#
A mapping of
Parameterdefinitions available to all application paths.
- request_class#
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size#
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class#
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies#
A list of
Cookieinstances.
- response_headers#
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto#
AbstractDTOto use for serializing outbound response data.
- security#
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace#
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types#
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- type_decoders#
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders#
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class#
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.
- class app.domain.admin.controllers.DashboardController(owner: Router)[source]#
Bases:
SecureControllerAdmin dashboard endpoints for aggregate statistics and recent activity.
Initialize a controller.
Should only be called by routers as part of controller registration.
- Parameters:
owner – An instance of
Router
- path#
A path fragment for the controller.
All route handlers under the controller will have the fragment appended to them. If not set it defaults to
/.
- tags#
A sequence of string tags that will be appended to the schema of all route handlers under the controller.
- guards#
A sequence of
Guardcallables.
- dependencies#
A string keyed dictionary of dependency
Providerinstances.
- after_request#
A sync or async function executed before a
Requestis passed to any route handler.If this function returns a value, the request will not reach the route handler, and instead this value will be used.
- after_response#
A sync or async function called after the response has been awaited.
It receives the
Requestinstance and should not return any values.
- before_request#
A sync or async function called immediately before calling the route handler.
It receives the
Requestinstance and any non-Nonereturn value is used for the response, bypassing the route handler.
- cache_control#
A
CacheControlHeaderheader to add to route handlers of this controller.Can be overridden by route handlers.
- dto#
AbstractDTOto use for (de)serializing and validation of request data.
- etag#
An
etagheader of typeETagto add to route handlers of this controller.Can be overridden by route handlers.
- exception_handlers#
A map of handler functions to status codes and/or exception types.
- include_in_schema#
A boolean flag dictating whether the route handler should be documented in the OpenAPI schema
- middleware#
A sequence of
Middleware.
- opt#
A string key mapping of arbitrary values that can be accessed in
Guardsor wherever you have access toRequestorASGI Scope.
- owner#
The
RouterorLitestarapp that owns the controller.This value is set internally by Litestar and it should not be set when subclassing the controller.
- parameters#
A mapping of
Parameterdefinitions available to all application paths.
- request_class#
A custom subclass of
Requestto be used as the default request for all route handlers under the controller.
- request_max_body_size#
Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.
- response_class#
A custom subclass of
Responseto be used as the default response for all route handlers under the controller.
- response_cookies#
A list of
Cookieinstances.
- response_headers#
A string keyed dictionary mapping
ResponseHeaderinstances.
- return_dto#
AbstractDTOto use for serializing outbound response data.
- security#
A sequence of dictionaries that to the schema of all route handlers under the controller.
- signature_namespace#
A mapping of names to types for use in forward reference resolution during signature modelling.
- signature_types#
A sequence of types for use in forward reference resolution during signature modelling.
These types will be added to the signature namespace using their
__name__attribute.
- type_decoders#
A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.
- type_encoders#
A mapping of types to callables that transform them into types supported for serialization.
- websocket_class#
A custom subclass of
WebSocketto be used as the default websocket for all route handlers under the controller.