Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internal constructors and helper functions. You should NOT use this module under normal circumstances!
- data SyncConfig = SyncConfig {}
- pServer :: Lens' SyncConfig Server
- pApiKey :: Lens' SyncConfig (Maybe Text)
- pAuth :: Lens' SyncConfig (Maybe Auth)
- pHttps :: Lens' SyncConfig Bool
- pManager :: Lens' SyncConfig (Either ManagerSettings Manager)
- type SyncResult a = Either SyncError a
- newtype SyncM m a = SyncM {
- runSyncthing :: EitherT SyncError (ReaderT SyncConfig m) a
- class Monad m => MonadSync m where
- getMethod :: Options -> String -> m ByteString
- postMethod :: Options -> String -> Value -> m ByteString
- runSyncM :: SyncConfig -> SyncM m a -> m (SyncResult a)
- syncthingM :: MonadCatch m => SyncConfig -> SyncM m a -> m (SyncResult a)
- liftEither :: Monad m => EitherT SyncError (ReaderT SyncConfig m) a -> SyncM m a
- liftReader :: Monad m => ReaderT SyncConfig m a -> SyncM m a
- liftInner :: Monad m => m a -> SyncM m a
- liftLeft :: Monad m => SyncError -> SyncM m a
- liftRight :: Monad m => a -> SyncM m a
- type Param = (Text, Text)
- data HttpMethod
- data SyncRequest = SyncRequest {}
- query :: (MonadSync m, FromJSON a) => SyncRequest -> SyncM m a
- queryMaybe :: (MonadSync m, FromJSON a) => SyncRequest -> SyncM m (Maybe a)
- send :: MonadSync m => SyncRequest -> SyncM m ()
- get :: HttpMethod
- post :: ToJSON a => a -> HttpMethod
- getRequest :: SyncRequest
- postRequest :: SyncRequest
- data DeviceError
- data SyncError
- syncErrHandler :: MonadThrow m => HttpException -> m (Either SyncError a)
- decodeDeviceError :: Text -> DeviceError
- decodeError :: ByteString -> Maybe SyncError
- parseAddr :: Server -> Addr
- encodeAddr :: Addr -> Server
- toUTC :: String -> Maybe UTCTime
- fromUTC :: UTCTime -> String
Configuration
data SyncConfig Source
The Syncthing configuration for specifying the Syncthing server, authentication, the API Key etc.
pManager :: Lens' SyncConfig (Either ManagerSettings Manager) Source
A lens for specifying your own ManagerSettings/Manager. For more information, please refer to the Network.HTTP.Client package.
The Syncthing Monad
type SyncResult a = Either SyncError a Source
The result type of Syncthing requests.
The SyncM Monad represents one or multiple Syncthing requests.
SyncM | |
|
class Monad m => MonadSync m where Source
getMethod :: Options -> String -> m ByteString Source
postMethod :: Options -> String -> Value -> m ByteString Source
runSyncM :: SyncConfig -> SyncM m a -> m (SyncResult a) Source
Run Syncthing requests without error handling.
syncthingM :: MonadCatch m => SyncConfig -> SyncM m a -> m (SyncResult a) Source
Run Syncthing requests with error handling.
liftEither :: Monad m => EitherT SyncError (ReaderT SyncConfig m) a -> SyncM m a Source
liftReader :: Monad m => ReaderT SyncConfig m a -> SyncM m a Source
Requests
queryMaybe :: (MonadSync m, FromJSON a) => SyncRequest -> SyncM m (Maybe a) Source
send :: MonadSync m => SyncRequest -> SyncM m () Source
get :: HttpMethod Source
post :: ToJSON a => a -> HttpMethod Source
Error Handling
data DeviceError Source
syncErrHandler :: MonadThrow m => HttpException -> m (Either SyncError a) Source
Utils
encodeAddr :: Addr -> Server Source
Generate server string.