import { ILogService } from '../../log/common/logService';
import { IFetcherService } from '../../networking/common/fetcherService';
import { ITelemetryService } from '../../telemetry/common/telemetry';
export declare enum GraphQLErrorType {
    Unprocessable = "UNPROCESSABLE"
}
export interface GraphQLError {
    extensions?: {
        code: string;
    };
    type?: GraphQLErrorType;
    message?: string;
}
export declare function getErrorCode(e: unknown): string | undefined;
export interface PullRequestSearchItem {
    id: string;
    number: number;
    title: string;
    state: string;
    isDraft?: boolean;
    url: string;
    createdAt: string;
    updatedAt: string;
    author: {
        login: string;
    } | null;
    repository: {
        owner: {
            login: string;
        };
        name: string;
    };
    additions: number;
    deletions: number;
    files: {
        totalCount: number;
    };
    fullDatabaseId: number;
    headRefOid: string;
    baseRefOid?: string;
    headRefName?: string;
    baseRefName?: string;
    body: string;
}
export type PullRequestState = 'open' | 'closed' | 'merged' | 'draft';
/**
 * Derives a unified pull request state from the GitHub GraphQL `state` enum
 * and the `isDraft` boolean. Terminal states (merged, closed) take precedence
 * over draft — a closed draft PR is reported as 'closed', not 'draft'.
 */
export declare function derivePullRequestState(pr: Pick<PullRequestSearchItem, 'state' | 'isDraft'>): PullRequestState;
export interface PullRequestSearchResult {
    search: {
        nodes: PullRequestSearchItem[];
        pageInfo: {
            hasNextPage: boolean;
            endCursor: string | null;
        };
        issueCount: number;
    };
}
export interface SessionInfo {
    id: string;
    name: string;
    user_id: number;
    agent_id: number;
    logs: string;
    logs_blob_id: string;
    state: 'completed' | 'in_progress' | 'failed' | 'queued';
    owner_id: number;
    repo_id: number;
    resource_type: string;
    resource_id: number;
    last_updated_at: string;
    created_at: string;
    completed_at: string;
    event_type: string;
    workflow_run_id: number;
    premium_requests: number;
    error: string | null;
    resource_global_id: string;
}
export interface PullRequestComment {
    id: string;
    body: string;
    createdAt: string;
    author: {
        login: string;
    };
    url: string;
}
export interface AssignableActor {
    __typename: string;
    login: string;
    avatarUrl?: string;
    url?: string;
}
export interface AssignableActorsResponse {
    repository: {
        suggestedActors?: {
            nodes: AssignableActor[];
            pageInfo: {
                hasNextPage: boolean;
                endCursor: string | null;
            };
        };
        assignableUsers?: {
            nodes: AssignableActor[];
            pageInfo: {
                hasNextPage: boolean;
                endCursor: string | null;
            };
        };
    };
}
export interface GitHubAPIRequestOptions {
    body?: unknown;
    version?: string;
    type?: 'json' | 'text';
    userAgent?: string;
    accept?: string;
    additionalHeaders?: {
        [key: string]: string;
    };
    returnStatusCodeOnError?: boolean;
    silent404?: boolean;
    callSite?: string;
}
export declare function makeGitHubAPIRequest(fetcherService: IFetcherService, logService: ILogService, telemetry: ITelemetryService, host: string, routeSlug: string, method: 'GET' | 'POST', token: string | undefined, options?: GitHubAPIRequestOptions): Promise<any>;
export declare function makeGitHubGraphQLRequest(fetcherService: IFetcherService, logService: ILogService, telemetry: ITelemetryService, host: string, query: string, token: string | undefined, variables?: unknown, callSite?: string): Promise<any>;
export declare function makeSearchGraphQLRequest(fetcherService: IFetcherService, logService: ILogService, telemetry: ITelemetryService, host: string, token: string | undefined, searchQuery: string, first?: number): Promise<PullRequestSearchItem[]>;
export declare function getPullRequestFromGlobalId(fetcherService: IFetcherService, logService: ILogService, telemetry: ITelemetryService, host: string, token: string | undefined, globalId: string): Promise<PullRequestSearchItem | null>;
export declare function addPullRequestCommentGraphQLRequest(fetcherService: IFetcherService, logService: ILogService, telemetry: ITelemetryService, host: string, token: string | undefined, pullRequestId: string, commentBody: string): Promise<PullRequestComment | null>;
export declare function closePullRequest(fetcherService: IFetcherService, logService: ILogService, telemetry: ITelemetryService, host: string, token: string | undefined, owner: string, repo: string, pullNumber: number): Promise<boolean>;
export declare function makeGitHubAPIRequestWithPagination(fetcherService: IFetcherService, logService: ILogService, host: string, path: string, nwo: string, token: string): Promise<SessionInfo[]>;
/**
 * Fetches assignable actors (users/bots) for a repository using suggestedActors API.
 * This is the preferred API as it filters by capability (CAN_BE_ASSIGNED).
 */
export declare function getAssignableActorsWithSuggestedActors(fetcherService: IFetcherService, logService: ILogService, telemetry: ITelemetryService, host: string, token: string | undefined, owner: string, repo: string): Promise<AssignableActor[]>;
/**
 * Fetches assignable users for a repository using assignableUsers API.
 * This is a fallback for older GitHub Enterprise Server instances that don't support suggestedActors.
 */
export declare function getAssignableActorsWithAssignableUsers(fetcherService: IFetcherService, logService: ILogService, telemetry: ITelemetryService, host: string, token: string | undefined, owner: string, repo: string): Promise<AssignableActor[]>;
//# sourceMappingURL=githubAPI.d.ts.map