-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | HTTP Link header parser/writer
--   
--   Library for the HTTP Link header as specified in RFC 5988 "Web
--   Linking"
@package http-link-header
@version 1.2.3

-- | The data type definitions for the HTTP Link header.
module Network.HTTP.Link.Types

-- | The link attribute key.
data LinkParam
Rel :: LinkParam
Anchor :: LinkParam
Rev :: LinkParam
Hreflang :: LinkParam
Media :: LinkParam
Title :: LinkParam
Title' :: LinkParam
ContentType :: LinkParam
Other :: Text -> LinkParam

-- | A single link containing some representation of a URL.
data Link uri
Link :: uri -> [(LinkParam, Text)] -> Link uri

-- | Types that can represent URLs.
--   
--   For example, to parse links containing Text.URI.URI from the
--   modern-uri package, simply define the orphan instance:
--   
--   
--   instance IsURI Modern.URI where
--       uriFromText = left displayException . mkURI
--       uriToText = render
--   
class IsURI uri
uriFromText :: IsURI uri => Text -> Either String uri
uriToText :: IsURI uri => uri -> Text

-- | Extracts the URI from the link.
href :: IsURI uri => Link uri -> uri

-- | Extracts the parameters from the link.
linkParams :: Link uri -> [(LinkParam, Text)]
instance GHC.Classes.Eq uri => GHC.Classes.Eq (Network.HTTP.Link.Types.Link uri)
instance GHC.Classes.Eq Network.HTTP.Link.Types.LinkParam
instance Network.HTTP.Link.Types.IsURI Data.Text.Internal.Text
instance Network.HTTP.Link.Types.IsURI Network.URI.URI
instance GHC.Internal.Show.Show uri => GHC.Internal.Show.Show (Network.HTTP.Link.Types.Link uri)
instance GHC.Internal.Show.Show Network.HTTP.Link.Types.LinkParam

-- | The parser for the HTTP Link header as defined in RFC 5988. More
--   liberal than the RFC though: does not validate URLs and other deep
--   stuff, accepts whitespace in weird places.
module Network.HTTP.Link.Parser

-- | The Attoparsec parser for the Link header.
linkHeader :: IsURI uri => Parser [Link uri]

-- | Parses a Link header, returns an Either, where Left is the Attoparsec
--   error string (probably not a useful one).
parseLinkHeader' :: IsURI uri => Text -> Either String [Link uri]

-- | Parses a Link header, returns a Maybe.
parseLinkHeader :: IsURI uri => Text -> Maybe [Link uri]

-- | Parses a Link header, returns an Either, where Left is the Attoparsec
--   error string (probably not a useful one).
parseLinkHeaderBS' :: IsURI uri => ByteString -> Either String [Link uri]

-- | Parses a Link header, returns a Maybe.
parseLinkHeaderBS :: IsURI uri => ByteString -> Maybe [Link uri]

module Network.HTTP.Link.Writer
writeLink :: IsURI uri => Link uri -> Text
writeLinkHeader :: IsURI uri => [Link uri] -> Text

-- | This module exports all the things at the same time, plus a utility
--   function.
module Network.HTTP.Link

-- | Construct a Link.
lnk :: IsURI uri => String -> [(LinkParam, Text)] -> Maybe (Link uri)
instance Network.HTTP.Link.Types.IsURI uri => Web.Internal.HttpApiData.ToHttpApiData (Network.HTTP.Link.Types.Link uri)
instance Network.HTTP.Link.Types.IsURI uri => Web.Internal.HttpApiData.ToHttpApiData [Network.HTTP.Link.Types.Link uri]
