apiary-0.7.0.0: Simple web framework inspired by scotty.

Safe HaskellNone

Control.Monad.Apiary.Filter

Contents

Synopsis

filters

http method

method :: Method -> Apiary c a -> Apiary c aSource

filter by HTTP method. since 0.1.0.0.

stdMethod :: StdMethod -> Apiary c a -> Apiary c aSource

filter by HTTP method using StdMethod. since 0.1.0.0.

http version

httpVersion :: HttpVersion -> Apiary c b -> Apiary c bSource

http version filter. since 0.5.0.0.

http09 :: Apiary c b -> Apiary c bSource

http/0.9 only accepted fiter. since 0.5.0.0.

http10 :: Apiary c b -> Apiary c bSource

http/1.0 only accepted fiter. since 0.5.0.0.

http11 :: Apiary c b -> Apiary c bSource

http/1.1 only accepted fiter. since 0.5.0.0.

path matcher

root :: Apiary c b -> Apiary c bSource

filter by rootPattern of ApiaryConfig.

capture :: QuasiQuoterSource

capture QuasiQuoter. since 0.1.0.0.

example:

 [capture|/path|] -- first path == path
 [capture|/int/:Int|] -- first path == int && get 2nd path as Int.
 [capture|/:Int/:Double|] -- get first path as Int and get 2nd path as Double.

query matcher

query :: (Query a, Strategy w) => ByteString -> Proxy (w a) -> Apiary (SNext w as a) b -> Apiary as bSource

low level query getter. since 0.5.0.0.

 query key (Proxy :: Proxy (fetcher type))

examples:

 query key (Proxy :: Proxy (First Int)) -- get first 'key' query parameter as Int.
 query key (Proxy :: Proxy (Option (Maybe Int)) -- get first 'key' query parameter as Int. allow without param or value.
 query key (Proxy :: Proxy (Many String) -- get all 'key' query parameter as String.

specified operators

(=:) :: Query a => ByteString -> Proxy a -> Apiary (Snoc as a) b -> Apiary as bSource

get first matched paramerer. since 0.5.0.0.

 key =: pInt == query key (pFirst pInt) == query key (Proxy :: Proxy (First Int))

(=!:) :: Query a => ByteString -> Proxy a -> Apiary (Snoc as a) b -> Apiary as bSource

get one matched paramerer. since 0.5.0.0.

when more one parameger given, not matched.

 key =: pInt == query key (pOne pInt) == query key (Proxy :: Proxy (One Int))

(=?:) :: Query a => ByteString -> Proxy a -> Apiary (Snoc as (Maybe a)) b -> Apiary as bSource

get optional first paramerer. since 0.5.0.0.

when illegal type parameter given, fail mather(don't give Nothing).

 key =: pInt == query key (pOption pInt) == query key (Proxy :: Proxy (Option Int))

(?:) :: Query a => ByteString -> Proxy a -> Apiary as b -> Apiary as bSource

check parameger given and type. since 0.5.0.0.

If you wan't to allow any type, give pVoid.

 key =: pInt == query key (pCheck pInt) == query key (Proxy :: Proxy (Check Int))

(=*:) :: Query a => ByteString -> Proxy a -> Apiary (Snoc as [a]) b -> Apiary as bSource

get many paramerer. since 0.5.0.0.

 key =: pInt == query key (pMany pInt) == query key (Proxy :: Proxy (Many Int))

(=+:) :: Query a => ByteString -> Proxy a -> Apiary (Snoc as [a]) b -> Apiary as bSource

get some paramerer. since 0.5.0.0.

 key =: pInt == query key (pSome pInt) == query key (Proxy :: Proxy (Some Int))

hasQuery :: ByteString -> Apiary c a -> Apiary c aSource

query exists checker.

 hasQuery q = query q (Proxy :: Proxy (Check ()))

header matcher

hasHeader :: HeaderName -> Apiary as b -> Apiary as bSource

check whether to exists specified header or not. since 0.6.0.0.

eqHeaderSource

Arguments

:: HeaderName 
-> ByteString

header value

-> Apiary as b 
-> Apiary as b 

check whether to exists specified valued header or not. since 0.6.0.0.

headers :: HeaderName -> Apiary (Snoc as [ByteString]) b -> Apiary as bSource

filter by headers up to 100 entries. since 0.6.0.0.

header :: HeaderName -> Apiary (Snoc as ByteString) b -> Apiary as bSource

filter by header and get first. since 0.6.0.0.

header' :: Strategy w => (forall x. Proxy x -> Proxy (w x)) -> (Header -> Bool) -> Apiary (SNext w as ByteString) b -> Apiary as bSource

low level header filter. since 0.6.0.0.

other

ssl :: Apiary c a -> Apiary c aSource

filter by ssl accessed. since 0.1.0.0.

Reexport

StdMethod(..)

Strategy Proxies