revanced-api/api/info.py
Ushie 9bbd056c1b
feat: info endpoint (#71)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-19 22:35:09 +03:00

32 lines
888 B
Python

"""
This module provides a blueprint for the info endpoint.
Routes:
- GET /info: Get info about the owner of the API.
"""
from sanic import Blueprint, Request
from sanic.response import JSONResponse, json
from sanic_ext import openapi
from api.models.info import InfoResponseModel
from config import api_version, default_info
info: Blueprint = Blueprint("info", version=api_version)
@info.get("/info")
@openapi.definition(
summary="Information about the API",
response=[InfoResponseModel],
)
async def root(request: Request) -> JSONResponse:
"""
Returns a JSONResponse with a dictionary containing info about the owner of the API.
**Returns:**
- JSONResponse: A Sanic JSONResponse instance containing a dictionary with the info about the owner of the API.
"""
data: dict[str, dict] = {"info": default_info}
return json(data, status=200)