getAll()
getAll(page?: number, itemsPerPage?: number, orderBy = OrderBy.Desc): Promise<{ items: Poll[]; meta: PaginationMeta }>
Get a list of all polls with pagination support.
Parameters:
page
(number, optional): The page number to retrieve. Default isundefined
, which retrieves the first page.itemsPerPage
(number, optional): The number of items to retrieve per page. Default isundefined
, which retrieves the default number of items per page.orderBy
(OrderBy, optional): The order in which to retrieve polls. Default isOrderBy.Desc
(descending).
Returns:
A
Promise
resolving to an object with two properties:items
(Poll[]): An array of poll objects (Poll
).meta
(PaginationMeta): An object containing metadata about the retrieved polls, including the total count, current page, items per page, and the total number of pages.
Example:
The getAll
method allows you to retrieve a paginated list of all polls. You can specify the page number (page
), the number of items to retrieve per page (itemsPerPage
), and the order in which to retrieve polls (orderBy
).
The method returns a Promise
resolving to an object with an array of poll objects (Poll
) and metadata (PaginationMeta
) providing information about the total count, current page, items per page, and total number of pages.
Last updated