/** * SpecForge API Client * * HTTP client for communicating with the SpecForge API Gateway. * Handles authentication, request/response formatting, and error handling. */ import { McpConfig } from '../config/index.js'; /** * API response structure returned by SpecForge API */ export interface ApiResponse { /** Response data on success */ data?: T; /** Error message on failure */ error?: string; } /** * Result of API key validation */ export interface ApiKeyValidationResult { /** Whether the API key is valid */ valid: boolean; /** User ID associated with the key (if valid) */ userId?: string; /** Permissions granted to the key (if valid) */ permissions?: { read?: boolean; write?: boolean; admin?: boolean; }; /** Error message (if invalid) */ message?: string; } /** * Options for API requests */ export interface ApiRequestOptions { /** Request timeout in milliseconds */ timeout?: number; /** Additional headers to include */ headers?: Record; /** Signal for aborting the request */ signal?: AbortSignal; } /** * API Client for SpecForge * * @example * ```typescript * import { getConfig } from './config/index.js'; * import { ApiClient } from './client/api-client.js'; * * const config = getConfig(); * const client = new ApiClient(config); * * // Make an API call * const projects = await client.call('list_projects', { userId: 'user123' }); * ``` */ export declare class ApiClient { private config; private sessionId; constructor(config: McpConfig); /** * Get the session ID for this MCP connection * Used for working context management */ getSessionId(): string; /** * Make an API call to SpecForge * * @param operation - Name of the operation to execute * @param args - Arguments for the operation * @param options - Optional request configuration * @returns Promise resolving to the operation result * @throws {Error} If the request fails or returns an error * * @example * ```typescript * // List projects * const result = await client.call('list_projects'); * * // Get a specific ticket * const ticket = await client.call('get_ticket', { ticketId: 'ticket123' }); * ``` */ call(operation: string, args?: Record, options?: ApiRequestOptions): Promise; /** * Validate the configured API key * * Makes a lightweight call to verify the API key is valid and * returns the associated user information. * * @returns Promise resolving to validation result * * @example * ```typescript * const result = await client.validateApiKey(); * if (result.valid) { * console.log('Authenticated as:', result.userId); * } else { * console.error('Invalid API key:', result.message); * } * ``` */ validateApiKey(): Promise; /** * Get human-readable message for HTTP status codes */ private getStatusMessage; /** * Combine multiple AbortSignals into one */ private combineSignals; } //# sourceMappingURL=api-client.d.ts.map