/** * Platform API Client * * HTTP client for making authenticated requests to the Apso platform. * Features: * - Automatic token refresh * - Request/response interceptors * - Retry with exponential backoff * - Timeout handling */ import { ApiRequestOptions } from "./types"; /** * Custom error class for API errors */ export declare class ApiClientError extends Error { statusCode: number; details?: Record | undefined; /** Machine code from the server (e.g. SERVICE_LIMIT_REACHED), when present. */ code?: string; /** Relative URL to send the user to resolve the error (e.g. an upgrade page). */ upgradeUrl?: string; constructor(message: string, statusCode: number, details?: Record | undefined); /** * Check if error is due to authentication failure */ isAuthError(): boolean; /** * Check if error is an entitlement/plan limit that the user can resolve by * upgrading (e.g. the free-tier service or deploy limit). */ isLimitError(): boolean; /** * Check if error is a rate limit error */ isRateLimitError(): boolean; /** * Check if error is a server error (5xx) */ isServerError(): boolean; } /** * Check if we're running in an environment with network access */ export declare function checkNetworkConnectivity(): Promise; /** * Make an authenticated request to the platform API * Note: Sequential retries are intentional for proper backoff behavior */ export declare function apiRequest(path: string, options?: ApiRequestOptions): Promise; /** * Platform API client with typed methods */ export declare const api: { /** * Make a GET request */ get(path: string, options?: Omit): Promise; /** * Make a POST request */ post(path: string, body?: unknown, options?: Omit): Promise; /** * Make a PUT request */ put(path: string, body?: unknown, options?: Omit): Promise; /** * Make a PATCH request */ patch(path: string, body?: unknown, options?: Omit): Promise; /** * Make a DELETE request */ delete(path: string, options?: Omit): Promise; };