MyNixOS website logo
Description

Client for the Nylas API.

A client for the Nylas HTTP API, powered by lens and pipes.

nylas

Hackage Build Status

A partially complete Haskell client for the NylasHTTP 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.

Metadata

Version

0.1.1

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows