# EU-Utility V3 - API Documentation Complete API reference for plugin development. --- ## Table of Contents 1. [Overview](#overview) 2. [PluginAPI](#pluginapi) 3. [WidgetAPI](#widgetapi) 4. [ExternalAPI](#externalapi) 5. [TypeScript Types](#typescript-types) --- ## Overview EU-Utility V3 provides a unified API for plugin development. Plugins run in a secure sandbox with controlled access to system resources. ### API Structure ```typescript // Access the API const api = window.EUPluginAPI; // All methods return Promises const result = await api.someMethod(); ``` --- ## PluginAPI ### Log Reader ```typescript // Read last N log lines const lines = await api.readLogLines(100); // Read since timestamp const recent = await api.readLogSince(Date.now() - 300000); // Read filtered const loot = await api.readLogFiltered('Loot:'); ``` **Returns:** `Promise` --- ### Window Manager ```typescript // Get EU window info const window = await api.getEUWindow(); // Check focus const focused = await api.isEUFocused(); // Bring to front await api.bringEUToFront(); // Capture screenshot const screenshot = await api.captureEUWindow(); ``` **WindowInfo:** ```typescript interface WindowInfo { x: number; y: number; width: number; height: number; isFocused: boolean; } ``` --- ### OCR Service ```typescript // Check availability const available = await api.ocrAvailable(); // Recognize text const text = await api.recognizeText({ x: 100, y: 100, width: 200, height: 50 }); ``` **Returns:** `Promise` --- ### Nexus API ```typescript // Search items const results = await api.searchNexus({ query: 'omegaton', entityType: 'weapons', limit: 10 }); // Get item details const details = await api.getItemDetails('12345'); ``` **SearchResult:** ```typescript interface NexusItem { id: string; name: string; type: string; category: string; value?: number; markup?: number; } ``` --- ### HTTP Client ```typescript // GET request const data = await api.httpGet('https://api.example.com/data', { cache: true, ttl: 3600 }); // POST request const result = await api.httpPost('https://api.example.com/save', { key: 'value' }); ``` --- ### Notifications ```typescript await api.showNotification({ title: 'Alert', body: 'Something happened', duration: 3000 }); ``` --- ### Clipboard ```typescript // Copy await api.copyToClipboard('text'); // Paste const text = await api.pasteFromClipboard(); ``` --- ### Event Bus ```typescript // Subscribe const subId = await api.subscribeEvent('loot.received', (event) => { console.log(event.data); }); // Unsubscribe await api.unsubscribeEvent(subId); // Publish await api.publishEvent('my.event', { data: 'value' }); ``` --- ### Data Storage ```typescript // Save await api.savePluginData('myPlugin', 'key', { data: 'value' }); // Load const data = await api.loadPluginData('myPlugin', 'key'); // Delete await api.deletePluginData('myPlugin', 'key'); ``` --- ## WidgetAPI ### Creating Widgets ```typescript // Create overlay widget const widget = await api.createWidget({ id: 'my-widget', title: 'My Widget', width: 300, height: 200, x: 100, y: 100 }); // Update content await api.updateWidget('my-widget', { title: 'Updated', content: htmlContent }); // Close widget await api.closeWidget('my-widget'); ``` --- ## ExternalAPI ### REST Endpoints The application exposes a local REST API for external integrations. ``` GET /api/plugins - List all plugins POST /api/plugins/{id}/activate POST /api/plugins/{id}/deactivate GET /api/loot/recent - Recent loot events POST /api/ocr/recognize - OCR text recognition ``` --- ## TypeScript Types ```typescript // Full type definitions for plugin development interface PluginContext { api: PluginAPI; widget: WidgetAPI; logger: Logger; settings: SettingsManager; } interface PluginAPI { // Log Reader readLogLines(count: number): Promise; readLogSince(timestamp: number): Promise; readLogFiltered(pattern: string): Promise; // Window getEUWindow(): Promise; isEUFocused(): Promise; bringEUToFront(): Promise; captureEUWindow(): Promise; // base64 // OCR ocrAvailable(): Promise; recognizeText(region: Region): Promise; // Nexus searchNexus(params: SearchParams): Promise; getItemDetails(itemId: string): Promise; // HTTP httpGet(url: string, options?: HttpOptions): Promise; httpPost(url: string, body: any, options?: HttpOptions): Promise; // Notifications showNotification(options: NotificationOptions): Promise; // Clipboard copyToClipboard(text: string): Promise; pasteFromClipboard(): Promise; // Events subscribeEvent(type: string, handler: EventHandler): Promise; unsubscribeEvent(id: string): Promise; publishEvent(type: string, data: any): Promise; // Storage savePluginData(pluginId: string, key: string, data: any): Promise; loadPluginData(pluginId: string, key: string): Promise; deletePluginData(pluginId: string, key: string): Promise; } ``` --- *API Documentation - EU-Utility V3*