Network.Protocol.HTTP.DAV

DAV-1.3.1: RFC 4918 WebDAV support

Safe Haskell | None
Language | Haskell98

Network.Protocol.HTTP.DAV

Contents

- Orphan instances

Synopsis

- newtype DAVT m a = DAVT {
  - runDAVT :: ExceptT String (StateT DAVContext m) a
  }
- evalDAVT :: MonadIO m => DAVURL -> DAVT m a -> m (Either String a)
- withDAVContext :: MonadIO m => DAVURL -> (DAVContext -> m a) -> m a
- runDAVContext :: MonadIO m => DAVContext -> DAVT m a -> m (Either String a, DAVContext)
- setCreds :: MonadIO m => ByteString -> ByteString -> DAVT m ()
- setDepth :: MonadIO m => Maybe Depth -> DAVT m ()
- setResponseTimeout :: MonadIO m => Maybe Int -> DAVT m ()
- setUserAgent :: MonadIO m => ByteString -> DAVT m ()
- data DAVContext = DAVContext {
  - _allowedMethods :: [ByteString]
  - _baseRequest :: Request
  - _basicusername :: ByteString
  - _basicpassword :: ByteString
  - _complianceClasses :: [ByteString]
  - _depth :: Maybe Depth
  - _httpManager :: Maybe Manager
  - _lockToken :: Maybe ByteString
  - _userAgent :: ByteString
  }
- caldavReportM :: MonadIO m => DAVT m Document
- delContentM :: MonadIO m => DAVT m ()
- getPropsM :: MonadIO m => DAVT m Document
- getContentM :: MonadIO m => DAVT m (Maybe ByteString, ByteString)
- withContentM :: MonadIO m => (Response BodyReader -> IO a) -> DAVT m a
- mkCol :: (MonadIO m, MonadBase IO m, MonadCatch m) => DAVT m Bool
- moveContentM :: MonadIO m => ByteString -> DAVT m ()
- putPropsM :: MonadIO m => Document -> DAVT m ()
- putContentM :: MonadIO m => (Maybe ByteString, ByteString) -> DAVT m ()
- putContentM' :: MonadIO m => (Maybe ByteString, RequestBody) -> DAVT m ()
- withLockIfPossible :: (MonadIO m, MonadBase IO m) => Bool -> DAVT m a -> DAVT m a
- withLockIfPossibleForDelete :: (MonadIO m, MonadBase IO m) => Bool -> DAVT m a -> DAVT m a
- inDAVLocation :: MonadIO m => (String -> String) -> DAVT m a -> DAVT m a
- getDAVLocation :: Monad m => DAVT m String
- mkDAVContext :: MonadIO m => DAVURL -> m DAVContext
- closeDAVContext :: MonadIO m => DAVContext -> m ()
- data Depth
  - = Depth0
  - | Depth1
  - | DepthInfinity
- data DAVContext = DAVContext {
  - _allowedMethods :: [ByteString]
  - _baseRequest :: Request
  - _basicusername :: ByteString
  - _basicpassword :: ByteString
  - _complianceClasses :: [ByteString]
  - _depth :: Maybe Depth
  - _httpManager :: Maybe Manager
  - _lockToken :: Maybe ByteString
  - _userAgent :: ByteString
  }
- userAgent :: Lens' DAVContext ByteString
- lockToken :: Lens' DAVContext (Maybe ByteString)
- httpManager :: Lens' DAVContext (Maybe Manager)
- depth :: Lens' DAVContext (Maybe Depth)
- complianceClasses :: Lens' DAVContext [ByteString]
- basicusername :: Lens' DAVContext ByteString
- basicpassword :: Lens' DAVContext ByteString
- baseRequest :: Lens' DAVContext Request
- allowedMethods :: Lens' DAVContext [ByteString]

# Documentation

newtype DAVT m a #

Constructors

DAVT |
Fields runDAVT :: ExceptT String (StateT DAVContext m) a

Instances

MonadTrans DAVT # |
Methods lift :: Monad m => m a -> DAVT m a #
Monad m => MonadState DAVContext (DAVT m) # |
Methods get :: DAVT m DAVContext # put :: DAVContext -> DAVT m () # state :: (DAVContext -> (a, DAVContext)) -> DAVT m a #
Monad m => MonadError String (DAVT m) # |
Methods throwError :: String -> DAVT m a # catchError :: DAVT m a -> (String -> DAVT m a) -> DAVT m a #
MonadBase b m => MonadBase b (DAVT m) # |
Methods liftBase :: b α -> DAVT m α #
Monad m => Monad (DAVT m) # |
Methods (>>=) :: DAVT m a -> (a -> DAVT m b) -> DAVT m b # (>>) :: DAVT m a -> DAVT m b -> DAVT m b # return :: a -> DAVT m a # fail :: String -> DAVT m a #
Functor m => Functor (DAVT m) # |
Methods fmap :: (a -> b) -> DAVT m a -> DAVT m b # (<$) :: a -> DAVT m b -> DAVT m a #
MonadFix m => MonadFix (DAVT m) # |
Methods mfix :: (a -> DAVT m a) -> DAVT m a #
Monad m => Applicative (DAVT m) # |
Methods pure :: a -> DAVT m a # (<*>) :: DAVT m (a -> b) -> DAVT m a -> DAVT m b # (*>) :: DAVT m a -> DAVT m b -> DAVT m b # (<*) :: DAVT m a -> DAVT m b -> DAVT m a #
Monad m => Alternative (DAVT m) # |
Methods empty :: DAVT m a # (<|>) :: DAVT m a -> DAVT m a -> DAVT m a # some :: DAVT m a -> DAVT m [a] # many :: DAVT m a -> DAVT m [a] #
Monad m => MonadPlus (DAVT m) # |
Methods mzero :: DAVT m a # mplus :: DAVT m a -> DAVT m a -> DAVT m a #
MonadIO m => MonadIO (DAVT m) # |
Methods liftIO :: IO a -> DAVT m a #
MonadThrow m => MonadThrow (DAVT m) # |
Methods throwM :: Exception e => e -> DAVT m a #
MonadCatch m => MonadCatch (DAVT m) # |
Methods catch :: Exception e => DAVT m a -> (e -> DAVT m a) -> DAVT m a #

