diff --git a/src/sdk.d.ts b/src/sdk.d.ts new file mode 100644 index 0000000..f8a84e7 --- /dev/null +++ b/src/sdk.d.ts @@ -0,0 +1,123 @@ +export interface SourceConfig { + key: string; + label: string; + sourceFile: string; + proxyParam: string; + timeout: number; + jitter: number; + retries: number; + multiUrl: boolean; + skipProxy?: boolean; + cdnHeaders?: { + pattern: RegExp; + headers: { + Referer: string; + Origin: string; + }; + }[]; + skipVerify?: boolean; + verifyHeaders?: boolean; + disabled?: boolean; + sourcesTimeout?: number; +} +export interface ProbeResult { + ok: boolean; + ms: number | null; +} +export interface StreamResult { + url: string; + headers: { + "User-Agent": string; + Referer: string; + Origin: string; + [key: string]: string; + }; + server: string; + quality: string; + type: "mp4" | "hls"; + skipVerify?: boolean; + skipProxy?: boolean; +} + +export interface DownloadResult { + url: string; + quality: string; + size: number | null; + type: "mkv"; + active: boolean; +} +export interface SubtitleResult { + label: string; + file: string; + type: "vtt" | "srt"; + source: string; +} + +export type ProbeAllResult = Record; + +export interface VylaSDKOptions { + tmdbApiKey?: string; +} + +// Descriptions written with Claude. +export default class VylaSDK { + tmdbApiKey?: string; + + constructor(options?: VylaSDKOptions); + + /** + * Get the list of configured sources. + * @param excludeDisabled If true, filters out disabled sources. + */ + getSources(excludeDisabled?: boolean): SourceConfig[]; + + /** + * Probe all active (non-disabled) sources for availability. + */ + probeAllSources(): Promise; + + /** + * Probe a single source by key. + */ + probeSource(key: string): Promise; + + /** + * Get a playable stream for a given source/media id. + * @param key Source key + * @param id Media id (e.g. TMDB id) + * @param s Season number (for TV), or null for movies + * @param e Episode number (for TV), or null for movies + * @param clientIP Optional client IP for source-specific logic + */ + getStream( + key: string, + id: string | number, + s?: number | null, + e?: number | null, + clientIP?: string | null + ): Promise; + + /** + * Get subtitles for a movie or TV episode. + * @param id Media id + * @param s Season number (for TV), or null for movies + * @param e Episode number (for TV), or null for movies + */ + getSubtitles( + id: string | number, + s?: number | null, + e?: number | null + ): Promise; + + /** + * Get download links for a movie or TV episode. + * @param id Media id + * @param s Season number (for TV), or null for movies + * @param e Episode number (for TV), or null for movies + */ + getDownloads( + id: string | number, + s?: number | null, + e?: number | null + ): Promise; +} \ No newline at end of file