From 2be21d7f51e220c94d3bfc4623f5d5fbf973de07 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 20 Jun 2025 12:46:58 +0000 Subject: [PATCH] API: Export builders Signed-off-by: Michael Tremer --- Makefile.am | 1 + src/api/__init__.py | 1 + src/api/builders.py | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 src/api/builders.py diff --git a/Makefile.am b/Makefile.am index d7c406e2..588bd0ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -122,6 +122,7 @@ CLEANFILES += \ api_PYTHON = \ src/api/__init__.py \ src/api/auth.py \ + src/api/builders.py \ src/api/builds.py \ src/api/uploads.py diff --git a/src/api/__init__.py b/src/api/__init__.py index b7480eed..24625a26 100644 --- a/src/api/__init__.py +++ b/src/api/__init__.py @@ -52,6 +52,7 @@ apiv1 = fastapi.APIRouter( # Load all further modules from . import auth +from . import builders from . import builds from . import uploads diff --git a/src/api/builders.py b/src/api/builders.py new file mode 100644 index 00000000..d942589c --- /dev/null +++ b/src/api/builders.py @@ -0,0 +1,41 @@ +############################################################################### +# # +# Pakfire - The IPFire package management system # +# Copyright (C) 2025 Pakfire development team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +import fastapi + +from . import apiv1 +from . import auth +from . import backend + +from .. import users + +# Create a new router for all builder endpoints +router = fastapi.APIRouter( + prefix="/builders", + tags=["Builders"], +) + +@router.get("", summary="Returns all builders") +async def get(): + return [builder async for builder in backend.builders] + + +# Add everything to the APIv1 +apiv1.include_router(router) -- 2.47.2