vViktorPL / elm-jira-connector / Jira.Pagination

This module wraps paginated responses from Jira API

Page requests


type PaginationConfig

Pagination configuration which is just the limit of items per page.


type PageRequest

Represents data that is required to build a request for a specific page

paginationConfig : Basics.Int -> PaginationConfig

Create a pagination configuration

pageRequest : PaginationConfig -> Basics.Int -> PageRequest

Create a PageRequest for specific page number

pageRequestToQueryParams : PageRequest -> List Url.Builder.QueryParameter

Convert page request to query parameters that can be used to build a request URL

Pages


type Page item

Wraps up data from a decoded response of specific page request

getItems : Page a -> List a

Extract a list of items from a page

isLast : Page a -> Basics.Bool

Is the page the last one?

nextPage : Page a -> Maybe PageRequest

Get PageRequest for the page which is next to the provided one. There could be no next page hence Maybe return type.

pageNumber : Page a -> Basics.Int

Get page number

totalPages : Page a -> Basics.Int

Extract total number of pages

pageDecoder : Json.Decode.Decoder item -> Json.Decode.Decoder (Page item)

Page decoder. Requires decoder for paginated entity.

map : (a -> b) -> Page a -> Page b

Map page items