Movatterモバイル変換


[0]ホーム

URL:


Repository

Repository

Respository encapsulates the functionality to create, query, and modify files.

Constructor

new Repository(fullname, authopt, apiBaseopt)

Create a Repository.

Parameters:
NameTypeAttributesDefaultDescription
fullnamestring

the full name of the repository

authRequestable.auth <optional>

information required to authenticate to Github

apiBasestring <optional>
https://api.github.com

the base Github API URL

Source:

Methods

_getContentObject(content) → {Object}

Get the object that represents the provided content

Parameters:
NameTypeDescription
contentstring|Buffer|Blob

the content to send to the server

Source:
Returns:

the representation ofcontent for the GitHub API

Type
Object

commit(parent, tree, message, cb) → {Promise}

Add a commit to the repository

Parameters:
NameTypeDescription
parentstring

the SHA of the parent commit

treestring

the SHA of the tree for this commit

messagestring

the commit message

cbRequestable.callback

will receive the commit that is created

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

compareBranches(base, head, cb) → {Promise}

Compare two branches/commits/repositories

Parameters:
NameTypeDescription
basestring

the base commit

headstring

the head commit

cbRequestable.callback

will receive the comparison

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

createBlob(content, cb) → {Promise}

Create a blob

Parameters:
NameTypeDescription
contentstring|Buffer|Blob

the content to add to the repository

cbRequestable.callback

will receive the details of the created blob

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

createBranch(oldBranchopt, newBranch, cb) → {Promise}

Create a new branch from an existing branch.

Parameters:
NameTypeAttributesDefaultDescription
oldBranchstring <optional>
master

the name of the existing branch

newBranchstring

the name of the new branch

cbRequestable.callback

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:
NameTypeDescription
optionsObject

the configuration describing the new hook

cbRequestable.callback

will receive the new webhook

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

createKey(options, cb) → {Promise}

Add a new deploy key to the repository

Parameters:
NameTypeDescription
optionsObject

the configuration describing the new deploy key

cbRequestable.callback

will receive the new deploy key

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

createProject(options, cb) → {Promise}

Create a new project

Parameters:
NameTypeDescription
optionsObject

the description of the project

cbRequestable.callback

will receive the newly created project

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

createPullRequest(options, cb) → {Promise}

Create a new pull request

Parameters:
NameTypeDescription
optionsObject

the pull request description

cbRequestable.callback

will receive the new pull request

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

createRef(options, cbopt) → {Promise}

Create a reference

Parameters:
NameTypeAttributesDescription
optionsObject

the object describing the ref

cbRequestable.callback <optional>

will receive the ref

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

createRelease(options, cb) → {Promise}

Create a new release

Parameters:
NameTypeDescription
optionsObject

the description of the release

cbRequestable.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:
NameTypeDescription
treeObject

the tree to create

baseSHAstring

the root sha of the tree

cbRequestable.callback

will receive the new tree that is created

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

deleteFile(branch, path, cb) → {Promise}

Delete a file from a branch

Parameters:
NameTypeDescription
branchstring

the branch to delete from, or the default branch if not specified

pathstring

the path of the file to remove

cbRequestable.callback

will receive the commit in which the delete occurred

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

deleteHook(id, cb) → {Promise}

Delete a webhook

Parameters:
NameTypeDescription
idnumber

the id of the webhook to be deleted

cbRequestable.callback

will receive true if the call is successful

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

deleteKey(id, cb) → {Promise}

Delete a deploy key

Parameters:
NameTypeDescription
idnumber

the id of the deploy key to be deleted

cbRequestable.callback

will receive true if the call is successful

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

deleteRef(ref, cbopt) → {Promise}

Delete a reference

Parameters:
NameTypeAttributesDescription
refstring

the name of the ref to delte

cbRequestable.callback <optional>

will receive true if the request is successful

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

deleteRelease(id, cb) → {Promise}

Delete a release

Parameters:
NameTypeDescription
idstring

the release to be deleted

cbRequestable.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:
NameTypeAttributesDescription
cbRequestable.callback <optional>

will receive true if the request is successful

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

fork(cb) → {Promise}

Fork a repository

Parameters:
NameTypeDescription
cbRequestable.callback

will receive the information about the newly created fork

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getBlob(sha, cb) → {Promise}

Get a raw blob from the repository

Parameters:
NameTypeDescription
shastring

the sha of the blob to fetch

cbRequestable.callback

will receive the blob from the API

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getBranch(branch, cb) → {Promise}

Get a single branch

