packages feed

bugzilla-redhat 0.3.2 → 0.3.3

raw patch · 4 files changed

+36/−15 lines, 4 filesdep ~aesonPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: aeson

API changes (from Hackage documentation)

- Web.Bugzilla.RedHat: Bug :: !BugId -> Maybe [Text] -> UserEmail -> User -> [BugId] -> [UserEmail] -> [User] -> Text -> [Text] -> UTCTime -> UserEmail -> User -> [BugId] -> Maybe BugId -> Maybe [Flag] -> [Text] -> Bool -> Bool -> Bool -> Bool -> [Text] -> UTCTime -> Text -> Text -> Text -> Text -> UserEmail -> Text -> [Text] -> Text -> Text -> Text -> Text -> Text -> [Text] -> Text -> HashMap Text Text -> Maybe [ExternalBug] -> Bug
+ Web.Bugzilla.RedHat: Bug :: !BugId -> Maybe [Text] -> UserEmail -> User -> [BugId] -> [UserEmail] -> [User] -> Text -> [Text] -> UTCTime -> UserEmail -> User -> [BugId] -> Maybe BugId -> Maybe [Flag] -> [Text] -> Bool -> Bool -> Bool -> Bool -> [Text] -> UTCTime -> Text -> Text -> Text -> Text -> UserEmail -> Text -> [Text] -> Text -> Text -> Text -> Text -> Text -> [Text] -> Text -> KeyMap Text -> Maybe [ExternalBug] -> Bug
- Web.Bugzilla.RedHat: [bugCustomFields] :: Bug -> HashMap Text Text
+ Web.Bugzilla.RedHat: [bugCustomFields] :: Bug -> KeyMap Text

Files

ChangeLog.md view
@@ -1,5 +1,8 @@ # bugzilla-redhat version history +## 0.3.3 (2021-10-14)+- support building with aeson-2.0+ ## 0.3.2 (2021-06-19) - BugillaServer can now be fully qualified (@TristanCacqueray) - Add apikeySession to support api_key auth (@TristanCacqueray)
bugzilla-redhat.cabal view
@@ -1,5 +1,5 @@ name:                bugzilla-redhat-version:             0.3.2+version:             0.3.3 synopsis:            A Haskell interface to the Bugzilla native REST API description:         This package is designed to provide an easy-to-use,                      type-safe interface to querying Bugzilla from Haskell.@@ -37,7 +37,7 @@                        Web.Bugzilla.RedHat.Internal.Search,                        Web.Bugzilla.RedHat.Internal.Types   build-depends:       base >=4.6 && <5,-                       aeson >=0.7 && <1.6,+                       aeson >=0.7 && <2.1,                        blaze-builder >=0.3 && <0.5,                        bytestring >=0.10 && <0.11,                        connection >=0.2 && <0.4,@@ -75,7 +75,7 @@   hs-source-dirs:      test   main-is:             Spec.hs   build-depends:       base >=4.6 && <5,-                       aeson >=0.7 && <1.6,+                       aeson >=0.7 && <2.1,                        bugzilla-redhat,                        hspec >=2.0 && <3.0,                        time >=1.4 && <1.10
src/Web/Bugzilla/RedHat.hs view
@@ -10,7 +10,7 @@ -- --   A very simple program using this package might look like this: ----- >   ctx <- newBugzillaContext "bugzilla.redhat.com"+-- >   ctx <- newBugzillaContext "https://bugzilla.redhat.com" -- >   let session = anonymousSession ctx -- >       user = "me@example.org" -- >       query = AssignedToField .==. user .&&.
src/Web/Bugzilla/RedHat/Internal/Types.hs view
@@ -46,7 +46,12 @@ import Data.Aeson.Encode #endif import Data.Aeson.Types-import qualified Data.HashMap.Strict as H+#if MIN_VERSION_aeson(2,0,0)+import Data.Aeson.Key+import qualified Data.Aeson.KeyMap as M+#else+import qualified Data.HashMap.Strict as M+#endif import qualified Data.Text as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Builder as TLB@@ -418,8 +423,13 @@   , bugUrl                 :: T.Text   , bugVersion             :: [T.Text]   , bugWhiteboard          :: T.Text-  , bugCustomFields        :: H.HashMap T.Text T.Text-  , bugExternalBugs        :: Maybe [ExternalBug]+  , bugCustomFields        ::+#if MIN_VERSION_aeson(2,0,0)+                              M.KeyMap T.Text+#else+                              M.HashMap T.Text T.Text+#endif+, bugExternalBugs        :: Maybe [ExternalBug]   } deriving (Eq, Show)  instance FromJSON Bug where@@ -464,9 +474,14 @@           <*> v .:? "external_bugs"   parseJSON _ = mzero -customFields :: Object -> H.HashMap T.Text T.Text-customFields = H.map stringifyCustomFields-             . H.filterWithKey filterCustomFields+customFields :: Object ->+#if MIN_VERSION_aeson(2,0,0)+                M.KeyMap T.Text+#else+                M.HashMap T.Text T.Text+#endif+customFields = M.map stringifyCustomFields+             . M.filterWithKey filterCustomFields   where     stringifyCustomFields :: Value -> T.Text     stringifyCustomFields (String t) = t@@ -477,7 +492,10 @@                                      . toJSON                                      $ v -    filterCustomFields k _ = "cf_" `T.isPrefixOf` k+    filterCustomFields k _ = "cf_" `T.isPrefixOf` toText k+#if !MIN_VERSION_aeson(2,0,0)+      where toText = id+#endif  newtype BugList = BugList [Bug]                deriving (Eq, Show)@@ -544,8 +562,8 @@     attachmentsVal <- v .: "attachments"     bugsVal <- v .: "bugs"     case (attachmentsVal, bugsVal) of-      (Object (H.toList -> [(_, as)]), _) -> AttachmentList . (:[]) <$> parseJSON as-      (_, Object (H.toList -> [(_, as)])) -> AttachmentList <$> parseJSON as+      (Object (M.toList -> [(_, as)]), _) -> AttachmentList . (:[]) <$> parseJSON as+      (_, Object (M.toList -> [(_, as)])) -> AttachmentList <$> parseJSON as       _                                   -> mzero   parseJSON _ = mzero @@ -581,7 +599,7 @@   parseJSON (Object v) = do     bugsVal <- v .: "bugs"     case bugsVal of-      Object (H.toList -> [(_, cs)]) ->+      Object (M.toList -> [(_, cs)]) ->         do comments <- withObject "comments" (.: "comments") cs            withArray "comment list" (\a -> CommentList <$> parseJSON (addCount a)) comments       _ -> mzero@@ -594,7 +612,7 @@ addCount vs = Array $ V.zipWith addCount' (V.enumFromN 0 $ V.length vs) vs  where    addCount' :: Int -> Value -> Value-   addCount' c (Object v) = Object $ H.insert "count" (Number $ fromIntegral c) v+   addCount' c (Object v) = Object $ M.insert "count" (Number $ fromIntegral c) v    addCount' _ v          = v  -- | History information for a bug.