GithubHelp home page GithubHelp logo

silverfoxa / node-bitbucket Goto Github PK

View Code? Open in Web Editor NEW

This project forked from muniftanjim/node-bitbucket

0.0 0.0 0.0 1.35 MB

Bitbucket API client for Browser and Node.js

Home Page: https://bitbucketjs.netlify.com

License: MIT License

JavaScript 95.82% HTML 4.18%

node-bitbucket's Introduction

version:@latest Documentation License

Bitbucket.js

Bitbucket API client for Browser and Node.js

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


BITBUCKET CLOUD API CHANGING NOTICE: https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-gdpr
BITBUCKET CLOUD API MIGRATION GUIDE: https://developer.atlassian.com/cloud/bitbucket/bbc-gdpr-api-migration-guide
BITBUCKET CLOUD API REPO URL CHANGE: https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-workspaces

BREAKING CHANGES FOR API NAME: Unfortunately, API Name changes were published on the following minor version updates: v1.8.0, v1.9.0, v1.10.0. This type of changes won't happen again for minor version updates anymore.


Installation

via npm:

$ npm install bitbucket --save

via yarn:

$ yarn add bitbucket

Usage

Browser

<script src="https://unpkg.com/bitbucket/dist/bitbucket.min.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',
  headers: {},
  options: {
    timeout: 10
  }
}

const bitbucket = new Bitbucket(clientOptions)

Authentication

bitbucket.authenticate({
  type: 'basic',
  username: 'username',
  password: 'password'
})

API Methods

async/await

try {
  let { data, headers } = await bitbucket.<namespace>.<api>({ ...params })
} catch (err) {}

Promise

bitbucket.<namespace>
  .<api>({ ...params })
  .then(({ data, headers }) => {})
  .catch(err => {})

Callback

bitbucket.<namespace>.<api>({ ...params }, (err, { data, headers }) => {})

Notes:

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

Namespace Names

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

API Names

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

Examples
bitbucket.repositories
  .list({ username: 'MunifTanjim' })
  .then(({ data, headers }) => 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.

node-bitbucket's People

Contributors

alexivkin avatar bbathel13 avatar dependabot[bot] avatar folofse avatar jdoklovic avatar kirill89 avatar muniftanjim avatar prkb avatar rundquist avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.