-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from ReVanced/dev
- Loading branch information
Showing
14 changed files
with
387 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from api.models.donations import DonationFields | ||
from api.models.socials import SocialFields | ||
from pydantic import BaseModel | ||
|
||
|
||
class ContactFields(BaseModel): | ||
""" | ||
Implements the fields for the API owner contact info. | ||
""" | ||
|
||
email: str | ||
|
||
|
||
class InfoFields(BaseModel): | ||
""" | ||
Implements the fields for the API owner info. | ||
""" | ||
|
||
name: str | ||
about: str | ||
contact: ContactFields | ||
socials: list[SocialFields] | ||
donations: DonationFields | ||
|
||
|
||
class InfoResponseModel(BaseModel): | ||
""" | ||
A Pydantic BaseModel that represents a dictionary of info. | ||
""" | ||
|
||
info: InfoFields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.