Constructor
new Repository(fullname, authopt, apiBaseopt)
Create a Repository.
Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| fullname | string | the full name of the repository | ||
| auth | Requestable.auth | <optional> | information required to authenticate to Github | |
| apiBase | string | <optional> | https://api.github.com | the base Github API URL | 
- Source:
Methods
commit(parent, tree, message, cb) → {Promise}
Add a commit to the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| parent | string | the SHA of the parent commit | 
| tree | Object | the tree that describes this commit | 
| message | string | the commit message | 
| cb | function | will receive the commit that is created | 
Returns:
- the promise for the http request
- Type
- Promise
compareBranches(base, head, cb) → {Promise}
Compare two branches/commits/repositories
Parameters:
| Name | Type | Description | 
|---|---|---|
| base | string | the base commit | 
| head | string | the head commit | 
| cb | Requestable.callback | will receive the comparison | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
createBlob(content, cb) → {Promise}
Create a blob
Parameters:
| Name | Type | Description | 
|---|---|---|
| content | string | Buffer | Blob | the content to add to the repository | 
| cb | Requestable.callback | will receive the details of the created blob | 
Returns:
- the promise for the http request
- Type
- Promise
createBranch(oldBranchopt, newBranch, cb) → {Promise}
Create a new branch from an existing branch.
Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| oldBranch | string | <optional> | master | the name of the existing branch | 
| newBranch | string | the name of the new branch | ||
| cb | function | will receive the commit data for the head of the new branch | 
- Source:
Returns:
- the promise for the http request
- Type
- Promise
createHook(options, cb) → {Promise}
Add a new hook to the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| options | Object | the configuration describing the new hook | 
| cb | function | will receive the new webhook | 
Returns:
- the promise for the http request
- Type
- Promise
createPullRequest(options, cb) → {Promise}
Create a new pull request
Parameters:
| Name | Type | Description | 
|---|---|---|
| options | Object | the pull request description | 
| cb | function | will receive the new pull request | 
Returns:
- the promise for the http request
- Type
- Promise
createRef(options, cbopt) → {Promise}
Create a reference
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| options | Object | the object describing the ref | |
| cb | Requestable.callback | <optional> | will receive the ref | 
Returns:
- the promise for the http request
- Type
- Promise
createRelease(options, cb) → {Promise}
Create a new release
Parameters:
| Name | Type | Description | 
|---|---|---|
| options | Object | the description of the release | 
| cb | Requestable.callback | will receive the newly created release | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
createTree(tree, baseSHA, cb) → {Promise}
Create a new tree in git
Parameters:
| Name | Type | Description | 
|---|---|---|
| tree | Object | the tree to create | 
| baseSHA | string | the root sha of the tree | 
| cb | Requestable.callback | will receive the new tree that is created | 
Returns:
- the promise for the http request
- Type
- Promise
deleteFile(branch, path, cb) → {Promise}
Delete a file from a branch
Parameters:
| Name | Type | Description | 
|---|---|---|
| branch | string | the branch to delete from, or the default branch if not specified | 
| path | string | the path of the file to remove | 
| cb | function | will receive the commit in which the delete occurred | 
Returns:
- the promise for the http request
- Type
- Promise
deleteHook(id, cb) → {Promise}
Delete a webhook
Parameters:
| Name | Type | Description | 
|---|---|---|
| id | number | the id of the webhook to be deleted | 
| cb | function | will receive true if the call is successful | 
Returns:
- the promise for the http request
- Type
- Promise
deleteRef(ref, cbopt) → {Promise}
Delete a reference
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| ref | string | the name of the ref to delte | |
| cb | Requestable.callback | <optional> | will receive true if the request is successful | 
Returns:
- the promise for the http request
- Type
- Promise
deleteRelease(id, cb) → {Promise}
Delete a release
Parameters:
| Name | Type | Description | 
|---|---|---|
| id | string | the release to be deleted | 
| cb | Requestable.callback | will receive true if the operation is successful | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
deleteRepo(cbopt) → {Promise}
Delete a repository
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| cb | Requestable.callback | <optional> | will receive true if the request is successful | 
Returns:
- the promise for the http request
- Type
- Promise
fork(cb) → {Promise}
Fork a repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | function | will receive the information about the newly created fork | 
Returns:
- the promise for the http request
- Type
- Promise
getBlob(sha, cb) → {Promise}
Get a raw blob from the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| sha | string | the sha of the blob to fetch | 
| cb | Requestable.callback | will receive the blob from the API | 
Returns:
- the promise for the http request
- Type
- Promise
getCollaborators(cb) → {Promise}
List the users who are collaborators on the repository. The currently authenticated user must have push access to use this method
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | function | will receive the list of collaborators | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
getCommit(sha, cb) → {Promise}
Get a commit from the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| sha | string | the sha for the commit to fetch | 
| cb | Requestable.callback | will receive the commit data | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
getContents(ref, path, raw, cb) → {Promise}
Get the contents of a repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| ref | string | the ref to check | 
| path | string | the path containing the content to fetch | 
| raw | boolean | 
 | 
| cb | function | will receive the fetched data | 
Returns:
- the promise for the http request
- Type
- Promise
getContributors(cb) → {Promise}
List the contributors to the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | function | will receive the list of contributors | 
Returns:
- the promise for the http request
- Type
- Promise
getDetails(cb) → {Promise}
Get information about the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | function | will receive the information about the repository | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
getHook(id, cb) → {Promise}
Get a hook for the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| id | number | the id of the webook | 
| cb | function | will receive the details of the webook | 
Returns:
- the promise for the http request
- Type
- Promise
getPullRequest(number, cbopt) → {Promise}
Get information about a specific pull request
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| number | number | the PR you wish to fetch | |
| cb | Requestable.callback | <optional> | will receive the PR from the API | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
getRef(ref, cbopt) → {Promise}
Get a reference
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| ref | string | the reference to get | |
| cb | Requestable.callback | <optional> | will receive the reference's refSpec or a list of refSpecs that match  | 
Returns:
- the promise for the http request
- Type
- Promise
getRelease(id, cb) → {Promise}
Get information about a release
Parameters:
| Name | Type | Description | 
|---|---|---|
| id | strign | the id of the release | 
| cb | Requestable.callback | will receive the release information | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
getSha(branchopt, path, cb) → {Promise}
Get tha sha for a particular object in the repository. This is a convenience function
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| branch | string | <optional> | the branch to look in, or the repository's default branch if omitted | 
| path | string | the path of the file or directory | |
| cb | Requestable.callback | will receive a description of the requested object, including a  | 
Returns:
- the promise for the http request
- Type
- Promise
getTree(treeSHA, cb) → {Promise}
Get a description of a git tree
Parameters:
| Name | Type | Description | 
|---|---|---|
| treeSHA | string | the SHA of the tree to fetch | 
| cb | Requestable.callback | will receive the callback data | 
Returns:
- the promise for the http request
- Type
- Promise
isCollaborator(username, cb) → {Promise}
Check if a user is a collaborator on the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| username | string | the user to check | 
| cb | function | will receive true if the user is a collaborator and false if they are not | 
- Source:
- See:
Returns:
- the promise for the http request {Boolean} [description]
- Type
- Promise
isStarred(cb) → {Promise}
Check if a repository is starred by you
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | Requestable.callback | will receive true if the repository is starred and false if the repository is not starred | 
- Source:
- See:
Returns:
- the promise for the http request {Boolean} [description]
- Type
- Promise
listBranches(cb) → {Promise}
List all the branches for the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | Requestable.callback | will receive the list of branches | 
Returns:
- the promise for the http request
- Type
- Promise
listCommits(optionsopt, cb) → {Promise}
List the commits on a repository, optionally filtering by path, author or time range
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | <optional> | Properties
 | ||||||||||||||||||||||||
| cb | Requestable.callback | will receive the list of commits found matching the criteria | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
listForks(cb) → {Promise}
List a repository's forks
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | function | will receive the list of repositories forked from this one | 
Returns:
- the promise for the http request
- Type
- Promise
listHooks(cb) → {Promise}
List the hooks for the repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | function | will receive the list of hooks | 
Returns:
- the promise for the http request
- Type
- Promise
listPullRequests(options, cbopt) → {Promise}
List the open pull requests on the repository
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| options | Object | options to filter the search | |
| cb | Requestable.callback | <optional> | will receive the list of PRs | 
Returns:
- the promise for the http request
- Type
- Promise
listStatuses(sha, cb) → {Promise}
List the commit statuses for a particular sha, branch, or tag
Parameters:
| Name | Type | Description | 
|---|---|---|
| sha | string | the sha, branch, or tag to get statuses for | 
| cb | Requestable.callback | will receive the list of statuses | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
listTags(cbopt) → {Promise}
List the tags on a repository
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| cb | Requestable.callback | <optional> | will receive the tag data | 
Returns:
- the promise for the http request
- Type
- Promise
star(cb) → {Promise}
Star a repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | Requestable.callback | will receive true if the repository is starred | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
unstar(cb) → {Promise}
Unstar a repository
Parameters:
| Name | Type | Description | 
|---|---|---|
| cb | Requestable.callback | will receive true if the repository is unstarred | 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
updateHead(ref, commitSHA, cb) → {Promise}
Update a ref
Parameters:
| Name | Type | Description | 
|---|---|---|
| ref | string | the ref to update | 
| commitSHA | string | the SHA to point the reference to | 
| cb | function | will receive the updated ref back | 
Returns:
- the promise for the http request
- Type
- Promise
updateHook(id, options, cb) → {Promise}
Edit an existing webhook
Parameters:
| Name | Type | Description | 
|---|---|---|
| id | number | the id of the webhook | 
| options | Object | the new description of the webhook | 
| cb | function | will receive the updated webhook | 
Returns:
- the promise for the http request
- Type
- Promise
updateRelease(id, options, cb) → {Promise}
Edit a release
Parameters:
| Name | Type | Description | 
|---|---|---|
| id | string | the id of the release | 
| options | Object | the description of the release | 
| cb | Requestable.callback | will receive the modified release | 
Returns:
- the promise for the http request
- Type
- Promise
updateTree(baseTreeSHA, path, blobSHA, cb) → {Promise}
Update a tree in Git
Parameters:
| Name | Type | Description | 
|---|---|---|
| baseTreeSHA | string | the SHA of the tree to update | 
| path | string | the path for the new file | 
| blobSHA | string | the SHA for the blob to put at  | 
| cb | Requestable.callback | will receive the new tree that is created | 
- Deprecated:
- use Repository#postTreeinstead
 
- use 
- Source:
- See:
Returns:
- the promise for the http request
- Type
- Promise
writeFile(branch, path, content, message, optionsopt, cb) → {Promise}
Write a file to the repository
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| branch | string | the name of the branch | |||||||||||||||||
| path | string | the path for the file | |||||||||||||||||
| content | string | the contents of the file | |||||||||||||||||
| message | string | the commit message | |||||||||||||||||
| options | Object | <optional> | Properties
 | ||||||||||||||||
| cb | function | will receive the new commit | 
Returns:
- the promise for the http request
- Type
- Promise