1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
GitHub
------
[](http://hackage.haskell.org/package/github)
[](https://stackage.org/nightly/package/github)
[](https://www.stackage.org/package/github)
[](https://github.com/haskell-github/github/actions/workflows/haskell-ci.yml)
The GitHub API v3 for Haskell.
Some functions are missing; these are functions where the GitHub API did
not work as expected. The full GitHub API is in beta and constantly
improving.
Installation
============
In your project's cabal file:
```cabal
Build-depends: github
```
Or from the command line:
```sh
cabal v1-install github
```
Example Usage
=============
See the samples in the
[samples/](https://github.com/haskell-github/github/tree/master/samples) directory.
Note: some samples might be outdated.
Documentation
=============
For details see the reference [documentation on Hackage][hackage].
Each module lines up with the hierarchy of
[documentation from the GitHub API](https://docs.github.com/en/rest).
Request functions (ending with `R`) construct a data type which can be executed
in `IO` by `executeRequest` functions. They are all listed in the root `GitHub`
module.
IO functions produce an `IO (Either Error a)`, where `a` is the actual thing
you want. You must call the function using IO goodness, then dispatch on the
possible error message. Here's an example from the samples:
Many function have samples under
[`samples/`](https://github.com/haskell-github/github/tree/master/samples) directory.
```hs
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
import Prelude.Compat
import Data.Text (Text, pack)
import Data.Text.IO as T (putStrLn)
import Data.Monoid ((<>))
import GitHub (github')
import qualified GitHub
main :: IO ()
main = do
possibleUsers <- github' GitHub.usersFollowingR "phadej"
T.putStrLn $ either (("Error: " <>) . pack . show)
(foldMap ((<> "\n") . formatUser))
possibleUsers
formatUser :: GitHub.SimpleUser -> Text
formatUser = GitHub.untagName . GitHub.simpleUserLogin
```
Contributions
=============
Please see
[CONTRIBUTING.md](https://github.com/haskell-github/github/blob/master/CONTRIBUTING.md)
for details on how you can help.
Copyright
=========
Copyright 2011-2012 Mike Burns.
Copyright 2013-2015 John Wiegley.
Copyright 2016-2019 Oleg Grenrus.
Available under the BSD 3-clause license.
[hackage]: https://hackage.haskell.org/package/github "Hackage"
Alternative
===========
Library [`github-rest`](https://hackage.haskell.org/package/github-rest)
also provides an interface to the GitHub API.
It compares itself to `github` here:
https://github.com/LeapYear/github-rest#comparison-to-other-libraries
|