mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Complete openapi 3 implementation
This commit is contained in:
parent
4049619c25
commit
70fd7d041c
6 changed files with 13 additions and 0 deletions
|
@ -18,6 +18,8 @@ class ApiLoginRoyalnetStar(ApiStar):
|
|||
"password": "The password of the user you are logging in as."
|
||||
}
|
||||
|
||||
tags = ["royalnet"]
|
||||
|
||||
async def api(self, data: ApiData) -> ru.JSON:
|
||||
TokenT = self.alchemy.get(Token)
|
||||
UserT = self.alchemy.get(User)
|
||||
|
|
|
@ -8,6 +8,8 @@ class ApiRoyalnetVersionStar(ApiStar):
|
|||
|
||||
summary = "Get the current Royalnet version."
|
||||
|
||||
tags = ["royalnet"]
|
||||
|
||||
async def api(self, data: ApiData) -> ru.JSON:
|
||||
return {
|
||||
"semantic": rv.semantic
|
||||
|
|
|
@ -16,6 +16,8 @@ class ApiTokenCreateStar(ApiStar):
|
|||
"duration": "The duration in seconds of the new token."
|
||||
}
|
||||
|
||||
tags = ["royalnet"]
|
||||
|
||||
async def api(self, data: ApiData) -> ru.JSON:
|
||||
user = await data.user()
|
||||
try:
|
||||
|
|
|
@ -7,6 +7,8 @@ class ApiTokenInfoStar(ApiStar):
|
|||
|
||||
summary = "Get info the current login token."
|
||||
|
||||
tags = ["royalnet"]
|
||||
|
||||
async def api(self, data: ApiData) -> ru.JSON:
|
||||
token = await data.token()
|
||||
return token.json()
|
||||
|
|
|
@ -17,6 +17,8 @@ class ApiTokenPasswdStar(ApiStar):
|
|||
"new_password": "The password you want to set."
|
||||
}
|
||||
|
||||
tags = ["royalnet"]
|
||||
|
||||
async def api(self, data: ApiData) -> ru.JSON:
|
||||
TokenT = self.alchemy.get(Token)
|
||||
token = await data.token()
|
||||
|
|
|
@ -17,6 +17,8 @@ class ApiStar(PageStar, ABC):
|
|||
|
||||
parameters: Dict[str, str] = {}
|
||||
|
||||
tags: List[str] = []
|
||||
|
||||
async def page(self, request: Request) -> JSONResponse:
|
||||
if request.query_params:
|
||||
data = request.query_params
|
||||
|
@ -64,6 +66,7 @@ class ApiStar(PageStar, ABC):
|
|||
"500": {"description": "Serverside unhandled exception"},
|
||||
"501": {"description": "Not yet implemented"}
|
||||
},
|
||||
"tags": cls.tags,
|
||||
"parameters": [{
|
||||
"name": parameter,
|
||||
"in": "query",
|
||||
|
|
Loading…
Reference in a new issue