Skip to main content

PaginatedResponse

Generic paginated response wrapper. Wraps a list of items with pagination metadata for cursor-based navigation.

Fields

FieldTypeRequiredDefaultDescription
itemsForwardRef('List[T]')PydanticUndefinedList of items in the current page
paginationForwardRef('PaginationInfo')PydanticUndefinedPagination metadata

Usage Example

from credoai.models import PaginatedResponse

# Create a new instance
model = PaginatedResponse(
items=None, # List of items in the current page
pagination=None, # Pagination metadata
)

# Convert to dictionary
model_dict = model.model_dump()
print(model_dict)

# Create from dictionary
data = {
"items": None,
"pagination": None,
}
model_from_dict = PaginatedResponse(**data)

JSON Schema

{
"type": "object",
"title": "PaginatedResponse",
"description": "Generic paginated response wrapper.
Wraps a list of items with pagination metadata for cursor-based navigation.",
"properties": {
"items": {
"type": "forwardref('list[t]')",
"description": "List of items in the current page"
},
"pagination": {
"type": "forwardref('paginationinfo')",
"description": "Pagination metadata"
}
},
"required": ["items", "pagination"]
}