Parameters:
NameTypeDescription
branchstring

the name of the branch to fetch

cbRequestable.callback

will receive the branch from the API

Source:
See:
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 havepush access to use this method

Parameters:
NameTypeDescription
cbRequestable.callback

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:
NameTypeDescription
shastring

the sha for the commit to fetch

cbRequestable.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:
NameTypeDescription
refstring

the ref to check

pathstring

the path containing the content to fetch

rawboolean

true if the results should be returned raw instead of GitHub's normalized format

cbRequestable.callback

will receive the fetched data

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getContributors(cb) → {Promise}

List the contributors to the repository

Parameters:
NameTypeDescription
cbRequestable.callback

will receive the list of contributors

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getContributorStats(cb) → {Promise}

List the contributor stats to the repository

Parameters:
NameTypeDescription
cbRequestable.callback

will receive the list of contributors

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getDetails(cb) → {Promise}

Get information about the repository

Parameters:
NameTypeDescription
cbRequestable.callback

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:
NameTypeDescription
idnumber

the id of the webook

cbRequestable.callback

will receive the details of the webook

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getKey(id, cb) → {Promise}

Get a deploy key for the repository

Parameters:
NameTypeDescription
idnumber

the id of the deploy key

cbRequestable.callback

will receive the details of the deploy key

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getPullRequest(number, cbopt) → {Promise}

Get information about a specific pull request

Parameters:
NameTypeAttributesDescription
numbernumber

the PR you wish to fetch

cbRequestable.callback <optional>

will receive the PR from the API

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getReadme(ref, raw, cb) → {Promise}

Get the README of a repository

Parameters:
NameTypeDescription
refstring

the ref to check

rawboolean

true if the results should be returned raw instead of GitHub's normalized format

cbRequestable.callback

will receive the fetched data

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getRef(ref, cbopt) → {Promise}

Get a reference

Parameters:
NameTypeAttributesDescription
refstring

the reference to get

cbRequestable.callback <optional>

will receive the reference's refSpec or a list of refSpecs that matchref

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getRelease(id, cb) → {Promise}

Get information about a release

Parameters:
NameTypeDescription
idstring

the id of the release

cbRequestable.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:
NameTypeAttributesDescription
branchstring <optional>

the branch to look in, or the repository's default branch if omitted

pathstring

the path of the file or directory

cbRequestable.callback

will receive a description of the requested object, including aSHA property

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getSingleCommit(ref, cb) → {Promise}

Gets a single commit information for a repository

Parameters:
NameTypeDescription
refstring

the reference for the commit-ish

cbRequestable.callback

will receive the commit information

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

getTree(treeSHA, cb) → {Promise}

Get a description of a git tree

Parameters:
NameTypeDescription
treeSHAstring

the SHA of the tree to fetch

cbRequestable.callback

will receive the callback data

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

isCollaborator(username, cb) → {Promise}

Check if a user is a collaborator on the repository

Parameters:
NameTypeDescription
usernamestring

the user to check

cbRequestable.callback

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:
NameTypeDescription
cbRequestable.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:
NameTypeDescription
cbRequestable.callback

will receive the list of branches

Source:
See:
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:
NameTypeAttributesDescription
optionsObject <optional>

the filtering options for commits

Properties
NameTypeAttributesDescription
shastring <optional>

the SHA or branch to start from

pathstring <optional>

the path to search on

authorstring <optional>

the commit author

sinceDate|string <optional>

only commits after this date will be returned

untilDate|string <optional>

only commits before this date will be returned

cbRequestable.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:
NameTypeDescription
cbRequestable.callback

will receive the list of repositories forked from this one

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

listHooks(cb) → {Promise}

List the hooks for the repository

Parameters:
NameTypeDescription
cbRequestable.callback

will receive the list of hooks

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

listKeys(cb) → {Promise}

List the deploy keys for the repository

Parameters:
NameTypeDescription
cbRequestable.callback

will receive the list of deploy keys

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

listProjects(cbopt) → {Promise}

Get information about all projects

Parameters:
NameTypeAttributesDescription
cbRequestable.callback <optional>

will receive the list of projects

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

listPullRequestFiles(number, cbopt) → {Promise}

List the files of a specific pull request

Parameters:
NameTypeAttributesDescription
numbernumber|string

the PR you wish to fetch

cbRequestable.callback <optional>

will receive the list of files from the API

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

listPullRequests(options, cbopt) → {Promise}

List the open pull requests on the repository

Parameters:
NameTypeAttributesDescription
optionsObject

options to filter the search

