packages feed

help-esb 0.1.5 → 0.1.6

raw patch · 2 files changed

+15/−9 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ HelpEsbClient: forM_ :: Monad m => [a] -> (a -> m b) -> m ()
- HelpEsbClient: esbListen :: Socket -> IO (ByteString)
+ HelpEsbClient: esbListen :: Socket -> IO ([ByteString])

Files

HelpEsbClient.hs view
@@ -32,11 +32,13 @@ , decode , eitherDecode , logger+, forM_ -- * Utility Types , Socket , module Data.UUID , module Data.UUID.V4 , module System.Environment+, module Control.Monad ) where  -- Base Modules@@ -45,6 +47,7 @@ import Network.Socket import Network.URI import Control.Exception+import Control.Monad import GHC.Generics import Data.Maybe import Data.Map@@ -130,7 +133,7 @@ readSocketDataRaw :: Socket -- ^ The socket connection.   -> IO [Char] -- ^ Any IO output. readSocketDataRaw sock = do-  message <- recv sock 1024+  message <- recv sock 4096   logger ("+ Raw Read: " ++ message)   return message @@ -237,14 +240,17 @@ -- | The 'esbListen' function performs all essential listening logic -- for any ESB client. esbListen :: Socket -- ^ The socket connection.-  -> IO (C.ByteString) -- ^ The JSON bytestring payload.+  -> IO ([C.ByteString]) -- ^ The array of JSON bytestring payload. esbListen sock = do   bytes <- readSocketData sock -  case eitherDecode bytes :: (Either String Login.Response.Message) of-    Left error -> return ()-    Right response -> do-      logger ("Response: " ++ show response)-      esbRecieve sock response+  let messages = C.split '\n' bytes -  return bytes+  forM_ messages $ \message -> do+    case eitherDecode bytes :: (Either String Login.Response.Message) of+      Left error -> return ()+      Right response -> do+        logger ("Response: " ++ show response)+        esbRecieve sock response++  return messages
help-esb.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                help-esb-version:             0.1.5+version:             0.1.6 synopsis:            A Haskell client for the Help.com team's ESB. description:         A Haskell client for the Help.com team's ESB. homepage:            https://github.com/helpdotcom/help-esb.hs