gitlab-haskell: A Haskell library for the GitLab web API

[ bsd3, git, library ] [ Propose Tags ] [ Report a vulnerability ]

This library lifts the GitLab REST API into Haskell: https://docs.gitlab.com/ee/api/

The library also features a reactive event driven API for writing Gitlab file hook applications.


[Skip to Readme]

Modules

[Last Documentation]

  • GitLab
    • API
      • GitLab.API.Boards
      • GitLab.API.Branches
      • GitLab.API.Commits
      • GitLab.API.Discussions
      • GitLab.API.Groups
      • GitLab.API.Issues
      • GitLab.API.Jobs
      • GitLab.API.Members
      • GitLab.API.MergeRequests
      • GitLab.API.Notes
      • GitLab.API.Pipelines
      • GitLab.API.Projects
      • GitLab.API.Repositories
      • GitLab.API.RepositoryFiles
      • GitLab.API.Tags
      • GitLab.API.Todos
      • GitLab.API.Users
      • GitLab.API.Version
    • SystemHooks
      • GitLab.SystemHooks.GitLabSystemHooks
      • GitLab.SystemHooks.Rules
      • GitLab.SystemHooks.Types
    • GitLab.Types

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.3.0, 0.3.0.1, 0.3.0.2, 0.3.1, 0.3.1.1, 0.3.2.0, 1.0.0.0, 1.0.0.1, 1.0.0.3, 1.0.0.4, 1.0.0.5, 1.0.1.0, 1.0.2.0, 1.0.2.1, 1.0.2.2
Dependencies aeson (>=2.0.0.0), base (>=4.7 && <5), bytestring, crypton-connection (>=0.4.1), data-default-class, http-client, http-conduit, http-types, mtl, temporary, text, time (>=1.9), transformers, unix-compat [details]
License BSD-3-Clause
Copyright 2024 Rob Stewart, Heriot-Watt University
Author Rob Stewart
Maintainer robstewart57@gmail.com
Category Git
Home page https://gitlab.com/robstewart57/gitlab-haskell
Bug tracker https://gitlab.com/robstewart57/gitlab-haskell/issues
Source repo head: git clone https://gitlab.com/robstewart57/gitlab-haskell
Uploaded by RobStewart at 2024-10-28T22:49:58Z
Distributions Stackage:1.0.2.2
Downloads 7654 total (174 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2024-10-29 [all 2 reports]

Readme for gitlab-haskell-1.0.2.1

[back to package description]

A Haskell library for the GitLab web API

This library lifts the GitLab REST API into Haskell. It supports queries about and updates to:

  • Branches
  • Commits
  • Groups
  • Issues
  • Jobs
  • Members
  • Merge requests
  • Pipelines
  • Projects
  • Repositories
  • Repository files
  • Users
  • Discussions
  • Tags
  • Todos
  • Version
  • Notes
  • Boards

gitlab-haskell API

The library parses JSON results into Haskell data types in the GitLab.Types module, allowing you to work with statically typed GitLab data with data types and functions that the library provides. E.g.

searchUser   :: Text -> GitLab (Maybe User)
userProjects :: User -> ProjectSearchAttrs -> GitLab (Maybe [Project])

Server-side GitLab file hooks

This library can also be used to implement rule based GitLab file system hooks that, when deployed a GitLab server, react in real time to GitLab events like project creation, new users, merge requests etc.

The rule based API for implementing file hooks is:

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 system hooks support, see post: GitLab automation with file hook rules.

This library has almost 100% coverage of the GitLab REST API. For the complete gitlab-haskell API, see the hackage documentation.

Example

Run all GitLab actions with runGitLab:

runGitLab ::
   => GitLabServerConfig
   -> GitLab a
   -> IO a

For example the following project returns all GitLab projects for the user "joe".

myProjects <-
  runGitLab
    (defaultGitLabServer
       { url = "https://gitlab.example.com"
       , token = AuthMethodToken "my_token"} )
    (searchUser "joe" >>=  \usr -> userProjects (fromJust usr) defaultProjectSearchAttrs)

Library use

It was initially developed to automate and support computer science education. See our ICSE-SEET 2024 paper for the details: "Integrating Canvas and GitLab to Enrich Learning Processes".

An example of an application using this library is gitlab-tools, which is a command line tool for bulk GitLab transactions link.

Unsurprisingly, this library is maintained on GitLab: GitLab project.