MyNixOS website logo
Description

A Haskell library for the GitLab web API.

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.

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 -> 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.

Metadata

Version

1.0.1.0

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows