http-link-header-1.2.3: HTTP Link header parser/writer

Safe Haskell | Safe
Language | Haskell2010

Network.HTTP.Link.Types

Description

The data type definitions for the HTTP Link header.

Synopsis

- data LinkParam
  - = Rel
  - | Anchor
  - | Rev
  - | Hreflang
  - | Media
  - | Title
  - | Title'
  - | ContentType
  - | Other Text
- data Link uri = Link uri [(LinkParam, Text)]
- class IsURI uri where
  - uriFromText :: Text -> Either String uri
  - uriToText :: uri -> Text
- href :: IsURI uri => Link uri -> uri
- linkParams :: Link uri -> [(LinkParam, Text)]

# Documentation

data LinkParam Source #

The link attribute key.

Constructors

Rel |
Anchor |
Rev |
Hreflang |
Media |
Title |
Title' |
ContentType |
Other Text |

#### Instances

Instances details

Show LinkParam Source # |
Instance details Defined in Network.HTTP.Link.Types Methods showsPrec :: Int -> LinkParam -> ShowS Source # show :: LinkParam -> String Source # showList :: [LinkParam] -> ShowS Source #
Eq LinkParam Source # |
Instance details Defined in Network.HTTP.Link.Types Methods (==) :: LinkParam -> LinkParam -> Bool Source # (/=) :: LinkParam -> LinkParam -> Bool Source #

data Link uri Source #

A single link containing some representation of a URL.

Constructors

Link uri [(LinkParam, Text)] |

#### Instances

Instances details

Show uri => Show (Link uri) Source # |
Instance details Defined in Network.HTTP.Link.Types Methods showsPrec :: Int -> Link uri -> ShowS Source # show :: Link uri -> String Source # showList :: [Link uri] -> ShowS Source #
Eq uri => Eq (Link uri) Source # |
Instance details Defined in Network.HTTP.Link.Types Methods (==) :: Link uri -> Link uri -> Bool Source # (/=) :: Link uri -> Link uri -> Bool Source #
IsURI uri => ToHttpApiData (Link uri) Source # |
Instance details Defined in Network.HTTP.Link Methods toUrlPiece :: Link uri -> Text Source # toEncodedUrlPiece :: Link uri -> Builder Source # toHeader :: Link uri -> ByteString Source # toQueryParam :: Link uri -> Text Source # toEncodedQueryParam :: Link uri -> Builder Source #
IsURI uri => ToHttpApiData [Link uri] Source # |
Instance details Defined in Network.HTTP.Link Methods toUrlPiece :: [Link uri] -> Text Source # toEncodedUrlPiece :: [Link uri] -> Builder Source # toHeader :: [Link uri] -> ByteString Source # toQueryParam :: [Link uri] -> Text Source # toEncodedQueryParam :: [Link uri] -> Builder Source #

class IsURI uri where Source #

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

Since: 1.1.0

Methods

uriFromText :: Text -> Either String uri Source #

uriToText :: uri -> Text Source #

#### Instances

Instances details

IsURI URI Source # |
Instance details Defined in Network.HTTP.Link.Types Methods uriFromText :: Text -> Either String URI Source # uriToText :: URI -> Text Source #
IsURI Text Source # |
Instance details Defined in Network.HTTP.Link.Types Methods uriFromText :: Text -> Either String Text Source # uriToText :: Text -> Text Source #

href :: IsURI uri => Link uri -> uri Source #

Extracts the URI from the link.

linkParams :: Link uri -> [(LinkParam, Text)] Source #

Extracts the parameters from the link.