/** * Metadata about a single completed HTTP request, reported to `onResponse`. * Deliberately telemetry-agnostic: the OTel bridge maps these onto HTTP * semantic-convention span attributes, but the client itself has no OTel * dependency. Carries no secrets — the token lives in a request header, not * the URL. */ export interface GitHubResponseInfo { method: string; path: string; url: string; status: number; /** Parsed Content-Length header in bytes, when the response provided one. */ responseContentLength?: number; } export interface GitHubClientOptions { /** * REST API base, honoring `GITHUB_API_URL` (default `https://api.github.com`; * GitHub Enterprise sets it to e.g. `https://ghe.example.com/api/v3`). Paths * are appended directly, so the base must already include any `/api/v3` prefix. */ apiUrl?: string; token: string; fetchImpl?: typeof fetch; requestTimeout?: number; /** * Optional instrumentation callback invoked once per completed HTTP response * (success or error status), before any error is thrown. Used to surface HTTP * metadata to diagnostics/OTel without coupling the client to those layers. */ onResponse?: (info: GitHubResponseInfo) => void; } export declare const DEFAULT_GITHUB_API_URL = "https://api.github.com"; /** * Extract the `rel="next"` URL from a GitHub `Link` response header, or `null` * when there is no next page. GitHub paginates with absolute URLs in this header * rather than the page-number headers GitLab uses. */ export declare function parseNextLink(header: string | null | undefined): string | null; export interface PullRequestRef { ref: string; sha: string; } export interface PullRequest { head: PullRequestRef; base: PullRequestRef; /** PR title — the one-line declared intent of the change. May be empty. */ title?: string; /** PR body — the author's full reasoning / decision log. May be empty or null. */ body?: string | null; } export interface GitHubUser { id: number; login: string; } /** An inline pull-request review comment (positioned against the diff). */ export interface PullRequestReviewComment { id: number; body?: string | null; path?: string; /** Line in the diff's new file, when the comment still anchors to it. */ line?: number | null; original_line?: number | null; side?: string | null; in_reply_to_id?: number; user?: GitHubUser | null; } /** A non-positional issue/PR-level comment (the summary note lives here). */ export interface IssueComment { id: number; body?: string | null; user?: GitHubUser | null; } /** A single inline comment in a batched review payload. */ export interface ReviewCommentInput { path: string; body: string; line?: number; side?: string; start_line?: number; start_side?: string; } /** * Payload for a batched pull-request review. Posted as one atomic review * (`event: 'COMMENT'`) to avoid per-comment secondary rate limits. */ export interface CreateReviewInput { commit_id: string; event?: string; body?: string; comments?: ReviewCommentInput[]; } export interface Review { id: number; } export declare class GitHubClient { private readonly base; private readonly token; private readonly fetchImpl; private readonly requestTimeout; private readonly onResponse?; constructor(options: GitHubClientOptions); private reportResponse; url(path: string, query?: Record): string; private headers; private fetchWithTimeout; private failure; request(path: string, init?: RequestInit, query?: Record): Promise; /** Follow GitHub `Link` `rel="next"` headers, accumulating every page. */ paginate(path: string, query?: Record): Promise; getPullRequest(owner: string, repo: string, pull: number): Promise; listReviewComments(owner: string, repo: string, pull: number): Promise; listIssueComments(owner: string, repo: string, pull: number): Promise; createReview(owner: string, repo: string, pull: number, payload: CreateReviewInput): Promise; createIssueComment(owner: string, repo: string, pull: number, body: string): Promise; updateIssueComment(owner: string, repo: string, commentId: number, body: string): Promise; /** Add labels to an issue or pull request (`POST /issues/{n}/labels`). */ addIssueLabels(owner: string, repo: string, issue: number, labels: string[]): Promise; /** * Remove one label from an issue or pull request. GitHub answers 404 when the * label is not on it; that is the desired end state, so it is not an error. */ removeIssueLabel(owner: string, repo: string, issue: number, label: string): Promise; getCurrentUser(): Promise; /** * Derive the GraphQL endpoint from the REST base. github.com exposes GraphQL * at `/graphql`, while GitHub Enterprise Server exposes it at * `/api/graphql` (its REST base is `/api/v3`). */ private graphqlEndpoint; private graphql; /** * Return the database IDs of review comments that belong to a **settled** * review thread — one that is either resolved or outdated. GitHub's REST * comment endpoints omit both states; they are only exposed via GraphQL * `reviewThreads.isResolved` / `isOutdated`. Callers use this set to mark * normalized notes resolved so settled threads are excluded from summary * carry-over and prior-thread context. Paginates over threads. * * Outdated counts as settled because GitHub, unlike GitLab, does not * auto-resolve a thread when the line it anchors to changes: fixing a finding * flips the thread to outdated but leaves `isResolved` false until someone * manually resolves it. Treating outdated as settled mirrors GitLab's * "automatically resolve outdated diff discussions" behaviour, so a fixed * finding stops being re-listed under "Still open from earlier reviews" (#133). */ listSettledReviewCommentIds(owner: string, repo: string, pull: number): Promise>; } //# sourceMappingURL=github.d.ts.map