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

Safe HaskellNone
LanguageHaskell2010

Hreq.Core.API.Response

Contents

Description

Specification for valid Response component types used at the Kind and Type level for creating an API structure.

Synopsis

Response type

data ResContent a Source #

Constructors

ResBody a a 
ResHeaders [(Symbol, a)] 
ResStream a a 
ResStatus a Nat 
Raw a 
Instances
(HttpReqConstraints ts, ReflectMethod method, SingI (Req ts), SingI (Res rs), HttpResConstraints rs) => HasRequest (ts :: [ReqContent Type]) (Verb method rs) Source # 
Instance details

Defined in Hreq.Core.Client.HasRequest

Associated Types

type HttpInput ts :: Type Source #

Methods

httpReq :: Proxy (Verb method rs) -> Proxy ts -> HttpInput ts -> Request -> Request Source #

SingI ts => SingI (ResHeaders ts :: ResContent Type) Source # 
Instance details

Defined in Hreq.Core.API.Response

Methods

sing :: Sing (ResHeaders ts) Source #

SingI a => SingI (Raw a :: ResContent Type) Source # 
Instance details

Defined in Hreq.Core.API.Response

Methods

sing :: Sing (Raw a) Source #

(SingI ctyp, SingI a) => SingI (ResBody ctyp a :: ResContent Type) Source # 
Instance details

Defined in Hreq.Core.API.Response

Methods

sing :: Sing (ResBody ctyp a) Source #

(SingI a, SingI ctyp) => SingI (ResStream ctyp a :: ResContent Type) Source # 
Instance details

Defined in Hreq.Core.API.Response

Methods

sing :: Sing (ResStream ctyp a) Source #

(SingI a, SingI n) => SingI (ResStatus a n :: ResContent Type) Source # 
Instance details

Defined in Hreq.Core.API.Response

Methods

sing :: Sing (ResStatus a n) 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 #

type Sing Source # 
Instance details

Defined in Hreq.Core.API.Response

type HttpOutput ((ResStream :: a -> a -> ResContent a) ': rs :: [a -> a -> ResContent a]) Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

type HttpOutput ((ResStream :: a -> a -> ResContent a) ': rs :: [a -> a -> ResContent a]) = (TypeError (Text "ResStream shouldn't be an instance of HasResponse class") :: Type)
type HttpOutput (ResHeaders hs ': rs :: [ResContent Type]) Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

type HttpOutput (ResHeaders hs ': rs :: [ResContent Type]) = Hlist (HttpRes (ResHeaders hs ': rs))
type HttpOutput (ResStatus n ': (r ': rs) :: [ResContent Type]) Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

type HttpOutput (ResStatus n ': (r ': rs) :: [ResContent Type]) = Hlist (HttpRes (r ': rs))
type HttpOutput (ResStatus n ': ([] :: [ResContent Type]) :: [ResContent Type]) Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

type HttpOutput (ResBody ctyp a ': (r ': rs) :: [ResContent Type]) Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

type HttpOutput (ResBody ctyp a ': (r ': rs) :: [ResContent Type]) = Hlist (a ': HttpRes (r ': rs))
type HttpOutput (ResBody ctyp a ': ([] :: [ResContent Type]) :: [ResContent Type]) Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

type HttpOutput (ResBody ctyp a ': ([] :: [ResContent Type]) :: [ResContent Type]) = a
type HttpOutput (Raw a2 ': (r ': rs) :: [ResContent a1]) Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

type HttpOutput (Raw a2 ': (r ': rs) :: [ResContent a1]) = (TypeError (Text "Raw should be used only in a singleton list") :: Type)
type HttpOutput (Raw a2 ': ([] :: [ResContent a1]) :: [ResContent a1]) Source # 
Instance details

Defined in Hreq.Core.Client.HasResponse

type HttpOutput (Raw a2 ': ([] :: [ResContent a1]) :: [ResContent a1]) = Response

Response type synonyms

type Raw = Raw () Source #

Response as a Singleton GADT

data SResContent (a :: ResContent Type) where Source #

Constructors

SResBody :: forall ctyp a. Sing ctyp -> Sing a -> SResContent (ResBody ctyp a) 
SResStream :: forall ctyp a. Sing ctyp -> Sing a -> SResContent (ResStream ctyp a) 
SResHeaders :: forall (ts :: [(Symbol, Type)]). Sing ts -> SResContent (ResHeaders ts) 
SResStatus :: forall (a :: Type) (n :: Nat). Sing a -> Sing n -> SResContent (ResStatus a n) 
SRaw :: forall (a :: Type). Sing a -> SResContent (Raw a)