bitbucket-rest v0.0.1
Bitbucket Nodejs Library
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.
Install
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);
});
Documentation
Create New Repository
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]
}
Get Repository Details
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]
}
Update Repository Details
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]
}
Delete a Repository
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
}
Fork a Repository
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]
}
Get Fork List
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]
}
Get Branches
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]
}
Get Main Branch
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]
}
Add Deployment-Key
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 - REQUIRED
This returns following object:
{
status : 200,
data : [object]
}
Get Deployment-Keys
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]
}
Get Content of a Deployment-Key
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]
}
Delete a Deployment-Key
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
}
Add Hook Service
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]
}
Get Hook Services
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]
}
Get Content of a Hook Service
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]
}
Update of a Hook Service
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]
}
Delete Content of a Hook Service
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
}
10 years ago