Socket
Socket
Sign inDemoInstall

bitbucket

Package Overview
Dependencies
11
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bitbucket

Bitbucket API client for Browser and Node.js


Version published
Weekly downloads
21K
decreased by-3.62%
Maintainers
1
Install size
1.05 MB
Created
Weekly downloads
 

Changelog

Source

[2.11.0] - 2023-03-08

  • Generate from latest API Specification

Readme

Source

version:@latest Documentation License

Bitbucket.js

Bitbucket API client for Browser and Node.js

Bitbucket API docs: https://api.bitbucket.org


BITBUCKET CLOUD API LATEST UPDATES: https://developer.atlassian.com/cloud/bitbucket


Installation

via npm:

$ npm install --save bitbucket

via yarn:

$ yarn add bitbucket

Usage

Browser

<script src="https://unpkg.com/bitbucket/lib/index.umd.js"></script>
<script>
  const bitbucket = new Bitbucket()
</script>

Node

const { Bitbucket } = require('bitbucket')

const bitbucket = new Bitbucket()
Client Options

You can set the APIs' baseUrl and modify some behaviors (e.g. request timeout etc.) by passing a clientOptions object to the Bitbucket constructor.

const clientOptions = {
  baseUrl: 'https://api.bitbucket.org/2.0',
  request: {
    timeout: 10,
  },
}

const bitbucket = new Bitbucket(clientOptions)
Authentication

Using username and password:

const clientOptions = {
  auth: {
    username: 'username',
    password: 'password',
  },
}

const bitbucket = new Bitbucket(clientOptions)

Using token:

const clientOptions = {
  auth: {
    token: 'abcdef123456',
  },
}

const bitbucket = new Bitbucket(clientOptions)
API Methods

async/await

try {
  const { data, headers, status, url } = await bitbucket.<namespace>.<api>({ ...params })
} catch (err) {
  const { message, error, headers, request, status } = err
}

Promise

bitbucket.<namespace>
  .<api>({ ...params })
  .then(({ data, headers, status, url }) => {})
  .catch(({ message, error, headers, request, status }) => {})

Notes:

  • <namespace> is one of the Namespace Names
  • <api> is one of the API Names
Namespace Names

branching_model, branchrestrictions, commits, commitstatuses, deploy, deployments, downloads, hook_events, issue_tracker, pipelines, projects, pullrequests, refs, repositories, search, snippet, snippets, source, ssh, teams, user, users, webhooks

API Names

Check API client docs: https://bitbucketjs.netlify.com

Examples
bitbucket.repositories
  .listGlobal({})
  .then(({ data }) => console.log(data.values))
  .catch((err) => console.error(err))

Acknowledgement

This API client is heavily inspired by the octokit/rest.js and a lot of ideas are taken from there. So, thanks goes to the maintainer Gregor Martynus and all the awesome contributors of octokit/rest.js.

License

Licensed under the MIT License. Check the LICENSE file for details.

Keywords

FAQs

Last updated on 08 Mar 2023

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