1{-# LANGUAGE TypeFamilies #-}
2{-# LANGUAGE OverloadedStrings #-}
3{-# LANGUAGE ScopedTypeVariables #-}
4{-# LANGUAGE DeriveDataTypeable #-}
5module Servant.API.Delete where
7import Control.Monad.Trans.Either
9import Data.String.Conversions
11import Network.HTTP.Types
16import Servant.Utils.Client
18-- | Endpoint for DELETE requests.
22instance HasServer Delete where
23 type Server Delete = EitherT (Int, String) IO ()
25 route Proxy action request respond
26 | null (pathInfo request) && requestMethod request == methodDelete = do
27 e <- runEitherT action
28 respond $ succeedWith $ case e of
30 responseLBS status204 [] ""
31 Left (status, message) ->
32 responseLBS (mkStatus status (cs message)) [] (cs message)
33 | null (pathInfo request) && requestMethod request /= methodDelete =
34 respond $ failWith WrongMethod
35 | otherwise = respond $ failWith NotFound
37instance HasClient Delete where
38 type Client Delete = BaseUrl -> EitherT String IO ()
40 clientWithRoute Proxy req host =
41 performRequest methodDelete req 204 host
43instance HasDocs Delete where
44 docsFor Proxy (endpoint, action) =
45 single endpoint' action'
47 where endpoint' = endpoint & method .~ DocDELETE
49 action' = action & response.respBody .~ Nothing
50 & response.respStatus .~ 204
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list