CodeRabbit's TypeScript API client for connecting to Bitbucket Cloud and Bitbucket Data Center.
- Bitbucket Cloud API docs: https://developer.atlassian.com/cloud/bitbucket/rest
- Bitbucket Data Center API docs: https://developer.atlassian.com/server/bitbucket/rest
This client is auto-generated by openapi-typescript using the OpenAPI schema from the documentation above.
pnpm add @coderabbitai/bitbucketYou can use the native openapi-fetch client or the BitbucketCloudClient class.
import{createBitbucketCloudClient}from"@coderabbitai/bitbucket/cloud"import{toBase64}from"@coderabbitai/bitbucket"import{BITBUCKET_CLOUD_APP_PASSWORD,BITBUCKET_CLOUD_URL,BITBUCKET_CLOUD_USERNAME,}from"./env.js"constbasic=toBase64(BITBUCKET_CLOUD_USERNAME+":"+BITBUCKET_CLOUD_APP_PASSWORD,)constclient=createBitbucketCloudClient({baseUrl: BITBUCKET_CLOUD_URL.toString(),headers: {Accept: "application/json",Authorization: `Basic ${basic}`},})The BitbucketCloudClient wraps openapi-fetch requests by using the schema's operationId as method names.
import{BitbucketCloudClient}from"@coderabbitai/bitbucket/cloud"import{toBase64}from"@coderabbitai/bitbucket"import{BITBUCKET_CLOUD_APP_PASSWORD,BITBUCKET_CLOUD_URL,BITBUCKET_CLOUD_USERNAME,}from"./env.js"constbasic=toBase64(BITBUCKET_CLOUD_USERNAME+":"+BITBUCKET_CLOUD_APP_PASSWORD,)constclient=newBitbucketCloudClient({baseUrl: BITBUCKET_CLOUD_URL.toString(),headers: {Accept: "application/json",Authorization: `Basic ${basic}`},})You can use the native openapi-fetch client or the BitbucketServerClient class.
import{createBitbucketServerClient}from"@coderabbitai/bitbucket/server"import{BITBUCKET_SERVER_TOKEN,BITBUCKET_SERVER_URL}from"./env.js"constclient=createBitbucketServerClient({baseUrl: BITBUCKET_SERVER_URL,headers: {Accept: "application/json",Authorization: `Bearer ${BITBUCKET_SERVER_TOKEN}`,},})The BitbucketServerClient wraps openapi-fetch requests by using the schema's operationId as method names.
import{BitbucketServerClient}from"@coderabbitai/bitbucket/server"import{BITBUCKET_SERVER_TOKEN,BITBUCKET_SERVER_URL}from"./env.js"constclient=newBitbucketServerClient({baseUrl: BITBUCKET_SERVER_URL,headers: {Accept: "application/json",Authorization: `Bearer ${BITBUCKET_SERVER_TOKEN}`,},})