alerta 0.1.0.3 → 0.1.0.4
raw patch · 3 files changed
+55/−55 lines, 3 filesdep ~aesondep ~aeson-prettydep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, aeson-pretty, containers, data-default, http-api-data, http-client, servant, servant-client, servant-server, text, time
API changes (from Hackage documentation)
Files
- alerta.cabal +46/−52
- src/Alerta/Helpers.hs +6/−0
- src/Alerta/Util.hs +3/−3
alerta.cabal view
@@ -1,56 +1,50 @@-name: alerta-version: 0.1.0.3-cabal-version: >=1.10-build-type: Simple-license: BSD3-license-file: LICENSE-copyright: Mark Hopkins-maintainer: markjohnhopkins@gmail.com-stability: experimental-homepage: https://github.com/mjhopkins/alerta-client-bug-reports: https://github.com/mjhopkins/alerta-client/issues-synopsis: Bindings to the alerta REST API+name: alerta+version: 0.1.0.4+synopsis: Bindings to the alerta REST API+homepage: https://github.com/mjhopkins/alerta-client+bug-reports: https://github.com/mjhopkins/alerta-client/issues+license: BSD3+license-file: LICENSE+author: Mark Hopkins+maintainer: markjohnhopkins@gmail.com+copyright: Mark Hopkins+category: Monitoring, API, Web+build-type: Simple+stability: experimental+extra-source-files: README.md CHANGELOG.md+cabal-version: >= 1.10 description:- <http://alerta.io Alerta> is an alert monitoring tool developed by the- <https://www.theguardian.com Guardian> newspaper- .- This package supplies bindings to the alerta REST API so that it can be used- from Haskell.- .- Built with <http://hackage.haskell.org/package/servant Servant>.-category: Monitoring, API, Web-author: Mark Hopkins-extra-source-files:- README.md- CHANGELOG.md--source-repository head- type: git- location: https://github.com/mjhopkins/alerta-client+ <http://alerta.io Alerta> is an alert monitoring tool developed by the+ <https://www.theguardian.com Guardian> newspaper+ .+ This package supplies bindings to the alerta REST API so that it can be used+ from Haskell.+ .+ Built with <http://hackage.haskell.org/package/servant Servant>. library- exposed-modules:- Alerta- build-depends:- base >=4.7 && <5,- aeson >=1.0.2.1 && <1.1,- aeson-pretty >=0.8.2 && <0.9,- containers >=0.5.7.1 && <0.6,- data-default >=0.7.1.1 && <0.8,- http-api-data >=0.3.6 && <0.4,- http-client >=0.5.6.1 && <0.6,- servant >=0.9.1.1 && <0.10,- servant-client >=0.9.1.1 && <0.10,- servant-server >=0.9.1.1 && <0.10,- text >=1.2.2.1 && <1.3,- time >=1.6.0.1 && <1.7- default-language: Haskell2010- hs-source-dirs: src- other-modules:- Alerta.Auth- Alerta.Helpers- Alerta.ServantExtras- Alerta.Types- Alerta.Util- ghc-options: -Wall+ hs-source-dirs: src+ exposed-modules: Alerta+ other-modules: Alerta.Auth+ , Alerta.Helpers+ , Alerta.ServantExtras+ , Alerta.Types+ , Alerta.Util+ build-depends: aeson >= 1.1 && < 1.3+ , aeson-pretty >= 0.8 && < 0.9+ , base >= 4.7 && < 5+ , containers >= 0.5 && < 0.6+ , data-default >= 0.7 && < 0.8+ , http-api-data >= 0.3 && < 0.4+ , http-client >= 0.5 && < 0.6+ , servant >= 0.10 && < 0.12+ , servant-client >= 0.10 && < 0.12+ , servant-server >= 0.10 && < 0.12+ , text >= 1.2.2 && < 1.3+ , time >= 1.6 && < 1.9+ ghc-options: -Wall+ default-language: Haskell2010 +source-repository head+ type: git+ location: https://github.com/mjhopkins/alerta-client
src/Alerta/Helpers.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ -------------------------------------------------------------------------------- -- | -- Module: Alerta.Helpers@@ -41,7 +43,11 @@ run' = void . run handleError :: (FromJSON a, ToJSON a) => ServantError -> IO a+#if MIN_VERSION_servant_client(0,11,0)+handleError (FailureResponse _ status _ b) = either fail (\r -> putStrLn ("Failure response (status " ++ show status ++ ")") >> prettyPrint r >> return r) (eitherDecode b)+#else handleError (FailureResponse status _ b) = either fail (\r -> putStrLn ("Failure response (status " ++ show status ++ ")") >> prettyPrint r >> return r) (eitherDecode b)+#endif handleError (DecodeFailure e _ b) = fail ("decode failure\n\n" ++ e ++ "\n\n" ++ showUnescaped b) handleError (UnsupportedContentType ct b) = fail ("unsupported content type\n\n" ++ show ct ++ "\n" ++ show b) handleError (InvalidContentTypeHeader h b) = fail ("unsupported content type type\n\n" ++ show h ++ "\n" ++ show b)
src/Alerta/Util.hs view
@@ -15,7 +15,7 @@ , dropRight ) where -import Data.Aeson.TH+import Data.Aeson.TH as Aeson import Data.Char import Data.Default import qualified Data.Text as T@@ -27,8 +27,8 @@ def = AesonOpts "status" True -- TODO increment num words dropped from fieldLabel when tag is set, otherwise don't use TaggedObject-toOpts :: Int -> Int -> AesonOpts -> Data.Aeson.TH.Options-toOpts k n (AesonOpts f u) = Data.Aeson.TH.Options {+toOpts :: Int -> Int -> AesonOpts -> Aeson.Options+toOpts k n (AesonOpts f u) = Aeson.defaultOptions { fieldLabelModifier = uncapitalise . onCamelComponents (drop k) , constructorTagModifier = uncapitalise . onCamelComponents (dropRight n) , omitNothingFields = True