cbRequestable.callback <optional>

will receive the list of PRs

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

listReleases(cb) → {Promise}

Get information about all releases

Parameters:
NameTypeDescription
cbRequestable.callback

will receive the release information

Source:
See:
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:
NameTypeDescription
shastring

the sha, branch, or tag to get statuses for

cbRequestable.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:
NameTypeAttributesDescription
cbRequestable.callback <optional>

will receive the tag data

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

mergePullRequest(number, options, cbopt) → {Promise}

Merge a pull request

Parameters:
NameTypeAttributesDescription
numbernumber|string

the number of the pull request to merge

optionsObject

the merge options for the pull request

cbRequestable.callback <optional>

will receive the merge information if the operation is successful

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

move(branch, oldPath, newPath, cb) → {Promise}

Change all references in a repo from oldPath to new_path

Parameters:
NameTypeDescription
branchstring

the branch to carry out the reference change, or the default branch if not specified

oldPathstring

original path

newPathstring

new reference path

cbRequestable.callback

will receive the commit in which the move occurred

Source:
Returns:
  • the promise for the http request
Type
Promise

star(cb) → {Promise}

Star a repository

Parameters:
NameTypeDescription
cbRequestable.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:
NameTypeDescription
cbRequestable.callback

will receive true if the repository is unstarred

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

updateHead(ref, commitSHA, force, cb) → {Promise}

Update a ref

Parameters:
NameTypeDescription
refstring

the ref to update

commitSHAstring

the SHA to point the reference to

forceboolean

indicates whether to force or ensure a fast-forward update

cbRequestable.callback

will receive the updated ref back

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

updateHook(id, options, cb) → {Promise}

Edit an existing webhook

Parameters:
NameTypeDescription
idnumber

the id of the webhook

optionsObject

the new description of the webhook

cbRequestable.callback

will receive the updated webhook

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

updatePullRequest(number, options, cbopt) → {Promise}

Update a pull request

Parameters:
NameTypeAttributesDescription
numbernumber|string

the number of the pull request to update

optionsObject

the pull request description

cbRequestable.callback <optional>

will receive the pull request information

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

updateRelease(id, options, cb) → {Promise}

Edit a release

Parameters:
NameTypeDescription
idstring

the id of the release

optionsObject

the description of the release

cbRequestable.callback

will receive the modified release

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

updateRepository(options, cb) → {Promise}

Update repository information

Parameters:
NameTypeDescription
optionsobject

New parameters that will be set to the repository

Properties
NameTypeAttributesDescription
namestring

Name of the repository

descriptionstring <optional>

A short description of the repository

homepagestring <optional>

A URL with more information about the repository

privateboolean <optional>

Either true to make the repository private, or false to make it public.

has_issuesboolean <optional>

Either true to enable issues for this repository, false to disable them.

has_wikiboolean <optional>

Either true to enable the wiki for this repository, false to disable it.

has_downloadsboolean <optional>

Either true to enable downloads, false to disable them.

default_branchstring <optional>

Updates the default branch for this repository.

cbRequestable.callback

will receive the updated repository back

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

updateStatus(commitSHA, options, cb) → {Promise}

Update commit status

Parameters:
NameTypeDescription
commitSHAstring

the SHA of the commit that should be updated

optionsobject

Commit status parameters

Properties
NameTypeAttributesDescription
statestring

The state of the status. Can be one of: pending, success, error, or failure.

target_urlstring <optional>

The target URL to associate with this status.

descriptionstring <optional>

A short description of the status.

contextstring <optional>

A string label to differentiate this status among CI systems.

cbRequestable.callback

will receive the updated commit back

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

updateTree(baseTreeSHA, path, blobSHA, cb) → {Promise}

Update a tree in Git

Parameters:
NameTypeDescription
baseTreeSHAstring

the SHA of the tree to update

pathstring

the path for the new file

blobSHAstring

the SHA for the blob to put atpath

cbRequestable.callback

will receive the new tree that is created

Deprecated:
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:
NameTypeAttributesDescription
branchstring

the name of the branch

pathstring

the path for the file

contentstring

the contents of the file

messagestring

the commit message

optionsObject <optional>

commit options

Properties
NameTypeAttributesDescription
authorObject <optional>

the author of the commit

commiterObject <optional>

the committer

encodeboolean <optional>

true if the content should be base64 encoded

cbRequestable.callback

will receive the new commit

Source:
See:
Returns:
  • the promise for the http request
Type
Promise


[8]ページ先頭

©2009-2025 Movatter.jp