Interface: OffsetBasedPaginationResponse<T>
OffsetBasedPaginationResponse is an interface that defines the shape of a response object
for an offset-based pagination query. It's a generic interface where T
represents the type
of individual items in the response.
This interface is used when implementing offset-based pagination, a common strategy used in APIs to handle large sets of data. It allows clients to request a specific page of data, reducing the amount of data transferred at a time and improving the performance and scalability of the application.
Type Parameters
Type Parameter |
---|
T |
Properties
Property | Type | Description | Defined in |
---|---|---|---|
currentPage | PageNumberOneIndexed | This represents the current page number using one-indexing (i.e., counting starts from 1). This is useful for clients to track the page that is currently being viewed. | lib/types-pagination.ts:24 (opens in a new tab) |
pageContent | T [] | This is an array of items that belong to the current page. The type of these items is represented as T[] , where T is a placeholder for the actual type of the items (passed when this interface is used). | lib/types-pagination.ts:35 (opens in a new tab) |
pageSize | number | This represents the number of items that the server returns per page. Together with totalCount , this information can be used to calculate the total number of pages. | lib/types-pagination.ts:29 (opens in a new tab) |
totalCount | number | This is the total number of items available on the server. It helps clients to understand how many items are there in total and potentially calculate the number of pages they might need to fetch. | lib/types-pagination.ts:19 (opens in a new tab) |