magically-sdk
Version:
Official SDK for Magically - Build mobile apps with AI
31 lines (30 loc) • 895 B
TypeScript
import { SDKConfig } from './types';
export interface RequestOptions {
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
headers?: Record<string, string>;
body?: any;
operation?: string;
}
export declare class APIClient {
private config;
private logger;
private baseUrl;
private apiKey;
constructor(config: SDKConfig, loggerPrefix?: string);
/**
* Make an authenticated API request with automatic logging
*/
request<T = any>(endpoint: string, options: RequestOptions, token?: string | null): Promise<T>;
/**
* Check if running in edge environment (has API key)
*/
isEdgeEnvironment(): boolean;
/**
* Sanitize response data for logging (avoid logging large arrays)
*/
private sanitizeResponseData;
/**
* Handle API errors with structured error information
*/
private handleAPIError;
}