/**
* Centralized API client for FastMode API requests
* Uses stored credentials with automatic refresh, or falls back to env var
*/
export interface ApiConfig {
apiUrl: string;
authToken: string | null;
}
/**
* Get API URL from environment or default
*/
export declare function getApiUrl(): string;
/**
* Get API configuration - tries stored credentials first, then env var
*/
export declare function getApiConfigAsync(): Promise<ApiConfig>;
/**
* Synchronous version - only checks env var (for quick checks)
*/
export declare function getApiConfig(): ApiConfig;
/**
* Check if authentication is configured (either stored credentials or env var)
*/
export declare function isAuthConfigured(): boolean;
/**
* Check if we need to trigger the device flow
*/
export declare function needsAuthentication(): Promise<boolean>;
/**
* Get a helpful message for authentication
*/
export declare function getAuthRequiredMessage(): string;
/**
* API request options
*/
export interface ApiRequestOptions {
tenantId?: string;
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
body?: unknown;
}
/**
* API error response
*/
export interface ApiError {
success: false;
error: string;
statusCode: number;
needsAuth?: boolean;
}
/**
* Make an authenticated API request
* Uses stored credentials with auto-refresh, or falls back to env var
*/
export declare function apiRequest<T>(endpoint: string, options?: ApiRequestOptions): Promise<{
data: T;
} | ApiError>;
/**
* Check if a response is an error
*/
export declare function isApiError(response: unknown): response is ApiError;
/**
* Check if error requires authentication
*/
export declare function needsAuthError(error: ApiError): boolean;
/**
* Resolve a project identifier to a tenant ID
* Accepts either a UUID or a project name
*/
export declare function resolveProjectId(projectIdentifier: string): Promise<{
tenantId: string;
} | {
error: string;
}>;
/**
* Make an authenticated external API request
* Uses the /external/* endpoints with tenant context
*/
export declare function externalApiRequest<T>(tenantId: string, endpoint: string, options?: Omit<ApiRequestOptions, 'tenantId'>): Promise<{
data: T;
} | ApiError>;
//# sourceMappingURL=api-client.d.ts.map