/** * Philips TV API Utilities */ import { type Dispatcher, type Headers } from 'undici'; import type { DeviceInfo, DigestAuthParams, FetchOptions, PairingSession, DiscoveredDevice } from './types.js'; export declare const httpsAgent: Dispatcher; export declare const md5: (str: string) => string; export declare const hmacSignature: (timestamp: string, pin: string) => string; export declare const buildUrl: (ip: string, endpoint: string) => string; /** * A fully-read HTTP response. The body is buffered before the response is * returned, so `text()`/`json()` resolve from memory and cannot block. */ export interface TimedResponse { ok: boolean; status: number; headers: Headers; text: () => Promise; json: () => Promise; } export declare const fetchWithTimeout: (url: string, options: { method: string; headers?: Record; body?: string; dispatcher?: Dispatcher; }, timeout: number, externalSignal?: AbortSignal) => Promise; export declare const postToTv: (ip: string, endpoint: string, body: unknown, options?: FetchOptions) => Promise; export declare const getFromTv: (ip: string, endpoint: string, options?: FetchOptions) => Promise; export declare const parseWwwAuthenticate: (header: string) => DigestAuthParams; export declare const createDigestAuth: (username: string, password: string, wwwAuthHeader: string, method: string, uri: string) => string; export declare const parseErrorResponse: (status: number, text?: string) => string; export declare const handleErrorResponse: (response: Awaited>, context: string) => Promise<{ success: false; error: string; }>; export declare const createDeviceInfo: (deviceName: string) => DeviceInfo; export declare const createPairingSuccess: (session: PairingSession) => { success: true; username: string; password: string; message: string; }; export declare const extractIpv4: (service: DiscoveredDevice) => string; /** * Sanitize a name for HomeKit compatibility. * HomeKit only allows alphanumeric, space, and apostrophe characters. */ export declare const sanitizeForHomeKit: (name: string) => string; /** * Send Wake-on-LAN magic packets in bursts (matching official Philips app). * Sends WOL_BURST_COUNT bursts of WOL_PACKETS_PER_BURST packets each, * with WOL_BURST_INTERVAL_MS between bursts. */ export declare const sendWakeOnLan: (macAddress: string) => Promise;