/** * Metrx API Client * * Handles authenticated requests to the Metrx API. * Uses API key authentication (same as the SDK). * * The API key is passed via the METRX_API_KEY environment variable * or configured at runtime. */ import type { ApiResponse } from '../types.js'; export declare class MetrxApiClient { private readonly baseUrl; private readonly apiKey; private readonly maxRetries; constructor(apiKey?: string, baseUrl?: string, maxRetries?: number); /** * Common request headers for all API calls. */ private get headers(); /** * Parse API error response and return user-friendly message */ private parseApiError; /** * Fetch with exponential backoff retry logic. * Retries only on 5xx errors and network errors, not on 4xx errors. * * @param url - The URL to fetch * @param options - Fetch options * @returns The fetch response * @throws Error if all retries fail or on non-retryable errors */ private fetchWithRetry; /** * Make an authenticated GET request to the Metrx API. */ get(path: string, params?: Record): Promise>; /** * Make an authenticated POST request to the Metrx API. */ post(path: string, body?: Record): Promise>; /** * Make an authenticated PATCH request to the Metrx API. */ patch(path: string, body?: Record): Promise>; /** * Lightweight ping to verify API key is valid. * Used by the `--test` CLI flag. * Attempts a GET request on the agents endpoint. * Returns { ok: true } on success, or { ok: false, error: string } on failure. */ ping(): Promise<{ ok: boolean; error?: string; }>; } //# sourceMappingURL=api-client.d.ts.map