|
3 | 3 | [](https://github.com/coderabbitai/bitbucket/actions/workflows/node.js.yaml) [](https://github.com/coderabbitai/bitbucket/actions/workflows/dependabot/dependabot-updates) [](https://github.com/coderabbitai/bitbucket/actions/workflows/github-pages.yaml)
|
4 | 4 |
|
5 | 5 | CodeRabbit's TypeScript API client for connecting to Bitbucket Cloud and Bitbucker Data Center.
|
| 6 | + |
| 7 | +- Bitbucket Cloud API docs: <https://developer.atlassian.com/cloud/bitbucket/rest> |
| 8 | +- Bitbucket Data Center API docs: <https://developer.atlassian.com/server/bitbucket/rest> |
| 9 | + |
| 10 | +This client is auto-generated by [https://github.com/openapi-ts/openapi-typescript](https://github.com/openapi-ts/openapi-typescript/tree/main/packages/openapi-typescript) using the OpenAPI schema from the documentation above. |
| 11 | + |
| 12 | +## Usage |
| 13 | + |
| 14 | +```sh |
| 15 | +pnpm i @coderabbitai/bitbucket |
| 16 | +``` |
| 17 | + |
| 18 | +### Cloud |
| 19 | + |
| 20 | +```ts |
| 21 | +import { createBitbucketCloudClient } from "@coderabbitai/bitbucket" |
| 22 | +import { |
| 23 | + BITBUCKET_CLOUD_APP_PASSWORD, |
| 24 | + BITBUCKET_CLOUD_URL, |
| 25 | + BITBUCKET_CLOUD_USERNAME, |
| 26 | +} from "./env.js" |
| 27 | + |
| 28 | +const basic = Buffer.from( |
| 29 | + BITBUCKET_CLOUD_USERNAME + ":" + BITBUCKET_CLOUD_APP_PASSWORD, |
| 30 | +).toString("base64") |
| 31 | + |
| 32 | +export const cloud = createBitbucketCloudClient({ |
| 33 | + baseUrl: BITBUCKET_CLOUD_URL, |
| 34 | + headers: { Accept: "application/json", Authorization: `Basic ${basic}` }, |
| 35 | +}) |
| 36 | +``` |
| 37 | + |
| 38 | +### Server |
| 39 | + |
| 40 | +```ts |
| 41 | +import { createBitbucketServerClient } from "@coderabbitai/bitbucket" |
| 42 | +import { BITBUCKET_SERVER_TOKEN, BITBUCKET_SERVER_URL } from "./env.js" |
| 43 | + |
| 44 | +export const server = createBitbucketServerClient({ |
| 45 | + baseUrl: BITBUCKET_SERVER_URL, |
| 46 | + headers: { |
| 47 | + Accept: "application/json", |
| 48 | + Authorization: `Bearer ${BITBUCKET_SERVER_TOKEN}`, |
| 49 | + }, |
| 50 | +}) |
| 51 | +``` |
0 commit comments