import type { PaginatedResponse } from './common.js'; import type { RestMinimalCommit } from './pull-request.js'; /** * A branch (or tag) ref returned by Bitbucket. */ export interface RestBranch { /** Full ref ID (e.g., "refs/heads/main") */ id: string; /** Short display name (e.g., "main") */ displayId: string; /** Always "BRANCH" for the branches endpoint */ type: 'BRANCH'; /** Latest commit hash on this branch */ latestCommit?: string; /** Latest commit on the changeset (may differ from latestCommit for merge commits) */ latestChangeset?: string; /** Whether this branch is the repo's default */ isDefault?: boolean; /** Ahead/behind metadata when --details is requested */ metadata?: Record; } /** * Sort order for branch/tag listings. */ export type RefOrderBy = 'ALPHABETICAL' | 'MODIFICATION'; /** * Parameters for list method on BranchesApi. */ export interface ListBranchesParams { /** The Bitbucket project key */ projectKey: string; /** The repository slug */ repositorySlug: string; /** Prefix-match on branch name (API: filterText) */ filterText?: string; /** Sort order */ orderBy?: RefOrderBy; /** Include plugin metadata (ahead/behind, latest commit) */ details?: boolean; /** Compare metadata against this ref */ base?: string; /** Rank exact matches above prefix matches */ boostMatches?: boolean; /** Pagination start offset */ start?: number; /** Pagination limit (default 25) */ limit?: number; } export type BranchesResponse = PaginatedResponse; /** * The default branch endpoint returns a single ref object (not a paginated list). * Shape matches RestBranch but `type` may be omitted. */ export interface RestDefaultBranch { id: string; displayId: string; type?: 'BRANCH'; latestCommit?: string; } /** * Parameters for getDefaultBranch on RepositoriesApi. */ export interface GetDefaultBranchParams { projectKey: string; repositorySlug: string; } export type { RestMinimalCommit }; /** * Parameters for deleteBranch on BranchesApi. Hits the branch-utils plugin * endpoint, which lives outside the main /rest/api/latest namespace. */ export interface DeleteBranchParams { projectKey: string; repositorySlug: string; /** Ref name to delete, e.g. "refs/heads/feature-x" or "feature-x" — Bitbucket accepts both. */ name: string; /** Don't actually delete; validate only. */ dryRun?: boolean; /** Expected current commit ID at the ref tip (safety guard). */ endPoint?: string; } /** * Parameters for getDeleteAfterMergeSetting on BranchesApi. */ export interface GetDeleteAfterMergeSettingParams { projectKey: string; repositorySlug: string; } /** * Response from the branch-utils delete-after-merge endpoint. The repo-level * endpoint resolves the effective setting (repo override or inherited from * project). */ export interface DeleteAfterMergeSetting { enabled: boolean; } //# sourceMappingURL=branch.d.ts.map