node-bitbucket-v2
node.js library to access the Bitbucket API v2
usage
Not supported for Node < 7.6
const Bitbucket = require('node-bitbucket-v2');
const bitbucketApi = new Bitbucket(options);
bitbucketApi.authenticateOAuth2(accessTokenString);
bitbucketApi.user.get().then(({ body }) => {
console.log(body.uuid);
});
options
It is not necessary to provide any options at all (Bitbucket
can be constructed with no argument).
useXhr
(Boolean
): If true
, requests will be made using XMLHttpRequest. This is only available in a web browser, and will fail otherwise. This can be very useful in Electron for automatically resolving proxies and custom SSL certificates.proxy
(String
): Defines a proxy to make requests against, instead of api.bitbucket.org:443
. This option is ignored when useXhr
is active.
For implemented methods, check bitbucket/repositories.js
and bitbucket/user.js
.
0.5.1
This version is targeted at two main goals:
- Bitbucket's breaking API changes (migrating from users and teams to "workspaces"), in order to comply with GDPR. For more details, see: https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-workspaces/
- Modernizing the code from node-callbacks to promises.
Due to the aforementioned breaking changes on Bitbucket's end, usage of previous versions of this package will stop working in general after 2020-04-29, except for a few basic uses like getting the authenticated user.
- Started CHANGELOG document.
- Added Node 7.6 requirement.
- All asynchronous functions now return a promise, and no longer accept a callback.
- On success, the old response will now be packed inside a
body
property, and it now has a sibling statusCode
property. - On errors that result from API responses, the response body will now be on a property called
body
(instead of msg
), and status
has been renamed to statusCode
. - When
useXhr
is enabled, the entire XHR response will now be provided on both success and failure. Note that this is consistent with the body
and statusCode
properties previously described. repositories.getByUser
and repositories.getByTeam
have been merged to repositories.getByWorkspace
.teams.get
has been removed.workspaces.get
has been added.- Fixed a bug where double JSON parsing would cause parsing to throw an error. Thanks to @mateusmcg for the fix!