@sleavely/bitbucket
v1.0.0
Published
Client and utils for Bitbucket Cloud REST APIs
Downloads
8
Maintainers
Readme
@sleavely/bitbucket
API client and collection of common utility methods for managing Bitbucket Cloud via their REST API.
Usage
npm install @sleavely/bitbucket
import { BitbucketClient } from '@sleavely/bitbucket'
const bitbucket = new BitbucketClient({
auth: {
username: 'foobar',
password: 'secret', // Create an app password: https://bitbucket.org/account/settings/app-passwords/
},
})
console.log(await bitbucket.getCurrentUser())
FAQ
The response type for xyz is wrong
The initial types were handcrafted according to the Bitbucket Cloud REST API reference which in turn are likely autogenerated from their OpenAPI schema. Unfortunately their schema in many cases differs from reality, so discrepancies will occur from time to time. Let me know in an issue (or pull request) and I'll do my best to amend it.
A feature I need is missing!
I've only added utility methods for things I've personally needed in the past, but I'd be happy to add more. In the meantime the public client
property acts as an escape hatch to the got
instance:
// List branches and tags without the need for helper utils.
await bitbucket.client('/repositories/{workspace}/{repo_slug}/refs')
.json<unknown>()
// or simply `.json()`