DAV-1.0.5: RFC 4918 WebDAV support

Safe HaskellNone
LanguageHaskell98

Network.Protocol.HTTP.DAV

Synopsis

Documentation

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

withDAVContext :: (MonadIO m, MonadMask m) => DAVURL -> (DAVContext -> m a) -> m a Source

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

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

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

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

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

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

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

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 Source

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