This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
We were not able to find the expected elm-package.json file at this tag.
Tag 4.0.0
Committed At 2018-09-21 19:04:52 UTC

Modules

    README

    A library for fetching data from paginated JSON REST APIs.

    Motivation

    This library is built to handle fetching data from a JSON REST API that paginates its results. It inspects response headers, and will prepare subsequent requests when additional pages of results remain.

    Given a JSON decoder for the data type returned in the paginated collection, it will return a data structure containing the results fetched, and a new request object for fetching additional records from the next page if more are available.

    It is expected that the paginated REST API will provide a link for the next page of results in the Link header, e.g.:

    Link: <https://api.example.com/search?q=abc&page=2>; rel="next"
    

    Absence of a link with rel="next" in the response headers is assumed to mean the final page of results has been reached.

    Example Usage

    import Http
    import Json.Decode exposing (string)
    import Paginated exposing (Response(..))
    
    type alias Model =
        { results : Maybe (List String) }
    
    type Msg
        = Search
        | Results (Result Http.Error (List String))
    
    update : Msg -> Model -> ( Model, Cmd Msg )
    update msg model =
        case msg of
            Search ->
                ( model, doSearch )
    
            Results results ->
                ( { model | results = Result.toMaybe results }
                , Cmd.none
                )
    
    doSearch : Cmd Msg
    doSearch =
        Paginated.send Results <|
            Paginated.get "http://example.com/search?q=abc" string