UNPKG

@atlassian/bitbucket-server

Version:

Bitbucket Server API client for Browser and Node.js

69 lines (49 loc) 1.34 kB
# bitbucket-server.js Bitbucket Server API client for Browser and Node.js This is a port of the excellent bitbucket library by Munif Tanjim: [https://github.com/MunifTanjim/node-bitbucket](https://github.com/MunifTanjim/node-bitbucket) Bitbucket Server API docs: [https://docs.atlassian.com/bitbucket-server/rest/latest/bitbucket-rest.html](https://docs.atlassian.com/bitbucket-server/rest/latest/bitbucket-rest.html) ## Installation via **npm**: ```sh $ npm install @atlassian/bitbucket-server --save ``` via **yarn**: ```sh $ yarn add @atlassian/bitbucket-server ``` ## Usage ### Node ```js const BitbucketServer = require('@atlassian/bitbucket-server') const BitbucketServer = new BitbucketServer() ``` #### Client Options You can set the APIs' `baseUrl` and modify some behaviors (e.g. request timeout etc.) by passing a clientOptions object to the `BitbucketServer` constructor. ```js const clientOptions = { baseUrl: 'https://<server base url>', headers: {}, options: { timeout: 10 } } const client = new BitbucketServer(clientOptions) ``` This enables you to use the client with Bitbucket Server. #### Authentication Basic ```js client.authenticate({ type: 'basic', username: 'username', password: 'password' }) ``` OAuth ```js client.authenticate({ type: 'token', token: 'access token' }) ```