25 lines
409 B
Python
25 lines
409 B
Python
from typing import Generic, TypeVar
|
|
|
|
from pydantic import BaseModel
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class APIResponse(BaseModel, Generic[T]):
|
|
success: bool = True
|
|
data: T | None = None
|
|
message: str = ""
|
|
|
|
|
|
class PageParams(BaseModel):
|
|
page: int = 1
|
|
page_size: int = 20
|
|
|
|
|
|
class PageResponse(BaseModel, Generic[T]):
|
|
items: list[T]
|
|
total: int
|
|
page: int
|
|
page_size: int
|
|
total_pages: int
|