github: Access to the GitHub API, v3.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

The GitHub API provides programmatic access to the full GitHub Web site, from Issues to Gists to repos down to the underlying git data like references and trees. This library wraps all of that, exposing a basic but Haskell-friendly set of functions and data structures.

For supported endpoints see GitHub module.

import qualified GitHub as GH

main :: IO ()
main = do
    possibleUser <- GH.github' GH.userInfoForR "phadej"
    print possibleUser

For more of an overview please see the README: https://github.com/phadej/github/blob/master/README.md


[Skip to ReadMe]

Properties

Versions0.1, 0.1.1, 0.1.2, 0.2.0, 0.2.1, 0.3.0, 0.4.0, 0.4.1, 0.5.0, 0.6.0, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.8, 0.9, 0.10.0, 0.11.0, 0.11.1, 0.12, 0.13, 0.13.1, 0.13.2, 0.14.0, 0.14.1, 0.15.0, 0.16.0, 0.17.0, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.24
Change logCHANGELOG.md
Dependenciesaeson (>=1.4.0.0 && <1.5), base (>=4.7 && <4.14), base-compat (>=0.10.4 && <0.12), base16-bytestring (>=0.1.1.6 && <0.2), binary (>=0.7.1.0 && <0.11), binary-instances (>=1 && <1.1), bytestring (>=0.10.4.0 && <0.11), containers (>=0.5.5.1 && <0.7), cryptohash-sha1 (>=0.11.100.1 && <0.12), deepseq (>=1.3.0.2 && <1.5), deepseq-generics (>=0.2.0.0 && <0.3), exceptions (>=0.10.2 && <0.11), hashable (>=1.2.7.0 && <1.4), http-client (>=0.5.12 && <0.7), http-client-tls (>=0.3.5.3 && <0.4), http-link-header (>=1.0.3.1 && <1.1), http-types (>=0.12.3 && <0.13), iso8601-time (>=0.1.5 && <0.2), mtl (>=2.1.3.1 && <2.2 || >=2.2.1 && <2.3), network-uri (>=2.6.1.0 && <2.7), semigroups (>=0.18.5 && <0.20), tagged (>=0.8.5 && <0.9), text (>=1.2.0.6 && <1.3), time (>=1.4 && <1.10), tls (>=1.4.1), transformers (>=0.3.0.0 && <0.6), transformers-compat (>=0.6.5 && <0.7), unordered-containers (>=0.2.10.0 && <0.3), vector (>=0.12.0.1 && <0.13), vector-instances (==3.4.*) [details]
LicenseBSD-3-Clause
CopyrightCopyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2019 Oleg Grenrus
AuthorMike Burns, John Wiegley, Oleg Grenrus
MaintainerOleg Grenrus <oleg.grenrus@iki.fi>
CategoryNetwork
Home pagehttps://github.com/phadej/github
Source repositoryhead: git clone git://github.com/phadej/github.git
UploadedWed Nov 27 12:25:55 UTC 2019 by phadej

Modules

[Index]

Flags

NameDescriptionDefaultType
openssl

"Use http-client-openssl"

DisabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for github-0.24

[back to package description]

Github

Build Status Hackage Stackage LTS 5 Stackage Nightly

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:

-- Packages needed in order to build this package.
Build-depends:       github

Or from the command line:

cabal install github

Example Usage

See the samples in the samples/ directory.

Documentation

For details see the reference documentation on Hackage.

Each module lines up with the hierarchy of documentation from the Github API.

Request functions (ending with R) construct a data type with 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/ directory.

{-# 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

Test setup

To run integration part of tests, you'll need github access token Token is needed, because unauthorised access is highly limited. It's enough to add only basic read access for public information.

With travis encrypt --org --repo yournick/github "GITHUB_TOKEN=yourtoken" command you get a secret, you can use in your travis setup to run the test-suite there.

Contributions

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