gitlab-haskell 1.0.0.0 → 1.0.0.1
raw patch · 5 files changed
+19/−51 lines, 5 filesdep ~aeson
Dependency ranges changed: aeson
Files
- README.md +3/−1
- gitlab-haskell.cabal +4/−38
- src/GitLab/Types.hs +8/−8
- tests/API/Common.hs +3/−3
- tests/API/UsersTests.hs +1/−1
README.md view
@@ -39,7 +39,7 @@ -> GitLab a -> IO a -For example the following project finds all GitLab projects for the+For example the following project returns all GitLab projects for the user "joe". myProjects <-@@ -68,3 +68,5 @@ An example of an application using this library is `gitlab-tools`, which is a command line tool for bulk GitLab transactions [link](https://gitlab.com/robstewart57/gitlab-tools).++Unsurprisingly, this library is maintained on GitLab: [GitLab project](https://gitlab.com/robstewart57/gitlab-haskell).
gitlab-haskell.cabal view
@@ -1,46 +1,12 @@ cabal-version: 2.4 name: gitlab-haskell category: Git-version: 1.0.0.0+version: 1.0.0.1 synopsis: A Haskell library for the GitLab web API description: This library lifts the GitLab REST API into Haskell: <https://docs.gitlab.com/ee/api/> .- It also features an event driven reactive API for writing Gitlab file hook applications- .- Run all GitLab actions with `runGitLab`:- .- > runGitLab ::- > => GitLabServerConfig -- ^ the GitLab server details- > -> GitLab a -- ^ the GitLab action- > -> IO a- .- For example:- .- > myProjects <- runGitLab- > (defaultGitLabServer- > { url = "https://gitlab.example.com"- > , token="my_token"} )- > (searchUser "joe" >>= userProjects . fromJust)- .- Which uses the functions:- .- > searchUser :: Text -> GitLab (Maybe User)- > userProjects :: User -> GitLab (Maybe [Project])- .- This is the API to develop event driven rule based GitLab file hooks that fire in real-time on events on a GitLab server:- .- > receive :: [Rule] -> GitLab ()- .- > class (FromJSON a) => SystemHook a where- > match :: String -> (a -> GitLab ()) -> Rule- > matchIf :: String -> (a -> GitLab Bool) -> (a -> GitLab ()) -> Rule- .- For more details about the file hooks support: <https://www.macs.hw.ac.uk/~rs46/posts/2020-06-06-gitlab-system-hooks.html>- .- Unsurprisingly, this library is maintained on GitLab: <https://gitlab.com/robstewart57/gitlab-haskell>--+ The library also features a reactive event driven API for writing Gitlab file hook applications. homepage: https://gitlab.com/robstewart57/gitlab-haskell bug-reports: https://gitlab.com/robstewart57/gitlab-haskell/issues author: Rob Stewart@@ -93,7 +59,7 @@ base >=4.7 && <5 , http-conduit , connection- , aeson >= 1.4.4.0+ , aeson >= 2.0.0.0 , bytestring , text , http-client@@ -139,7 +105,7 @@ , tasty-hunit , gitlab-haskell , bytestring- , aeson+ , aeson >= 2.0.0.0 , tree-diff , ansi-wl-pprint , vector
src/GitLab/Types.hs view
@@ -106,9 +106,9 @@ where import Control.Monad.Trans.Reader-import Data.Aeson+import Data.Aeson hiding (Key) import Data.Aeson.TH-import Data.Aeson.Types+import Data.Aeson.Types hiding (Key) import Data.Text (Text) import qualified Data.Text as T import Data.Time.Clock@@ -1425,6 +1425,10 @@ $(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "time_stats_"), omitNothingFields = True} ''TimeStats) +$(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "saml_identity_"), omitNothingFields = True} ''SamlIdentity)++$(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "identity_"), omitNothingFields = True} ''Identity)+ $(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "user_"), omitNothingFields = True} ''User) instance ToJSON MilestoneState where@@ -1457,10 +1461,6 @@ $(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "contributor_"), omitNothingFields = True} ''Contributor) -$(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "saml_identity_"), omitNothingFields = True} ''SamlIdentity)--$(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "identity_"), omitNothingFields = True} ''Identity)- $(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "member_"), omitNothingFields = True} ''Member) $(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "permissions_"), omitNothingFields = True} ''Permissions)@@ -1622,6 +1622,6 @@ $(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "user_count_"), omitNothingFields = True} ''UserCount) -$(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "event_"), omitNothingFields = True} ''Event)- $(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "push_data_"), omitNothingFields = True} ''PushData)++$(deriveJSON defaultOptions {fieldLabelModifier = drop (T.length "event_"), omitNothingFields = True} ''Event)
tests/API/Common.hs view
@@ -6,9 +6,9 @@ module API.Common where -import Data.Aeson+import Data.Aeson hiding (Key)+import qualified Data.Aeson.KeyMap as KeyMap import qualified Data.ByteString.Lazy.Char8 as BSL-import qualified Data.HashMap.Strict as HashMap import Data.Maybe import Data.TreeDiff.Class import Data.TreeDiff.Pretty@@ -102,7 +102,7 @@ removeNulls (String x) = Just $ String x removeNulls (Number x) = Just $ Number x removeNulls (Bool x) = Just $ Bool x-removeNulls (Object keyMap) = Just $ Object (HashMap.mapMaybe removeNulls keyMap)+removeNulls (Object keyMap) = Just $ Object (KeyMap.mapMaybe removeNulls keyMap) gitlabJsonParserTests :: (ToExpr a, FromJSON a, ToJSON a, Eq a, Show a) => String -> FilePath -> IO a -> IO a -> [TestTree] gitlabJsonParserTests testPrefix jsonFilename parseFileF decodedCustomTypeF = do
tests/API/UsersTests.hs view
@@ -4,7 +4,7 @@ import API.Common import Control.Monad.IO.Class-import Data.Aeson+import Data.Aeson hiding (Key) import qualified Data.ByteString.Lazy.Char8 as BSL import GitLab import GitLab.SystemHooks.GitLabSystemHooks