]> git.ipfire.org Git - pbs.git/commitdiff
API: Export builders
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 Jun 2025 12:46:58 +0000 (12:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 20 Jun 2025 12:46:58 +0000 (12:46 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/api/__init__.py
src/api/builders.py [new file with mode: 0644]

index d7c406e2edbeed55fcbbde28904328cb80207a3b..588bd0ed26600b5f659ee7eca53e6937ab226596 100644 (file)
@@ -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
 
index b7480eedf937430c993bd02bf7dc7c0a7ce7f882..24625a266a416fc16b1779e5e465a2034f5488a1 100644 (file)
@@ -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 (file)
index 0000000..d942589
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+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)