packages feed

pagerduty 0.0.5 → 0.0.6

raw patch · 3 files changed

+12/−8 lines, 3 files

Files

pagerduty.cabal view
@@ -1,5 +1,5 @@ name:                  pagerduty-version:               0.0.5+version:               0.0.6 synopsis:              Client library for PagerDuty Integration and REST APIs. homepage:              http://github.com/brendanhay/pagerduty license:               OtherLicense
src/Network/PagerDuty/Internal/Types.hs view
@@ -279,8 +279,13 @@  makeLenses ''Pager -instance FromJSON a => FromJSON (a, Maybe Pager) where-    parseJSON = withObject "paginated" $ \o -> (,)+data Page a = Page+    { _pgItem  :: a+    , _pgPager :: Maybe Pager+    }++instance FromJSON a => FromJSON (Page a) where+    parseJSON = withObject "paginated" $ \o -> Page         <$> parseJSON (Object o)         <*> optional  (parse o)       where
src/Network/PagerDuty/REST.hs view
@@ -13,7 +13,6 @@  module Network.PagerDuty.REST     (-     -- * Sending requests       send     , sendWith@@ -56,7 +55,7 @@          => Env s          -> Request a s b          -> m (Either Error b)-sendWith e = liftM (fmap fst) . http e+sendWith e = liftM (fmap _pgItem) . http e  -- | /See:/ 'paginateWith' paginate :: (MonadIO m, Paginate a, FromJSON b)@@ -75,15 +74,15 @@   where     go rq = do         rs <- lift (http e rq)-        yield  (fst <$> rs)+        yield  (_pgItem <$> rs)         either (const (return ()))-               (maybe (return ()) go . next rq . snd)+               (maybe (return ()) go . next rq . _pgPager)                rs  http :: (MonadIO m, FromJSON b)      => Env s      -> Request a s b-     -> m (Either Error (b, Maybe Pager))+     -> m (Either Error (Page b)) http e rq = request (e ^. envManager) (e ^. envLogger) rq $ raw     { Client.host        = domain (e ^. envDomain)     , Client.path        = renderPath (rq ^. path)