Copyright | Dennis Gosnell 2017 |
---|---|
License | BSD3 |
Maintainer | Dennis Gosnell (cdep.illabout@gmail.com) |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
- data Throws (e :: *)
- data NoThrow
- data Throwing (e :: [*])
- type family ThrowingNonterminal api where ...
- data VerbWithErr (method :: k1) (successStatusCode :: Nat) (contentTypes :: [*]) (es :: [*]) a
- type GetWithErr = VerbWithErr GET 200
- type PostWithErr = VerbWithErr POST 200
- type PutWithErr = VerbWithErr PUT 200
- type DeleteWithErr = VerbWithErr DELETE 200
- type PatchWithErr = VerbWithErr PATCH 200
- type PostCreatedWithErr = VerbWithErr POST 201
- type GetAcceptedWithErr = VerbWithErr GET 202
- type PostAcceptedWithErr = VerbWithErr POST 202
- type DeleteAcceptedWithErr = VerbWithErr DELETE 202
- type PatchAcceptedWithErr = VerbWithErr PATCH 202
- type PutAcceptedWithErr = VerbWithErr PUT 202
- type GetNonAuthoritativeWithErr = VerbWithErr GET 203
- type PostNonAuthoritativeWithErr = VerbWithErr POST 203
- type DeleteNonAuthoritativeWithErr = VerbWithErr DELETE 203
- type PatchNonAuthoritativeWithErr = VerbWithErr PATCH 203
- type PutNonAuthoritativeWithErr = VerbWithErr PUT 203
- type GetNoContentWithErr = VerbWithErr GET 204
- type PostNoContentWithErr = VerbWithErr POST 204
- type DeleteNoContentWithErr = VerbWithErr DELETE 204
- type PatchNoContentWithErr = VerbWithErr PATCH 204
- type PutNoContentWithErr = VerbWithErr PUT 204
- type GetResetContentWithErr = VerbWithErr GET 205
- type PostResetContentWithErr = VerbWithErr POST 205
- type DeleteResetContentWithErr = VerbWithErr DELETE 205
- type PatchResetContentWithErr = VerbWithErr PATCH 205
- type PutResetContentWithErr = VerbWithErr PUT 205
- type GetPartialContentWithErr = VerbWithErr GET 206
- class ErrStatus e where
- type family AllErrStatus (es :: [k]) :: Constraint where ...
Documentation
NoThrow
is used to indicate that an API will not throw an error, but
that it will still return a response wrapped in a
Envelope
.
Examples
Create an API using NoThrow
:
>>>
import Servant.API (Get, JSON, (:>))
>>>
type API = NoThrow :> Get '[JSON] Int
A servant-server handler for this type would look like the following:
apiHandler ::Handler
(Envelope
'[] Int) apiHandler =pureSuccEnvelope
3
type Client m ((:>) * * NoThrow ((:>) k k1 api apis)) # | |
type Client m ((:>) * * NoThrow ((:<|>) api1 api2)) # | |
type Client m ((:>) * * NoThrow (Verb k1 * method status ctypes a)) # | |
type ServerT * ((:>) * * NoThrow (Verb k1 k method status ctypes a)) m # | |
type ServerT * ((:>) * * NoThrow ((:>) k k1 api apis)) m # | |
type ServerT * ((:>) * * NoThrow ((:<|>) api1 api2)) m # | |
data Throwing (e :: [*]) Source #
This is used internally and should not be used by end-users.
type Client m ((:>) * * (Throwing es) ((:>) k k1 api apis)) # | |
type Client m ((:>) * * (Throwing es) ((:<|>) api1 api2)) # | |
type Client m ((:>) * * (Throwing es) (Verb k1 * method status ctypes a)) # | |
type ServerT * ((:>) * * (Throwing es) ((:>) k k1 api apis)) m # | |
type ServerT * ((:>) * * (Throwing es) ((:<|>) api1 api2)) m # | |
type ServerT * ((:>) * * (Throwing es) (Verb k1 k method status ctypes a)) m # | |
type family ThrowingNonterminal api where ... Source #
data VerbWithErr (method :: k1) (successStatusCode :: Nat) (contentTypes :: [*]) (es :: [*]) a Source #
Generic (VerbWithErr k1 k method successStatusCode contentTypes es a) Source # | |
type ServerT * (VerbWithErr k1 * method successStatus ctypes es a) m # | |
type Rep (VerbWithErr k1 k method successStatusCode contentTypes es a) Source # | |
type GetWithErr = VerbWithErr GET 200 Source #
type PostWithErr = VerbWithErr POST 200 Source #
type PutWithErr = VerbWithErr PUT 200 Source #
type DeleteWithErr = VerbWithErr DELETE 200 Source #
type PatchWithErr = VerbWithErr PATCH 200 Source #
type PostCreatedWithErr = VerbWithErr POST 201 Source #
type GetAcceptedWithErr = VerbWithErr GET 202 Source #
type PostAcceptedWithErr = VerbWithErr POST 202 Source #
type DeleteAcceptedWithErr = VerbWithErr DELETE 202 Source #
type PatchAcceptedWithErr = VerbWithErr PATCH 202 Source #
type PutAcceptedWithErr = VerbWithErr PUT 202 Source #
type GetNonAuthoritativeWithErr = VerbWithErr GET 203 Source #
type PostNonAuthoritativeWithErr = VerbWithErr POST 203 Source #
type DeleteNonAuthoritativeWithErr = VerbWithErr DELETE 203 Source #
type PatchNonAuthoritativeWithErr = VerbWithErr PATCH 203 Source #
type PutNonAuthoritativeWithErr = VerbWithErr PUT 203 Source #
type GetNoContentWithErr = VerbWithErr GET 204 Source #
type PostNoContentWithErr = VerbWithErr POST 204 Source #
type DeleteNoContentWithErr = VerbWithErr DELETE 204 Source #
type PatchNoContentWithErr = VerbWithErr PATCH 204 Source #
type PutNoContentWithErr = VerbWithErr PUT 204 Source #
type GetResetContentWithErr = VerbWithErr GET 205 Source #
type PostResetContentWithErr = VerbWithErr POST 205 Source #
type DeleteResetContentWithErr = VerbWithErr DELETE 205 Source #
type PatchResetContentWithErr = VerbWithErr PATCH 205 Source #
type PutResetContentWithErr = VerbWithErr PUT 205 Source #
type GetPartialContentWithErr = VerbWithErr GET 206 Source #
type family AllErrStatus (es :: [k]) :: Constraint where ... Source #
AllErrStatus '[] = () | |
AllErrStatus (a ': as) = (ErrStatus a, AllErrStatus as) |