Merge pull request 'CI API' (#4) from ci into develop
Reviewed-on: https://hattori.ztsh.eu/paas/karl/pulls/4
This commit is contained in:
commit
eeada83132
3 changed files with 27 additions and 1 deletions
15
app/api/models.py
Normal file
15
app/api/models.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Request:
|
||||||
|
build_id: str
|
||||||
|
build_url: str
|
||||||
|
commit_id: str
|
||||||
|
commit_url: str
|
||||||
|
changelist: List[str]
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Response:
|
||||||
|
status: int
|
||||||
|
|
@ -1,8 +1,19 @@
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
|
|
||||||
|
from app.api.models import Request, Response
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/", summary="Main API")
|
@router.get("/", summary="Main API")
|
||||||
async def root():
|
async def root():
|
||||||
return {"message": "Witaj w API v12"}
|
return {"message": "Witaj w API v1"}
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/health", summary="Health check")
|
||||||
|
async def health():
|
||||||
|
return {"status": "ok"}
|
||||||
|
|
||||||
|
@router.post("/ci", summary="CI Webhook")
|
||||||
|
async def ci(request: Request):
|
||||||
|
return Response(200)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue