17 lines
579 B
Python
17 lines
579 B
Python
from __future__ import annotations
|
|
from typing import Optional, Literal
|
|
from pydantic import BaseModel, Field, ConfigDict
|
|
|
|
class TemplateIn(BaseModel):
|
|
name: str = Field(min_length=1, max_length=64)
|
|
title: Optional[str] = None
|
|
type: Literal["text","photo","video","animation"] = "text"
|
|
content: str
|
|
keyboard_tpl: Optional[list[dict]] = None
|
|
parse_mode: Optional[str] = "HTML"
|
|
visibility: Literal["private","org","public"] = "private"
|
|
|
|
class TemplateOut(TemplateIn):
|
|
id: int
|
|
is_archived: bool
|
|
model_config = ConfigDict(from_attributes=True) |