Archived
Add basic internal message model
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class msg_types(Enum):
|
||||
info = "info"
|
||||
warning = "warning"
|
||||
error = "error"
|
||||
|
||||
|
||||
class Msg(BaseModel):
|
||||
msg: str = Field(..., description="Message. Required.", examples=["Hello, world!"])
|
||||
type: msg_types = Field(default=msg_types.info)
|
||||
timestamp: datetime = Field(
|
||||
default_factory=datetime.now().astimezone,
|
||||
description="Timestamp. Defaults to current time.",
|
||||
examples=[datetime.now().astimezone()],
|
||||
)
|
||||
Reference in New Issue
Block a user