| CARVIEW |
nylas: Client for the Nylas API
Downloads
- nylas-0.1.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.0, 0.1.1 |
|---|---|
| Change log | CHANGELOG.md |
| Dependencies | aeson (>=0.8 && <0.10), base (>=4.7 && <5.0), bytestring (>=0.10.6.0 && <0.11), lens (>=4.5 && <5.0), lens-aeson (>=1.0.0.4 && <1.1), pipes (>=4.1.0 && <5.0), pipes-aeson (>=0.4.1.3 && <0.5), pipes-bytestring (>=2.1.1 && <3.0), pipes-http (>=1.0.2 && <2.0), pipes-parse (>=3.0.2 && <4.0), text (>=1.2.1.1 && <1.3), time (>=1.5 && <2.0), wreq (>=0.4.0.0 && <0.5) [details] |
| License | BSD-3-Clause |
| Copyright | 2015, Brian Schroeder |
| Author | Brian Schroeder |
| Maintainer | bts@gmail.com |
| Uploaded | by bts at 2015-08-24T19:27:26Z |
| Category | Network, API |
| Home page | https://github.com/bts/nylas-hs |
| Bug tracker | https://github.com/bts/nylas-hs/issues |
| Source repo | head: git clone git://github.com/bts/nylas-hs.git |
| Distributions | |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Downloads | 1665 total (3 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-09-30 [all 3 reports] |
Readme for nylas-0.1.1
[back to package description]nylas
A partially complete Haskell client for the Nylas HTTP API, powered by lens and pipes. At the moment I've only implemented support for the endpoints I need.
Pull requests for the support of additional endpoints would be greatly appreciated!
See Hackage for documentation.
Features
- constant-space stream ingestion of the changes (currently only message and thread objects) to an inbox since a given transactional cursor (or the beginning of time)
- requesting a message object
- requesting a thread object
Quickstart
The following example prints out all of the (thread and message) changes to an inbox using pipes:
{-# LANGUAGE OverloadedStrings #-}
module Quickstart where
import qualified Data.ByteString.Char8 as B
import Data.Monoid ((<>))
import Pipes (runEffect, (>->))
import Pipes.HTTP (newManager, tlsManagerSettings)
import qualified Pipes.Prelude as P
import Network.Nylas
token :: AccessToken
token = AccessToken "_PUT_YOUR_ACCESS_TOKEN_HERE_"
main :: IO ()
main = do
mgr <- newManager tlsManagerSettings
let cursor = Nothing
res <- consumeDeltas mgr token cursor (P.map show >-> P.print)
case res of
Left (ParsingError err remainder) -> do
putStrLn $ "ERROR: " <> show err
putStrLn "next few items:"
runEffect $ remainder >-> P.take 3 >-> P.map B.unpack >-> P.stdoutLn
Left (ConsumerError _) -> error "not possible"
Right _ -> return ()
License (3-clause BSD)
Copyright (c) 2015, Brian Schroeder
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of Brian Schroeder nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.