Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
bitbucket-rest
Advanced tools
Readme
This is nodejs module to use the functionalities of repository, deploy-keys, service hooks in bitbucket. Bitbucket's native REST API, both version 1 & version 2 are used for appropriate actions.
To install the most recent release from npm, run:
npm install bitbucket-rest
A simple example to create a bitbucket client.
var bitbucket = require('bitbucket-rest');
var client = bitbucket.connectClient({username : 'user', password : 'pass'});
client.getRepoDetails({owner:'owner_name', repo_slug : 'repo_slug'}, function(res){
callback(res);
});
To create a new repository.
client.createRepo(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.name
name of the repository.description
description for the repository.is_private
forking_policy
fork policy values - no_public_forks, allow_forks, no_forkslanguage
has_issues
has_wiki
scm
This returns following object:
{
status : 200,
data : [object]
}
To get complete detail about the repository.
client.getRepoDetails(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.This returns following object:
{
status : 200,
data : [object]
}
To update the details of the repository.
client.updateRepoDetails(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.name
name of the repository.description
description for the repository.is_private
forking_policy
fork policy values - no_public_forks, allow_forks, no_forkslanguage
scm
This returns following object:
{
status : 200,
data : [object]
}
To delete a repository.
client.deleteRepo(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.This returns following object:
{
status : 204,
data : undefined
}
To fork a repository.
client.forkRepo(repo, forkRepo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.Parameters of forkRepo
:
name
name of the repository - REQUIRED.description
description for the repository.is_private
language
scm
This returns following object:
{
status : 200,
data : [object]
}
To get list of forks of a repository.
client.getRepoForks(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.This returns following object:
{
status : 200,
data : [object]
}
To get branches of the repository.
client.getRepoBranches(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.This returns following object:
{
status : 200,
data : [object]
}
To get the main branch of a repository.
client.getRepoMainBranch(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.This returns following object:
{
status : 200,
data : [object]
}
To add deployment keys to a repository.
client.addRepoDeployKey(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.label
label to represent the keykey
RSA key generated by ssh keygen - REQUIREDThis returns following object:
{
status : 200,
data : [object]
}
To get deployment keys of a repository.
client.getRepoDeployKeys(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.This returns following object:
{
status : 200,
data : [object]
}
To get the content of a deployment key of a repository.
client.getRepoDeployKeyContent(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.pk
key_id of the deployment-key - REQUIRED.This returns following object:
{
status : 200,
data : [object]
}
To delete a deployment key of a repository.
client.deleteRepoDeployKey(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.pk
key_id of the deployment-key - REQUIRED.This returns following object:
{
status : 204,
data : undefined
}
To add a hook service to a repository.
client.addRepoHook(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.type
hook type ex.POST (case sensitive)URL
service url for which accepts post hook.This returns following object:
{
status : 200,
data : [object]
}
To get the list of hook services of a repository.
client.getRepoHooks(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.This returns following object:
{
status : 200,
data : [object]
}
To get the content of a single hook service of a repository.
client.getRepoHookContent(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.id
hook service id - REQUIRED.This returns following object:
{
status : 200,
data : [object]
}
To update a hook service of a repository.
client.updateRepoHook(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.id
hook service id - REQUIRED.URL
service url for which accepts post hook.This returns following object:
{
status : 200,
data : [object]
}
To delete a hook service of a repository.
client.deleteRepoHook(repo, callback)
Parameters of repo
:
owner
owner of the repository - REQUIRED.repo_slug
slug of the repository - REQUIRED.id
hook service id - REQUIRED.This returns following object:
{
status : 204,
data : undefined
}
FAQs
A package to access the BitBucket REST API.
The npm package bitbucket-rest receives a total of 3 weekly downloads. As such, bitbucket-rest popularity was classified as not popular.
We found that bitbucket-rest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.