Socket
Socket
Sign inDemoInstall

bitbucket-api

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bitbucket-api

A package to access the BitBucket Api.


Version published
Maintainers
1
Install size
26.2 kB
Created

Readme

Source

Intro

A very simple to use library to hook into the BitBucket api. At the moment it covers issues and all related objects + getting a list of repositories and a single one. The Api is in flux and you should expect changes coming in the future.

Usage

var bitbucket = require('node-bitbucket-api');
var credentials = {username: 'USER', password: 'PWD'};
var client = bitbucket.createClient(credentials);
var repository = client.getRepository({slug: 'SLUG', owner: 'OWNER'}, function (err, repo) {
   //Code to access the repo object.
});

Api

createClient

Takes an object with a username and a password keys Returns a BitBucket object

var bitbucket = require('node-bitbucket-api');
var credentials = {username: 'USER', password: 'PWD'};
var client = bitbucket.createClient(credentials);

BitBucket

Instance properties
username // The username passed to the createClient function.
password // The password passed to the createClient function.
root     // The root for the bitbucket api, defaults to 'api.bitbucket.org'
version  // The version for the bitbucket api, defaults to '1.0s'
Instance methods
credentials() // returns 'username:password'
getUrl()    // Builds the first part of the URL to connect to the bitbucket api
Prototype methods
repositories(cb)

Takes a callback of the form `cb(err, result) result is an array of the repositories the user has access to.

getRepository(options, cb)

Takes an option parameter with the owner and slug keys for the repository to get. To get details for the repository of this module the owner will be hgarcia and the slug will be node-bitbucket-api.

The call back takes the for of cb(err, repo) where repo is a Repository object.

Repository

Instance properties

This are mapped from the api result into a more proper JavaScript format, mostly replacing '_' with camelcase names.

provider // A reference to the BitBucket instance that created it.
scm // String either 'git' or 'mercurial'
hasWiki // Boolean
lastUpdated // Date
creator // String username of the person who created the repository
forksCount // Number
createdOn // Date
owner // String username of the repository owner
logo // String || null
emailMailingList //String
isMq // Boolean
size // Number
readOnly // Boolean
forkOff // String || null
mqOf // String || null;
followersCount // Number
state // String
utcCreatedOn // Date
website // String
description // String
hasIssuses // Boolean
isFork // Boolean
slug // String
isPrivate // Boolean
name // String
language // String ex: 'javascript'
utcLastUpdated // Date
emailWriters // Boolean
noPublicForks // Boolean
resourceURI // String
Instance methods
credentials() // delegates to this.provider.credentials()
getUrl()    // Builds the URL to connect to this repository
Prototype methods
issues()

Returns an `Issues object

issue(Id)

Takes the id of an issue and returns an Issue object.

milestones()

Returns a `Milestones object

versions()

Returns a `Versions object

components()

Returns a `Components object

Milestones, Versions, Components

They share the same api with four standard methods.

Instance methods
create(name, cb)

Takes a string as the name for the new object and a callback; The callback takes the form `cb(err, obj) where obj is a literal with the data for the newly created object with the id.

getById(id, cb)

Takes the id of the object to get and a callback. The callback takes the form `cb(err, obj) where obj is a literal with the data for the requested object.

getAll(cb)

Takes a callback of the form `cb(err, results) where results is an array with all the objects of that type in the repository.

update(id, name, cb)

Takes the id of the object, a string as the new name for the object and a callback. The callback takes the form `cb(err, obj) where obj is a literal with the data for the modified object.

remove(id, cb)

Takes the id of the object to remove and a callback. The callback takes the form cb(err, result) where result contains a boolean success key.

FAQs

Last updated on 03 Sep 2012

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc