hreq-core-0.1.1.0: Core functionality for Hreq Http client library

Safe HaskellNone
LanguageHaskell2010

Hreq.Core.Client.HasResponse

Description

This module provides a HasResponse class that Interprets Verb content into a particular api endpoint query result.

For instance Verb GET '[] gets interpreted as an empty response of type Unit i.e ()

Synopsis

Documentation

class MonadError ClientError m => HasResponse (a :: k) m where Source #

Associated Types

type HttpOutput a :: Type Source #

Methods

httpRes :: sing a -> Response -> m (HttpOutput a) Source #

Instances
MonadError ClientError m => HasResponse ([] :: [k]) m Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput [] :: Type Source #

Methods

httpRes :: sing [] -> Response -> m (HttpOutput []) Source #

MonadError ClientError m => HasResponse ((ResStream :: a -> a -> ResContent a) ': rs :: [a -> a -> ResContent a]) m Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (ResStream ': rs) :: Type Source #

Methods

httpRes :: sing (ResStream ': rs) -> Response -> m (HttpOutput (ResStream ': rs)) Source #

(MonadError ClientError m, SingI (Res (ResHeaders hs ': rs)), HttpResConstraints (ResHeaders hs ': rs)) => HasResponse (ResHeaders hs ': rs :: [ResContent Type]) m Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (ResHeaders hs ': rs) :: Type Source #

Methods

httpRes :: sing (ResHeaders hs ': rs) -> Response -> m (HttpOutput (ResHeaders hs ': rs)) Source #

(MonadError ClientError m, KnownNat n, SingI (Res (r ': rs)), HttpResConstraints (r ': rs)) => HasResponse (ResStatus n ': (r ': rs) :: [ResContent Type]) m Source #

Expected status code much match received code in a response code list

Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (ResStatus n ': (r ': rs)) :: Type Source #

Methods

httpRes :: sing (ResStatus n ': (r ': rs)) -> Response -> m (HttpOutput (ResStatus n ': (r ': rs))) Source #

(MonadError ClientError m, KnownNat n) => HasResponse (ResStatus n ': ([] :: [ResContent Type]) :: [ResContent Type]) m Source #

Expected status code much match received code

Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (ResStatus n ': []) :: Type Source #

Methods

httpRes :: sing (ResStatus n ': []) -> Response -> m (HttpOutput (ResStatus n ': [])) Source #

(MediaDecode ctyp a, MonadError ClientError m, SingI (Res (r ': rs)), HttpResConstraints (r ': rs)) => HasResponse (ResBody ctyp a ': (r ': rs) :: [ResContent Type]) m Source #

The following type instance is overly restrictive to avoid overlapping type family instance error.

Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (ResBody ctyp a ': (r ': rs)) :: Type Source #

Methods

httpRes :: sing (ResBody ctyp a ': (r ': rs)) -> Response -> m (HttpOutput (ResBody ctyp a ': (r ': rs))) Source #

(MediaDecode ctyp a, MonadError ClientError m) => HasResponse (ResBody ctyp a ': ([] :: [ResContent Type]) :: [ResContent Type]) m Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (ResBody ctyp a ': []) :: Type Source #

Methods

httpRes :: sing (ResBody ctyp a ': []) -> Response -> m (HttpOutput (ResBody ctyp a ': [])) Source #

MonadError ClientError m => HasResponse (Raw a2 ': (r ': rs) :: [ResContent a1]) m Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (Raw a2 ': (r ': rs)) :: Type Source #

Methods

httpRes :: sing (Raw a2 ': (r ': rs)) -> Response -> m (HttpOutput (Raw a2 ': (r ': rs))) Source #

MonadError ClientError m => HasResponse (Raw a2 ': ([] :: [ResContent a1]) :: [ResContent a1]) m Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (Raw a2 ': []) :: Type Source #

Methods

httpRes :: sing (Raw a2 ': []) -> Response -> m (HttpOutput (Raw a2 ': [])) Source #

(UniqMembers rs "Response", HasResponse rs m) => HasResponse (Verb method rs :: Type) m Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

Associated Types

type HttpOutput (Verb method rs) :: Type Source #

Methods

httpRes :: sing (Verb method rs) -> Response -> m (HttpOutput (Verb method rs)) Source #

decodeAsBody :: forall ctyp a m sing. (MonadError ClientError m, MediaDecode ctyp a) => sing ctyp -> Response -> m a Source #

decodeAsHlist :: (MonadError ClientError m, HttpResConstraints rs) => Sing rs -> Response -> m (Hlist (HttpRes rs)) Source #

Turn a Response into a Hlist of outputs