syncthing-hs

Haskell bindings for the Syncthing REST API https://github.com/jetho/syncthing-hs

Latest on Hackage:0.3.0.0

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed by Jens Thomas
Maintained by jetho@gmx.de

syncthing-hs

Hackage Build Status

Haskell bindings for the Syncthing REST API.

Tutorial

A short tutorial is available at: http://jetho.org/posts/2015-03-07-syncthing-hs-tutorial.html

Installation

cabal update
cabal install syncthing-hs

Usage Example

{-# LANGUAGE OverloadedStrings #-}

import Control.Lens ((&), (.~), (?~))
import Control.Monad (liftM2)
import qualified Network.Wreq as Wreq
import Network.Syncthing
import qualified Network.Syncthing.Get as Get

-- A single Syncthing request.
single = syncthing defaultConfig Get.ping

-- Connection sharing for multiple Syncthing requests.
multiple1 = withManager $ \cfg ->
    syncthing cfg $ do
        p <- Get.ping
        v <- Get.version
        return (p, v)

-- Multiple Syncthing requests with connection sharing and customized configuration.
multiple2 = withManager $ \cfg -> do
    let cfg' = cfg & pServer .~ "192.168.0.10:8080"
                   & pHttps  .~ True
                   & pAuth   ?~ Wreq.basicAuth "user" "pass"
    syncthing cfg' $ liftM2 (,) Get.ping Get.version

Changes

0.3.0.0

  • Add support for GHC 7.10
  • Update Get.config and Post.scan requests

0.2.0.0

  • Update library for Syncthing v0.11
  • Refactor package internals

0.1.2.0

  • Update lower bounds of package dependencies
  • Re-export Network.Syncthing.Session by Network.Syncthing
  • Add /rest/report GET request

0.1.1.0

  • Add test-suite source files
  • Add module Network.Syncthing.Types
  • Add module Network.Syncthing.Utils

0.1.0.0

  • Initial release.

comments powered byDisqus