packages feed

github-rest 1.1.0 → 1.1.1

raw patch · 4 files changed

+33/−6 lines, 4 filesdep ~aesondep ~bytestringdep ~time

Dependency ranges changed: aeson, bytestring, time

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ ## Upcoming +## 1.1.1++* Add support for `aeson-2.0.0.0`+ ## 1.1.0  * Rename `GitHubState` to `GitHubSettings`
github-rest.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 800fa4f169210c967d917bacbc61e12d696ad192e8744af6798c68552fd8c05c+-- hash: cd7875e6f445fb80991854ab94196826c6e579e0149c6b3a3d63fb928f3a10f5  name:           github-rest-version:        1.1.0+version:        1.1.1 synopsis:       Query the GitHub REST API programmatically description:    Query the GitHub REST API programmatically, which can provide a more                 flexible and clear interface than if all of the endpoints and their types@@ -46,7 +46,7 @@       src   ghc-options: -Wall   build-depends:-      aeson >=1.1.2.0 && <1.6+      aeson >=1.1.2.0 && <2.1     , base >=4.9 && <5     , bytestring >=0.10.8.1 && <0.11     , http-client >=0.5.13.1 && <0.8@@ -80,7 +80,7 @@       test   ghc-options: -Wall   build-depends:-      aeson >=1.1.2.0 && <1.6+      aeson >=1.1.2.0 && <2.1     , aeson-qq     , base >=4.9 && <5     , bytestring >=0.10.8.1 && <0.11
src/GitHub/REST.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ {- | Module      :  GitHub.REST Maintainer  :  Brandon Chinn <brandon@leapyear.io>@@ -46,6 +48,10 @@ import Network.HTTP.Types (Status, StdMethod (..), status422) import UnliftIO.Exception (handleJust) +#if MIN_VERSION_aeson(2,0,0)+import Data.Aeson.Key (fromText)+#endif+ import GitHub.REST.Auth import GitHub.REST.Endpoint import GitHub.REST.KeyValue@@ -77,4 +83,9 @@ (.:) :: FromJSON a => Value -> Text -> a (.:) v key = either error id $ parseEither parseObject v   where-    parseObject = withObject "parseObject" (`parseField` key)+    parseObject = withObject "parseObject" (`parseField` fromText key)++#if !MIN_VERSION_aeson(2,0,0)+fromText :: Text -> Text+fromText = id+#endif
src/GitHub/REST/KeyValue.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} @@ -21,6 +22,10 @@ import Data.Text (Text) import qualified Data.Text as Text +#if MIN_VERSION_aeson(2,0,0)+import Data.Aeson.Key (fromText)+#endif+ -- | A type representing a key-value pair. data KeyValue where   (:=) :: (Show v, ToJSON v) => Text -> v -> KeyValue@@ -35,7 +40,7 @@  -- | Convert a 'KeyValue' into a 'Pair'. toPair :: KeyValue -> Pair-toPair (k := v) = (k, toJSON v)+toPair (k := v) = (fromText k, toJSON v)  -- | Convert the given KeyValues into a JSON Object. kvToValue :: [KeyValue] -> Value@@ -51,3 +56,10 @@       Bool b -> Text.pack . show $ b       _ -> error $ "Could not convert value: " ++ show v     prettyNum x = either show show (floatingOrInteger x :: Either Double Integer)++{- Helpers -}++#if !MIN_VERSION_aeson(2,0,0)+fromText :: Text -> Text+fromText = id+#endif