Bitbucket Data Center API Client
    Preparing search index...

    Class RepositoryResource

    Represents a Bitbucket repository resource with chainable async methods.

    Implements PromiseLike<BitbucketRepository> so it can be awaited directly to fetch repository info, while also exposing sub-resource methods.

    // Await directly to get repository info
    const repo = await bbClient.project('PROJ').repo('my-repo');

    // Get pull requests
    const prs = await bbClient.project('PROJ').repo('my-repo').pullRequests({ state: 'OPEN' });

    // Navigate into a specific pull request
    const activities = await bbClient.project('PROJ').repo('my-repo').pullRequest(42).activities();

    // Get commits
    const commits = await bbClient.project('PROJ').repo('my-repo').commits({ limit: 10 });

    Implements

    Index

    Methods

    • Browses the contents of a directory or file in this repository.

      GET /rest/api/latest/projects/{key}/repos/{slug}/browse/{srcPath}

      Parameters

      • OptionalsrcPath: string

        Path to browse (e.g., 'src' or 'src/index.ts'). Omit to browse the root.

      • Optionalparams: BrowseParams

        Optional: at (branch/tag/commit), type, blame, noContent, limit, start

      Returns Promise<BitbucketBrowseResponse>

      The browse response with path info and children

    • Fetches the raw content of a file in this repository.

      GET /rest/api/latest/projects/{key}/repos/{slug}/raw/{path}

      Parameters

      • filePath: string

        Path to the file (e.g., 'src/index.ts')

      • Optionalparams: RawFileParams

        Optional: at (branch, tag, or commit SHA)

      Returns Promise<string>

      The raw file content as a string

    • Fetches the pull-request settings for this repository.

      GET /rest/api/latest/projects/{key}/repos/{slug}/settings/pull-requests

      Returns Promise<BitbucketRepositorySettings>

      The repository pull-request settings object

    • Fetches tags associated with a list of commits.

      POST /rest/api/latest/projects/{key}/repos/{slug}/tags

      Parameters

      • commits: string[]

        Array of commit SHAs to look up tags for

      • Optionaloptions: { apiPath?: string }

        Optional overrides (e.g. apiPath to target a different API version)

      Returns Promise<PagedResponse<BitbucketTag>>

      A paged response of tags