cryptic-game/python-daemon

View on GitHub
daemon/endpoints/__init__.py

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
from fastapi import FastAPI

from .counter import counter_collection

ENDPOINT_COLLECTIONS = [
    counter_collection,
]


def register_collections(app: FastAPI) -> list[dict]:
    """
    Register endpoint collections and prepare response for /daemon/endpoints endpoint

    :param app: the fastapi app
    :return: a list of dicts containing information about all endpoints and endpoint collections
    """

    return [description for collection in ENDPOINT_COLLECTIONS if (description := collection.register(app))]