labthings_fastapi.descriptors.endpoint
Module Contents
Classes
A descriptor to allow Things to easily add other endpoints |
Data
API
- labthings_fastapi.descriptors.endpoint.HTTPMethod
None
- class labthings_fastapi.descriptors.endpoint.EndpointDescriptor(func: Callable, http_method: labthings_fastapi.descriptors.endpoint.HTTPMethod = 'get', path: Optional[str] = None, **kwargs: Mapping)
A descriptor to allow Things to easily add other endpoints
- __init__(func: Callable, http_method: labthings_fastapi.descriptors.endpoint.HTTPMethod = 'get', path: Optional[str] = None, **kwargs: Mapping)
- __get__(obj: Optional[labthings_fastapi.thing.Thing], type=None) Union[typing_extensions.Self, Callable]
The function, bound to an object as for a normal method.
If
objis None, the descriptor is returned, so we can get the descriptor conveniently as an attribute of the class.
- property name
The name of the wrapped function
- property path
The path of the endpoint (relative to the Thing)
- property title
A human-readable title
- property description
A description of the endpoint
- add_to_fastapi(app: fastapi.FastAPI, thing: labthings_fastapi.thing.Thing)
Add this function to a FastAPI app, bound to a particular Thing.