evalDAVT :: MonadIO m => DAVURL -> DAVT m a -> m (Either String a) #

withDAVContext :: MonadIO m => DAVURL -> (DAVContext -> m a) -> m a #

runDAVContext :: MonadIO m => DAVContext -> DAVT m a -> m (Either String a, DAVContext) #

setCreds :: MonadIO m => ByteString -> ByteString -> DAVT m () #

setDepth :: MonadIO m => Maybe Depth -> DAVT m () #

setResponseTimeout :: MonadIO m => Maybe Int -> DAVT m () #

setUserAgent :: MonadIO m => ByteString -> DAVT m () #

data DAVContext #

Constructors

DAVContext |
Fields _allowedMethods :: [ByteString] _baseRequest :: Request _basicusername :: ByteString _basicpassword :: ByteString _complianceClasses :: [ByteString] _depth :: Maybe Depth _httpManager :: Maybe Manager _lockToken :: Maybe ByteString _userAgent :: ByteString

Instances

Monad m => MonadState DAVContext (DAVT m) # |
Methods get :: DAVT m DAVContext # put :: DAVContext -> DAVT m () # state :: (DAVContext -> (a, DAVContext)) -> DAVT m a #

caldavReportM :: MonadIO m => DAVT m Document #

delContentM :: MonadIO m => DAVT m () #

getPropsM :: MonadIO m => DAVT m Document #

getContentM :: MonadIO m => DAVT m (Maybe ByteString, ByteString) #

Note that the entire request body is buffered in memory. To stream large files use withContentM instead.

withContentM :: MonadIO m => (Response BodyReader -> IO a) -> DAVT m a #

mkCol :: (MonadIO m, MonadBase IO m, MonadCatch m) => DAVT m Bool #

moveContentM :: MonadIO m => ByteString -> DAVT m () #

putPropsM :: MonadIO m => Document -> DAVT m () #

putContentM :: MonadIO m => (Maybe ByteString, ByteString) -> DAVT m () #

Note that the entire request body is buffered in memory; not suitable for large files.

putContentM' :: MonadIO m => (Maybe ByteString, RequestBody) -> DAVT m () #

To send a large file, pass eg a RequestBodyStream containing the file's content.

withLockIfPossible :: (MonadIO m, MonadBase IO m) => Bool -> DAVT m a -> DAVT m a #

withLockIfPossibleForDelete :: (MonadIO m, MonadBase IO m) => Bool -> DAVT m a -> DAVT m a #

inDAVLocation :: MonadIO m => (String -> String) -> DAVT m a -> DAVT m a #

Normally, DAVT actions act on the url that is provided to eg, evalDAVT. Sometimes, it's useful to adjust the url that is acted on, while remaining in the same DAV session.

inLocation temporarily adjusts the url's path, while performing a DAVT action.

For example:

    import System.FilePath.Posix -- posix for url path manipulation

    mkColRecursive d = do
      let parent = takeDirectory d
      when (parent /= d) $
        mkColRecursive parent
      inDAVLocation (</> d) mkCol

Note that operations that modify the DAVContext (such as setCreds and setCreds) can be run inside davLocation, but will not have any effect on the calling DAVContext.

getDAVLocation :: Monad m => DAVT m String #

Gets the path of the url that DAVT actions will act on.

mkDAVContext :: MonadIO m => DAVURL -> m DAVContext #

closeDAVContext :: MonadIO m => DAVContext -> m () #

Deprecated: deprecated because http-client deprecated closeManager

data Depth #

Constructors

Depth0 |
Depth1 |
DepthInfinity |

Instances

Read Depth # |
Methods readsPrec :: Int -> ReadS Depth # readList :: ReadS [Depth] # readPrec :: ReadPrec Depth # readListPrec :: ReadPrec [Depth] #
Show Depth # |
Methods showsPrec :: Int -> Depth -> ShowS # show :: Depth -> String # showList :: [Depth] -> ShowS #

data DAVContext #

Constructors

DAVContext |
Fields _allowedMethods :: [ByteString] _baseRequest :: Request _basicusername :: ByteString _basicpassword :: ByteString _complianceClasses :: [ByteString] _depth :: Maybe Depth _httpManager :: Maybe Manager _lockToken :: Maybe ByteString _userAgent :: ByteString

Instances

Monad m => MonadState DAVContext (DAVT m) # |
Methods get :: DAVT m DAVContext # put :: DAVContext -> DAVT m () # state :: (DAVContext -> (a, DAVContext)) -> DAVT m a #

userAgent :: Lens' DAVContext ByteString #

lockToken :: Lens' DAVContext (Maybe ByteString) #

httpManager :: Lens' DAVContext (Maybe Manager) #

depth :: Lens' DAVContext (Maybe Depth) #

complianceClasses :: Lens' DAVContext [ByteString] #

basicusername :: Lens' DAVContext ByteString #

basicpassword :: Lens' DAVContext ByteString #

baseRequest :: Lens' DAVContext Request #

allowedMethods :: Lens' DAVContext [ByteString] #

# Orphan instances

Default DAVContext # |
Methods def :: DAVContext #