Skip to content

Commit ca65972

Browse files
committed
✨(api) add statuses dynamic router
For now we only design the API.
1 parent fe95213 commit ca65972

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

src/api/qualicharge/api/v1/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from qualicharge.auth.oidc import get_token
1010
from qualicharge.exceptions import OIDCAuthenticationError, OIDCProviderException
1111

12-
from .routers import auth, static
12+
from .routers import auth, dynamic, static
1313

1414
logger = logging.getLogger(__name__)
1515

@@ -30,3 +30,4 @@ async def authentication_exception_handler(
3030

3131
app.include_router(auth.router)
3232
app.include_router(static.router)
33+
app.include_router(dynamic.router)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""QualiCharge API v1 dynamique router."""
2+
3+
import logging
4+
from typing import Annotated, List
5+
6+
from fastapi import APIRouter, Path, status
7+
8+
from qualicharge.models.dynamic import Status
9+
10+
logger = logging.getLogger(__name__)
11+
12+
router = APIRouter(
13+
prefix="/dynamique",
14+
tags=["IRVE Dynamique"],
15+
)
16+
17+
18+
@router.get("/status/", tags=["Status"])
19+
async def list_statuses() -> List[Status]:
20+
"""List last known point of charge statuses."""
21+
return []
22+
23+
24+
@router.get("/status/{id_pdc_itinerance}", tags=["Status"])
25+
async def read_status(
26+
id_pdc_itinerance: Annotated[
27+
str,
28+
Path(
29+
description=(
30+
"L'identifiant du point de recharge délivré selon les modalités "
31+
"définies à l'article 10 du décret n° 2017-26 du 12 janvier 2017."
32+
),
33+
),
34+
],
35+
) -> Status:
36+
"""Read last known point of charge status."""
37+
raise NotImplementedError
38+
39+
40+
@router.post("/status/", status_code=status.HTTP_201_CREATED, tags=["Status"])
41+
async def create_status(status: Status) -> Status:
42+
"""Create a status."""
43+
raise NotImplementedError

0 commit comments

Comments
 (0)