pydantic docstrings

This commit is contained in:
2025-02-16 08:17:27 -05:00
parent 2a57348178
commit f47ea0665f
6 changed files with 51 additions and 11 deletions

View File

@@ -121,6 +121,7 @@ class Karma(FastAPI):
data: Optional[ValidTopKarmaRequest] = None) -> JSONResponse:
"""
Get top keywords for karma
- **n**: Number of top results to return (default: 10)
"""
if not self.util.check_key(request.url.path, request.headers.get('X-Authd-With')):
@@ -148,7 +149,10 @@ class Karma(FastAPI):
async def get_karma_handler(self, data: ValidKarmaRetrievalRequest,
request: Request) -> JSONResponse:
"""Get current karma value"""
"""
Get current karma value
- **keyword**: Keyword to retrieve karma value for
"""
if not self.util.check_key(request.url.path, request.headers.get('X-Authd-With')):
raise HTTPException(status_code=403, detail="Unauthorized")
@@ -169,7 +173,12 @@ class Karma(FastAPI):
async def modify_karma_handler(self, data: ValidKarmaUpdateRequest,
request: Request) -> JSONResponse:
"""Update karma count"""
"""
Update karma count
- **granter**: User who granted the karma
- **keyword**: The keyword to modify
- **flag**: 0 to decrement (--), 1 to increment (++)
"""
if not self.util.check_key(request.url.path, request.headers.get('X-Authd-With'), 2):
raise HTTPException(status_code=403, detail="Unauthorized")