labthings_fastapi.dependencies.thing

Module Contents

Functions

direct_thing_client_dependency

A type annotation that causes FastAPI to supply a direct thing client

API

labthings_fastapi.dependencies.thing.direct_thing_client_dependency(thing_class: type[labthings_fastapi.thing.Thing], thing_path: str, actions: Optional[list[str]] = None) type[labthings_fastapi.thing.Thing]

A type annotation that causes FastAPI to supply a direct thing client

Parameters:
  • thing_class – The class of the thing to connect to

  • thing_path – The path to the thing on the server

  • actions

    The actions that the client should be able to perform. If this is specified, only those actions will be available. If it is None (default), all actions will be available.

    Note that the dependencies of all available actions will be added to your endpoint - so it is best to only specify the actions you need, in order to avoid spurious extra dependencies.

Returns:

A type annotation that will cause FastAPI to supply a direct thing client