Bitbucket Data Center API Client
    Preparing search index...

    Class ProjectResource

    Represents a Bitbucket project resource with chainable async methods.

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

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

    // Get repositories with filters
    const repos = await bbClient.project('PROJ').repos({ limit: 50, name: 'api' });

    // Navigate into a specific repository
    const prs = await bbClient.project('PROJ').repo('my-repo').pullRequests();

    // Get users with access to the project
    const users = await bbClient.project('PROJ').users({ permission: 'PROJECT_WRITE' });

    Implements

    Index

    Methods

    • Creates a ref restriction (branch permission) on this project.

      POST /rest/branch-permissions/latest/projects/{key}/restrictions

      Parameters

      Returns Promise<BitbucketRefRestriction>

      The created restriction

      Sends a single restriction as application/json. The endpoint also supports bulk creation of several restrictions in one call with the application/vnd.atl.bitbucket.bulk+json media type, which this client does not wrap — issue one call per restriction instead.

    • Deletes all default tasks from this project.

      DELETE /rest/default-tasks/latest/projects/{key}/tasks

      Returns Promise<void>

    • Deletes this project's auto-decline settings, falling back to the instance-level default.

      DELETE /rest/api/latest/projects/{key}/settings/auto-decline

      Returns Promise<void>

    • Deletes this project's pull request auto-merge settings, falling back to the instance-level default.

      DELETE /rest/api/latest/projects/{key}/settings/auto-merge

      Returns Promise<void>

    • Deletes a ref restriction from this project.

      DELETE /rest/branch-permissions/latest/projects/{key}/restrictions/{id}

      Parameters

      • id: number

        The restriction's numeric id

      Returns Promise<void>

    • Deletes a default reviewer condition from this project.

      DELETE /rest/default-reviewers/latest/projects/{key}/condition/{id}

      Parameters

      • id: number

        The condition's numeric id

      Returns Promise<void>

    • Deletes a default task from this project.

      DELETE /rest/default-tasks/latest/projects/{key}/tasks/{taskId}

      Parameters

      • taskId: number

        The task's numeric id

      Returns Promise<void>

    • Deletes a reviewer group from this project.

      DELETE /rest/api/latest/projects/{key}/settings/reviewer-groups/{id}

      Parameters

      • id: number

        The reviewer group's numeric id

      Returns Promise<void>

    • Deletes a webhook from this project.

      DELETE /rest/api/latest/projects/{key}/webhooks/{webhookId}

      Parameters

      • webhookId: number

        The webhook's numeric id

      Returns Promise<void>

    • Fetches the settings stored for a repository hook on this project.

      GET /rest/api/latest/projects/{key}/settings/hooks/{hookKey}/settings

      Parameters

      • hookKey: string

        The hook's module key

      Returns Promise<HookSettings>

      The hook's settings (shape defined by the hook itself)

    • Revokes all of a group's permissions on this project.

      DELETE /rest/api/latest/projects/{key}/permissions/groups?name={name}

      Parameters

      • name: string

        The group's name

      Returns Promise<void>

    • Revokes all of a user's permissions on this project.

      DELETE /rest/api/latest/projects/{key}/permissions/users?name={name}

      Parameters

      • name: string

        The user's username/slug

      Returns Promise<void>

    • Returns a RepositoryResource for a given repository slug, providing access to repository-level data and sub-resources (pull requests, commits, etc.).

      The returned resource can be awaited directly to fetch repository info, or chained to access nested resources.

      Parameters

      • repoSlug: string

        The repository slug (e.g., 'my-repo')

      Returns RepositoryResource

      A chainable repository resource

      const repo    = await bbClient.project('PROJ').repo('my-repo');
      const prs = await bbClient.project('PROJ').repo('my-repo').pullRequests({ state: 'OPEN' });
      const commits = await bbClient.project('PROJ').repo('my-repo').commits({ limit: 10 });
    • Grants or changes a group's permission level on this project.

      PUT /rest/api/latest/projects/{key}/permissions/groups?name={name}&permission={permission}

      Parameters

      • name: string

        The group's name

      • permission: ProjectPermission

        'PROJECT_READ', 'PROJECT_WRITE', or 'PROJECT_ADMIN'

      Returns Promise<void>

    • Grants or changes a user's permission level on this project.

      PUT /rest/api/latest/projects/{key}/permissions/users?name={name}&permission={permission}

      Parameters

      • name: string

        The user's username/slug

      • permission: ProjectPermission

        'PROJECT_READ', 'PROJECT_WRITE', or 'PROJECT_ADMIN'

      Returns Promise<void>

    • Replaces the settings stored for a repository hook on this project.

      PUT /rest/api/latest/projects/{key}/settings/hooks/{hookKey}/settings

      Parameters

      • hookKey: string

        The hook's module key

      • settings: HookSettings

        The full replacement settings object

      Returns Promise<HookSettings>

      The stored settings