DAV-1.3.4: 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 Source #

Constructors

DAVT |

Fields

- runDAVT :: ExceptT String (StateT DAVContext m) a

#### Instances

Instances details

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

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

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

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

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

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

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

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

data DAVContext Source #

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

Instances details

Default DAVContext Source # |
Instance details Defined in Network.Protocol.HTTP.DAV Methods def :: DAVContext #
Monad m => MonadState DAVContext (DAVT m) Source # |
Instance details Defined in Network.Protocol.HTTP.DAV Methods get :: DAVT m DAVContext Source # put :: DAVContext -> DAVT m () Source # state :: (DAVContext -> (a, DAVContext)) -> DAVT m a Source #

caldavReportM :: MonadIO m => DAVT m Document Source #

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

getPropsM :: MonadIO m => DAVT m Document 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.

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

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

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

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

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.

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

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

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.

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

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

Deprecated: deprecated because http-client deprecated closeManager

data Depth Source #

Constructors

Depth0 |
Depth1 |
DepthInfinity |

#### Instances

Instances details

Read Depth Source # |
Instance details Defined in Network.Protocol.HTTP.DAV.TH Methods readsPrec :: Int -> ReadS Depth Source # readList :: ReadS [Depth] Source # readPrec :: ReadPrec Depth Source # readListPrec :: ReadPrec [Depth] Source #
Show Depth Source # |
Instance details Defined in Network.Protocol.HTTP.DAV.TH Methods showsPrec :: Int -> Depth -> ShowS Source # show :: Depth -> String Source # showList :: [Depth] -> ShowS Source #

data DAVContext Source #

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

Instances details

Default DAVContext Source # |
Instance details Defined in Network.Protocol.HTTP.DAV Methods def :: DAVContext #
Monad m => MonadState DAVContext (DAVT m) Source # |
Instance details Defined in Network.Protocol.HTTP.DAV Methods get :: DAVT m DAVContext Source # put :: DAVContext -> DAVT m () Source # state :: (DAVContext -> (a, DAVContext)) -> DAVT m a Source #

userAgent :: Lens' DAVContext ByteString Source #

lockToken :: Lens' DAVContext (Maybe ByteString) Source #

httpManager :: Lens' DAVContext (Maybe Manager) Source #

depth :: Lens' DAVContext (Maybe Depth) Source #

complianceClasses :: Lens' DAVContext [ByteString] Source #

basicusername :: Lens' DAVContext ByteString Source #

basicpassword :: Lens' DAVContext ByteString Source #

baseRequest :: Lens' DAVContext Request Source #

allowedMethods :: Lens' DAVContext [ByteString] Source #

# Orphan instances

Default DAVContext Source # |
Instance details Methods def :: DAVContext #