/**
 * Jenkins Source
 *
 * Fetches plugin information from Jenkins CI servers using the REST API
 * API Docs: https://www.jenkins.io/doc/book/using/remote-access-api/
 */
import type { PluginInfo, SourceType } from '../types/index.js';
import { BasePluginSource } from './base.js';
/**
 * Jenkins API response types
 */
/**
 * Jenkins build artifact information
 */
interface JenkinsArtifact {
    displayPath: string;
    fileName: string;
    relativePath: string;
}
/**
 * Jenkins build information from lastSuccessfulBuild
 */
interface JenkinsBuild {
    number: number;
    url: string;
    timestamp: number;
    duration: number;
    result: string;
    displayName?: string;
    description?: string;
    artifacts: JenkinsArtifact[];
}
/**
 * Configuration options for JenkinsSource
 */
export interface JenkinsSourceOptions {
    /** Base URL of the Jenkins server (e.g., "https://ci.example.com") */
    baseUrl: string;
    /** Username for authentication (optional) */
    username?: string;
    /** API token for authentication (optional) */
    apiToken?: string;
    /** Cache TTL in seconds (default: 300) */
    cacheTtlSeconds?: number;
}
/**
 * JenkinsSource implementation for fetching plugins from Jenkins CI
 */
export declare class JenkinsSource extends BasePluginSource {
    readonly id: string;
    readonly name = "Jenkins CI";
    readonly type: SourceType;
    private readonly baseUrl;
    private readonly username;
    private readonly apiToken;
    /**
     * Create a new JenkinsSource
     * @param options - Configuration options
     */
    constructor(options: JenkinsSourceOptions);
    /**
     * Encode a job path for use in URLs
     * Handles nested folder paths like "Folder/job/JobName" by encoding each segment
     * but preserving the /job/ separators
     * @param jobPath - The job path (e.g., "EvenMoreFish/job/EvenMoreFish" or just "JobName")
     * @returns Properly encoded path segment
     */
    private encodeJobPath;
    /**
     * Set authentication credentials
     * @param username - Jenkins username
     * @param apiToken - Jenkins API token
     */
    setCredentials(username: string, apiToken: string): void;
    /**
     * Get plugin info by job name
     * @param jobName - Jenkins job name
     * @param artifactType - Optional artifact type filter (e.g., "jar")
     * @returns Plugin info or null if not found
     */
    getPluginInfo(jobName: string, artifactType?: string): Promise<PluginInfo | null>;
    /**
     * Search for plugins (not supported by Jenkins)
     * Jenkins doesn't have a search API, so this returns an empty array
     * @param _query - Search query (unused)
     * @param _limit - Maximum results (unused)
     * @returns Empty array
     */
    searchPlugins(_query: string, _limit?: number): Promise<PluginInfo[]>;
    /**
     * Get latest version (build number) for a job
     * @param jobName - Jenkins job name
     * @returns Build number as string, or null if no successful builds
     */
    getLatestVersion(jobName: string): Promise<string | null>;
    /**
     * Build the download URL for an artifact
     * @param jobName - Jenkins job name
     * @param artifactPath - Relative path to the artifact
     * @returns Download URL
     */
    buildDownloadUrl(jobName: string, artifactPath: string): string;
    /**
     * Get all artifacts for a job's latest successful build
     * @param jobName - Jenkins job name
     * @returns Array of artifacts
     */
    getArtifacts(jobName: string): Promise<JenkinsArtifact[]>;
    /**
     * Get build information for a specific build number
     * @param jobName - Jenkins job name
     * @param buildNumber - Build number
     * @returns Build info or null
     */
    getBuild(jobName: string, buildNumber: number): Promise<JenkinsBuild | null>;
    /**
     * Override headers to include authentication if configured
     */
    protected buildHeaders(additional?: Record<string, string>): Record<string, string>;
    /**
     * Parse Jenkins build into PluginInfo
     * @param job - Jenkins job information
     * @param build - Jenkins build information
     * @param artifactType - Optional artifact type filter
     * @returns Plugin info or null if no suitable artifact found
     */
    private parseBuild;
    /**
     * Find the best artifact from a build
     * @param artifacts - List of build artifacts
     * @param artifactType - Optional type filter (e.g., "jar")
     * @returns Best matching artifact or undefined
     */
    private findArtifact;
    /**
     * Clean version string (remove 'v' prefix, etc.)
     * @param version - Raw version string
     * @returns Cleaned version
     */
    private cleanVersion;
}
/**
 * Create a JenkinsSource instance with the given options
 * @param options - Configuration options
 * @returns JenkinsSource instance
 */
export declare function createJenkinsSource(options: JenkinsSourceOptions): JenkinsSource;
export {};
//# sourceMappingURL=jenkins.d.ts.map