gitlab-haskell 0.1.6 → 0.1.7
raw patch · 5 files changed
+19/−21 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- GitLab.API.Repositories: getFileArchive :: MonadIO m => Project -> ArchiveFormat -> FilePath -> GitLab m ()
+ GitLab.API.Repositories: getFileArchive :: MonadIO m => Project -> ArchiveFormat -> FilePath -> GitLab m (Either Status ())
- GitLab.API.Repositories: getFileArchive' :: MonadIO m => Int -> ArchiveFormat -> FilePath -> GitLab m ()
+ GitLab.API.Repositories: getFileArchive' :: MonadIO m => Int -> ArchiveFormat -> FilePath -> GitLab m (Either Status ())
Files
- README.md +1/−4
- gitlab-haskell.cabal +3/−3
- src/GitLab/API/Groups.hs +1/−1
- src/GitLab/API/Repositories.hs +5/−5
- src/GitLab/WebRequests/GitLabWebCalls.hs +9/−8
README.md view
@@ -38,13 +38,10 @@ , token="my_token"} ) (searchUser "joe" >>= userProjects . fromJust) -Which uses the` function:+Which uses the functions: searchUser :: Text -> GitLab m (Maybe User) userProjects :: User -> GitLab m (Maybe [Project])--This returns all GitLab TODO items, as Haskell values of type `Todo`-for the user identified with the access token`my_token`. The `gitlab-tools` command line tool for bulk GitLab transactions uses this library [link](https://gitlab.com/robstewart57/gitlab-tools).
gitlab-haskell.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4 name: gitlab-haskell category: Git-version: 0.1.6+version: 0.1.7 synopsis: A Haskell library for the GitLab web API description: This Haskell library queries and updates the database of a GitLab instance using the GitLab web API: <https://docs.gitlab.com/ee/api/>@@ -15,13 +15,13 @@ . For example: .- > myTodos <- runGitLab+ > myProjects <- runGitLab > (defaultGitLabServer > { url = "https://gitlab.example.com" > , token="my_token"} ) > (searchUser "joe" >>= userProjects . fromJust) .- Which uses the `todos` function:+ Which uses the functions: . > searchUser :: Text -> GitLab m (Maybe User) > userProjects :: User -> GitLab m (Maybe [Project])
src/GitLab/API/Groups.hs view
@@ -88,7 +88,7 @@ case attempt of Left httpStatus -> return (Left httpStatus) Right [] -> return (Left (mkStatus 404 (C.pack "cannot find group")))- Right [grp] -> do+ Right [grp] -> gitlabPost addr dataBody where dataBody :: Text
src/GitLab/API/Repositories.hs view
@@ -53,7 +53,7 @@ ArchiveFormat -> -- | file path to store the archive FilePath ->- GitLab m ()+ GitLab m (Either Status ()) getFileArchive project = getFileArchive' (project_id project) -- | get a file archive of the repository files as a@@ -81,13 +81,13 @@ ArchiveFormat -> -- | file path to store the archive FilePath ->- GitLab m ()+ GitLab m (Either Status ()) getFileArchive' projectId format path = do attempt <- getFileArchiveBS' projectId format case attempt of- Left _status -> return ()+ Left st -> return (Left st) Right archiveData ->- liftIO $ BSL.writeFile path archiveData+ Right <$> liftIO (BSL.writeFile path archiveData) -- | get a file archive of the repository files as a 'BSL.ByteString' -- using the project's ID. For example:@@ -100,7 +100,7 @@ -- | file format ArchiveFormat -> GitLab m (Either Status BSL.ByteString)-getFileArchiveBS' projectId format = do+getFileArchiveBS' projectId format = gitlabReqByteString addr where addr =
src/GitLab/WebRequests/GitLabWebCalls.hs view
@@ -9,7 +9,8 @@ gitlabWithAttrsUnsafe, gitlabOne, gitlabWithAttrsOne,- gitlabWithAttrsOneUnsafe,+ -- not currently used.+ -- gitlabWithAttrsOneUnsafe, gitlabPost, gitlabReqText, gitlabReqByteString,@@ -158,11 +159,10 @@ if successStatus (responseStatus resp) then return (Right (parser (responseBody resp))) else return (Left (responseStatus resp))- where gitlabReqJsonOne :: (MonadIO m, FromJSON a) => Text -> Text -> GitLab m (Either Status (Maybe a))-gitlabReqJsonOne gitlabURL attr = do- gitlabReqOne parseBSOne gitlabURL attr+gitlabReqJsonOne =+ gitlabReqOne parseBSOne gitlabReqText :: (MonadIO m) => Text -> GitLab m (Either Status String) gitlabReqText urlPath = gitlabReqOne C.unpack urlPath ""@@ -174,7 +174,7 @@ gitlab addr = gitlabReqJsonMany addr "" gitlabUnsafe :: (MonadIO m, FromJSON a) => Text -> GitLab m [a]-gitlabUnsafe addr = do+gitlabUnsafe addr = fromRight (error "gitlabUnsafe error") <$> gitlab addr gitlabOne :: (MonadIO m, FromJSON a) => Text -> GitLab m (Either Status (Maybe a))@@ -190,9 +190,10 @@ gitlabWithAttrsOne :: (MonadIO m, FromJSON a) => Text -> Text -> GitLab m (Either Status (Maybe a)) gitlabWithAttrsOne = gitlabReqJsonOne -gitlabWithAttrsOneUnsafe :: (MonadIO m, FromJSON a) => Text -> Text -> GitLab m (Maybe a)-gitlabWithAttrsOneUnsafe gitlabURL attrs =- fromRight (error "gitlabWithAttrsUnsafe error") <$> gitlabReqJsonOne gitlabURL attrs+-- not currently used.+-- gitlabWithAttrsOneUnsafe :: (MonadIO m, FromJSON a) => Text -> Text -> GitLab m (Maybe a)+-- gitlabWithAttrsOneUnsafe gitlabURL attrs =+-- fromRight (error "gitlabWithAttrsUnsafe error") <$> gitlabReqJsonOne gitlabURL attrs totalPages :: Response a -> Int totalPages resp =