import { SonarQubeClient as WebApiClient } from 'sonarqube-web-api-client'; import { ElicitationManager } from './utils/elicitation.js'; import type { PaginationParams, SonarQubeProjectsResult, SonarQubeIssuesResult, IssuesParams, SonarQubeMetricsResult, ComponentMeasuresParams, ComponentsMeasuresParams, MeasuresHistoryParams, SonarQubeComponentMeasuresResult, SonarQubeComponentsMeasuresResult, SonarQubeMeasuresHistoryResult, SonarQubeHealthStatus, SonarQubeSystemStatus, SonarQubeQualityGatesResult, SonarQubeQualityGate, SonarQubeQualityGateStatus, ProjectQualityGateParams, SourceCodeParams, ScmBlameParams, SonarQubeSourceResult, SonarQubeScmBlameResult, HotspotSearchParams, SonarQubeHotspotSearchResult, SonarQubeHotspotDetails, HotspotStatusUpdateParams, MarkIssueFalsePositiveParams, MarkIssueWontFixParams, BulkIssueMarkParams, AddCommentToIssueParams, AssignIssueParams, ConfirmIssueParams, UnconfirmIssueParams, ResolveIssueParams, ReopenIssueParams, DoTransitionResponse, ISonarQubeClient, SonarQubeIssueComment, SonarQubeIssue } from './types/index.js'; export type { PaginationParams, SeverityLevel, SonarQubeProject, SonarQubeProjectsResult, SonarQubeIssue, SonarQubeIssueComment, SonarQubeIssueFlow, SonarQubeIssueImpact, SonarQubeIssueLocation, SonarQubeMessageFormatting, SonarQubeTextRange, SonarQubeComponent, SonarQubeRule, SonarQubeUser, SonarQubeFacet, SonarQubeFacetValue, SonarQubeIssuesResult, IssuesParams, SonarQubeMetric, SonarQubeMetricsResult, ComponentMeasuresParams, ComponentsMeasuresParams, MeasuresHistoryParams, SonarQubeMeasure, SonarQubeMeasureComponent, SonarQubeComponentMeasuresResult, SonarQubeComponentsMeasuresResult, SonarQubeMeasuresHistoryResult, SonarQubeHealthStatus, SonarQubeSystemStatus, SonarQubeQualityGateCondition, SonarQubeQualityGate, SonarQubeQualityGatesResult, SonarQubeQualityGateStatus, ProjectQualityGateParams, SourceCodeParams, ScmBlameParams, SonarQubeLineIssue, SonarQubeScmAuthor, SonarQubeSourceLine, SonarQubeSourceResult, SonarQubeScmBlameResult, HotspotSearchParams, SonarQubeHotspot, SonarQubeHotspotSearchResult, SonarQubeHotspotDetails, HotspotStatusUpdateParams, MarkIssueFalsePositiveParams, MarkIssueWontFixParams, BulkIssueMarkParams, AddCommentToIssueParams, ISonarQubeClient, } from './types/index.js'; /** * Type alias for optional organization parameter */ type OptionalOrganization = string | null; /** * SonarQube client for interacting with the SonarQube API */ export declare class SonarQubeClient implements ISonarQubeClient { readonly webApiClient: WebApiClient; private readonly organization; private readonly projectsDomain; private readonly issuesDomain; private readonly metricsDomain; private readonly measuresDomain; private readonly systemDomain; private readonly qualityGatesDomain; private readonly sourceCodeDomain; private readonly hotspotsDomain; /** * Creates a new SonarQube client * @param token SonarQube authentication token * @param baseUrl Base URL of the SonarQube instance (default: https://sonarcloud.io) * @param organization Organization name */ constructor(token: string, baseUrl?: string, organization?: OptionalOrganization); /** * Initializes all domain modules for a client instance */ private static initializeDomains; /** * Creates a SonarQube client with HTTP Basic authentication * @param username Username for basic auth * @param password Password for basic auth * @param baseUrl Base URL of the SonarQube instance * @param organization Organization name * @returns A new SonarQube client instance */ static withBasicAuth(username: string, password: string, baseUrl?: string, organization?: OptionalOrganization): SonarQubeClient; /** * Creates a SonarQube client with system passcode authentication * @param passcode System passcode * @param baseUrl Base URL of the SonarQube instance * @param organization Organization name * @returns A new SonarQube client instance */ static withPasscode(passcode: string, baseUrl?: string, organization?: OptionalOrganization): SonarQubeClient; /** * Lists all projects in SonarQube * @param params Pagination and organization parameters * @returns Promise with the list of projects */ listProjects(params?: PaginationParams): Promise; /** * Gets issues for a project in SonarQube * @param params Parameters including project key, severity, pagination and organization * @returns Promise with the list of issues */ getIssues(params: IssuesParams): Promise; /** * Gets available metrics from SonarQube * @param params Parameters including pagination * @returns Promise with the list of metrics */ getMetrics(params?: PaginationParams): Promise; /** * Gets the health status of the SonarQube instance * @returns Promise with the health status */ getHealth(): Promise; /** * Gets the system status of the SonarQube instance * @returns Promise with the system status */ getStatus(): Promise; /** * Pings the SonarQube instance to check if it's up * @returns Promise with the ping response */ ping(): Promise; /** * Gets measures for a specific component * @param params Parameters including component key and metrics * @returns Promise with the component measures result */ getComponentMeasures(params: ComponentMeasuresParams): Promise; /** * Gets measures for multiple components * * **Performance Note**: This method uses an N+1 API pattern where it makes one API call per component. * For large numbers of components, this can result in many API calls. Consider: * - Using pagination to limit the number of components fetched at once * - Batching requests if you need measures for many components * - Using the single component API (`getComponentMeasures`) when possible * * @param params Parameters including component keys, metrics, and pagination * @returns Promise with the components measures result */ getComponentsMeasures(params: ComponentsMeasuresParams): Promise; /** * Gets measures history for a component * @param params Parameters including component, metrics, and date range * @returns Promise with the measures history result */ getMeasuresHistory(params: MeasuresHistoryParams): Promise; /** * Lists all quality gates from SonarQube * @returns Promise with the list of quality gates */ listQualityGates(): Promise; /** * Gets details of a quality gate including its conditions * @param id The ID of the quality gate * @returns Promise with the quality gate details */ getQualityGate(id: string): Promise; /** * Gets quality gate status for a specific project * @param params Parameters including project key, branch, and pull request * @returns Promise with the project's quality gate status */ getProjectQualityGateStatus(params: ProjectQualityGateParams): Promise; /** * Gets source code with optional SCM and issue annotations * @param params Parameters including component key, line range, branch, and pull request * @returns Promise with the source code and annotations */ getSourceCode(params: SourceCodeParams): Promise; /** * Gets SCM blame information for a file * @param params Parameters including component key, line range, branch, and pull request * @returns Promise with the blame information */ getScmBlame(params: ScmBlameParams): Promise; /** * Searches for security hotspots * @param params Parameters for hotspot search * @returns Promise with the hotspot search results */ hotspots(params: HotspotSearchParams): Promise; /** * Gets detailed information about a specific security hotspot * @param hotspotKey The key of the hotspot * @returns Promise with the hotspot details */ hotspot(hotspotKey: string): Promise; /** * Updates the status of a security hotspot * @param params Parameters for updating hotspot status * @returns Promise that resolves when the update is complete */ updateHotspotStatus(params: HotspotStatusUpdateParams): Promise; /** * Mark an issue as false positive * @param params Parameters including issue key and optional comment * @returns Promise with the updated issue and related data */ markIssueFalsePositive(params: MarkIssueFalsePositiveParams): Promise; /** * Mark an issue as won't fix * @param params Parameters including issue key and optional comment * @returns Promise with the updated issue and related data */ markIssueWontFix(params: MarkIssueWontFixParams): Promise; /** * Mark multiple issues as false positive * @param params Parameters including issue keys and optional comment * @returns Promise with array of updated issues and related data */ markIssuesFalsePositive(params: BulkIssueMarkParams): Promise; /** * Mark multiple issues as won't fix * @param params Parameters including issue keys and optional comment * @returns Promise with array of updated issues and related data */ markIssuesWontFix(params: BulkIssueMarkParams): Promise; /** * Add a comment to an issue * @param params Parameters including issue key and comment text * @returns Promise with the created comment details */ addCommentToIssue(params: AddCommentToIssueParams): Promise; /** * Assign an issue to a user * @param params Parameters including issue key and assignee * @returns Promise with the updated issue details */ assignIssue(params: AssignIssueParams): Promise; /** * Confirms an issue * @param params Parameters including issue key and optional comment * @returns Promise with the updated issue and related data */ confirmIssue(params: ConfirmIssueParams): Promise; /** * Unconfirms an issue * @param params Parameters including issue key and optional comment * @returns Promise with the updated issue and related data */ unconfirmIssue(params: UnconfirmIssueParams): Promise; /** * Resolves an issue * @param params Parameters including issue key and optional comment * @returns Promise with the updated issue and related data */ resolveIssue(params: ResolveIssueParams): Promise; /** * Reopens an issue * @param params Parameters including issue key and optional comment * @returns Promise with the updated issue and related data */ reopenIssue(params: ReopenIssueParams): Promise; } /** * Creates a SonarQube client with HTTP Basic authentication * @param username Username for basic auth * @param password Password for basic auth * @param baseUrl Base URL of the SonarQube instance * @param organization Organization name * @returns A new SonarQube client instance */ export declare function createSonarQubeClientWithBasicAuth(username: string, password: string, baseUrl?: string, organization?: OptionalOrganization): ISonarQubeClient; /** * Creates a SonarQube client with system passcode authentication * @param passcode System passcode * @param baseUrl Base URL of the SonarQube instance * @param organization Organization name * @returns A new SonarQube client instance */ export declare function createSonarQubeClientWithPasscode(passcode: string, baseUrl?: string, organization?: OptionalOrganization): ISonarQubeClient; export declare function setSonarQubeElicitationManager(manager: ElicitationManager): void; /** * Creates a SonarQube client from environment variables * Supports multiple authentication methods: * - Token auth: SONARQUBE_TOKEN * - Basic auth: SONARQUBE_USERNAME and SONARQUBE_PASSWORD * - Passcode auth: SONARQUBE_PASSCODE * @returns A new SonarQube client instance */ export declare function createSonarQubeClientFromEnv(): ISonarQubeClient; /** * Creates a SonarQube client from environment variables with elicitation support * If no authentication is configured and elicitation is enabled, prompts for credentials * @returns A promise that resolves to a new SonarQube client instance */ export declare function createSonarQubeClientFromEnvWithElicitation(): Promise; /** * Factory function to create a SonarQube client * @param token SonarQube authentication token * @param baseUrl Base URL of the SonarQube instance * @param organization Organization name * @returns A new SonarQube client instance */ export declare function createSonarQubeClient(token: string, baseUrl?: string, organization?: OptionalOrganization): ISonarQubeClient;