syncthing-hs: Haskell bindings for the Syncthing REST API

[ bsd3, library, network ] [ Propose Tags ]
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.2.0.0, 0.3.0.0
Change log changelog.md
Dependencies aeson (>=0.8.0.1), base (>=4.5 && <5), bytestring (>=0.9), connection (>=0.2.3), containers (>=0.5.5.1), either (>=4.3.1), http-client (>=0.3.1.1), http-client-tls (>=0.2), lens (>=4.5), old-locale (>=1.0.0.6), regex-posix (>=0.95.2), text (>=1.2.0.0), time (>=1.4.2), transformers (>=0.3.0.0), unordered-containers (>=0.2.5.1), wreq (>=0.3.0.0) [details]
License BSD-3-Clause
Author Jens Thomas
Maintainer jetho@gmx.de
Category Network
Home page https://github.com/jetho/syncthing-hs
Bug tracker https://github.com/jetho/syncthing-hs/issues
Source repo head: git clone https://github.com/jetho/syncthing-hs
Uploaded by JensThomas at 2015-03-14T21:31:23Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2985 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-03-14 [all 1 reports]

Readme for syncthing-hs-0.1.1.0

[back to package description]

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 qualified Network.Wreq as Wreq
import Control.Monad (liftM2)
import Control.Lens ((&), (.~), (?~))
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