From 9c95351fe0a3e62b6a6ec9afab3d827de3e87792 Mon Sep 17 00:00:00 2001 From: Manuel Raimann Date: Sun, 12 Jan 2025 20:29:08 +0100 Subject: [PATCH] Add endpoint to retrieve available command variables --- deadlock_data_api/routers/v1_commands.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deadlock_data_api/routers/v1_commands.py b/deadlock_data_api/routers/v1_commands.py index 3a23a99..b9d50f4 100644 --- a/deadlock_data_api/routers/v1_commands.py +++ b/deadlock_data_api/routers/v1_commands.py @@ -255,6 +255,13 @@ def dl_latest_patchnotes_link( return latest.link +@router.get("/commands/available-variables") +def get_command_variables(res: Response) -> list[str]: + res.headers["Cache-Control"] = "public, max-age=60" + variable_resolvers = inspect.getmembers(CommandVariable(), inspect.ismethod) + return [name for name, _ in variable_resolvers] + + @router.get( "/commands/{region}/{account_id}/resolve", response_class=PlainTextResponse,