Project description

API Star Pagination

Features

Page number pagination.

Limit-offset pagination.

Quick start

Install API star Pagination:

pip install apistar-pagination

Use paginated response in your views:

Page number pagination

fromapistar_paginationimportPageNumberResponsedefpage_number(page:http.QueryParam,page_size:http.QueryParam)->typing.List[int]:collection=range(10)# Get your whole collection instead of a list of numbersreturnPageNumberResponse(page=page,page_size=page_size,content=collection)

Limit-offset pagination

fromapistar_paginationimportLimitOffsetResponsedeflimit_offset(offset:http.QueryParam,limit:http.QueryParam)->typing.List[int]:collection=range(10)# Get your whole collection instead of a list of numbersreturnLimitOffsetResponse(offset=offset,limit=limit,content=collection)