Safe Haskell | None |
---|
Control.Monad.Apiary.Action
- data ActionT exts m a
- data ApiaryConfig = ApiaryConfig {}
- defaultDocumentationAction :: Monad m => DefaultDocumentConfig -> ActionT exts m ()
- data DefaultDocumentConfig = DefaultDocumentConfig {}
- stop :: Monad m => ActionT exts m a
- stopWith :: Monad m => Response -> ActionT exts m a
- getRequest :: Monad m => ActionT exts m Request
- getHeaders :: Monad m => ActionT exts m RequestHeaders
- getReqParams :: MonadIO m => ActionT exts m [Param]
- data File = File {}
- getReqFiles :: MonadIO m => ActionT exts m [File]
- getExt :: (Has e exts, Monad m) => proxy e -> ActionT exts m e
- status :: Monad m => Status -> ActionT exts m ()
- addHeader :: Monad m => HeaderName -> ByteString -> ActionT exts m ()
- setHeaders :: Monad m => ResponseHeaders -> ActionT exts m ()
- modifyHeader :: Monad m => (ResponseHeaders -> ResponseHeaders) -> ActionT exts m ()
- type ContentType = ByteString
- contentType :: Monad m => ContentType -> ActionT exts m ()
- reset :: Monad m => ActionT exts m ()
- file :: Monad m => FilePath -> Maybe FilePart -> ActionT exts m ()
- file' :: Monad m => FilePath -> Maybe FilePart -> ActionT exts m ()
- builder :: Monad m => Builder -> ActionT exts m ()
- bytes :: Monad m => ByteString -> ActionT exts m ()
- lazyBytes :: Monad m => ByteString -> ActionT exts m ()
- text :: Monad m => Text -> ActionT exts m ()
- lazyText :: Monad m => Text -> ActionT exts m ()
- showing :: (Monad m, Show a) => a -> ActionT exts m ()
- string :: Monad m => String -> ActionT exts m ()
- char :: Monad m => Char -> ActionT exts m ()
- stream :: Monad m => StreamingBody -> ActionT exts m ()
- rawResponse :: Monad m => (Status -> ResponseHeaders -> Response) -> ActionT exts m ()
- type StreamingBody = (Builder -> IO ()) -> IO () -> IO ()
- redirect :: Monad m => ByteString -> ActionT exts m ()
- redirectPermanently :: Monad m => ByteString -> ActionT exts m ()
- redirectTemporary :: Monad m => ByteString -> ActionT exts m ()
- redirectWith :: Monad m => Status -> ByteString -> ActionT exts m ()
- redirectFound :: Monad m => ByteString -> ActionT exts m ()
- redirectSeeOther :: Monad m => ByteString -> ActionT exts m ()
- source :: Monad m => StreamingBody -> ActionT exts m ()
- lbs :: Monad m => ByteString -> ActionT exts m ()
Documentation
Instances
MonadBase b m => MonadBase b (ActionT exts m) | |
MonadBaseControl b m => MonadBaseControl b (ActionT exts m) | |
MonadReader r m => MonadReader r (ActionT exts m) | |
MonadTrans (ActionT exts) | |
MonadTransControl (ActionT exts) | |
Monad m => Monad (ActionT exts m) | |
Functor (ActionT exts m) | |
Monad m => MonadPlus (ActionT exts m) | |
Applicative (ActionT exts m) | |
(Monad m, Functor m) => Alternative (ActionT exts m) | |
MonadThrow m => MonadThrow (ActionT exts m) | |
MonadCatch m => MonadCatch (ActionT exts m) | |
MonadMask m => MonadMask (ActionT exts m) | |
MonadIO m => MonadIO (ActionT exts m) |
data ApiaryConfig Source
Constructors
ApiaryConfig | |
Fields
|
Instances
defaultDocumentationAction :: Monad m => DefaultDocumentConfig -> ActionT exts m ()Source
actions
getter
getRequest :: Monad m => ActionT exts m RequestSource
get raw request. since 0.1.0.0.
getHeaders :: Monad m => ActionT exts m RequestHeadersSource
get all request headers. since 0.6.0.0.
getReqParams :: MonadIO m => ActionT exts m [Param]Source
parse request body and return params. since 0.9.0.0.
Constructors
File | |
Fields |
getReqFiles :: MonadIO m => ActionT exts m [File]Source
parse request body and return files. since 0.9.0.0.
setter
response header
addHeader :: Monad m => HeaderName -> ByteString -> ActionT exts m ()Source
add response header. since 0.1.0.0.
setHeaders :: Monad m => ResponseHeaders -> ActionT exts m ()Source
set response headers. since 0.1.0.0.
modifyHeader :: Monad m => (ResponseHeaders -> ResponseHeaders) -> ActionT exts m ()Source
modify response header. since 0.1.0.0.
type ContentType = ByteStringSource
contentType :: Monad m => ContentType -> ActionT exts m ()Source
set content-type header. if content-type header already exists, replace it. since 0.1.0.0.
response body
file :: Monad m => FilePath -> Maybe FilePart -> ActionT exts m ()Source
set response body file content and detect Content-Type by extension. since 0.1.0.0.
file' :: Monad m => FilePath -> Maybe FilePart -> ActionT exts m ()Source
set response body file content, without set Content-Type. since 0.1.0.0.
builder :: Monad m => Builder -> ActionT exts m ()Source
append response body from builder. since 0.1.0.0.
bytes :: Monad m => ByteString -> ActionT exts m ()Source
append response body from strict bytestring. since 0.15.2.
lazyBytes :: Monad m => ByteString -> ActionT exts m ()Source
append response body from lazy bytestring. since 0.15.2.
text :: Monad m => Text -> ActionT exts m ()Source
append response body from strict text. encoding UTF-8. since 0.15.2.
lazyText :: Monad m => Text -> ActionT exts m ()Source
append response body from lazy text. encoding UTF-8. since 0.15.2.
showing :: (Monad m, Show a) => a -> ActionT exts m ()Source
append response body from show. encoding UTF-8. since 0.15.2.
string :: Monad m => String -> ActionT exts m ()Source
append response body from string. encoding UTF-8. since 0.15.2.
char :: Monad m => Char -> ActionT exts m ()Source
append response body from char. encoding UTF-8. since 0.15.2.
stream :: Monad m => StreamingBody -> ActionT exts m ()Source
set response body source. since 0.9.0.0.
rawResponse :: Monad m => (Status -> ResponseHeaders -> Response) -> ActionT exts m ()Source
set raw response constructor. since 0.10.
example(use pipes-wai)
producer :: Monad m => Producer (Flush Builder) IO () -> ActionT exts m () producer = response (s h -> responseProducer s h)
type StreamingBody = (Builder -> IO ()) -> IO () -> IO ()
Represents a streaming HTTP response body. It's a function of two parameters; the first parameter provides a means of sending another chunk of data, and the second parameter provides a means of flushing the data to the client.
Since 3.0.0
monolithic action
redirect
redirect :: Monad m => ByteString -> ActionT exts m ()Source
redirect with:
303 See Other (HTTP/1.1) or 302 Moved Temporarily (Other)
since 0.6.2.0.
redirectPermanently :: Monad m => ByteString -> ActionT exts m ()Source
redirect with 301 Moved Permanently. since 0.3.3.0.
redirectTemporary :: Monad m => ByteString -> ActionT exts m ()Source
redirect with:
307 Temporary Redirect (HTTP/1.1) or 302 Moved Temporarily (Other)
since 0.3.3.0.
Arguments
:: Monad m | |
=> Status | |
-> ByteString | Location redirect to |
-> ActionT exts m () |
redirect handler
set status and add location header. since 0.3.3.0.
rename from redirect in 0.6.2.0.
deprecated
redirectFound :: Monad m => ByteString -> ActionT exts m ()Source
Deprecated: use redirect
redirect with 302 Found. since 0.3.3.0.
redirectSeeOther :: Monad m => ByteString -> ActionT exts m ()Source
Deprecated: use redirect
redirect with 303 See Other. since 0.3.3.0.
source :: Monad m => StreamingBody -> ActionT exts m ()Source
Deprecated: use stream
lbs :: Monad m => ByteString -> ActionT exts m ()Source
Deprecated: use lazyBytes
append response body from lazy bytestring. since 0.1.0.0.