okapi-0.1.0.0: A microframework based on monadic parsing
Safe HaskellNone
LanguageHaskell2010

Okapi.Function

Synopsis

Documentation

runOkapi :: Monad m => (forall a. m a -> IO a) -> Int -> OkapiT m Result -> IO () Source #

runOkapiTLS :: Monad m => (forall a. m a -> IO a) -> TLSSettings -> Settings -> OkapiT m Result -> IO () Source #

makeOkapiApp :: Monad m => (forall a. m a -> IO a) -> OkapiT m Result -> Application Source #

get :: forall m. MonadOkapi m => m () Source #

post :: forall m. MonadOkapi m => m () Source #

head :: forall m. MonadOkapi m => m () Source #

put :: forall m. MonadOkapi m => m () Source #

delete :: forall m. MonadOkapi m => m () Source #

trace :: forall m. MonadOkapi m => m () Source #

connect :: forall m. MonadOkapi m => m () Source #

options :: forall m. MonadOkapi m => m () Source #

patch :: forall m. MonadOkapi m => m () Source #

seg :: forall m. MonadOkapi m => Text -> m () Source #

Parses a single path segment matching the given text and discards it

segs :: forall m. MonadOkapi m => [Text] -> m () Source #

Parses mutiple segments matching the order of the given list and discards them | TODO: Needs testing. May not have the correct behavior

segParam :: forall a m. (MonadOkapi m, FromHttpApiData a) => m a Source #

TODO: Change Read a constraint to custom typeclass or FromHTTPApiData | Parses a single seg segment, and returns the parsed seg segment as a value of the given type

segWith :: forall m. MonadOkapi m => (Text -> Bool) -> m () Source #

path :: forall m. MonadOkapi m => [Text] -> m () Source #

Matches entire remaining path or fails

queryParam :: forall a m. (MonadOkapi m, FromHttpApiData a) => Text -> m a Source #

Parses a query parameter with the given name and returns the value as the given type

queryFlag :: forall m. MonadOkapi m => Text -> m Bool Source #

header :: forall m. MonadOkapi m => HeaderName -> m Text Source #

auth :: forall m. MonadOkapi m => m Text Source #

basicAuth :: forall m. MonadOkapi m => m (Text, Text) Source #

bodyJSON :: forall a m. (MonadOkapi m, FromJSON a) => m a Source #

bodyForm :: forall a m. (MonadOkapi m, FromForm a) => m a Source #

okPlainText :: forall m. MonadOkapi m => Headers -> Text -> m Result Source #

okJSON :: forall a m. (MonadOkapi m, ToJSON a) => Headers -> a -> m Result Source #

okHTML :: forall m. MonadOkapi m => Headers -> ByteString -> m Result Source #

okLucid :: forall a m. (MonadOkapi m, ToHtml a) => Headers -> a -> m Result Source #

noContent :: forall a m. MonadOkapi m => Headers -> m Result Source #

file :: forall m. MonadOkapi m => Natural -> Headers -> FilePath -> m Result Source #

okFile :: forall m. MonadOkapi m => Headers -> FilePath -> m Result Source #

skip :: forall a m. MonadOkapi m => m a Source #

error :: forall a m. MonadOkapi m => Natural -> Headers -> ByteString -> m a Source #

error500 :: forall a m. MonadOkapi m => Headers -> ByteString -> m a Source #

error401 :: forall a m. MonadOkapi m => Headers -> ByteString -> m a Source #

error403 :: forall a m. MonadOkapi m => Headers -> ByteString -> m a Source #

error404 :: forall a m. MonadOkapi m => Headers -> ByteString -> m a Source #

error422 :: forall a m. MonadOkapi m => Headers -> ByteString -> m a Source #

(<!>) :: MonadOkapi m => m a -> m a -> m a Source #

Execute the next parser even if the first one throws an Error error

optionalError :: MonadOkapi m => m a -> m (Maybe a) Source #

optionError :: MonadOkapi m => a -> m a -> m a Source #