Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Output a = Output {
- outputStatus :: Status
- outputPayload :: Payload a
- outputHeaders :: [Header]
- data Payload a
- = Payload a
- | NoPayload
- | Exception e => ErrorPayload e
- ok :: a -> Output a
- created :: a -> Output a
- accepted :: Output a
- noContent :: Output a
- badRequest :: Exception e => e -> Output a
- unauthorized :: Exception e => e -> Output a
- paymentRequired :: Exception e => e -> Output a
- forbidden :: Exception e => e -> Output a
- notFound :: Exception e => e -> Output a
- methodNotAllowed :: Exception e => e -> Output a
- notAcceptable :: Exception e => e -> Output a
- conflict :: Exception e => e -> Output a
- gone :: Exception e => e -> Output a
- lengthRequired :: Exception e => e -> Output a
- preconditionFailed :: Exception e => e -> Output a
- requestEntityTooLarge :: Exception e => e -> Output a
- unprocessableEntity :: Exception e => e -> Output a
- tooManyRequests :: Exception e => e -> Output a
- internalServerError :: Exception e => e -> Output a
- notImplemented :: Exception e => e -> Output a
- badGateway :: Exception e => e -> Output a
- serviceUnavailable :: Exception e => e -> Output a
- gatewayTimeout :: Exception e => e -> Output a
- payloadOutput :: Status -> a -> Output a
- payloadError :: Exception e => Status -> e -> Output a
- payloadEmpty :: Status -> Output a
- transformM :: Applicative m => (a -> m (Output b)) -> Output a -> m (Output b)
- withHeader :: (ByteString, ByteString) -> Output a -> Output a
- outputToResponse :: forall a ct. (KnownSymbol ct, ToResponse ct a, ToResponse ct SomeException) => Output a -> Response
Documentation
Output of Endpoint
that carries some Payload
a
together with response status and headers
Output | |
|
Instances
Monad Output Source # | |
Functor Output Source # | |
Applicative Output Source # | |
Foldable Output Source # | |
Defined in Linnet.Output fold :: Monoid m => Output m -> m # foldMap :: Monoid m => (a -> m) -> Output a -> m # foldr :: (a -> b -> b) -> b -> Output a -> b # foldr' :: (a -> b -> b) -> b -> Output a -> b # foldl :: (b -> a -> b) -> b -> Output a -> b # foldl' :: (b -> a -> b) -> b -> Output a -> b # foldr1 :: (a -> a -> a) -> Output a -> a # foldl1 :: (a -> a -> a) -> Output a -> a # elem :: Eq a => a -> Output a -> Bool # maximum :: Ord a => Output a -> a # minimum :: Ord a => Output a -> a # | |
Traversable Output Source # | |
MonadThrow Output Source # | |
Defined in Linnet.Output | |
Show a => Show (Output a) Source # | |
Payload of Output
that could be:
Payload a | Payload with some value |
NoPayload | Represents empty response |
Exception e => ErrorPayload e | Failed payload with an exception inside |
badRequest :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status BAD REQUEST 400
unauthorized :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status UNAUTHORIZED 401
paymentRequired :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status PAYMENT REQUIRED 402
forbidden :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status FORBIDDEN 403
notFound :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status NOT FOUND 404
methodNotAllowed :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status METHOD NOT ALLOWED 405
notAcceptable :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status NOT ACCEPTABLE 406
conflict :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status CONFLICT 409
lengthRequired :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status LENGTH REQUIRED 411
preconditionFailed :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status PRECONDITIONED FAILED 412
requestEntityTooLarge :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status REQUEST ENTITY TOO LARGE 413
unprocessableEntity :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status UNPROCESSABLE ENTITY 422
tooManyRequests :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status TOO MANY REQUESTS 422
internalServerError :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status INTERNAL SERVER ERROR 500
notImplemented :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status NOT IMPLEMENTED 501
badGateway :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status BAD GATEWAY 502
serviceUnavailable :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status SERVICE UNAVAILABLE 503
gatewayTimeout :: Exception e => e -> Output a Source #
Create Output
with ErrorPayload e
and status GATEWAY TIMEOUT 504
payloadOutput :: Status -> a -> Output a Source #
Create successful Output
with payload a
and given status
payloadError :: Exception e => Status -> e -> Output a Source #
Create failed Output
with exception e
and given status
transformM :: Applicative m => (a -> m (Output b)) -> Output a -> m (Output b) Source #
Transform payload of output
withHeader :: (ByteString, ByteString) -> Output a -> Output a Source #
Add header to given Output
outputToResponse :: forall a ct. (KnownSymbol ct, ToResponse ct a, ToResponse ct SomeException) => Output a -> Response Source #