1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Complete openapi 3 implementation

This commit is contained in:
Steffo 2020-03-09 16:00:22 +01:00
parent 4049619c25
commit 70fd7d041c
6 changed files with 13 additions and 0 deletions

View file

@ -18,6 +18,8 @@ class ApiLoginRoyalnetStar(ApiStar):
"password": "The password of the user you are logging in as." "password": "The password of the user you are logging in as."
} }
tags = ["royalnet"]
async def api(self, data: ApiData) -> ru.JSON: async def api(self, data: ApiData) -> ru.JSON:
TokenT = self.alchemy.get(Token) TokenT = self.alchemy.get(Token)
UserT = self.alchemy.get(User) UserT = self.alchemy.get(User)

View file

@ -8,6 +8,8 @@ class ApiRoyalnetVersionStar(ApiStar):
summary = "Get the current Royalnet version." summary = "Get the current Royalnet version."
tags = ["royalnet"]
async def api(self, data: ApiData) -> ru.JSON: async def api(self, data: ApiData) -> ru.JSON:
return { return {
"semantic": rv.semantic "semantic": rv.semantic

View file

@ -16,6 +16,8 @@ class ApiTokenCreateStar(ApiStar):
"duration": "The duration in seconds of the new token." "duration": "The duration in seconds of the new token."
} }
tags = ["royalnet"]
async def api(self, data: ApiData) -> ru.JSON: async def api(self, data: ApiData) -> ru.JSON:
user = await data.user() user = await data.user()
try: try:

View file

@ -7,6 +7,8 @@ class ApiTokenInfoStar(ApiStar):
summary = "Get info the current login token." summary = "Get info the current login token."
tags = ["royalnet"]
async def api(self, data: ApiData) -> ru.JSON: async def api(self, data: ApiData) -> ru.JSON:
token = await data.token() token = await data.token()
return token.json() return token.json()

View file

@ -17,6 +17,8 @@ class ApiTokenPasswdStar(ApiStar):
"new_password": "The password you want to set." "new_password": "The password you want to set."
} }
tags = ["royalnet"]
async def api(self, data: ApiData) -> ru.JSON: async def api(self, data: ApiData) -> ru.JSON:
TokenT = self.alchemy.get(Token) TokenT = self.alchemy.get(Token)
token = await data.token() token = await data.token()

View file

@ -17,6 +17,8 @@ class ApiStar(PageStar, ABC):
parameters: Dict[str, str] = {} parameters: Dict[str, str] = {}
tags: List[str] = []
async def page(self, request: Request) -> JSONResponse: async def page(self, request: Request) -> JSONResponse:
if request.query_params: if request.query_params:
data = request.query_params data = request.query_params
@ -64,6 +66,7 @@ class ApiStar(PageStar, ABC):
"500": {"description": "Serverside unhandled exception"}, "500": {"description": "Serverside unhandled exception"},
"501": {"description": "Not yet implemented"} "501": {"description": "Not yet implemented"}
}, },
"tags": cls.tags,
"parameters": [{ "parameters": [{
"name": parameter, "name": parameter,
"in": "query", "in": "query",