servant-hateoas-0.3.4: HATEOAS extension for servant
Safe HaskellSafe-Inferred
LanguageGHC2021

Servant.Hateoas.RelationLink

Synopsis

RelationLink

Type

data RelationLink Source #

Link data-type for hypermedia-links in HATEOAS with potentially templated URIs.

data RelationParam Source #

Parameter data-type for hypermedia-links in HATEOAS.

Constructors

RelationParam 

Fields

Creation

Operations

(<<<) :: RelationLink -> RelationLink -> RelationLink Source #

Shifting append-operator for RelationLink.

This operator can be seen as a monoidal append for RelationLink with a right-bias for meta information e.g. _method, _contentTypes, _summary and _description.

getHref :: RelationLink -> Text Source #

Get the hypermedia-reference of a RelationLink.

getPath :: RelationLink -> Text Source #

Get the path of a RelationLink as in getHref.

getParams :: RelationLink -> Text Source #

Get the parameters of a RelationLink as in getHref.

prependSeg :: Text -> RelationLink -> RelationLink Source #

Prepend a path segment to a RelationLink.

Takes care of potential templating.

prependSegs :: [Text] -> RelationLink -> RelationLink Source #

Prepend path segments to a RelationLink.

Takes care of potential templating.

addParam :: RelationParam -> RelationLink -> RelationLink Source #

Add a parameter to a RelationLink.

Takes care of potential templating.

addParams :: [RelationParam] -> RelationLink -> RelationLink Source #

Add parameters to a RelationLink.

Takes care of potential templating.

mkPlaceHolder :: Text -> Text Source #

Create a placeholder for a template path segment.

Class

class HasTemplatedLink endpoint where Source #

Class for creating a templated RelationLink to an endpoint.

Methods

toTemplatedLink :: Proxy endpoint -> RelationLink Source #

Instances

class HasLink endpoint => HasRelationLink endpoint where Source #

Class for creating a RelationLink to an endpoint.

This is highly similar to HasLink but it also gathers HATEOAS meta-information for the resource a link refers to.

Methods

toRelationLink :: Proxy endpoint -> MkLink endpoint RelationLink Source #

Instances

type RightLink b = (HasRelationLink b, PolyvariadicComp (MkLink b RelationLink) (IsFun (MkLink b RelationLink)), Return (MkLink b RelationLink) (IsFun (MkLink b RelationLink)) ~ RelationLink, Replace (MkLink b RelationLink) RelationLink (IsFun (MkLink b RelationLink)) ~ MkLink b RelationLink) Source #

Convenience alias-constraint for right-hand sides of a :> b where b is some function producing a RelationLink.

Utility

ReflectStdMethod

reflectStdMethod :: ReflectMethod method => Proxy method -> StdMethod Source #

Like reflectMethod but returns a StdMethod.