21 lines
650 B
Python
21 lines
650 B
Python
|
|
"""Common schemas used across the API."""
|
||
|
|
|
||
|
|
from pydantic import BaseModel, Field
|
||
|
|
|
||
|
|
|
||
|
|
class CursorParams(BaseModel):
|
||
|
|
"""Pagination parameters using cursor-based pagination."""
|
||
|
|
|
||
|
|
cursor: str | None = Field(default=None, description="Cursor for pagination")
|
||
|
|
limit: int = Field(default=20, ge=1, le=100, description="Number of items per page")
|
||
|
|
|
||
|
|
|
||
|
|
class PaginatedResponse[T](BaseModel):
|
||
|
|
"""Generic paginated response wrapper."""
|
||
|
|
|
||
|
|
items: list[T]
|
||
|
|
next_cursor: str | None = Field(
|
||
|
|
default=None, description="Cursor for next page, null if no more items"
|
||
|
|
)
|
||
|
|
has_more: bool = Field(description="Whether there are more items")
|