ghrepos
A node library to interact with the GitHub repos API
See also:
- https://github.com/rvagg/ghissues
- https://github.com/rvagg/ghusers
- https://github.com/rvagg/ghteams
- https://github.com/rvagg/ghauth
API
listUser(auth[, user][, options], callback)
List all repos for a user. If user
and options
are omitted the current user is assumed.
List all repos for user 'rvagg'
:
const ghrepos = authOptions = user: 'rvagg' token: '24d5dee258c64aef38a66c0c5eca459c379901c2' ghrepos
listOrg(auth, org[, options], callback)
List all repos for a organisation. If org
and options
are omitted the current org is assumed.
List all repos for org 'nodejs'
:
const ghrepos = authOptions = user: 'rvagg' token: '24d5dee258c64aef38a66c0c5eca459c379901c2' ghrepos
listRefs(auth, org, repo[, options], callback)
Get git ref data for all refs in a repo.
Get all ref data for nodejs/node
repo:
ghrepos
listBranches(auth, org, repo[, options], callback)
List git branches for a repo.
Get all branches for nodejs/node
repo:
ghrepos
listCommits(auth, org, repo[, options], callback)
List git commits for a repo.
Get all commits for nodejs/node
repo:
ghrepos
listTags(auth, org, repo[, options], callback)
List git tags for a repo.
Get all tag for nodejs/node
repo:
ghrepos
getRef(auth, org, repo, ref[, options], callback)
Get git ref data for a particular ref string.
Get git ref data for v1.x
branch in nodejs/node
repo:
ghrepos
getBranch(auth, org, repo, branch[, options], callback)
Get git branch data for a given branch name
Get git branch data for v1.x
branch in nodejs/node
repo:
ghrepos
getCommit(auth, org, repo, sha1[, options], callback)
Get git commit data for a given sha1
Get git commit data for sha1 75318e46b
in nodejs/node
repo:
ghrepos
getCommitComments(auth, org, repo, sha1[, options], callback)
Get git commit comments data for a given sha1
Get git commit comments data for sha1 75318e46b
in nodejs/node
repo:
ghrepos
Yields:
createLister(type)
Creates a function that lists different sub types related to the '/repos'
api, e.g. list 'issues'
, 'pulls'
or 'releases'
. The function returned has the signature: function list (auth, org, repo, options, callback)
.
More methods coming .. as I need them or as you PR them in.
The auth data is compatible with ghauth so you can just connect them together to make a simple command-line application:
const ghauth = ghrepos = authOptions = configName : 'lister' scopes : 'user'
License
ghrepos is Copyright (c) 2015 Rod Vagg @rvagg and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.