import { BaseApi } from './base.js'; import type { UsersApi } from './users.js'; import type { BitbucketClientConfig, PaginatedResponse } from '../types/common.js'; import type { AddPullRequestCommentParams, AddPullRequestCommentReactionParams, CanMergePullRequestParams, ChangesResponse, CreatePullRequestParams, DeclinePullRequestParams, DeletePullRequestCommentParams, DeletePullRequestParams, EditPullRequestCommentParams, DiffResponse, GetDashboardPullRequestsParams, GetInboxPullRequestsParams, GetPullRequestActivitiesParams, GetPullRequestChangesParams, GetPullRequestDiffParams, GetPullRequestParams, GetRequiredReviewersParams, InboxPullRequest, MergeCheckResult, MergePullRequestParams, RemovePullRequestCommentReactionParams, RestComment, RestPullRequest, RestPullRequestActivityApiResponse, RestPullRequestParticipant, RestUserReaction, UpdatePullRequestParams, UpdateReviewStatusParams } from '../types/pull-request.js'; import type { RestUser } from '../types/user.js'; /** * Pull Requests API for Bitbucket Server. * Provides methods for pull request-related operations. * * Holds a reference to `UsersApi` so endpoints that need the authenticated * user's slug (e.g. `updateReviewStatus` posts to `/participants/{userSlug}`) * can resolve it via `users.getCurrentUserSlug()` instead of duplicating the * `X-AUSERNAME` header read. */ export declare class PullRequestsApi extends BaseApi { private readonly users; constructor(config: BitbucketClientConfig, users: UsersApi); /** * Get pull requests in the authenticated user's inbox (where they are assigned as reviewer) */ getInbox(params?: GetInboxPullRequestsParams): Promise>; /** * Get pull requests from the user's dashboard. * Can filter by role (AUTHOR, REVIEWER, PARTICIPANT), state, and more. */ getDashboard(params?: GetDashboardPullRequestsParams): Promise>; /** * Get pull request details (title, description, author, branches, etc.) */ get(params: GetPullRequestParams): Promise; /** * Create a new pull request. * Supports both same-repo PRs (default) and cross-repo PRs (when fromRepositorySlug is provided). * Branch names are automatically converted to full refs (e.g., "main" → "refs/heads/main"). */ create(params: CreatePullRequestParams): Promise; /** * Get all changed files in a pull request */ getChanges(params: GetPullRequestChangesParams): Promise; /** * Get diff for a pull request (or specific file). * When path is empty or undefined, returns the full PR diff. * Format controls the response type: * - 'text': Raw diff as plain text string * - 'json': Structured diff object (DiffResponse) */ getDiff(params: GetPullRequestDiffParams): Promise; /** * Get activity on a pull request (comments, approvals, merges, reviews, updates) */ getActivities(params: GetPullRequestActivitiesParams): Promise>; /** * Add a comment to a pull request (supports general comments, replies, and inline file/line comments) */ addComment(params: AddPullRequestCommentParams): Promise; /** * Get a single pull request comment by ID. */ getComment(params: { projectKey: string; repositorySlug: string; pullRequestId: number; commentId: number; }): Promise; /** * Edit a pull request comment. Requires the comment version for optimistic locking. */ editComment(params: EditPullRequestCommentParams): Promise; /** * Delete a pull request comment. Returns void on success (HTTP 204). * Anyone can delete their own comment. Only REPO_ADMIN can delete others' comments. * Comments with replies cannot be deleted. */ deleteComment(params: DeletePullRequestCommentParams): Promise; /** * Update review status for a pull request (approve, request changes, or remove approval) */ updateReviewStatus(params: UpdateReviewStatusParams): Promise; /** * Add an emoticon reaction to a pull request comment */ addReaction(params: AddPullRequestCommentReactionParams): Promise; /** * Remove an emoticon reaction from a pull request comment */ removeReaction(params: RemovePullRequestCommentReactionParams): Promise; /** * Get the list of required/default reviewers for a pull request. * Returns users who would be automatically assigned as reviewers based on configured rules. * Note: Default reviewers are NOT auto-added when creating PRs via API - you must * fetch them with this method and pass them to create(). * Branch names are automatically converted to full refs (e.g., "main" → "refs/heads/main"). * Use repositories.get() to obtain the repositoryId. */ getRequiredReviewers(params: GetRequiredReviewersParams): Promise; /** * Update a pull request's title, description and/or target branch. * * The endpoint has **replace** semantics: whatever the body omits is cleared, * and that includes `reviewers` — sending only the fields being changed removes * every reviewer and their approvals. So the current pull request is read first * and the requested fields are merged into it; everything else, reviewers above * all, goes back verbatim. `version` comes from the same read and gives Bitbucket * its optimistic lock. * * Throws if the updated pull request comes back on a different target than the * one requested, or short a reviewer it had before — a 200 that quietly discarded * review state is the failure this method exists to prevent, so it is reported * rather than returned. */ update(params: UpdatePullRequestParams): Promise; /** * Decline a pull request. Auto-fetches version for optimistic locking. */ decline(params: DeclinePullRequestParams): Promise; /** * Merge a pull request. Auto-fetches version for optimistic locking. */ merge(params: MergePullRequestParams): Promise; /** * Check if a pull request can be merged (conflicts, required approvals, etc.) */ canMerge(params: CanMergePullRequestParams): Promise; /** * Delete a pull request. Auto-fetches version for optimistic locking. */ deletePullRequest(params: DeletePullRequestParams): Promise; } //# sourceMappingURL=pull-requests.d.ts.map