ServiceAPIRouter

class omni.services.crash.services.service.ServiceAPIRouter(routes: typing.Optional[typing.List[starlette.routing.BaseRoute]] = None, redirect_slashes: bool = True, default: typing.Optional[typing.Callable[[typing.MutableMapping[str, typing.Any], typing.Callable[[], typing.Awaitable[typing.MutableMapping[str, typing.Any]]], typing.Callable[[typing.MutableMapping[str, typing.Any]], typing.Awaitable[None]]], typing.Awaitable[None]]] = None, dependency_overrides_provider: typing.Optional[typing.Any] = None, route_class: typing.Type[fastapi.routing.APIRoute] = <class 'omni.services.core._route.CompressedRoute'>, default_response_class: typing.Type[starlette.responses.Response] = <fastapi.datastructures.DefaultPlaceholder object>, on_startup: typing.Optional[typing.Sequence[typing.Callable]] = None, on_shutdown: typing.Optional[typing.Sequence[typing.Callable]] = None, prefix: typing.Optional[str] = '', tags: typing.Optional[typing.List[str]] = None, **kwargs)

Bases: fastapi.routing.APIRouter

Extended fastapi.APIRouter to support the storing and getting of facilities at runtime. Overrides the basic route_class with a class that supports compressed data (like gzip)

Methods

__init__([routes, redirect_slashes, ...])

get_facility(name)

Returns a callable for the given name.

register_facility(name, facility_inst)

__init__(routes: typing.Optional[typing.List[starlette.routing.BaseRoute]] = None, redirect_slashes: bool = True, default: typing.Optional[typing.Callable[[typing.MutableMapping[str, typing.Any], typing.Callable[[], typing.Awaitable[typing.MutableMapping[str, typing.Any]]], typing.Callable[[typing.MutableMapping[str, typing.Any]], typing.Awaitable[None]]], typing.Awaitable[None]]] = None, dependency_overrides_provider: typing.Optional[typing.Any] = None, route_class: typing.Type[fastapi.routing.APIRoute] = <class 'omni.services.core._route.CompressedRoute'>, default_response_class: typing.Type[starlette.responses.Response] = <fastapi.datastructures.DefaultPlaceholder object>, on_startup: typing.Optional[typing.Sequence[typing.Callable]] = None, on_shutdown: typing.Optional[typing.Sequence[typing.Callable]] = None, prefix: typing.Optional[str] = '', tags: typing.Optional[typing.List[str]] = None, **kwargs) None
get_facility(name)

Returns a callable for the given name.

The Facility is injected like Query and Depends are for fastapi: https://fastapi.tiangolo.com/tutorial/dependencies/ https://fastapi.tiangolo.com/tutorial/sql-databases/#create-the-database-tables