PySimpleSocial/src/responses/__init__.py

97 lines
1.6 KiB
Python

from pydantic import BaseModel
from orm.users import User
class Response(BaseModel):
"""
A generic response model
"""
status_code: int = 200
msg: str = "Success"
class UnprocessableEntity(Response):
"""
A 422 Unprocessable Entity response
model
"""
status_code: int = 422
msg: str = "Input Validation Failure"
class NotFound(Response):
"""
A 404 Not Found response
model
"""
status_code: int = 404
msg: str = "Not Found"
class PayloadTooLarge(Response):
"""
A 413 Payload Too Large response
model
"""
status_code: int = 413
msg: str = "Payload too large"
class MediaTypeNotAcceptable(Response):
"""
A 415 Media Type Not Acceptable response
model
"""
status_code: int = 415
msg: str = "Media type not acceptable"
class BadRequest(Response):
"""
A 400 Bad Request response model
"""
status_code: int = 400
msg: str = "Bad Request"
class InternalServerError(Response):
"""
A 500 Internal Server Error response model
"""
status_code: int = 500
msg: str = "Internal Server Error"
class TooManyRequests(Response):
"""
A 429 Too Many Requests response model
"""
status_code: int = 429
msg: str = "Too Many Requests"
class Unauthorized(Response):
"""
A 401 Unauthorized response model
"""
status_code: int = 401
msg: str = "Unauthorized"
class Forbidden(Response):
"""
A 403 Forbidden response model
"""
status_code: int = 403
msg: str = "Forbidden"