jackfranklin / elm-parse-link-header / LinkHeader

This library provides the ability to parse Link headers returned from APIs.

Types


type alias WebLink =
{ rel : LinkRel
, url : String 
}

An individual link contains a rel, the page number and the URL.


type LinkRel
    = RelNext Basics.Int
    | RelPrev Basics.Int
    | RelFirst Basics.Int
    | RelLast Basics.Int
    | RelUnknown Basics.Int

The possible types of web links that this parser might produce.

Parsing

parse : String -> List WebLink

Parse is given the string, which should be the entire link header from your API and returns a list of WebLinks. This will be empty if no matches were found